topical media & game development
mobile-query-three-vendor-three-r53.js-shaders-ColorCorrectionShader.js / js
author: alteredq / alteredqualia.com/
Color correction
THREE.ColorCorrectionShader = {
uniforms: {
"tDiffuse": { type: "t", value: null },
"powRGB": { type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
"mulRGB": { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
},
vertexShader: [
"varying vec2 vUv;",
"void main() {",
"vUv = uv;",
"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
].join("\n"),
fragmentShader: [
"uniform sampler2D tDiffuse;",
"uniform vec3 powRGB;",
"uniform vec3 mulRGB;",
"varying vec2 vUv;",
"void main() {",
"gl_FragColor = texture2D( tDiffuse, vUv );",
"gl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );",
"}"
].join("\n")
};
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.