instanced_rsm.frag 556 B

12345678910111213141516171819202122232425262728
  1. #ifndef Use_Bindless_Texture
  2. uniform sampler2D tex;
  3. #endif
  4. in vec2 uv;
  5. in vec3 nor;
  6. in vec4 color;
  7. #ifdef Use_Bindless_Texture
  8. flat in uvec2 handle;
  9. #endif
  10. layout (location = 0) out vec3 RSMColor;
  11. layout (location = 1) out vec3 RSMNormals;
  12. void main()
  13. {
  14. #ifdef Use_Bindless_Texture
  15. vec4 col = texture(sampler2D(handle), uv);
  16. #ifdef SRGBBindlessFix
  17. col.xyz = pow(col.xyz, vec3(2.2));
  18. #endif
  19. #else
  20. vec4 col = texture(tex, uv);
  21. #endif
  22. if (col.a < .5) discard;
  23. RSMColor = col.xyz * color.rgb;
  24. RSMNormals = .5 * normalize(nor) + .5;
  25. }