PDA

View Full Version : mod2x blend mode?



Leadwerks
10-29-2007, 04:09 PM
For overlays like bullet marks and details placed by the artist, it is good to have a blend mode whereby anything darker than (128,128,128) darkens the fragment, and anything brighter than (128,128,128) lightens it. The equation would be this:

color1 * color2 * 2

Though I am a huge OpenGL fan, this is one thing I must admit is nice about DirectX. Is there any way to perform this type of blending in OpenGL by using one of the blend extensions? I can duplicate the lighting of the underlying surface and draw it in the second pass, but it would be so much easier if a simple mod2x blend were available.

Jan
10-29-2007, 04:32 PM
Isn't that the same as:

color1 * color2 + color1 * color2

which would then be:

glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);

Jan.

Leadwerks
10-29-2007, 04:33 PM
Yeah, I just found it:
http://www.opengl.org/discussion_boards/...=true#Post79745 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Board=2&Number=79745&Searchpage=1&Main=19873&Words=modulate2x&topic=0&Search=true#Post79745)

Thanks, it seems to work.