objectref_pass1.frag 482 B

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