TechnicolorShader.js 864 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Technicolor Shader
  3. * Simulates the look of the two-strip technicolor process popular in early 20th century films.
  4. * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
  5. * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
  6. */
  7. const TechnicolorShader = {
  8. name: 'TechnicolorShader',
  9. uniforms: {
  10. 'tDiffuse': { value: null }
  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, vec2( vUv.x, vUv.y ) );
  23. vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);
  24. gl_FragColor = newTex;
  25. }`
  26. };
  27. export { TechnicolorShader };