How to: Cloud Shadows


Hello there, my name is Dylon and Today I will explain how to make moving cloud shadows for your game.

You will be making two alpha textures for the clouds. Both textures can be created in any photo editor like photoshop. The textures should resemble something like this you can make it look however you want. Some things to keep in mind are that the dark spots are the shadows, and the light spots are the light. So, make the clouds darker and the space in between lighter. Save out the photo as a .TIFF file.


The next step is to import these two textures into unity and create a folder and name it cloud shadows. Next in the same folder create a custom render texture. To find this right click in the folder go to create>shader>custom render texture. Name it something like cloud shadow and open it.

For the next step I’ll Walk you through briefly on what the code is doing. Line 5 is going to be controlling the speed of the texture across the ground. Line 6 and 7 is just getting the two textures that we made. Lines 31 through 38 is where the action is really happening, and speeds and locations are getting multiplied.

 

Now exit out of the code and go back to the folder and right click and create a material and name it cloud Material. And apply the two cloud textures.


Go back to the folder and right click again and create a custom render texture. This is going to be what you put the cloud material onto. There's a few settings we need to change on the custom render texture.


Change what’s next to red. This is to always make sure the texture repeats across the landscape.

The last step is to assign the Custom Render Texture to the cookie slot on the directional light.


This is where you can adjust the size of the images to whatever fits your needs.


That’s all from me I hope this was useful and that you learned something I hope you have a chance to play our game and leave some feedback thanks and have a good day.

Get Not so Trash Panda

Leave a comment

Log in with itch.io to leave a comment.