Jason Daly wrote:
Smeenk, R.J.M. (Roland) wrote:
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.

What you say makes sense, but I've never seen it done this way in any of the files I've used or created via COLLADA plugins.  I think we need to support the "RGBA texture in diffuse channel only" model, just because so many files and tools work that way.  This isn't ideal, but it's probably necessary.


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.

It clearly doesn't map to FFP, but it's as close as COLLADA comes.  The biggest problem with handling profile_COMMON with shaders is that it makes it hard for an OSG developer to use his/her own shaders higher up in the scene graph.  I think this is what drives the desire to handle profile_COMMON with FFP.


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.

Well, I believe ARB_texture_env_combine was made a core feature in OpenGL 1.3, so many would consider it FFP.  But I digress...


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?
I don't think that is allowed (the schema says only one color or texture per channel).  That would get out of hand quickly.  I don't think anyone here expects that to work anyway.  We're just talking about a single RGBA texture in the diffuse channel.

Roland,

As Jason says, attempting to map the Collada FX common profile to OpenGL fixed functionality is a design goal rather than an absolute. I apologise that I have used the term "fixed functionality" loosely to refer to both the OpenGL FFP and the abstract fixed functionality referred to in the Collada spec.

"The <profile_COMMON> elements encapsulate all the values and declarations for a platform-independent
fixed-function shader. All platforms are required to support <profile_COMMON>. <profile_COMMON>
effects are designed to be used as the reliable fallback when no other profile is recognized by the current
effects runtime."

If you also take into account Mark Barnes statement in his book..

"profile_COMMON (is) for basic interchange between digital content creation (DCC) tools"

then you can see that Collada's abstract understanding of fixed functionality could be quite different from OpenGL's concrete implementation. For example the "fixed functionality" of a DCC might in fact be a ray tracer implemented in software, in fact it could even be implementeed entirely in programmable OpenGL shaders!

The problems we have been wrestling with stem from the lack of a clear definition of what Collada's abstract "fixed functionality" model is. Your intrepretation of the spec clearly highlights this, and it is very close to the intrepretation I have been trying to map into a concrete OpenGL implementation (and trying to obey our design goals whilst doing this).  Correct me if I am wrong but I believe your interpretation  is  that the diffuse, ambient etc. terms of a particular technique define the source of a colour term (either a texture map or a fixed value) that is used as input to the lighting equation of that technique. The result of this equation is the colour of the material (it is probably easier to think of this as a fragment colour in OpenGL terms). Collada defines colour as a RGBA value. So this intrepration would seem to imply that the alpha component of, for example, the diffuse element should be passed through the lighting equation and contribute to the alpha component of the result, and I think this is the only point where we differ.

The main problem this model gives us is that when we try and map this interpretation to OpenGL, whether or not we use OpenGL fixed or programmable functionality, is that the OpenGL pipeline assumes that the lighting equation has been applied prior to the application of any textures. Applying textures before lighting may not have been what the Collada designers intended, who knows, because the model is not documented.

Regarding the use of the transparent element, because the Collada designers come from a DCC background I have assumed that the transparent colour or texture would be handled in a similar way to that which it is in a DCC tool such as Maya. That is the the transparent colour is used soley to provide a single component greyscale (alpha) transparency map which is applied to the material in some way (usually as a way of decalling in a diffuse texture in the top layer of a multi layer material). Because I have not been able to determine what this "way" is I have left it as unimplemented for the time being. Should we use it to replace the materials alpha after the lighting computation, or before it, should we blend it . I do not know, and would like further input from anyone on this.

Sorry for this long winded rant, but I wanted to provide as much background information as I could for further discussion.

Roger


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

Reply via email to