• Advertisement

Archived

This topic is now archived and is closed to further replies.

Volumetric Fog Eh?

This topic is 6386 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 see it everywhere and it''s a cool effect. I know the basic idea of how it works, but how do you make it fast enough for realtime in D3D?

Share this post


Link to post
Share on other sites
Advertisement
yeah. i have the same question for opengl.

a2k

Share this post


Link to post
Share on other sites
not much help sorry but i have written a demo a couple of months ago that does it (badly) with 2 different methods (one quasi like quake3 and another way ) ill try to get around to putting it on me site in the next few days
also im looking at a third way with an opengl extension aint tested it yet though

Share this post


Link to post
Share on other sites
hehe for i forget wrote a demo last night not much use for u nes8bit it uses a gl extension ill post it in a couple of hours here
BTW this is the third way that i mentioned above still havent got around to tidying up the source for the first two ways

basically what this extension does is not limit the fog based on its zdistance from the camera but lets u specifiy where u want the fog to be in the scene ie per vertex

Share this post


Link to post
Share on other sites
You probably mean EXT_fog_coord . nes8bit ,note that Direct3d have a comparable functionality(but the OpenGL extension is "more robust" according to NVdia).
This extension is great ,but I think it may slow thinks down when you have most of your vertices outside the fog volume, by specifying a fogcoord of 0.(I have to do more testing to verify this ,but it seems that the vertex color calculations take place even with a textcoord of 0).Also ,by specifying a fogcoord array you are loosing the optimizations of the drivers.(Remember that even on the Nvdia drivers only the Quake 3 CVA format is optimized )
The faster way to do vol. fog is to cast rays from your current position to the vertices inside the fog volume, and determine the amount of fog between the eye and the vertex. Then apply to that vertex the color of the fog ,darker or brighter according to the previous test. Do that for each vertex inside the fog .Having enabled the smooth shading (is free )the OpenGL will calculate smooth gradients between your vertices. And finally draw an alpha blended surface with the fog texture at the boundary of the fog volume. I think this is the way carmack achieve it.
Finaly,I want to point out that when you see the word "volumetric"(fog, lighting),the right way to do it is with an alpha blended 3d texture. I’m going to test this ,just for fun, because I m not expecting great performance.

Share this post


Link to post
Share on other sites
Hey thanks for the help everyone.

pavlos: I know that much, but how do you make it fast enough for realtime using the texture? I know about casting the rays and such, but I don''t see how that could be possibly fast enough for realtime. Oh, I can''t do vertex fog because I''m gonna be doing volumetric explosions which are very small.

Share this post


Link to post
Share on other sites

  • Advertisement