instanced_object_pass2.frag 853 B

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