This page is created automatically. Click here to view this shader on Shadertoy.
This is my first attempt to render volumetric clouds in a fragment shader.
I started this shader by trying to implement the clouds of Horizon Zero Dawn, as described in "The real-time volumetric cloudscapes of Horizon Zero Dawn" by Andrew Schneider and Nathan Vos. To model the shape of the clouds, two look-up textures are created with different frequencies of (Perlin -) Worley noise:
Buffer A: The main look-up texture for the cloud shapes. Buffer B: A 3D (32x32x32) look-up texture with Worley Noise used to add small details to the shapes of the clouds. I have packed this 3D texture into a 2D buffer.
Because it is not possible (yet) to create buffers with fixed size, or 3D buffers, the look-up texture in Buffer A is 2D, and a slice of the volume that is described in the article. Therefore, and because I didn't have any slots left (in Buffer C) to use a cloud type/cloud coverage texture, the modelling of the cloud shapes in this shader is in the end mostly based on trial and error, and is probably far from the code used in Horizon Zero Dawn.
Buffer D: Rendering of the clouds.
I render the clouds using the improved integration method of volumetric media, as described in "Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite" by Sébastien Hillaire.
You can find the (excellent) example shaders of Sébastien Hillaire (SebH) here:
Buffer C: Landscape
To create an interesting scene and to add some scale to the clouds, I render a terrain using a simple heightmap, based on the work by Íñigo Quílez on value noise and its analytical derivatives.
In fact, the heightmap of this shader is almost exactly the same as the heightmap that is used in Íñigo Quílez' shader Elevated:
To reduce noise I use temporal reprojection (both for clouds (Buffer D) and the terrain (Buffer C)) separatly. The temporal reprojection code is based on code from the shader "Rain Forest" (again by Íñigo Quílez):
Finally, in the Image tab, clouds and terrain are combined, a small humanoid is added (by Hazel Quantock) and post processing is done.