TechnicolorShader.js 1.1 KB
Newer Older
M
r119  
Mr.doob 已提交
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." );
M
r68  
Mr.doob 已提交
2 3 4 5 6 7 8 9 10 11 12
/**
 * Technicolor Shader
 * Simulates the look of the two-strip technicolor process popular in early 20th century films.
 * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
 * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
 */

THREE.TechnicolorShader = {

	uniforms: {

M
r83  
Mr.doob 已提交
13
		"tDiffuse": { value: null }
M
r68  
Mr.doob 已提交
14 15 16 17 18 19 20 21 22

	},

	vertexShader: [

		"varying vec2 vUv;",

		"void main() {",

M
r109  
Mr.doob 已提交
23 24
		"	vUv = uv;",
		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
M
r68  
Mr.doob 已提交
25 26 27

		"}"

M
r72  
Mr.doob 已提交
28
	].join( "\n" ),
M
r68  
Mr.doob 已提交
29 30 31 32 33 34 35 36

	fragmentShader: [

		"uniform sampler2D tDiffuse;",
		"varying vec2 vUv;",

		"void main() {",

M
r109  
Mr.doob 已提交
37 38
		"	vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );",
		"	vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);",
M
r68  
Mr.doob 已提交
39

M
r109  
Mr.doob 已提交
40
		"	gl_FragColor = newTex;",
M
r68  
Mr.doob 已提交
41 42 43

		"}"

M
r72  
Mr.doob 已提交
44
	].join( "\n" )
M
r68  
Mr.doob 已提交
45 46

};