[osg-users] Absolutely dark scene

Fernan osgforum at tevs.eu
Tue Mar 17 09:04:31 PDT 2009


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








More information about the osg-users mailing list