[osg-users] Absolutely dark scene
Hi, first of all a greeting to everyone, because I'm new around here. I am developing an application that need to be done at night and become completely dark scene, but I can not. I do not know how to remove the whole lighting of the scene, it is made at night, but there is always some light. How can I create a totally dark scene? Thanks a lot. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8593#8593 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolutely dark scene
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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolutely dark scene
Hi Robert, Thank you for your help. I've achieved my purpose. Following your instructions I realized that my problems were two: 1) On the one hand, the scene by default sets the AmbientIntensity as follows: osg::LightModel* lightmodel = new osg::LightModel; lightmodel-setAmbientIntensity(osg::Vec4(0.1f,0.1f,0.1f,1.0f)); _globalStateSet-setAttributeAndModes(lightmodel, osg::StateAttribute::ON); And due this the scene was always a little light. Then I set this value to zero in my application after create the scene: osg::LightModel* lightmodel = new osg::LightModel; lightmodel-setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); _globalStateSet-setAttributeAndModes(lightmodel, osg::StateAttribute::ON); And I got all the elements of the scene appear dark unless sea. 2) On the other, I realized that I was applying to the sea surface an OSG::Material with Emission value set to nonzero. Once I set the zero value to this parameter, all to be completely dark in my scene. -- I leave here my solution in order to it can help someone with same problem. Thanks a lot again for your help. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8627#8627 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org