Sign in to follow this  

GLSL - 2 Water related problems (screenshot)

This topic is 4274 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

Firstly, here's the screen grab. Free Image Hosting at www.ImageShack.us The main problem is with transformed objects. When drawing the scene, fog is applied correctly in the frag shader (computing it myself based upon camera distance). The problem arises with translated and rotated scene objects. The fog is applied as if the object was at the origin. I'm obtaining the vertex in the vert shader as follows:

	cullvertex	= 	gl_Vertex;





In the frag shader, i'm just computing the fog as a scalar value between a given falloff distance against the distance between the camera and the fragment. What's going on? Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
I'm not sure exactly what you're doing since you've only posted one line of shader code, but shouldn't you be multiplying gl_vertex by the modelview matrix?

Share this post


Link to post
Share on other sites
I've tried multuplying it by the mv matrix, but then the fog, which should be green below 0 in the y axis, and grey above changes dependant upon the where the box is in relation to the middle of the screen.

I think it has something to do with the way the sahder handles translation and rotation.

Share this post


Link to post
Share on other sites

This topic is 4274 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