Posts

Showing posts with the label shaders

Unity3D mirror using camera and RenderTexture

Image
There are several ways to create mirror in Unity3D. Some of them require more scripting than others, but I will now present an easy way using just one extra camera and RenderTexture.  In this solution you will use RenderTexture on an object and place camera behind that object. This is easy option that does not require scripting. Alternatively you can use reflective shader, but it requires some more work. Seven small steps to create object with mirror RenderTexture: Create new Unity project. It is recommended to use latest LTS version (Long Term Support).I was using Unity 2020.1.3f1 version for this example.   Create plane object for ground and Cube for the mirror object. Scale both objects to match your needs.  Create new camera for attaching the RenderTexture. Position it inside recently created cube and adjust direction so that it is pointing out to the direction where mirror should be reflecting the image.  Create RenderTexture. Name it as you wish. No need t...

Using Unity3D LWRP and shader graphs in real game

Image
My previous Unity3D post was demonstrating my trials with scriptable render pipeline and shader graphs. Now I have gone one step further and combined these techniques with one of my previously released game. "Ball Twister" was originally released about an year ago. I did not advertise it too much because of boring outlook and bit simple gameplay. However, now I have found this game perfect for testing scriptable render pipeline and shader graphs in real 3D environment. Attached video shows how different new version of Ball Twister looks compared to the original one. Original version (on left) is using standard Unity render pipeline and shaders. Enhanced version (on right) is using LWRP (or URP) and shader graphs. In enhanced version, rolling checker board texture, swirling sky and obstacle materials are all using shader graphs to create a sense of movement just by tweaking textures. Basically, only objects that are really moved are black obstacles and coins. Everyth...