TechnicolorShader.js 926 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /** @module TriangleBlurShader */
  2. /**
  3. * Simulates the look of the two-strip technicolor process popular in early 20th century films.
  4. * More historical info here: {@link http://www.widescreenmuseum.com/oldcolor/technicolor1.htm}
  5. * Demo here: {@link http://charliehoey.com/technicolor_shader/shader_test.html}
  6. *
  7. * @constant
  8. * @type {Object}
  9. */
  10. const TechnicolorShader = {
  11. name: 'TechnicolorShader',
  12. uniforms: {
  13. 'tDiffuse': { value: null }
  14. },
  15. vertexShader: /* glsl */`
  16. varying vec2 vUv;
  17. void main() {
  18. vUv = uv;
  19. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  20. }`,
  21. fragmentShader: /* glsl */`
  22. uniform sampler2D tDiffuse;
  23. varying vec2 vUv;
  24. void main() {
  25. vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );
  26. vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);
  27. gl_FragColor = newTex;
  28. }`
  29. };
  30. export { TechnicolorShader };
粤ICP备19079148号