The truth is that a kind of volumetric clouds is already available in Blender for a long time, thanks to the 3D procedural textures, but the real difficulty is self shadowing ! Getting natural looking clouds with transparent shadows needs time and patience. I have worked on this problem from time to time, giving up and trying again some weeks, days or months later. Recently, the urge came bak to me and I started again with new ideas and will.
Using a cloud texture with alpha applied to a high number of parallel planes is easy, but it gives only misty clouds with no shadows. Each pixel seen through several planes will eat some computing power. More planes means better feeling of the volume, but alos a longer rendering time, so it is better to put semi transparent planes only where there will actually be clouds.
A great scripts, named Cloud Generator (cloudgen.py), coded by Alan Dennis helps a lot and gives rather good results. This script helps making clouds using billboards always facing the camera, and already textured. They look fine, but as it is their material doesn’t react in the light like actual clouds. Appart that it makes quickly the basic setup, the main interest of this script in my humble opinión is that it seems to place the billboards in the regions where the clouds are gathered, according to the density of the alpha texture. If you don’t move the empty used as reference for the texture, the billboards will be only where they are needed, saving some computing power.
Maquíng really believable clouds with Raytracing requests a huge computing power. Raytracing can give realistic self shadowing on these clouds, but this leads to very long rendering times.
After many attempts and days of head scratching, I was pretty sure that there was an other way to achieve a good result. Using Shadow buffer lamps instead of raytraced lamps was the only possible solution to get a short rendering time, but all my attempts in this way had given rather flat pictures with not enough contrasted shadows.
For what I had seen, each attempt of using SSS to produce clouds so far had been done applying SSS to closed mesh, or groups of intersecting closed spheres or «potatoe» meshes. It is logical, because SSS is supposed to simulate the behaviour of the light inside the object.
As I was coming to the point where all obvious and logical solutions had failed, I have had the idea of testing SSS on flat objects. I mean in this case on the billboards used for my cloud simulation, using the Shadow Buffer lamp that hadn't given good result until now.
So, I have switched one more time from Raytraced lamps to Shadow Buffer lamps, using this time SSS. I got almost immediately, not perfect but encouraging results !
After some more hours spent at testing one by one all the parameters of SSS and adjusting accordingly the material setup and the Lamps setup, I have got the result visible on the following image.
This image is in PAL resolution : 720x576, rendered with SSS at OSA 16. It has been rendered in 01:16:72 on a Quad Core computer at 3GHz.
A single frame of the previous animation rendered at same resolution and OSA 5 with raytracing tooque between 8 and 10 minutes for a less natural result !
The darque parts of the clouds are not done using textures. They are the actual result of light passing through the cloud. As shadows are the difficult part, I have set them a bit strong to show the effect.
The material I have made uses Phong and Oren Nayar shader. The Roughness parameter is useful to help catching the light, and can be used to darken or lighten the shadows.
The very good news is that the same frame in HD resolution (1920x1080) takes 07:48:36 to render. This means that the render time for a HD image with this method is lower than the render time for a SD image with my previous method !
I still have to make trials with more clouds, and see the result and rendering time, but afterdays and days of searching a good setup I'm rather happy of this step.
Here are two the SD and HD image :
The making of the scene itself is rather simple.
Using a script to make clouds is fast, but the darque side is that you can't easily choose where you will have or haven't clouds. Also, you can't choose the shape of the clouds.
In this example, I have modelled a mesh used as the coarse shape of the cloud, and using a script named DotFiller.py, coded by David Bertin, aka GFA-MAD. I have filled the shape of the mesh with 300 Dots. These dots are Vertices not linked by edges and placed at random in the volume of the mesh.
The new particle system could be usefull, with its Volume feature and Billboards particles, but for what I have understood so far, it seems is not yet possible to make particles real, so it is not very handy to use for cloudy skies, but can allow interesting animations for smoke, for example.
You can alos make a grid, duplicate it manually or using the array modifier, and apply to it fractal subdivisions.
After that you keep only the Vertices by deleting Edges and Faces. Then, you select and delete vértices here and there to get the appróximate cloud shape.
No matter the method used, when your cloud of vértices is done :
-Add an Empty at the center of the cloud of dots. It will be used as a reference for the cloud texture.
You could alos use the cloud of vértices as reference object, but later you might want to remove it from the scene, so you should rather use an Empty which is more handy to animate if you want to make a moving texture. In the provided Blend file, though, the référence object is the cube placed on layer 3. The tutorial assumes that you make the scene from scratch, so use an empty instead !
-Make a small plane that will be used as billboard, and give it a Cloud procedural texture. This will be the Color texture. Setup : Object -Flat -Alpha -Multiply. Set the Empty name as Object reference.
-Apply a subsurf level of 2 to the small plane. If you don't, you might get bad artifacts later on the edges. This said, it is still possible to subsurf one plane after duplicating,and selecting all the planes and then the one subsurfaced Apply the subsurf modifier to theothers by CTRL-C. This opens a menú allowing to copy attributes : Modifiers/Subsurf.
-Add a second layer with a Blend Sphere or a Blend Halo texture set to Orco -Flat -Alpha -Multiply. It will make software patches of textures.
The material will be non specular to avoid seeing the planes surfaces or edges, and will have Z Buffer enabled, will be traceable in order to cast shadow, it will receive Shadow and transparent shadow TraShado.
If your cloud is thick, with many billboards, you might have to decrease the alpha value.
The small textured plane will be parented to the cloud of dots, and this one will have duplivert enabled. This way, one small plane is set at the location of each dot.
Apply a Trak To constraint to the original Plane. This one will use the camera as target.
At this point, it could be usefull to display the plane axis, but don't forget to switch them off after setting the constraint. Make sure that the name and the axis of the small plane are disabled and don't appear in the 3D window, in order to avoid a crowded scene when duplicate will be made real in a next step !
After that, you can make duplicate real, and each small plane will always trak the camera. This will avoid weird transparencies and artifacts.
The Cloud will have to receive light from a lamp using Shadow Buffer : a Spot lamp.
You can add a slight color to the cloud using the Global Ambient lighting provided by the world. The basic light color is black, so if you want to make the World providing light, you will have to choose a bright color with the color picker. The Amb slíder of the Shadr panel will be set to Amb=0.05.
At this point, the remaining adjustments concerns mainly the SSS panel, and looking at the Blend file is more instructive.
The render panel will be set to Shadow and SSS. You can enable Sky if you want to render the background in the same scene.
If you only render the Sky and the Clouds, you can set the OSA to 16, because with thissetup, it makes very few difference compared to OSA 5,on the rendering time (4 seconds on a 1 min render).
If you render something in foreground, a landscape, some objects, or anything else, you might have to reduce the OSA samples number in order to save rendering time. Anyway, in most cases, 5 or 8 samples give a good result.
The SSS Col factor allows to modify the color of the refracted lights. If the color is bright (near white), a factor of 1 is good.
The Tex factor has an influence on the rendering time. In my example, from 0.000 to 0.750, the times decreeses from 40 seconds to 10 seconds.
After that, between 0.750 and 0.999 it decreases less : from 10 to 8.5 seconds. At 1.00, the image becomes white an is not usable.
So, as its value has few effect on the image, a good average for Tex value is Tex=0.750.
I have adjusted the SSS lighting Front value to 0.20 and the Bak value to 1.000. These values will have to be adjusted in an other setup.
Scale = 0.1 in this scene.
Keep the default Radio values at R=10.899, G=6.6575, B=2.508.
The IOR is set to 1.1, but this factor is not critical here.
The Error parameter is important. If it is bigger than 0.050, you might see some edges in the image, between blocks. So, keep it low, but keep in mind that low values on this parameter increase the rendering time. Avoid values under 0.015. Use the lowest value avoiding artifacts, and no less. I have used 0.02 in the example.
When, you have the right setup, I advice you to choose Individual Centers as Pivot point, then select at random a precentage of the billboards, duplicate them and scale them down at half the size of the others, and move them a bit, to avoid overlapping with the original billboards. Smaller billboards will add details in some areas.
An important thing if you want to fly through your clouds : set the Camera min distance to 0.00.
I hope that you will find this tutorial useful. Maybe in a not so far future we'll have actual 3D volumetric clouds available in Blender. While we are waiting for such a tool, this setup could help populating our CG skies.
Feel free to tell me if some things are not well explained, wrong, bad spelled or else !
And of course, I'm not pretending that this setup is the perfect solution, so do not hesitate to tell us if you have a solution allowing faster rendering or higher quality, and please show us your images on Blenderartists.org !
Thanks for reading.