PDA

View Full Version : Is fog only calculated along the Z-axis?



05-03-2000, 07:08 AM
I can't get my fog to look the way I want. It looks like what's happening is that the fog is only applied along the z-axis, but not along the x- or y-axis. Is this what is supposed to happen? The books use a z as a distance variable in the calculations, but I interpreted that as a 3D distance length, instead of a z-axis value. Is this analysis correct?

I saw a reference that there was some stuff on volumetric fog in the archives, but couldn't find the info. Is this what I need to do, rather than the fog I'm trying to use? If so, where can I get volumetric fog info?

Thanks to all!

dmy
05-03-2000, 07:19 AM
yes, fogging occours as a function of eye space depth.
to get a different axial behaviour, you could try to rotate the projection matrix and see what happens, but i didn't tried it yet, so i don't know what kind of distortions and design problems you could get...

what you thought is called radial fog, and can't be obtained with unextended opengl 1.1 and fogging stage.

by extendin it, insteda, you can easily get custom fogging: just assign the fog coordinate to the verts of your interest.

there is the EXT_fog_coord (or something like that) that allows to do exactly this:
i tried and it works very good.

only one thing: seems like the nvidia drivers for tnt and geforce cards didn't respected the interface specification for vertex arrays, and you could get a GP fault using it, at least under Win32.
btw, it is a little bug and it is easy to play with.

i never implemented fog volumes, only radial fog.

Dolo/\/\ightY


[This message has been edited by dmy (edited 05-03-2000).]

MikeC
05-04-2000, 12:43 AM
AFAIK the normal fogging is _supposed_ to be 3D distance, but the spec explicitly allows implementations to use Z as an approximation. (If it didn't, fog would require a sqrt per pixel, which would kill you without hardware support.)

Newer chipsets (e.g. ATI Radeon) can do correct distance-based fogging.

dmy
05-04-2000, 05:39 AM
oh, didn't know that.
so, is right to think the gl hint about fog should operate on this?

in my early gl days i've tested the performance difference of the two states, but i didn't see any difference: probably this was not implemented on the tnt.

i'll try on the nv10.

Dolo/\/\ightY

MikeC
05-04-2000, 06:01 AM
No, I wouldn't expect true-distance fog on the TNT. I suspect the fact that the latest crop of accelerators can do it is a side-effect of the per-pixel dot product they need for bump mapping.