9
\$\begingroup\$

We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online.

For anyone interested, here they are:

  • Multiply = GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA
  • Screen = GL_MINUS_DST_COLOR, GL_ONE
  • Linear Dodge = GL_ONE, GL_ONE

You can try these and other such modes in action online, at this very useful website: http://www.andersriggelsen.dk/glblendfunc.php

Now, we would appreciate it if anyone could provide us with additional blending modes that we can recreate inside Cocos2D, since our Open GL experience is really, really limited.

Thank you in advance!

Argiris

\$\endgroup\$
  • 1
    \$\begingroup\$ Linear Dodge (Add) = GL_ONE, GL_ONE does this behave for you the same as at andersriggelsen.dk/glblendfunc.php and photoshop? it makes sprites transparent? not working for me \$\endgroup\$ – Rakka Rage Feb 16 '12 at 16:56
4
+100
\$\begingroup\$

Bad news is that you can't implement all of photoshop's blend modes with glBlendFunc, even though there are a bazillion of combinations that you can use.

Good news is, when you move to shaders, the orange book (OpenGL Shading Language, http://www.amazon.com/exec/obidos/ASIN/0321637631/khongrou-20 ) contains a chapter with shaders to emulate the photoshop's blend modes.

Luckily all you'll probably ever need in pre-shader world are the three most common blend modes;

  • Add: GL_ONE, GL_ONE
  • Blend: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
  • Multiply: various, such as the one you mentioned: GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA

EDIT:

Related (almost duplicate) question on stackoverflow: https://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders

Photoshop blending shaders: http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.