transparent.frag 436 B

1234567891011121314151617181920212223
  1. #ifdef Use_Bindless_Texture
  2. layout(bindless_sampler) uniform sampler2D tex;
  3. #else
  4. uniform sampler2D tex;
  5. #endif
  6. in vec2 uv;
  7. in vec4 color;
  8. out vec4 FragColor;
  9. void main()
  10. {
  11. vec4 Color = texture(tex, uv);
  12. #ifdef Use_Bindless_Texture
  13. Color.xyz = pow(Color.xyz, vec3(2.2));
  14. #endif
  15. Color.xyz *= pow(color.xyz, vec3(2.2));
  16. Color.a *= color.a;
  17. // Premultiply alpha
  18. FragColor = vec4(Color.rgb * Color.a, Color.a);
  19. }