Is it possible to take the lighting scheme from osgProducer::Viewer and
apply it to my own SceneView? I'm not happy with my current lighting
situation but for my specific purposes I need to roll with my own SceneView
instead of using the viewer. Admittedly, I don't know much if anything about
lighting. Whatever code I have is stuff I grabbed from the examples.

Specifically, I have a light over the top of my terrain but and that lights
it just fine, but my open flight models (tanks, planes, etc.) all show up
brightly and you can't see any contours on the model like you can in
osgProducer::Viewer. I'm guessing it probably has something to do with the
ambient lighting.

     osg::BoundingBox bb;
     bb.expandBy(bs);

     osg::Light* myLight = new osg::Light;
     myLight->setLightNum(0);
     myLight->setPosition(osg::Vec4(bb.corner(4),1.0f));
     myLight->setAmbient(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
     myLight->setDiffuse(osg::Vec4(1.0f,1.0f,1.0f,1.0f));

     myLight->setDirection(osg::Vec3(1.0f,1.0f,-1.0f));

     osg::LightSource* lightS1 = new osg::LightSource;
     lightS1->setLight(myLight);
     lightS1->setLocalStateSetModes(osg::StateAttribute::ON);

     lightS1->setStateSetModes(*ss,osg::StateAttribute::ON);
     group->addChild(lightS1);

Thanks,
Jason
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to