[osg-users] Unwanted light source when importing 3DS file.

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Thu Apr 28 13:41:19 PDT 2016


Hi Greger
> Hello!
>
> I am currently working extra on a project for uni where I render the scene using 9 different cameras. This is in order to show the scene on a 3D monitor, similar to the Nintendo 3DS.
>
> I have received the scene in a .3ds format. However when I import this in osg there seem to be a light source attached somewhere in the node structure. If I move the 3ds loaded mesh away from other meshes the light is gone (that is, it follows the 3ds mesh).
>
> My question is then; How can I remove this light?
>
> I have attempted to use a visitor in order to find any osg::Light or osg::LightSource, as well as trying to find the name of the object I think is the light source. However all these attempts have come up short.
A visitor should do just fine.

See my visitor:

class FindLightsVisitor : public osg::NodeVisitor
{
     public:
     FindLightsVisitor()
:osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
     {
     }

         void apply( osg::LightSource& light_node )
         {
             mFoundLightSources.push_back(&light_node);
             traverse(light_node);
         }


         void unlinkLightSources()
         {
             ..remove from parent(s)
         }

     private:
         std::vector<osg::ref_ptr<osg::LightSource>> mFoundLightSources;
     };
> Is there a default light when importing a .3ds format?
Not to my knowledge. Are you sure the light is not exported by the 
original exporter?
>
>
> I would be very grateful for any help.

Cheers
Sebastian
>
> Best regards,
> Greger
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67014#67014
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list