PDA

View Full Version : GeForce 2 Pro broken fog?!?



ToolChest
03-18-2002, 06:03 AM
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? http://www.opengl.org/discussion_boards/ubb/confused.gif

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. http://www.opengl.org/discussion_boards/ubb/confused.gif

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

Thanks…

John.

Nutty
03-18-2002, 09:16 AM
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

Adrian
03-18-2002, 11:03 AM
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.

ToolChest
03-18-2002, 11:21 AM
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.

DFrey
03-18-2002, 11:35 AM
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).

knackered
03-18-2002, 02:11 PM
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.

mcraighead
03-18-2002, 04:30 PM
Fog does not modify alpha.

- Matt

ToolChest
03-20-2002, 09:29 AM
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.

NitroGL
03-20-2002, 09:37 AM
Originally posted by john_at_kbs_is:
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.

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