GammaCorrectionShader.js 612 B

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