splatting_rsm.frag 784 B

12345678910111213141516171819202122232425262728
  1. uniform sampler2D tex_layout;
  2. uniform sampler2D tex_detail0;
  3. uniform sampler2D tex_detail1;
  4. uniform sampler2D tex_detail2;
  5. uniform sampler2D tex_detail3;
  6. in vec2 uv;
  7. in vec2 uv_bis;
  8. in vec3 nor;
  9. layout (location = 0) out vec3 RSMColor;
  10. layout (location = 1) out vec3 RSMNormals;
  11. void main()
  12. {
  13. vec4 splatting = texture(tex_layout, uv_bis);
  14. vec4 detail0 = texture(tex_detail0, uv);
  15. vec4 detail1 = texture(tex_detail1, uv);
  16. vec4 detail2 = texture(tex_detail2, uv);
  17. vec4 detail3 = texture(tex_detail3, uv);
  18. vec4 splatted = splatting.r * detail0 +
  19. splatting.g * detail1 +
  20. splatting.b * detail2 +
  21. max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
  22. RSMColor = splatted.rgb;
  23. RSMNormals = .5 * normalize(nor) + .5;
  24. }