I was able to create a fragment shader to convert a color image 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)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With