three
Version:
JavaScript 3D library
50 lines (30 loc) • 1.12 kB
JavaScript
console.warn( "THREE.ColorCorrectionShader: 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." );
/**
* Color correction
*/
THREE.ColorCorrectionShader = {
uniforms: {
"tDiffuse": { value: null },
"powRGB": { value: new THREE.Vector3( 2, 2, 2 ) },
"mulRGB": { value: new THREE.Vector3( 1, 1, 1 ) },
"addRGB": { value: new THREE.Vector3( 0, 0, 0 ) }
},
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;",
"uniform vec3 addRGB;",
"varying vec2 vUv;",
"void main() {",
" gl_FragColor = texture2D( tDiffuse, vUv );",
" gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );",
"}"
].join( "\n" )
};