instanced_object_pass1.frag 464 B

123456789101112131415161718192021222324
  1. #ifndef Use_Bindless_Texture
  2. uniform sampler2D glosstex;
  3. #endif
  4. #ifdef Use_Bindless_Texture
  5. flat in sampler2D secondhandle;
  6. #endif
  7. in vec3 nor;
  8. in vec2 uv;
  9. out vec3 EncodedNormal;
  10. vec2 EncodeNormal(vec3 n);
  11. void main(void)
  12. {
  13. #ifdef Use_Bindless_Texture
  14. float glossmap = texture(secondhandle, uv).x;
  15. #else
  16. float glossmap = texture(glosstex, uv).x;
  17. #endif
  18. EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
  19. EncodedNormal.z = glossmap;
  20. }