Sign in to follow this  

Fog won't change w/ camera

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this