Doing the clouds system.

I though that clouds would be easy, I would eventually buy some assets and go, but that was not the case. 3 days fighting with clouds and here is the result.

Everybody knows that tropical storms can be dramatic and I want to have those in my game.  I tested several solutions:

Toz Clouds: this thing is looking good in the demos, but in practice it was really awful in game. Trashed.

Volumetric Clouds: ok but the shape is more looking like a balloon. Maybe for a cartoon game?

3d Photorealistic clouds: not good enough, not realistic to me, do not change with light.

Kode80 Volumetric Cloud System: have a bug (check the Unity’s forum for a fix). The clouds are looking good, but the speed is not suitable for a game. If you have some puffy clouds on the screen it can make it but if you overcast, then my FPS drops from 30  FPS to 4 FPS, who is going to use this in a game?

Introducing uSky Pro: not well maintained, a little messy, the author busy doing something else, but so far, the different features are working good together. I am using this from the beginning and I have not found anything better so far. It works, and the code is simple to understand. That will be the sun, the atmospheric scattering and the regular clouds.

Now how to make the huge Thunderstorms?

3d Clouds Models from Quantum Theory: when I purchased these clouds, I thought it will be a no brainer, but that’s when the problems raised.

This asset is old and using a specific shader made with Shader Forge beta 0.78! I think that must date from 2015 or so, and there was no Global Illumination at this time. So the clouds are looking good, but they are not affected by light at all. Totally unusable. Another case of money spent for nothing.

I decided to re-create the asset.

 

 

 

First I had to fix all the cumulus pictures. Because of his exotic shader, the RGB was used to store 2 types of alpha and that was not compatible with a regular surface shader. I changed all the clouds I liked (4 of them are really ugly, I removed them).

Once done, I took the Shader Forge Shader and translated into a regular transparent Surface Shader that will support lightning and shadows.

 

Bingo, it worked. Now I only had to modify the uSky cloud shader so that it has a similar sun color gathering math formula, and in consequence will have a compatible color and will mix together with the cumulonimbus thunderstorm billboards modified from the QT package.

After all this Asset was not that useless, because I kept the math inside (not sure if I will not simplify that, log(bias) and Pow are slow for just showing billboard, but I will deal with that if I need more optimization.

 

 

 

Now I have both working together and with automatic adaptation to the sun light, working days and night.

Additionally I had to make a script that copy the color of the sun and the ambient color to the shader automatically. And in order to get the billboard looking at the camera all the time another small script attached to each billboard is doing this task so that you never see the billboards on the side, and also they are moving following the player.

Here is the video

 

Author TheWolf
Published
Views 3159