Volumetric Clouds – Part II

Hello again! These are exciting times…and things are getting crazy!! First off, I will say that I will probably not be able to make too many posts over the next five months. Starting this month (12/2009), I have entered Final Project at Full Sail University. This encompasses the last 5 months of the degree and involves creating a full-scale game, with the final product in mind being a sweet demo to show-off to any who may be interested. With that said, I bring you the fruit of last month’s labor, a continuation of research into volumetric cloud rendering from the prior month, culminating in what I consider a fairly decent volumetric cloud…

Volumetric clouds, with self-shadowing yet to come.

Volumetric clouds, with self-shadowing yet to come.

Having stumbled upon a decent render to 3d texture demo from nVidia, I began familiarizing myself with the concepts of frame buffer objects and using a pixel shader to create “geometry” and perform a ray marching algorithm for blending. These techniques are becoming more and more widely used from what I understand, especially as graphics cards continue to become more and more powerful…to the point where 3d textures are well-supported and efficient. There were definitely a fair share of mistakes and challenges along the way, a few of which I have screen shots of:

Turns out only 1/4 of the texture memory was being filled :(

Turns out only 1/4 of the noise texture's memory was being filled :(

A complete 3d noise texture...looking like red carpet!

A complete 3d noise texture...looking like red carpet!

One of the techniques I learned during the journey is called “splatting”, which is a way to draw things to the screen via a 3d texture and a fragment shader. The process is to fill out each slice of a 3d texture by rendering a quad and specifying appropriate 3d texture coordinates. Different 3d textures may be rendered to any number of frame buffer objects to create an animation, such as a wave.

The noise appears as furry extrusions of the cloud surface.

The noise appears as furry extrusions of the cloud surface.

The most difficult part, which I have yet to master, is to find a way to do the entire process in an efficient manner so that it is viable in real-time. Currently, no calculations are done on the CPU at all. There is no actual geometry and blending must be performed by marching a ray through the volume and accumulating the color values from back to front towards the camera. The following picture is before threshold values were tweaked properly to make the dark values blend in completely with the background and to make the rest to lean more towards white and then blending that with whatever is behind it (from the camera’s perspective).

Blending is incorrect, producing glittery areas where the noise values are closest to 1.

Blending is incorrect, producing glittery areas where the noise values are closest to 1.

A very interesting effect that happened along the way was what the following picture portrays: a very cartoonish cloud look. This may be useful someday :)

Sweet volumetric cartoon clouds Batman!

Sweet volumetric cartoon clouds Batman!

And to finish up, the final product was a matter of introducing a much higher influence from the background sky color. This had the effect of making thinner parts of the cloud actually look thin. The thicker parts leaning more towards white — along with a slight blurriness to the noise applied — helped to make the clouds fluffy instead of blocky.

Volumetric clouds, with self-shadowing yet to come (which is why the don't look convincingly 3D).

Volumetric clouds, with self-shadowing yet to come (which is why the don't look convincingly 3D).

About Ray Johannessen

Currently a Game Engineer at Tournament One in Stamford, CT. Love to play games, read, write, drum, program, watch movies, and chill with my wife & daughter.
This entry was posted in Projects and tagged , , , , , , . Bookmark the permalink.

2 Responses to Volumetric Clouds – Part II

  1. Love your site man keep up the good work

  2. Ray J. says:

    Thanks! Glad you enjoyed it! Trying to post more on here, but work has got me wiped at the end of the day…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>