Sign in to follow this  

Effects: Light beams / fog / smoke / gas

This topic is 3411 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

Hi, This time not a question about ambient lighting :) Nope, its about effects. I'll have to add stuff like particle generators and sprites to my editor, so I was wondering what techniques are used nowadays for fog/smoke. Of course we can do that with simple old fashioned fog, and/or 2D particle sprites. But I guess there are better ways now. Last time I did these kind of athmospheric effects was years ago, so I need an update. For example, how could you add local fog above a misty lake, or make a light beam with dust through a window? I think I know the answer... Volumetric Rendering? I just had a quick look at the webpage in another post here by Quat. It looks pretty complicated though, so I was wondering if volumetric rendering has already been applied in games for stuff like this. I think about putting a box(or other shape) in my world that is filled with an effect such as fog, smoke, lightbeam dust, or stinky gas. Is volumetric rendering a good option here, or does it still take much GPU power/memory? I need to make a 3D texture somehow. I could draw a cloud of smog, but probably that requires quite alot of memory (how many slices would I need?). And... it needs to be animated somehow. Procedural textures... Ifso, how? Any practical demo's out there? I've seen some, but these were pretty heavy to run. In case more simple techniques are normally used, which ones? Greetings, Rick

Share this post


Link to post
Share on other sites
http://www.gamedev.net/community/forums/topic.asp?topic_id=501861

This thread should pretty much answer your questions.
I have seen this approach in action in various games already.

Share this post


Link to post
Share on other sites
Thanks! That ATI paper shows some cool stuff indeed. I haven't read the paper yet (I tried the demo mentioned in that thread). It's certainly one of the things I like to add for lights. As far as I've seen, it does create a pile of textures, eventually with some noise (such as dust/smoke). Does the same trick also work for a (large) volume of fog? Or a cloud?

Best way to know it is to implement it. But I really don't have much time, and there is so much I want to do :) Therefore I always ask which technique to use here on GD, to prevent myself reinventing the wheel or trying 50 techniques before meeting the right one.

Anyway, thanks!
Rick

Share this post


Link to post
Share on other sites
As far as I can see they use the light's frustrum and render planes inside that frustrum perpendicular to the light's direction and clip them against the frustrum. They use a shadowmap and a colormap and project it onto these planes. This way you get shadowed volumetric light shafts.
The disadvantage is, if you also look perpendicular to the light's direction you will see these planes, because they are not touching each other.

So dependent of the size of the frustrum you need noise textures of higher resolution if you want to keep it sharp.

You probably could render the light's frustrum instead of the planes and in the fragment shader you run a loop "N" times, and fake "N" virtual planes, this way you will drastically reduce fillrate requirements and on the same run increase your number of sampling planes.
a) Lookup the shadow map z value
b) use a linear z buffer for shadow map
c) run from i=0, at the light, to N , increment virtual plane's z coordinate uniformly
d) you know at which iteration the shadow map test will fail, so
you end up with a lequal comparsion in each iteration.

e) handle fragments with no contribution to the current virtual plane

Thats just an idea that is also suggested in the paper more or less.


As for fog there is always the approach of "depth peeling" also called "soft particles", where you fade out your particles dependent on the z coordinate difference, to avoid the ugly edges when a particles intersects the surface.
So you just render a couple of billboards above the ground.

This is also producing a huge amount of overdraw, but particles are currently superior to ray casting through a polygonal hull, because they produce no sharp edges at the corners.

Applying the light shaft algorithm should theoretically work, but I think you need to do something with the cookie texture, since your fog volume can be any concave mesh and clipping the sampling planes will be a problem.


Share this post


Link to post
Share on other sites
Allright. These shafts sound pretty heavy to do, although I might be able to optimize them. In the old days I just rendered a pyramid with noise on it. Maybe I can mix that old trick with this one, using less texture stacks. And I don't think I always need the shadowMap. Of course, that really gives that affect, but most of the lights won't be occluded nearby in my case.

I like the soft particles idea. Never thought about it. I really thought both effects were using 3D textures to achieve the volumetric look, but I guess they are probably too slow, too memory expensive, or too difficult to make so far?

Thanks Basiror, you whipped the horse, let's get working!
Rick

Share this post


Link to post
Share on other sites

This topic is 3411 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this