From: Bambang Veriansyah (vaveri++at++yahoo.com)
Date: 06/28/2005 17:48:34
Thanks Terry,
I modified my fragment shader as your suggestion,
Here is the my fragment shader:
vec4 reflVec;
reflVec.xyz = reflect(vViewVec, vNormal);
reflVec = ViewMatrix_inverse * reflVec;
vec4 refl = textureCube(envMap, reflVec.xyz);
gl_FragColor = refl;
When I change the eye direction, the reflection is
correct.But if I change the eye position, the
reflection still not correct.
Do I miss something ? Should I send the eye position
to the shader?
Thanks in advanced.
==================================================
Terry Welsh wrote:
It looks like you need to transform reflVec from view
space to world space before you use it to access your
cube map. To do this, you can pass the inverse view
matrix to your shader as a uniform and multiply
reflVec by it. In fact, you only really need the
upper-left 3x3 of that matrix, since translation
doesn't matter in this case.
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
This archive was generated by hypermail 2b29 : Tue Jun 28 2005 - 17:48:33 PDT