Oyonale - 3D art and graphic experiments
All 3D models POV-Ray objects and scripts Free Cinema 4D models Free OBJ models 3D techniques Animals Architecture Furniture Household Landscapes Plants Toys Vehicles Weapons

Cloud generator (POV-Ray)


Media based on density files (df3) tend to render much faster than procedural-based media and still interact nicely with lighting. For this reason, df3 files can be used to create realistic cloudscapes, and particularly ones impossible to create with other methods.

In the download section below you will find complete scenes (written in pure POV-Ray script) and the corresponding df3 files. These scenes took between 3 and 6 hours to render at 1600x600 or 800x600 on my P4 1.7Gz (with the exception of "Sunset 2" which took 35 hours, probably because it uses an extra light source), which is quite fast considering that they all use radiosity and many "slow" features such as other media and isosurfaces. The clouds themselves took 1-2 hours depending on the scene.

The MakeCloud macros help create df3 files such as the ones used in these scenes. These macros work as follows: they create a 3-dimensional black and white pigment in the x-y plane that defines the shape of a single cloud. This pigment is moved along the z axis, so that, when the macro is rendered as an animation, each frame (in TGA format) corresponds to a "slice" of the pigment (like in a tomography scan), as shown in the picture below (10 frames, z axis in red)

The main difficulty consists in creating a credible cloud shape and the two macros use different methods:

See the macros' headers for usage and meaning of parameters.

To produce the df3 file from the TGA bitmaps, the tga2df3 utility is required:

The df3 file is put in a box as follows (the scattering and absorption values are just examples):

#declare C_Cloud=White*0.7;
#declare C_Scattering=C_Cloud*0.004;
#declare C_Absorption=(1-C_Cloud)*0.0005;
#declare Cloud=box{-0.5,0.5
    texture{pigment{Clear}finish{ambient 0 diffuse 0}}
            scattering{1,C_Scattering extinction 0.3}
            absorption C_Absorption
            intervals 3
                density_file df3 "cloud2_1.df3"
                turbulence 0.15 // mostly useful for MakeCloud2 clouds, which are not created turbulent
                lambda 2.1
                omega 0.8
                interpolate 1
                translate -0.5
                scale <1,-1,1>
    scale <4/3,1,1>



One of the reasons why df3 clouds are fast is (probably) that the density values are precomputed. The other is that each cloud is in its own box. In fact, it should be possible to get more speed by using a smaller container, at least if the cloud isn't too turbulent. The cloud box technique has 2 important drawbacks though:

Also, the cloud shapes in Makecloud1 and Makecloud2 are still far from optimal and people are invited to experiment with other methods. One particular issue is to keep the bottom of the cloud flat... In real life, the top of a cloud can get quite turbulent and fluffy even when its bottom is completely flat. MakeCloud2 can extend the cloud vertically but it doesn't work very well.

Brief summary of the available methods to create clouds in POV-Ray

MethodPros (1) Cons
Photo backgroundFast ; easy to set up ; realistic by definition ; all types of cloudsPoorly scalable (2) because limited by the size of the photo ; requires photos that match the scene ; partial environments only ; doesn't interact with lighting (3) ; possible mismatch with 3D objects
Terragen backgroundFast ; scalable (Terragen images can be very large) ; relatively easy to set up for simple situations ; quite realistic ; possibility to model an entire environmentRequires a good knowledge of Terragen ; can be difficult to set up for complex situations ; limited to the skies Terragen can do (which can be quite recognisable) ; doesn't interact with lighting
Pigment on plane or sky sphere (entire sky) Fast ; very scalable ; can be realistic enough in certains situationsDifficult to set up ; doesn't interact with lighting ; useless for many cloud environments
Pigment on polygon (mimics a single cloud) Fast ; scalable ; realistic enough for some large cloudscapes of isolated clouds seen from a certain angleDifficult to set up ; doesn't interact with lighting ; useless for most cloud environments
Stacked planes with a partially transparent pigment Fast and scalable at screen resolution ; usually more realistic than the pigment method ; interacts with lighting ; good for dense cloud covers Can be slow to very slow when high resolutions are needed ; not very good for isolated clouds, like fair weather cumulus
Media (procedural using a pattern such as bozo or granite) Scalable ; can be very photorealistic, particularly when used in combination with other atmospheric media ; near-perfect interaction with lighting Painfully slow (too slow for large renders) ; very difficult to set up and test due to slowness ; not very goof for isolated clouds, like fair weather cumulus
Media (density file)Quite fast ; can be photorealistic ; partial interaction with lighting ; good for isolated fluffy clouds, like fair weather cumulusNot fully scalable ; can be difficult to set up ; requires the generation of df3 files and an external utility ; not usable for dense cloud covers

(1) Pros and cons are relative, and counter-examples can certainly be found.

(2) Scalable in this context means that the object or texture retains its aspect independently of the render size.

(3) A cloud interacting with lighting should change its aspect according to the sun position, colour and intensity, and project shadows both on the media and objects below. All this can obviously be faked somehow when the basic technique doesn't support it.


3D scenes

This 3D object was used in the following pictures :

Makecloud 1 Makecloud 2: Day Makecloud 2: Rain Makecloud 2: Sea Makecloud 2: Sunset #1 Makecloud 2: Sunset #2 


Creative Commons License By Attribution Creative Commons License