NokiMo
pucklovesgames
pucklovesgames

patreon


Fake Volume Clouds in 1 layer, without crazy overdraw!

While the previous volumetric clouds could look pretty good, I was never happy with how many stacked layers were required to get a decent effect, causing a huge amount of overdraw. So I've tried to make a 'one layer' version that exists all on a single quad and avoids the crazy overdraw issues altogether. While it's obviously going to look flatter than the quad stack, I think it still does a reasonable job of simulating fluffy, three dimensional clouds.

The clouds are made with three distinct passes. The first is the classic layered panning noise that I use in all my favourite shaders. This is where we take a noise texture, split it into two copies, each with a different uv scale, and then pan them at different speeds and directions, and then blend them back together again. This is mostly used as the overall opacity, to define the shape of the clouds, as well as being layered with the next two passes to help fake some lighting and give the clouds a more three dimensional appearance. 

The panning layered noise. Used to define the overall shape of the Clouds.

The 2nd pass helps to fake top down lighting, by shading the 'underside' of the clouds. This is done by making a copy of the noise and offsetting it towards the horizon, by to the distance from the camera position. Pushing the noise away from the view causes it to shift lower vertically in screen space. Take this offset noise, one minus it, and then multiply that back onto the original noise, creates shading that appears to effect the underside of the clouds.

The horizon offset noise. Used to create a fake top-down shading.

The final pass is another copy of this layered panning noise, except this time the UVs are offset by the Light Direction transformed into tangent space, which allows us to fake light information by using this offset noise as either a shadow or a light overlay. This pass is also scaled based on how close it is to the sun (* the negated LightDir and View direction dot product that we use in the subsurface scattering shader), which helps to create a rim lighting effect closer to the sun.

The light direction offset noise. Used to fake light direction and rim lighting.

The colouring uses the same blending of ambient light and light colour that we used in the previous volumetric clouds, with the sub surface scattering gradient to boost the area around the sun. These colours are all set by a Time of Day script which I like to use, which rotates the sun light and sets the light and ambient colours over time based on a public Gradient.

Time of Day script evaluates a public gradient to set light and ambient colours.

I think there's still a lot of room from improvement in this shader, both optimisation and visual quality. I still want to play around with using parallax mapping to fake a more volumetric look while still keeping it as a single quad. I also think there's probably some gains to be made by generating fake normals from the panning noise and calculating Fresnel rim lighting from that. Let me know if you have any ideas, I'd love to keep improving this shader over time!

Fake Volume Clouds in 1 layer, without crazy overdraw!

Related Creators