I have looked at bit harder at the code now and I now realise that I
only partially fixed Sketchup's broken Collada stuff.
Sketchup is putting the texture image sampler reference into the
Collada <diffuse> parameter and sets the <transparent>
parameter to a fixed opaque white colour. The plugin assumes assumes
that when tranparency processing is active (the spec says this is when
either <transparent> or <transparency> is present) the
colour information should come from the <transparent> parameter
which is either a fixed colour or a texture sampler. So as things are
as the moment the plugin will not use ONE_MINUS_SRC_ALPHA as the blend
function unless <transparent> is a image sampler rather than a
fixed colour.
As far as I can see this is a grey area in the Collada spec. I think
our current interpretation is reasonable as I cannot see another way to
distinguish between from the Collada document when to use
ONE_MINUS_CONSTANT_ALPHA and ONE_MINUS_SRC_ALPHA as the OpenGL blend
function. Any one got any thoughts on this?
Sketchup and Google Earth are two of the biggest users of Collada, so
sheer weight of numbers makes it difficult to argue against their
interpretation of the spec. If only we really knew what it was!
I asked a similar question when I originally submitted the changes a
year go and got no replies. So once again. Does anyone have any further
information about how this should be interpreted? Also any information
on how the major players intepret it would be useful!
Roger
Roger James wrote:
Alessandro,
I put the GoogleMode flag into the dae writer in December 2007 after
examing the dae files ouput by Sketchup at that time. Here is the
comment from the SVN log.
8. User can supply an experimental GoogleMode option on output. The
plugin
will try to emulate the way Sketchup specifies transparency (i.e. the
inverse of what it should be!). I am still struggling to get GE to
understand transparency, anyone know what it expects?
Sketchup at that time wrote dae files that did not conform to the
Collada specification. It may or may not still do so, I have not
checked recently. At around the same time I put a check into the dae
reader code to set a flag if the authoring tool field in the collada
header contained the words "Google Sketchup". Have a look at
daeRMaterials.cpp and search for m_AuthoringTool and you will see how
the current reader handles transparency settings it thinks come from
Sketchup. Looking at your osg file below it looks like whatever the the
transparency value was in the incoming dae file the material is
actually being treated as opaque (transparency * constant colour alpha
> 0.99) and not put in the transparent bin. This may not be correct
behaviour any more.
Roger
aalessandro terenzi wrote:
I'm experiencing some problem with collada models and
transparency texture maps. I saw that in May someone had the same
problem but finally I couldn't find a solution. I tried with osg2.2.0
and 2.6.0 and it looks like that transparency doesn't work with collada
models and png texture maps.
I checked Robert's suggestion and converted to .osg to check
if
GL_BLEND function was enabled or not and it looks like it is... here
follow a piece of the converted .osg file.
Geode {
name "material10"
nodeMask 0xffffffff
cullingActive TRUE
StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE OFF
GL_BLEND ON
Material {
ColorMode OFF
ambientColor 0 0 0 1
diffuseColor 0.8 0.8 0.8 1
specularColor 0.33 0.33 0.33 1
emissionColor 0 0 0 1
shininess 20
}
BlendFunc {
source CONSTANT_ALPHA
destination ONE_MINUS_CONSTANT_ALPHA
}
BlendColor {
constantColor 1 1 1 1
}
textureUnit 0 {
GL_TEXTURE_2D ON
Texture2D {
file "images/texture9.png"
wrap_s REPEAT
wrap_t REPEAT
wrap_r CLAMP
min_filter NEAREST_MIPMAP_LINEAR
mag_filter LINEAR
maxAnisotropy 1
borderColor 0 0 0 0
borderWidth 0
useHardwareMipMapGeneration TRUE
unRefImageDataAfterApply TRUE
internalFormatMode USE_IMAGE_DATA_FORMAT
resizeNonPowerOfTwo TRUE
}
}
}
[...gemoterty data follow here...]
Is there something wrong with this file?
Someone talked about a problem in Sketchup with png files,
actually the models I'm dealing with come from Sketchup...is there
really a problem with Sketchup? Someone talked about a 'GoogleMode' in
the collada plugin but it looks like it is an option used for writing
collada files not for reading.
Thank you for any advice or direction.
Alessandro
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
|
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org