objectref_pass2.frag 713 B

12345678910111213141516171819202122232425262728
  1. #ifdef Use_Bindless_Texture
  2. layout(bindless_sampler) uniform sampler2D Albedo;
  3. layout(bindless_sampler) uniform sampler2D SpecMap;
  4. #else
  5. uniform sampler2D Albedo;
  6. uniform sampler2D SpecMap;
  7. #endif
  8. in vec2 uv;
  9. in vec4 color;
  10. out vec4 FragColor;
  11. vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
  12. void main(void)
  13. {
  14. vec4 col = texture(Albedo, uv);
  15. #ifdef Use_Bindless_Texture
  16. #ifdef SRGBBindlessFix
  17. col.xyz = pow(col.xyz, vec3(2.2));
  18. #endif
  19. #endif
  20. col.xyz *= pow(color.xyz, vec3(2.2));
  21. if (col.a * color.a < 0.5) discard;
  22. float specmap = texture(SpecMap, uv).g;
  23. FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, 0.), 1.);
  24. }