cullvertex = gl_Vertex;
GLSL - 2 Water related problems (screenshot)
Firstly, here's the screen grab.
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:
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.
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?
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.
I think it has something to do with the way the sahder handles translation and rotation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement