instanced_objectref_pass1.frag 617 B

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