Hi again,
I took a quick look at the obj plugin in OSG and I think it is actually
parsing the file correctly. The mtl-file has both d an Tr defined. Both
Tr and d in the material file control the transparency of the material.
In the ford.mtl file it has d=1.0 and Tr=0.0 so the file is actually
specifying that the material should be fully opaque at the same time as
it is specifying that the material should be fully transparent. The
mtl-specification found here:
http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html
<http://people.sc.fsu.edu/%7Ejburkardt/data/mtl/mtl.html> has the
following description of the d an Tr fields:
*d*/alpha/
defines the transparency of the material to be alpha. The default is
1.0 (not transparent at all) Some formats use*Tr*instead of*d*;
*Tr*/alpha/
defines the transparency of the material to be alpha. The default is
1.0 (not transparent at all). Some formats use*d*instead of*Tr*;
So it is not specified which has precedence over the other and since in
the ford.mtl file the Tr field is after the d field in the file the obj
plugin reads the Tr field last and thus sets the alpha to 0.
The original specification that is referenced from the obj plugin
(http://local.wasp.uwa.edu.au/~pbourke/dataformats/mtl/) does not
mention the Tr field so I don't know where that comes from, but
apparently it is used in the mtl-files. I'm not sure how to best handle
a situation where both Tr and d are present.
Regards,
Per
On 06/28/2011 09:35 PM, Per Fahlberg wrote:
Hi Alexey,
The model is invisible since it has a material that has alpha set to
0. If you look in the ford.osg file all the material colors has alpha
set to 0. When I look at the ford.mtl file I notice that the alpha
component is missing for all colors and my guess would be that the obj
plugin somehow defaults to alpha 0 when the alpha component is missing.
Regards,
Per
On 06/28/2011 03:44 PM, Alexey Chernov wrote:
Hi,
I suffer strange problem loading obj file in OpenSceneGraph (tried
versions from 2.8.3 to 3.0 RC2). osgviewer starts successfully,
prints nothing to console but don't show the model, only background
is painted.
If I load the file in my code using
Code:
osg::Node* model = osgDB::readNodeFile(location);
the app just freezes and is unable to load the model, too. I tried
many different *.obj files without any success, one of them is
attached (it's sample from 3DSMax converted to *.obj). It can be
loaded successfully in Blender and 3DSMax.
Did someone face the same problem? I have really no idea what it can
be. So any help would be highly appreciated.
Thank you!
Cheers,
Alexey
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=40988#40988
Attachments:
http://forum.openscenegraph.org//files/ford_model_151.zip
_______________________________________________
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