Archived

This topic is now archived and is closed to further replies.

CoderTCD

realistic fog

Recommended Posts

CoderTCD    128
I use standard opengl fogging functions and linear fog. But It has a problem that opengl calculates the distance using depth in z axis. I want it to calculate the distance using distance in x y and z. here''s the formula I want it to use distance=squareroot(xdistance^2+ydistance^2+zdistance^2) If it uses his formula the fog will be like a sphere around the viewer. someone told me that I could make it using extentions but I couldn''t find any resource for that. Does anyone have an idea?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
There''s an article on spherical fog in the articles & resources section. Have you read that?

Share this post


Link to post
Share on other sites
zedzeek    528
the fog distance extension will do the above

from the spec
>>When the fog distance mode is EYE_RADIAL_NV, the fog distance z is computed as the Euclidean distance from the center of the fragment in eye coordinates to the eye position. Specifically:
z = sqrt( xe*xe + ye*ye + ze*ze );<<

Share this post


Link to post
Share on other sites