« Bright-for-Dark Photography | Main | Maya Double-Sided Shader »

May 06, 2006

Faking Simple Volumetric Fog

redMistPlane.jpg

Here's an old school way of faking volumetric fog. I'm not sure who invented the idea, but we used to do it this way back in the Eighties.

noFogPlaneRGB.jpg

Set up a scene.

noFogZ16.jpg

Use a camera-based grad to fake a Z-depth render. Let gray represent distance from camera - the further, the brighter. Render in 16 bits.

FogPlaneRGB.jpg

Slam in a ground plane. This will represent the height of the top of your ground mist.

FogZ16.jpg

Render out another 16-bit Z-depth image with your elevated ground plane in place.

fogSubtraction.jpg

Subtract one 16-bit Z-depth image from the other. This will give you an image of fog ray traversal lengths - exactly as if you ray-marched through the volumteric fog.

processedMask.jpg

You can tweak the contrast if you wish.

fogLayerMask.jpg

Use this volumetric ray-marched mask as a key mix between your rendered scene and an image of pure fog color. (I chose pure red for my full fog image)

redMistPlane.jpg

Here are the results again. You can adjust fog density to taste by adjusting the density of the Z-depth difference mask.

This technique is pretty old-school. For it to work you have to stay out of the fog.

Posted by digital artform at May 6, 2006 12:34 PM

Comments

thanks for sharing that!

Posted by: David ying at May 15, 2006 04:57 AM

I'm glad you liked it!

Posted by: Joseph Francis at June 3, 2006 06:13 PM

Post a comment




Remember Me?

(you may use HTML tags for style)