Localised fog

How do I make a localised patch of fog in a scene, I want to have a world with fog floating over a sea. Normal glFog depends only on the distance to the object from the viewer, correct? Cheers for your help.

One suggestion would be to use semi transparent textures to simulate fog?

Antonio www.fatech.com/tech

Volumetric fog. try gamedev.org

gamedev.org’ that site isn’t up and running yet, do you know of any others?

HI!

perhaps you have to increase or decrease the distance with each cam-modification
that means, when moving into the fog, do a

#define FOGSIZE 3
float x;

x+=0.1
glFogf(GL_FOG_START,x);
glFogf(GL_FOG_END,x+FOGSIZE);

and decrease x when moving away

x-=0.1

but i think you search something like the intro of unreal…a qube-fog…
perhaps use a cube with a white (or grey) texture and alpha-blending (also dependent from distance cam-fog)

but i hope somebody knows how to do a REAL localized fog, like in unreal…
cause the problem is, with GL_FOG_START & END you only can change the depth of the fog…I miss something like GL_FOG_POS and GL_FOG_HEIGTH

:-))

Bastian

greetings

I don’t think that Unreal uses glFog at all. I think that quake uses Volumetric fog. That is, you can specify a box filled with fog. You then need to calculate the fog values for the backfaces of that cube and blend it over the scene. Might be that you’ll have to use smaller quads than the actual backface. Afterwards, if you’re outside the fog, you need to calculate for any vertex in the fog volume, the length of the way, the viewer ray goes through the volume and then set the vertices color value to an according color. You’ll have to use GL_MODULATE texturing for that. If you’re inside the fog volume, you’ll only need the distance to that point.

yes, but i only wanted to give some suggestions :slight_smile:
i know that such a fog-effect isn’t possible with glFog.
the next problem I found in my suggestions is, if you use the distance to the FOG-start and put this into GL_FOG_START, it will look good, if you have an angle of 90 degrees to the fog (look direct into it ) but if your angle changes, it’ll look ****y…(cause OpenGL “think” your angle is 90° )
but I’ll try your way :slight_smile:

thanx 4 help

bastian.

Hey, don’t misunderstand me, I don’t want to offense anyone. I’ve only been remembered to the good old board’s time a year ago, when coco and the others were still there.
I’m sorry if I sound insulting, that is mostly because of my bad way of english.

I know exactly what do you want…, you can do it, using the gl_extfog
email-me if you want a piece of code to do that

cheers

Bruno

Michael: I think we have a little bit “aneinandervorbeigeredet”
The problem is, that you can’t express emotions via e-mail…
I don’t thought that you want to offense me (or someone else)

Bruno: yes, please give me some code!

THANX!

Cheers Bruno,
The code is a great help, but is there no way of doing it without using extensions?

Tom.

Yes , it’s possible, just blend a plane from the nearest fog to the farthest, with the plane that is far way less transparent than the one that is near., but that would be slower than using the extensions!

Bruno

Sorry, didn’t get what you mean Bruno, could you explain it to me?

Hey mcbastian: Was geht? Wie wärs wenn wir uns n spaß machen und auf Deutsch kommunizieren?

Well, look at this lousy draw

| - | 0.7
| — | 0.6
| ----- | 0.5
| ------- | 0.4
| --------- | 0.3
|-----------| 0.2

    X (camera)

Disable Textures, enable the fog color you want, then draw some planes where you want the fog, and as they go away from the camera, draw them smaller, and more solid (glcolor4f ) than the ones that are closer to the camera. You should also blend them to the walls, so that when you are inside the fog, you see the walls, of the color of the fog.
I think this should work.

Did you understood ?

Bruno

hmm…, the spaces i had in the ASCII drawing disappeared…, hope you understand it like it is

Bruno