Hi Fernan, You are probably best to go look at OpenGL docs on lighting, as the OSG just sets up the various OpenGL state relating to lighting and the drivers/hardware do the rest. In your case you'll need to look a the ambient light levels of the Light source and the objects in the scene, also attach an osg::LightModel state attribute to provide additional controls over the lighitng model.
For lights on the boats you'll need to use emmisive light values on the materials associated with the light geometry, or just disable lighting for them and set their colour directly using per vertex lighting. Robert. On Tue, Mar 17, 2009 at 11:27 AM, Fernan <[email protected]> wrote: > Hi Robert, > > thanks for reply. > > I initialize my system as follows: > > -------------- > > // construct the viewer. > osgViewer::Viewer viewer; > viewer.setLightingMode (osg::View::HEADLIGHT); > > // Configura el visor para aparecer en una ventana > viewer.setUpViewInWindow (100, 100, 800, 600, 0); > > // Pone el manejador de eventos de ratón (se hace por defecto dentro del > run() del viewer, pero > // aquí es necesario crearlo antes para poder ponerle la posición por > defecto de la cámara > viewer.setCameraManipulator(new osgGA::TrackballManipulator()); > > // Pone la posición por defecto de la cámara > osgGA::MatrixManipulator* pCameraManip = viewer.getCameraManipulator(); > if (pCameraManip != NULL) > { > pCameraManip->setHomePosition (osg::Vec3 (0.0, -600.0, 8.0), osg::Vec3 > (0.0, 0.0, 8.0), osg::Vec3 (0.0, 0.0, 1.0)); > } > > // create a model from the images. > osg::Group* pRoot = new osg::Group(); > > // Create a new light, and set the light number according to our > parameter. > osg::Light* pLight = new osg::Light(); > pLight->setLightNum (0); > pLight->setAmbient (osg::Vec4d (0.0, 0.0, 0.0, 1.0)); > pLight->setDiffuse (osg::Vec4d (0.0, 0.0, 0.0, 1.0)); > pLight->setSpecular (osg::Vec4d (0.0, 0.0, 0.0, 1.0)); > osg::LightSource* pLightsource = new osg::LightSource(); > pLightsource->setLight (pLight); > pLightsource->setStateSetModes (*pRoot->getOrCreateStateSet(), > osg::StateAttribute::ON); > pRoot->addChild (pLightsource); > > ---------------- > > > With this, the scene get a little dark, but it is not totally black. > There is always a little light, so objects that I add to the scene can be > seen. > > These objects are ships and what I want is to see their lights and not > ships due to it is night. > > Would that be possible? > > Thanks. > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=8605#8605 > > > > > > _______________________________________________ > 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

