I would like to say thanks to Malachy Duffin and Simeon Rice 'Noisecrime' for their research and contribution on Additive Blending for Shockwave.
This work is inspired on their work, althought completly different method is used and thanks to Ullala for her wonderfull 3DPI tool.
Also thanks to all the developers on dir3d-l and direct-l who contributed to test this:
( Alexx, Adam Kane, Alex da Franca, Antonio Quixadá, Barry Swan, Ben Pitt, Berndt Garbotz, CC, Christophe Leske, Geoffrey Hoffman, Johan Verhoeven, Lucas Meijer, Lutz Westermann, Malachy Duffin, Mark Hagers, Michael Kelly, Mike Osecky, Noisecrime, Nova Nova, Paul Schwarz, Petter Sundnes, Pieter Albers and Starvanger Sly).
Important
The methods proposed here are not documented by Adobe nor Macromedia, so it may or may not work in all video cards.
Shaders Setup
There is no need to test the users pc or mac configuration in order to achieve the additive or subtractive blending. It is just a shader setup that seems to works in both #OpenGL and #DirectX_7.0 render modes.
___________________________________________________________________________________________________________________
It has been confirmed by some developers that this shaders are not working in #DirectX_5.2 mode in some video cards.
Notice it also may won't work in upcoming #DirectX9 render mode that will be shipped with Director 11.
___________________________________________________________________________________________________________________
Additive Blending
theShader.transparent = 1
theShader.blend = 0.0
theShader.texture = ANY TEXTURE HERE
theShader.textureList[2] = ANY TEXTURE HERE
theShader.textureList[3] = ADDITIVE TEXTURE HERE
theShader.blendFunctionList[1] = #blend
theShader.blendConstantList[1] = 0.0
theShader.blendFunctionList[2] = #blend
theShader.blendConstantList[2] = 0.0
theShader.blendFunctionList[3] = #add
I also like to set the colors to black and shininess to 0 to be sure they do not influence the shader.
theShader.ambient = color( 0, 0, 0 )
theShader.diffuse = color( 0, 0, 0 )
theShader.specular = color( 0, 0, 0 )
theShader.shininess = 0.0
If you only plan to use #OpenGL you can just set 2 textures instead of 3.
theShader.transparent = 1
theShader.blend = 0.0
theShader.texture = ANY TEXTURE HERE
theShader.textureList[2] = ADDITIVE TEXTURE HERE
theShader.blendFunctionList[1] = #blend
theShader.blendConstantList[1] = 0.0
theShader.blendFunctionList[2] = #add
Subtractive Blending
For the Subtractive blending the only parameter that needs to be changed is the last texture blend mode to #multiply.
theShader.blendFunctionList[3] = #multiply
Have fun and hope to see some impressive game effects soon.
Other Demos and Tutorials
Little additive demo
Amazing "FireJet" effect using additive and subtractive shaders created by CC.
Jorge Rodríguez
jorge [at] isointeractive.com
Created
Last update |
| 11.08.07
| 11.15.07 |
|