Fog Problems

Posted By: Spaz

Fog Problems - 04/10/06 18:24

When I add fog to my level, it looks like it kind of chunks out in a triangular pattern. I'm assuming the triangles match up with those of the terrain mesh, but what causes this? How can I get a nice, smooth fog? Is it something with code, or is it simply a monitor setting? Right now my monitor is set to 800x600 (though I've tried 1024x768 and that didn't make any difference), 32-bit color. I've got an nVidia GeForce 6600 GT graphics card running on an AMD Athlon 64 Processor with Windows XP.



Also, is it possible with fog or some other method to get an effect like depth-of-field like you can with a camera, where things far away are blurrier than things up close? My level uses lod, but that doesn't really seem to do it. The problem is that as soon as trees or something come within the clip range, they appear instantly, rather than kind of fading in.

Thanks for any help,
Spaz
Posted By: ulillillia

Re: Fog Problems - 04/11/06 00:00

Are you using a shader for fog or are you using camera.fog_start and the related? Use camera.fog_start to get fog that works better. Either that or use volumetric fog (use a model with transparency and a grid-like pattern (and set it as passable) to do this.
Posted By: Spaz

Re: Fog Problems - 04/11/06 14:19

I'm using camera.fog_start. . . mostly because I don't know a thing about shaders . Can you explain the volumetric fog thing a little more and maybe show an example of the grid-like pattern you're talking about? Do you just place the model right in front of your camera?

How about having trees and things gradually show up in the distance rather than just popping up on screen once in the clip range? Should I do some sort of transparency fade? Or would it look more realistic to change their scale based on distance like they do in Doom?

Thanks,
Spaz
Posted By: ulillillia

Re: Fog Problems - 04/12/06 13:20

I don't have such a model. How you use the volumetric fog depends on what your level has. For underwater, it needs to be more dense, but for air near the ground, it needs to be less dense and very high up (on the order of miles), it's nearly absent. Want me to make a quick sample model so you can see the structure? I'll be using something similar for my 3D game's water.
Posted By: Spaz

Re: Fog Problems - 04/12/06 21:15

Yeah, that'd be great! Once I see what you mean for your water level I can adapt it for my driving simulator. Thanks!

-Spaz
Posted By: ulillillia

Re: Fog Problems - 04/13/06 06:25

Here's the model (ZIP file) that demonstrates it. This fog is rather dense though but is great for water. For air, have the grids spaced 8 times further apart (instead of 128, have it more around 512 or 1024). For sufficient testing, use this code and set the skills 1 through 4 in WED to set the color and alpha. Setting the alpha to 1% seems to be the best.

Code:

material volume_fog
{
ambient_red = 255;
ambient_green = 255;
ambient_blue = 255;
}

action gridfog
{
my.material = volume_fog;
my.passable = on;
my.transparent = on;
volume_fog.ambient_red = my.skill1;
volume_fog.ambient_green = my.skill2;
volume_fog.ambient_blue = my.skill3;
my.alpha = my.skill4;
wait(1); // registers the above
my.dynamic = off; // doesn't need to be dynamic
}



This is only a small sample though. If make the cube 2048x2048x2048 instead, twice the size on each dimension, you only need 8 times as many polygons.
Posted By: Spaz

Re: Fog Problems - 04/13/06 13:52

Thanks Ulillillia,

I'll try it out and let you know how it goes.

-Spaz
© 2024 lite-C Forums