GammaCorrectionShader.js 952 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. console.warn( "THREE.GammaCorrectionShader: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation." );
  2. /**
  3. * Gamma Correction Shader
  4. * http://en.wikipedia.org/wiki/gamma_correction
  5. */
  6. THREE.GammaCorrectionShader = {
  7. uniforms: {
  8. "tDiffuse": { value: null }
  9. },
  10. vertexShader: [
  11. "varying vec2 vUv;",
  12. "void main() {",
  13. " vUv = uv;",
  14. " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
  15. "}"
  16. ].join( "\n" ),
  17. fragmentShader: [
  18. "uniform sampler2D tDiffuse;",
  19. "varying vec2 vUv;",
  20. "void main() {",
  21. " vec4 tex = texture2D( tDiffuse, vUv );",
  22. " gl_FragColor = LinearTosRGB( tex );", // optional: LinearToGamma( tex, float( GAMMA_FACTOR ) );
  23. "}"
  24. ].join( "\n" )
  25. };