OpenGL ES shader to convert color image to black-and-white infrared?
I was able to create a fragment shader to convert a color im开发者_Python百科age to greyscale, by:
float luminance = pixelColor.r * 0.299 + pixelColor.g * 0.587 + pixelColor.b * 0.114;
gl_FragColor = vec4(luminance, luminance, luminance, 1.0);
Now I'd like to mimic a Photoshop channel mixer effect:
How can I translate the %
percentage values (-70%, +200%, -30%) into r g b
floating point numbers (e.g. 0.299, 0.587, 0.114)?
You should know from school that 10% of a value means multiplying that value by 0.1, so just use (-0.7, 2.0, -0.3)
.
精彩评论