Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main(){
- FragPos = vec3(view * model * vec4(aPos, 1.0));
- TexCoords = aTexCoord;
- Normal = transpose(inverse(mat3(view * model))) * aNormal;
- vec3 T = normalize(vec3(view * model * vec4(aTangent, 0.0)));
- vec3 N = normalize(vec3(view * model * vec4(aNormal, 0.0)));
- // re-orthogonalize T with respect to N
- T = normalize(T - dot(T, N) * N);
- // then retrieve perpendicular vector B with the cross product of T and N
- vec3 B = cross(N, T);
- mat3 TBN = transpose(mat3(T, B, N));
- for(int i = 0; i < 2; i++){
- lightpos[i] = vec3(view * vec4(vec3(pointLight[i].position), 1.0));
- }
- TangentLightPos = TBN * lightpos[0];
- //TangentViewPos = TBN * viewPos;
- TangentFragPos = TBN * FragPos;
- gl_Position = projection * view * model * vec4(aPos, 1.0f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement