• Advertisement
Sign in to follow this  

Depth Buffer in D3D9 for Volumetric Fog

This topic is 687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I read the article posted here:

 

http://www.gamasutra.com/blogs/MykhayloKotys/20150428/242150/Fast_perpixel_lit_volumetric_fog_without_depth_prepass.php

 

He suggests to use a Texture instead as the Scene Depth-Stencil Buffer does not have enough space (8-bit) to store the depth of a scene. Is this correct ?

 

I would like to proceed using the depth buffer instead of the Texture approach, but appreciate any thoughts on it.

 

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

D3D9 originally didn't support reading from the depth buffer as a texture, but there's an extension that works on D3D10-capable GPU's. You have to create an INTZ texture, which you can use as a depth buffer, and then read from as a texture.

 

Alternatively, what he seems to be suggesting is to make a regular color texture with a float32 format... That's a weird article though. It's a mixture of advice from 2005 to 2015.

Edited by Hodgman

Share this post


Link to post
Share on other sites

You have to create an INTZ texture, which you can use as a depth buffer, and then read from as a texture.


Thanks Hodgman. How portable are these commands varying from each GPU card? Do I need different FOURCC depending on the vendor? Edited by fs1

Share this post


Link to post
Share on other sites
On the page I linked to, he lists a few different FOURCC codes.
INTZ will work on every Dx10 compatible card (Intel/amd/nvidia).

The other ones will work on older (pre-dx10) cards, but are vendor-specific.

Share this post


Link to post
Share on other sites

I don't think its so much about getting depth in the same pass (INTZ) as the hurdle being adding different fog sources together. Depth will be what ever is closest even if it is partly transparent and then you have order of drawing issues.  If you sum all back and front face depths of fog you can then calculate the final depth of fog. The author of that article glossed over the important bits; notice he refers to fog "sprites" not volumes. This is how I do it: http://socoso.com.au/Tiogra/fog.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement