A little explanation after I successfully decyphered this.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent d64dd4f23f
commit 750e7b5e8e

@ -342,11 +342,13 @@ namespace NL3D
ss << "vec4 n = normalize( vnormal ); //normalized normal" << std::endl;
ss << "vec4 T; // second basis, Tangent" << std::endl;
ss << "T = texCoord1;" << std::endl;
ss << "T = T - n * dot( N, T ); // Gramm-Schmidt process" << std::endl;
ss << "T = normalize( T );" << std::endl;
ss << "vec4 B;" << std::endl;
ss << "B.xyz = cross( n.xyz, T.xyz );" << std::endl;
ss << "B.xyz = cross( n.xyz, T.xyz ); // B = N x T" << std::endl;
ss << "vec4 L = lightPos - vposition; //Inverse light vector" << std::endl;
ss << "L = normalize( L );" << std::endl;
ss << "L * [ T B N ]" << std::endl;
ss << "cubeTexCoords0.x = dot( T.xyz, L.xyz );" << std::endl;
ss << "cubeTexCoords0.y = dot( B.xyz, L.xyz );" << std::endl;
ss << "cubeTexCoords0.z = dot( n.xyz, L.xyz );" << std::endl;

@ -98,7 +98,7 @@ MUL R6, v[2], R1; \n\
\n\
#normalize the second vector \n\
DP3 R1, R6, v[9]; \n\
MAD R1, R6, -R1, v[9]; #subtract the normal component \n\
MAD R1, R6, -R1, v[9]; #subtract the normal component, Gramm-Schmidt process \n\
DP3 R2, R1, R1; \n\
RSQ R2, R2.x; \n\
MUL R5, R1, R2; #second basis vector in R5 \n\

Loading…
Cancel
Save