Recently, I want to give it a try again to rendering clouds in Cycles with all the new tools available (Mesh to Volume, Volume displacement and Point Density). However, I haven’t found any “realistic” cloud render examples in Cycles. So, my goal is to try different techniques to find the perfect solution for “photorealistic” clouds.
Part 1: Research
The basis for modelling a cloud in all the works I looked for are two simple steps:
Get a basic cloud shape (doesn’t have to be extremely detailed, even a sphere could work)
Distort the shape with noise (or any similar)
There are many ways to distort the shape with noise and they can vary according to the software, technique or render engine. For Cycles, I used two techniques:
Volume displacement modifier
Using a Noise texture (mixed with a Voronoi texture) to distort the Vector Coordinates of a Point Cloud texture
That’s it, these techniques are similar to others you can find in a lot of Blender tutorials, but still it doesn’t look quite right… Yeah, it looks like smoke, but not quite like a cloud, there’s something missing…
Here’s where Horizon Zero Dawn comes into the topic
Part 1.1: Rendering research
The guys at Guerrilla Games discovered what was odd with cloud rendering (or at least for their rendering engine), and they tweaked a little bit of the math involved in it. You can find the original paper here: http://advances.realtimerendering.com/s2015/The%20Real-time%20Volumetric%20Cloudscapes%20of%20Horizon%20-%20Zero%20Dawn%20-%20ARTR.pdf
In short, usually the enery transmittance of a volume is calculated using the Beer’s Law and the Henyey-Greenstein model to reproduce the Anisotropy of a volume.
However, this equation doesn’t deal pretty well with an effect that the guys at Guerrilla found, the dark edges around the clouds.
It’s important to mention that this effect is achievable using the traditional Beer’s and Henyey-Greenstein using multiple volume bounces and multiple sampling (as they mention in their paper), but for them that wasn’t possible for a real-time render engine, and in my experiments in Cycles, even increasing the volume samples at 10 didn’t do too much.
So, they found a technique, the Beer’s Powder equation
The Beer’s Powder equation would allow the volumes to have more pronounced edges (remember this since it would be important later). But, is there a way to implement the Beer’s Powder equation in cycles?
Part 2: Building Blender with Beer’s Powder for volumes
So, given the equations above, we can write the Beer’s Powder equation as the green one:
Is there a Blender source code file that we can modify to write the Beer’s Powder equation? Sure there is!: https://github.com/blender/blender/blob/master/intern/cycles/kernel/closure/volume.h
Here, in line 169, does it look familiar? That’s the traditional Beer’s Law, so we just have to rewrite it as:
float3 init_energy = make_float3(1.0f, 1.0f, 1.0f); return ((exp(-sigma * t)) * (init_energy - exp(-sigma * t * 2.0f));
That’s it, we have the Beer’s Powder equation in Cycles!
In Part 2.1 I will show you some test running the Beer’s Powder Cycles (since I made the built with CPU only rendering and I found some bugs with the implementation).
In Part 3 I will show you a less invasive and technical way to achieve similar results using a regular version of Blender, the same technique used for the first image of the post