Jason Daly wrote:
Roger James wrote:I think I will just assume that if a translucent texture is present in the ambient channel that it contains an ambient map and blend it in as texture unit 1 (0 is used for diffuse). According to both the spec and Mark's book the common profile of Collada FX is supposed to represent an abstraction for a "platform independent fixed-function shader". However in the abscence of any significant definition of what this abstract shader/pipeline actually is, the specification appears to suggest that texture values are used as input to the lighting process (blinn, lambert,etc.). Obviously this is not the way OpenGL works. I am not sure that this is what was intended :-). It is the source of much of the confusion (well mine at least!). Yes, some more opaque values have been added. There is a misprint in the spec on all of them that suggests that the default value has changed. I have been told that this is not the case, and the schema document should be taken as authorative on this. In my code, (which is probably technically wrong, but seems to work most of the time) I check the opaque setting on the transparent color. If it's A_ONE, I use the transparency value as the alpha on the material (the OpenGL material, that is). If it's RGB_ZERO, and transparency is specified as a color, I average the transparency color's RGB values and set the material's alpha to 1 minus the average (this is probably a best-effort kind of hack). If transparency is a texture (an alpha map), I ignore it, since it's not possible to support in fixed-function (at least I don't think it is).That sounds like a reasonable approach. However, I have thought some more about the approach I was suggesting and have modified it slightly. I think I will try that and if it gives too many problems fall back to your approach. I will attempt to pseudo code my latest thinking: 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. For anyone else reading this. Just a reminder that we are talking about transparent and transparency within the confines of the common profile which does not allow multiple techniques in an effect. I suspect that in profiles that do allow multiple techniques there are many more issues, the decalling of materials and textures being just one I can think of. Roger |
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

