instanced_objectref_pass2.frag 789 B

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