Advertisement
Guest User

Untitled

a guest
Jun 12th, 2025
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. void main(){
  2. FragPos = vec3(view * model * vec4(aPos, 1.0));
  3. TexCoords = aTexCoord;
  4. Normal = transpose(inverse(mat3(view * model))) * aNormal;
  5. vec3 T = normalize(vec3(view * model * vec4(aTangent, 0.0)));
  6. vec3 N = normalize(vec3(view * model * vec4(aNormal, 0.0)));
  7. // re-orthogonalize T with respect to N
  8. T = normalize(T - dot(T, N) * N);
  9. // then retrieve perpendicular vector B with the cross product of T and N
  10. vec3 B = cross(N, T);
  11.  
  12. mat3 TBN = transpose(mat3(T, B, N));
  13. for(int i = 0; i < 2; i++){
  14. lightpos[i] = vec3(view * vec4(vec3(pointLight[i].position), 1.0));
  15. }
  16. TangentLightPos = TBN * lightpos[0];
  17. //TangentViewPos = TBN * viewPos;
  18. TangentFragPos = TBN * FragPos;
  19. gl_Position = projection * view * model * vec4(aPos, 1.0f);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement