object_pass2.frag 764 B

123456789101112131415161718192021222324252627282930
  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. #ifdef Use_Bindless_Texture
  15. vec4 col = texture(Albedo, uv);
  16. #ifdef SRGBBindlessFix
  17. col.xyz = pow(col.xyz, vec3(2.2));
  18. #endif
  19. #else
  20. vec4 col = texture(Albedo, uv);
  21. #endif
  22. col.xyz *= pow(color.xyz, vec3(2.2));
  23. float specmap = texture(SpecMap, uv).g;
  24. float emitmap = texture(SpecMap, uv).b;
  25. FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap), 1.);
  26. }