Additive Blending - how?

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
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

Additive Blending - how?

Post by jack_1313 »

How does one use additive blending (as opposed to standard alpha blending)? I hear that DirectX calls can be made through the ‘driver’ – but while setting the render state appropriately would work perfectly when drawing additional primitives into the scene, the majority of objects (such as meshes, billboards etc) are rendered with a single call to drawAll(). Can I set a material to use additive blending?
WarZone - A 2D Action Wargame
http://warzone2d.zapto.org
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

Post by jack_1313 »

Several days and no replies to such a straightforward question?
WarZone - A 2D Action Wargame
http://warzone2d.zapto.org
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, maybe EMT_TRANSPARENT_ADD_COLOR is what you need? If not, simply add your own material to the driver. :)
tstuefe
Posts: 40
Joined: Wed Jan 07, 2004 12:53 pm
Location: Heidelberg, Germany
Contact:

Post by tstuefe »

You probably will have to code it via plain DirectX APIs.

For DirectX 9, set the following Render States (with IDirect3DDevice9::SetRenderState):

D3DRS_SRCBLEND=D3DBLEND_ONE
D3DRS_DESTBLEND=D3DBLEND_ONE
D3DRS_ALPHABLENDENABLE=TRUE

Should result in additive Blending.

DX8.1 should be similar. See the DirectX Documentation.

No clue how to do this with OpenGL, can anyone fill in?
Post Reply