alpha result after blending in rtt

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
tom_gamer
Posts: 15
Joined: Sat Jun 01, 2013 8:51 am

alpha result after blending in rtt

Post by tom_gamer »

Hello developers,

I have a unwanted effect with blending. Maybe you have any ideas to solve my problem.

I start with a black background and alpha 0.0 (completely transparent). Then I draw a blue rectangle with texture alpha 1.0 (opaque). Finally, I draw a half-transparent red square with texture alpha 0.5, that is partly on the blue rectangle. (Use EMT_TRANSPARENT_ALPHA_CHANNEL)

When I draw into the frame buffer, everything is fine. But when I draw into a real time texture, I have an bad effect of the alpha there.
The black area has alpha 0.0 ==> ok
The blue area has alpha 1.0 ==> ok
The dark red area has alpha 0.5 ==> ok
The violet area has alpha 0.5 ==> not ok!

That’s because the alpha for the whole square is set to 0.5 (source alpha). It’s seems to be not relevant, what the alpha of the destination pixels is.

(Irrlicht 1.8.1, OpenGL, Windows with MinGW and Linux)

I require texture alpha blending. But it should set the new alpha to “MAX(srcAlpha, destAlpha)”. What can I do?

(I “googled” a bit and found the OpenGL function “glBlendFuncSeparate”. This may be the solution for my requirement. How do I use it?)
SpaceCombat
http://sourceforge.net/projects/spacecombatgame
(OpenSource space combat simulation)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: alpha result after blending in rtt

Post by hendu »

Irr does not currently support separate blending for alpha and color.
Post Reply