OSDN Git Service

three.jsをThirdPartyに追加
[webglgame/webgl_framework.git] / webglFramework / Thirdparty / three.js-master / examples / js / shaders / TechnicolorShader.js
1 /**
2  * @author flimshaw / http://charliehoey.com
3  *
4  * Technicolor Shader
5  * Simulates the look of the two-strip technicolor process popular in early 20th century films.
6  * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
7  * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
8  */
9
10 THREE.TechnicolorShader = {
11
12         uniforms: {
13
14                 "tDiffuse": { value: null }
15
16         },
17
18         vertexShader: [
19
20                 "varying vec2 vUv;",
21
22                 "void main() {",
23
24                         "vUv = uv;",
25                         "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
26
27                 "}"
28
29         ].join( "\n" ),
30
31         fragmentShader: [
32
33                 "uniform sampler2D tDiffuse;",
34                 "varying vec2 vUv;",
35
36                 "void main() {",
37
38                         "vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
39                         "vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
40
41                         "gl_FragColor = newTex;",
42
43                 "}"
44
45         ].join( "\n" )
46
47 };