glClearColor(
(float)(160.0/255.0),
0.85f,
1.0f,
0.0f);
GLfloat fogColor[] = {
(float)(160.0/255.0),
0.85f,
1.0f,
1.0f};
// Camera
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glEnable (GL_FOG);
glFogi (GL_FOG_MODE, GL_EXP);
glFogfv (GL_FOG_COLOR, fogColor);
glFogf (GL_FOG_DENSITY, 0.00003);
gluPerspective(45.0, 4.0/3.0, 500, cam.depth );
gluLookAt(...
It doesn't seem to change, no matter where I put the fog code.
Help?
Fog won't change w/ camera
http://www.ews.uiuc.edu/~bartkus/damnfog.JPG
The camera starts in the far corner of the map, from which the fog looks fine. I've moved across the terrain to exacerbate the effect of the bug.
Basically, the fog seems to be solely a function of distance from the axis x=0.
Here's what I initiate my scene with:
Basic glfog is simple based on the distance a given point is from the camera (more often the distance to the plane perpendicular to the direction the camera is facing). That said, I'm not quite sure what problem you are having.
Quote:Original post by falkone
Basic glfog is simple based on the distance a given point is from the camera (more often the distance to the plane perpendicular to the direction the camera is facing). That said, I'm not quite sure what problem you are having.
Look at the picture. The fog is blue. The near polygons are blue. The far polygons are the proper color. This is the opposite of how it should work.
I move the camera in my program, but the coloring done by the fog is static after initialization. It's not recomputing the fog coloration between frames.
gluPerspective(45.0, 4.0/3.0, 500, cam.depth );gluLookAt(...
I sincerely hope that you have a glMatrixMode call between those two lines.
Enigma
This is one of the reasons why you shouldn't put the viewpoint transform in the projection matrix unless you know what you're doing. The viewpoint transform belongs to the modelview matrix.
i may misunderstood, but i think you should use volumetric fog for your problem. or making a point and changing the GL_FOG_DENSITY with the distance of camera and this point. or you may use soe blended quads to maek a good fog effect. (i works well for terrains)
and i am not sure, maybe helps: there is a tutorial about terrains with volumetric fog @gametutorials.com
i said; i think i misunderstand you.
edit: i see you reply. i think there ise a problem with fog_end. increase it.
and i am not sure, maybe helps: there is a tutorial about terrains with volumetric fog @gametutorials.com
i said; i think i misunderstand you.
edit: i see you reply. i think there ise a problem with fog_end. increase it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement