Archived

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

SoaringTortoise

X/Z based distance fogging?

Recommended Posts

Is it possible in DX8 to get fog to take into account only the horizontal distance from the camera? The reason being that I am using fog to shorten the view distance, but there are some areas, such as on top of tall buildings, where the ground is fogged out as well. This is a pity because it would look neat to have massive gorges on either side of the player, but this effect is nullified by the fog. I was toying with using a cylinder around the view and rendering it a couple of times with varying transparency and scales to emulate fog, but it gets really expensive if I want the fog to look smooth and natural this way.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
What about using a spotlight? You could create a spotlight that looks straight down onto the terrain with a really large attenuation.

Share this post


Link to post
Share on other sites
I tried that, but it messes with my time-of-day lighting which is a directional light... not to mention the bump-mapping.

Using multiple cylinders seems to work well-ish, but it''s seriously chewing up my performance (rendering 10 massive cylinders with alpha from 1 to 0), plus it looks quite jaggy.

Always prey on the weak, the timid and the stupid. Otherwise you''ll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Use vertex shaders to do your own fog calculations. It''s no biggie.

Share this post


Link to post
Share on other sites
billybob    134
if you don't want to do that, you could also do it based on the pitch.

SetFogDistance(YourFogDistanceHere / cos(pitch));

that will mean when you are looking down, there will be no fog, when you are looking horizontal, there will be as much fog as there is now. you might have to switch pitch to -pitch depending on dx's coordinate system. note this will suffer from the same thing as things appearing at the edges based on z depth, at least as bad as regular distance fog. its a cheap hack, only do it if you absolutely can't use vertex shaders

edit: actually looking down is divide by zero, you would have to turn off fog at exactly down or up.

[edited by - billybob on May 27, 2003 9:19:01 PM]

Share this post


Link to post
Share on other sites