GammaCorrectionShader.js 595 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Gamma Correction Shader
  3. * http://en.wikipedia.org/wiki/gamma_correction
  4. */
  5. const GammaCorrectionShader = {
  6. name: 'GammaCorrectionShader',
  7. uniforms: {
  8. 'tDiffuse': { value: null }
  9. },
  10. vertexShader: /* glsl */`
  11. varying vec2 vUv;
  12. void main() {
  13. vUv = uv;
  14. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  15. }`,
  16. fragmentShader: /* glsl */`
  17. uniform sampler2D tDiffuse;
  18. varying vec2 vUv;
  19. void main() {
  20. vec4 tex = texture2D( tDiffuse, vUv );
  21. gl_FragColor = sRGBTransferOETF( tex );
  22. }`
  23. };
  24. export { GammaCorrectionShader };