TechnicolorShader.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. console.warn( "THREE.TechnicolorShader: 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/index.html#manual/en/introduction/Import-via-modules." );
  2. /**
  3. * @author flimshaw / http://charliehoey.com
  4. *
  5. * Technicolor Shader
  6. * Simulates the look of the two-strip technicolor process popular in early 20th century films.
  7. * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
  8. * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
  9. */
  10. THREE.TechnicolorShader = {
  11. uniforms: {
  12. "tDiffuse": { value: null }
  13. },
  14. vertexShader: [
  15. "varying vec2 vUv;",
  16. "void main() {",
  17. " vUv = uv;",
  18. " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
  19. "}"
  20. ].join( "\n" ),
  21. fragmentShader: [
  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. ].join( "\n" )
  30. };