Created
September 10, 2012 00:14
-
-
Save jeiting/3688050 to your computer and use it in GitHub Desktop.
YcRcBA Compositing with GLSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varying highp vec2 v_texCoord; | |
uniform sampler2D u_YTex; | |
uniform sampler2D u_cRTex; | |
uniform sampler2D u_cBTex; | |
uniform sampler2D u_ATex; | |
void main() | |
{ | |
const lowp mat3 M = mat3 (1.164, 1.164, 1.164, | |
0.0, -0.3917, 2.01723, | |
1.5960, -0.812, 0.0); | |
const lowp vec3 postBias = vec3(-0.870, 0.529, -1.0813); | |
lowp vec4 p; | |
lowp float Y = texture2D(u_YTex, v_texCoord.st).x; | |
lowp float cB = texture2D(u_cBTex, v_texCoord.st).x; | |
lowp float cR = texture2D(u_cRTex, v_texCoord.st).x; | |
lowp float A = texture2D(u_ATex, v_texCoord.st).x; | |
p.a = A; | |
p.xyz = M * vec3(Y,cB,cR) + postBias; | |
gl_FragColor = p; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment