I have been trying to import animated charater meshes to OSG via osgCal. I can add example cal3D animated meshes and call their animations in my application.
However there is a possible problem regarding (probably) lighting. The surfaces that are exposed to my (directional) light are pure white as you can see on the screenshot. I already tried to use GL_NORMALIZE or
GL_RESCALE_NORMAL that i saw on this topic :
viewtopic.php?t=3402
, but it didnt work. I also used Cal3D converter to convert binary mesh files to xml, and checked their normals. they all seem ok and their magnitude seems to be 1, as expected for a Normal vector.
I will appreciate any hints to solve my issue.
Thanks in advance.
Arif
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33720#33720
Attachments:
http://forum.openscenegraph.org//files/cal3d_3dsmax_exported_animated_mesh_possible_overlit_problem_867.png
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
On 11/12/2010 05:01 PM, Arif Yetkin Sarı wrote:
> Hello guys,
>
> I have been trying to import animated charater meshes to OSG via osgCal. I can add example cal3D animated meshes and call their animations in my application.
> However there is a possible problem regarding (probably) lighting. The surfaces that are exposed to my (directional) light are pure white as you can see on the screenshot. I already tried to use GL_NORMALIZE or
> GL_RESCALE_NORMAL that i saw on this topic :
> viewtopic.php?t=3402
> , but it didnt work. I also used Cal3D converter to convert binary mesh files to xml, and checked their normals. they all seem ok and their magnitude seems to be 1, as expected for a Normal vector.
>
> I will appreciate any hints to solve my issue.
>
> Thanks in advance.
>
> Arif
Hum, light source too strong/close?
If the models shows OK in the viewer that comes with osgCal then it has
nothing to do with Cal3D/osgCal.
Regards,
Jan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org/
iD8DBQFM4DvEn11XseNj94gRAqKnAKDedb9ax/uAU6suL9IQ3TqLBItEJQCeLElo
omt0iw2jQoCeOtK+0M508Wc=
=AipD
-----END PGP SIGNATURE-----
First of all thanks for the advices.
The models look ok in cal3D openGL based viewers.
Though I couldn't setup independent cal3d properly and run its viewer. (I work on a simulation project, which uses osgCal to load animated meshes, thats where i code, and see the bug mentioned in this topic)
Also I checked if specular exponent is used anywhere. it is a part of osgFX::SpecularHighlights , and it is not used in my project.
But i did manage to overcome the problem by setting my light
mSun = new osg::LightSource;
mSun->getLight()->setLightNum(0);
to
mSun = new osg::LightSource;
mSun->getLight()->setLightNum(1);
I am curious and have a few questions :
(I am new to OSG, and maintaining someone else's project, so sorry for the noob questions :)
Why light slot 0 is problematic ?
When i completely delete my light, i still get visual (not complete darkness in the scene). So it means i have another light source ? Probably my sun and the other light is both assigned as light0, so this may be the cause of the overlit problem ?
I dont have any lights other then mSun, but i see that in the code osgEphemeris is used. It has internal moon and sun light, so they are probably overlapping with my manual sun light ?
And also, i heard that Silverlining can illuminate your scene like osgEphemeris, if so, it has also internal lights too ? How can i understand which light slots ephemeris and silverlining is using ?
Did I understand the light slot concept correct ? : U can use 8 lights, and u need to assign them properly to make it work as expected ?
Thank you for your patience.
Arif
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33927#33927
I think that the light 0 is used as a skylight/headlight attached to
the camera. So if you want to use that light, you have to turn the
default light off.
> I dont have any lights other then mSun, but i see that in the code osgEphemeris is used. It has internal moon and sun light, so they are probably overlapping with my manual sun light ?
No idea what that nodekit does - they may well define their own lights.
>
> And also, i heard that Silverlining can illuminate your scene like osgEphemeris, if so, it has also internal lights too ? How can i understand which light slots ephemeris and silverlining is using ?
What do you mean by "Silverlining"?
> Did I understand the light slot concept correct ? : U can use 8 lights, and u need to assign them properly to make it work as expected ?
OpenGL defines up to 8 user definable lights. Unless you set
something up yourself, you get only the default skylight/headlight
created by OSG, nothing else. In plain OpenGL you would have no lights
at all (ergo totally dark scene). So you need to define your own
lighting rig if you want the scene to be lit.
Regards,
Jan
For those that need/will need help in a similar situation, (as far as I can tell) osgUtil::SmoothingVisitor added to osgCal models solved the overlit problem. (And a little bit material adjustment for the mesh made it lit at a normal level)
Arif
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33967#33967