[osg-users] osgCal animated mesh, possible overlit problem

9 views
Skip to first unread message

Arif Yetkin Sarı

unread,
Nov 12, 2010, 11:01:11 AM11/12/10
to osg-...@lists.openscenegraph.org
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

------------------
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

Thomas Hogarth

unread,
Nov 13, 2010, 1:55:06 PM11/13/10
to osg-...@lists.openscenegraph.org
Hi Arif

Your secular exponent / shine value is probably 0.0 that's usually the cause of lighting like that

Cheers
Tom

Jan Ciger

unread,
Nov 14, 2010, 2:43:02 PM11/14/10
to osg-...@lists.openscenegraph.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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-----

Arif Yetkin Sarı

unread,
Nov 22, 2010, 9:55:37 AM11/22/10
to osg-...@lists.openscenegraph.org
Hello again.

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

Jan Ciger

unread,
Nov 22, 2010, 12:18:06 PM11/22/10
to osg-...@lists.openscenegraph.org
2010/11/22 Arif Yetkin Sarı <arify...@gmail.com>:
> Hello again.
>
...

> 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 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

Trajce (Nick) Nikolov

unread,
Nov 22, 2010, 1:26:26 PM11/22/10
to OpenSceneGraph Users
@Jan - Silverlining is the toolkit for ephemeris used in this project (www.sundog-soft.com)

I have sent Arif fix

-Nick

Arif Yetkin Sarı

unread,
Nov 23, 2010, 2:50:02 AM11/23/10
to osg-...@lists.openscenegraph.org
Hi, ty for the fix Nick.

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

Trajce (Nick) Nikolov

unread,
Nov 23, 2010, 4:32:52 AM11/23/10
to osg-...@lists.openscenegraph.org
no that ..... I forced the rendering on the software (so it is not a fix, but a work around) . This cal3d seams to not be supported anymore. I advice FBX instead ...

-Nick


2010/11/23 Arif Yetkin Sarı <arify...@gmail.com>
Reply all
Reply to author
Forward
0 new messages