Roger James wrote:

If there is a texture present, then if transparency * transparent yields an opaque value (transparency.a * transparent == 1 in A_ONE mode) the we use source alpha as the blending constant. If transparent * transparency yields a transparent value then we put that value into the blenders constant colour alpha and use that as the bending constant.

If there is no texture present then if transparency * transparent * mat.a yields an opaque value we do not turn the blender on. Otherwise we should put transparency * transparent * mat.a into the blenders constant colour alpha and use that as the bending constant.

This effectively modifies the equations as follows (I think!)
factor = transparent.a * transparency * mat.a
fb.r = fb.r * (1.0f - factor ) + mat.r * factor
fb.g = fb.g * (1.0f - factor ) + mat.g * factor
fb.b = fb.b * (1.0f - factor ) + mat.b * factor
fb.a = fb.a * (1.0f - factor) + mat.a * factor

Sorry, I got the equations wrong/unclear as usual. They should be:-

1. Texture present and transparent.a * transparency opaque
fb.r = fb.r * (1.0f - mat.a ) + mat.r * mat.a
fb.g = fb.g * (1.0f - mat.a) + mat.g * mat.a
fb.b = fb.b * (1.0f - mat.a) + mat.b * mat.a
fb.a = fb.a * (1.0f - mat.a) + mat.a * mat.a

2. Texture present and transparent.a * transparency not opaque
factor = transparent.a * transparency
fb.r = fb.r * (1.0f - factor ) + mat.r * factor
fb.g = fb.g * (1.0f - factor ) + mat.g * factor
fb.b = fb.b * (1.0f - factor ) + mat.b * factor
fb.a = fb.a * (1.0f - factor) + mat.a * factor

3. No texture and transparency * transparent * mat.a not opaque
factor = transparent.a * transparency * mat.a
fb.r = fb.r * (1.0f - factor ) + mat.r * factor
fb.g = fb.g * (1.0f - factor ) + mat.g * factor
fb.b = fb.b * (1.0f - factor ) + mat.b * factor
fb.a = fb.a * (1.0f - factor) + mat.a * factor

On looking at equation 3 it would probably need to be partially implemented in a shader as mat.a is the result of the lighting calculation. But then I am not sure how you would turn the blender off! So it is probably better use the the diffuse alpha instead of mat.a, or maybe ignore mat.a altogether. Comments anyone?

Roger

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to