I need to imitate Photoshop blending modes (“multiply”, “screen” etc.) in my OpenGL ES 1.1 code (without shaders).
There are some docs on how to do this with HLSL:
- http://www.nathanm.com/photoshop-blending-math/ (archive)
I need at least working Screen mode.
Are there any implementations on fixed pipeline I may look at?
Most photoshop blend-modes are based upon the Porter-Duff blendmodes.
These requires that all your images (textures, renderbuffer) are in premultiplied color-space. This is usually done by multiplying all pixel-values with the alpha-value before storing them in a texture. E.g. a full transparent pixel will look like black in non-premultiplied color space. If you’re unfamiliar with this color-space spend an hour or two reading about it on the web. It’s a neat and good concept and required for photoshop-like compositions.
Anyway – once you have your images in that format you can enable SCREEN using:
The full MULTIPLY mode is not possible with the OpenGL|ES pipeline. If you only work with full opaque pixels you can fake it using:
The results for transparent pixels either in your texture and your framebuffer will be wrong though.
Answered By – Nils Pipenbrinck
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0