GeForce 2 Pro broken fog?!?

I’m running a GeForce 2 with drivers from nVidia and I’m trying to use linear fog and I’ve run into two problems.

Problem 1: The fog was always at full intensity. After exploring the issue I noticed if I change the GL_FOG_END (using glFogf) to a higher number like 4000 the fog thinned out. Shouldn’t the end float val be 1? And if this is the case then what is the max val?

Problem 2: I need to change the alpha value with the fog, so I set the GL_FOG_COLOR (using glFogfv) to {0, 0, 0, 0} the book I have says to pass a float 4 into this param, however the alpha is not affected. I made sure that I have a 32bit color buffer and that the alpha buffer was definitely 8 bit.

Has anyone had this problem before? With the fog alpha is the book wrong or are the GeForce drivers not to spec?

Thanks…

John.

The end fog value, is not like the Zbuffer, where it goes from 0 to 1. Instead you need to set it at the distance based on world coordinates. i.e. if your clip plane is set to 1000 units, then your fog end value needs to be around that value also.

I’m not sure fog uses an alpha value at all, perhaps it just uses a 4 component float for completeness, as pretty much every other color value in GL does have an alpha component.

I may be wrong on that tho…

Nutty

Make sure you are not touching your projection matrix after you have set it with glfrustum. If you want to move/rotate your view point apply the reverse transformations to your objects modelview matrices. Moving/rotating your projection matrix will “break” fog.

I’m not changing my projection matrix, but I will avoid that in the future.

I’ll try setting the fog end to my far clipping plane. The values for the clipping plane and an accurate fog end were very close in value I just failed to make the connection.

Thanks guys…

Can anyone verify the alpha fog value?
To give a little back ground, I just need fast depth queued alpha. Linear fog should be the best way to do it. If it works…

Thanks…

John.

To do depth cued alpha, I think a vertex shader will be needed, or something along that line (such as calculating vertex alpha in the app).

The alpha value does get interpolated by fog - I’ve used it to smoothly fade from zero LOD to crude LOD ranges, which looks good.

Fog does not modify alpha.

  • Matt

Ok new question:

When setting light color with glLightfv the param should be float[4]. Does lighting affect the alpha or not?

Also, I can get a 32bit color buffer with an 8bit Alpha on my GeForce 2 Pro, but do all 3D cards developed in the last few years support this (I hope so, destination alpha is my friend)?

Thanks…

John.

Originally posted by john_at_kbs_is:
[b]Ok new question:

When setting light color with glLightfv the param should be float[4]. Does lighting affect the alpha or not?

Also, I can get a 32bit color buffer with an 8bit Alpha on my GeForce 2 Pro, but do all 3D cards developed in the last few years support this (I hope so, destination alpha is my friend)?

Thanks…

John.[/b]

Lighting shouldn’t affect alpha either. The only thing that should affect the alpha is glMaterial.