Hi!
I have a water shader where I've added a cloudy texture to simulate reflections.
It works well as it follows the camera, but when I turn the camera the texture follows the rotation.
How can I stop the rotation?
From vertex shader:
Code:
vec3 vEyeNormal = gl_NormalMatrix * gl_Normal;
vec4 vVert4 = gl_ModelViewMatrix * gl_Vertex;
vec3 vEyeVertex = normalize(vVert4.xyz / vVert4.w);
vec4 vCoords = vec4(reflect(vEyeVertex, vEyeNormal), 0.0);
RefTexcoord.xyz =normalize(vCoords.xyz);
From frag shader:
Code:
vec4 refImage = texture2D(refMap, vec2(RefTexcoord.x, RefTexcoord.y));
Cheers!
Bookmarks