ExposureShader.js 729 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @module ExposureShader
  3. * @three_import import { ExposureShader } from 'three/addons/shaders/ExposureShader.js';
  4. */
  5. /**
  6. * TODO
  7. *
  8. * @constant
  9. * @type {ShaderMaterial~Shader}
  10. */
  11. const ExposureShader = {
  12. name: 'ExposureShader',
  13. uniforms: {
  14. 'tDiffuse': { value: null },
  15. 'exposure': { value: 1.0 }
  16. },
  17. vertexShader: /* glsl */`
  18. varying vec2 vUv;
  19. void main() {
  20. vUv = uv;
  21. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  22. }`,
  23. fragmentShader: /* glsl */`
  24. uniform float exposure;
  25. uniform sampler2D tDiffuse;
  26. varying vec2 vUv;
  27. void main() {
  28. gl_FragColor = texture2D( tDiffuse, vUv );
  29. gl_FragColor.rgb *= exposure;
  30. }`
  31. };
  32. export { ExposureShader };