Volumetric Clouds

< Volumetric Clouds which takes 0.75 ms on GTX 1060 mobile, 1920 x 1080 resolution>


Guerrilla Game’s presentation about their Volumetric clouds was a hot issue in Computer graphics conferences such as GDC and SIGGRAPH for years.
The one of the reasons why Volumetric rendering solutions are spotlighted is that the cost is too expensive in real-time.
So, in this post, I would like to describe simple tips how this solution can be run in less than 2.0 ms on standard PS4, mainly.



Modeling Volumetric clouds seems to be simple. Basically, from the height of the lowest layer of clouds, along the view ray, do ray-marching into a 3D noise texture until it reaches the height of the highest layer of clouds. But, the problem is, if we does not know magic numbers such as Earth radius, thickness of clouds layer, maximum ray-marching distance, tiling of the 3D noise texture and weather map, it is really difficult to make fancy cloud shapes, which is also running fast. Thus, UI such as Slide bar is really helpful to find these magic numbers.

And, the major bottleneck of this Volumetric clouds solution is from texture fetching (memory bandwidth). Thus, in keeping with the quality, using lod of 3D noise texture helps a lot to improve the performance.

Plus, someone may encounter some banding artifacts caused by ray-marching. In this case, using ray marching offset with temporal random number generated by CPU or GPU will help to reduce them.



The performance in Lighting depends on the number of sampling, the calculation of ray direction for lighting, and the lod level of 3D noise texture, mainly.



Guerrilla Game’s solution suggests re-projection and two culling methods for optimization. In two culling methods, the first one, horizontal culling prevents do ray-marching if current ray-marched target is below the ground (like negative y coordinates). I would like to suggest something in here. When we implement this solution, considering blending factor which blends the clouds and its background (like sky box or atmosphere scattered procedural sky) will be needed. If the blending factor indicates showing the background 100%, we don’t need to do ray-marching and can improve the performance. The second culling method, lodded depth culling, has limitation to be used for every case. Because of re-projection artifact, unless huge objects such as mountain cover the background, it will show the artifact if camera angle moves fast. If the fps is fast enough, it would be fine. But for fixed fps environment like console or VR, this culling method cannot be used.