instanced_detailed_object_pass2.frag 887 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef Use_Bindless_Texture
  2. uniform sampler2D Albedo;
  3. uniform sampler2D Detail;
  4. uniform sampler2D SpecMap;
  5. #endif
  6. #ifdef Use_Bindless_Texture
  7. flat in sampler2D handle;
  8. flat in sampler2D secondhandle;
  9. flat in sampler2D thirdhandle;
  10. #endif
  11. in vec2 uv;
  12. in vec2 uv_bis;
  13. out vec4 FragColor;
  14. vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
  15. void main(void)
  16. {
  17. #ifdef Use_Bindless_Texture
  18. vec4 color = texture(handle, uv);
  19. float specmap = texture(secondhandle, uv).g;
  20. #ifdef SRGBBindlessFix
  21. color.xyz = pow(color.xyz, vec3(2.2));
  22. #endif
  23. vec4 detail = texture(thirdhandle, uv_bis);
  24. #else
  25. vec4 color = texture(Albedo, uv);
  26. vec4 detail = texture(Detail, uv_bis);
  27. float specmap = texture(SpecMap, uv).g;
  28. #endif
  29. color *= detail;
  30. FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap, 0.), 1.);
  31. }