math behind texture blending mode "overlay"

… I hope I’m not completely wrong putting my question here :wink:

We are working on a cg shader for a game engine, and want to implement detail textures.

The texture blending mode “overlay” gives very nice results for our models in blender, so we thought it would be interesting to try this approach for our in-game shader, too.

For this we need to know the exact math behind texture blending mode “overlay” in blender.
If I’m not mistaken the blender manual does not specify the exact operation performed.

Can anyone help us?

Thanks very much!

I have no idea… but blender is open source so if someone on your team is competent enough, check the source code.

the overlay blend mode is not specific to blender… if you search on google or ask on the openGL GLSL forum they could probably tell you there. There is a GLSL book that has the maths for all the blending modes.

thanks very much!

although we did find something, not yet perfect.
sure I’ll post useful search results here.

altogether, any hint from your side still appreciated :slight_smile:

I found this:

-E is the resulting pixel
-I is the pixel underneath the M pixel.

There a few more formulas on that page so if that one doesn’t work try another.

wow, thanky very much! we’ll do some testing now :slight_smile: