OSG handles positional state (lights and clip planes) by transforming their positions first, at the start of the draw traversal. Any parts of your scene graph with lighting/clip planes enabled will use the transformed positional state.
The Quick Start Guide discusses lighting and provides a simple example, if that helps. http://www.openscenegraph.com/osgwiki/pmwiki.php/Documentation/QuickStartGui de Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com 303 859 9466 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Lionel Lagarde > Sent: Tuesday, April 24, 2007 7:17 AM > To: osg users > Subject: Re: [osg-users] light and lightsource > > Hi Robert, > > So, osg::LightSource nodes are used to register lights (with > their transformation matrix). To make a light lit only a > piece of the scene graph, the corresponding state attributes > have to be activated in this sub graph (with > setStateSetModes) and deactivated in the others nodes. > > Am I right ? Just be sure to do the right things. > > > Robert Osfield wrote: > > Hi Lionel, > > > > Lights are positional state so need to applied with a specific > > modelview matrix, rather than at any time during the draw traversal. > > Positional state requires a special node to allow the cull > traversal > > to capture the appropriate modelview matrix, in this case its the > > osg::LightSource node - it role is to position the light, > but not to > > switch it on/off. To switch on/off a light you need to enable the > > GL_LIGHTi mode for the subgraph you wish to illuminate. > > > > To handle more than 8 lights then you start moving beyond > what OpenGL > > and OSG support natively. You can do it with the OSG, but > you have to > > segment your scene into rendering stages, where each > rendering stage > > has at most 8 OpenGL lights active. Its possible to create these > > stages but its rather awkard, not a topic for a short support email. > > > > Robert. > > > > On 4/24/07, Lionel Lagarde <[EMAIL PROTECTED]> wrote: > >> Hi all, > >> > >> I'm trying to understand how OSG handles lighting. > >> > >> Which nodes are affected by an osg::LightSource ? > >> > >> It seems that the sibling nodes and the children will be > lit. But I > >> don't see the function "removePositionalAttribute" in the > cullvisitor. > >> > >> If osg::LightSource nodes are only used to register > lights, how can I > >> setup more than 8 lights ? > >> > >> > >> > >> > >> _______________________________________________ > >> osg-users mailing list > >> [email protected] > >> http://openscenegraph.net/mailman/listinfo/osg-users > >> http://www.openscenegraph.org/ > >> > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
