TechnicolorShader.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/#manual/en/introduction/Installation." );
  2. /**
  3. * Technicolor Shader
  4. * Simulates the look of the two-strip technicolor process popular in early 20th century films.
  5. * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
  6. * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
  7. */
  8. THREE.TechnicolorShader = {
  9. uniforms: {
  10. "tDiffuse": { value: null }
  11. },
  12. vertexShader: [
  13. "varying vec2 vUv;",
  14. "void main() {",
  15. " vUv = uv;",
  16. " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
  17. "}"
  18. ].join( "\n" ),
  19. fragmentShader: [
  20. "uniform sampler2D tDiffuse;",
  21. "varying vec2 vUv;",
  22. "void main() {",
  23. " vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
  24. " vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
  25. " gl_FragColor = newTex;",
  26. "}"
  27. ].join( "\n" )
  28. };