ExposureShader.js 567 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Exposure shader
  3. */
  4. const ExposureShader = {
  5. name: 'ExposureShader',
  6. uniforms: {
  7. 'tDiffuse': { value: null },
  8. 'exposure': { value: 1.0 }
  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 float exposure;
  18. uniform sampler2D tDiffuse;
  19. varying vec2 vUv;
  20. void main() {
  21. gl_FragColor = texture2D( tDiffuse, vUv );
  22. gl_FragColor.rgb *= exposure;
  23. }`
  24. };
  25. export { ExposureShader };