Hello Roger,
I did not make a study of the Collada transparency intricacies like you
did. The assumption I made was that a texture for diffuse specifies the
diffuse components to use in the texture. The fact that texture
coincidently was packed with an alpha channel (which of course happens a
lot) should not influence that.
When you consider the chain <texture><sampler><surface><image> the
responsibilities are clearly dividided. It could be possible that
somebody decides to pack an ambient occlusion or specular value in the
alpha channel of an image. The semantics of the data source should be
specified by the texture elements in ambient, diffuse, specular, etc.
That's why I added code to only enable blending if a texture was
specified in the transparant element.
I've been very suprised to see suggested everywhere that the common
profile maps to the fixed function pipeline, but this easily falls short
if you need to support both blinn and phong. Well OpenGL FFP does not
even support phong shading. Gouraud is the closest we get with per
vertex lighting. I don't know how to map textures specified for both
ambient, diffuse, specular etc. to the Ogl FFP. Texture combiners might
bring us a little closer, but I hardly consider this the FFP. Besides
what happens if the surface contains a channels specification other that
rgb or rgba? It gets even worse if it is allowed to compose 3 channel
input for a diffuse texture combining components of three different
source images. I am not sure if this is allowed in the profile_COMMON.
Though very flexible, who is going to support this?
kind regards,
Roland
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger
James
Sent: donderdag 11 december 2008 20:37
To: OpenSceneGraph Users
Subject: Re: [osg-users] The Collada plugin and transparency
Jason Daly wrote:
Roger James wrote:
if (transparent or transparency element present
in the technique)
{
// Turn on the OpenGL blender
Calculate a blending factor using
transparent and transparency according to the "opaque" mode in force.
// Decide whether to use GL_SRC_XXX or
GL_CONSTANT _XXX in the OpenGL blender
if (the calculated factor would mean opacity
when applied)
Use the relevant blend factor from the
incoming lit and textured fragment
else
Use the previously calculated blending
factor as a constant blend factor
}
I would appreciate any comments you have, time
permitting of course.
The only thing that worries me about this is that you're
using the <transparent>/<transparency> tags to decide when to enable
blending. I'd suggest you add one more check to see if your calculated
blending factor results in the surface being fully opaque before you
enable blending. I say this because I've made a lot of use of the
ColladaMAX plugin from Feeling Software, and every single model I've
exported with that plugin has transparent/transparency set on all of its
materials, even if they're actually fully opaque.
The problem I have is deciding if the surface is going to end up
fully opaque when there is a texture in the diffuse channel supplying
the incoming fragments alpha component. The best I can come up with is
this, but it is messy and does not take it account any modification of
the incoming frgaments alpha component by the application of the
lighting equation.
if (transparent or transparency element present in the
technique)
{
Calculate a blending factor using transparent and
transparency according to the "opaque" mode in force.
// Decide whether to use GL_SRC_XXX or GL_CONSTANT _XXX in
the OpenGL blender
if (the calculated factor would mean opacity when applied)
{
if (there is a translucent texture in the diffuse
channel)
{
Use the relevant blend factor from the incoming lit
and textured fragment
Turn on the OpenGL blender
}
else if (the calculated factor along with the alpha from
the constant diffuse colour woud result in a translucent colour)
{
Use the relevant blend factor from the incoming lit
and textured fragment
Turn on the OpenGL blender
}
}
else
{
Use the previously calculated blending factor as a
constant blend factor
Turn on the OpenGL blender
}
}
I cannot believe that a profile that is meant to represent fixed
functionality ends up this messy. It just highlights the _opacity_ of
the spec in this area :-)
Roger
This e-mail and its contents are subject to the DISCLAIMER at
http://www.tno.nl/disclaimer/email.html
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org