A Cunning Plan
As stated, additive blending is not natively supported in SW3D, but due to a bug, feature, exploit (whatever you'd like to call it) a perfect workaround is available. What's more as will soon be seen its reliable enough be used in projects!
The concept behind the additive blending process and why its so useful, l is that the texture contents are blended/combined directly with the current state of the color/render buffer.Much like alpha channel textures, but with one major difference, instead of blending the source and destination it adds the two values together, clamped within rgb range. Although additive blending is available within a shader between its layers, it is not natively supported between the shader and color buffer.
The big discovery was that if you could force SW3D to draw a mesh in two separate passes from within a single shader the desired process was achievable. However initial tests proved inconclusive for a variety of reasons such as a cards max number of textureunits (multi-texturing), which API was being used, etc. These factors have now been fully determined through the use of the Additive Blending Test Demo and the dedication of the Director community.
The methodology to achieve additive blending is quite simple and works across the board on all cards and API's.. Within a single shader, populate layers up to and including the number of textureunits supported by the card or API with fill textures. These will all be rendered with a single pass due to the multi-texturing capabilities of the 3D card. Then the layer immediately after (textureunits+1) must contain the additive texture, with the layer blend set to #add. This layer exceeds the multi-texturing capability of the card/api, so it is forced to be drawn in a separate pass that unlike the first pass can combine itself with the current color buffer.
However whilst the method is simple, the differences between cards and API's meant that it has to be tailored to the users specific hardware/software. In order to determine the settings I produced the Additive Blending Test Demo.
All material including text, images, source, results
and demos are copyright Noisecrime Productions @ 1996-2003 Noisecrime Productions |