Hi Adrian, The osgspotlight example that illustrates the use of multi-texturing to do a spot light, rather than just using OpenGL lighting to do the spot light.
>From your explanation I can't work out whether the osgspotlight example is working correctly on your system. When I run the example what I see is a cessna moving through a circle with a region of the terrain in front and below it light up, but the rest of the terrain is darkened by not completely black. If you aren't seeing the light up area then it sounds like very basic features of OpenGL are not working on your system and you need to look at the driver/hardware. As for the height field not being illuminated, there is no reason for this not to work if you've set up everything correctly. Personally I wouldn't use ShapeDrawable's for this type of work as they are just very primitive convenience classes, they don't scale well to handle complete rendering requirements or provide best performance. Robert. On Wed, Sep 22, 2010 at 9:18 AM, BARRAL Adrien <a...@robopec.com> wrote: > Hello, > > I am creating a scene composed of two objects : - A (yellow) submarine, and a > osg::ShapeDrawable created from an osg::HeightField : The Seabed. > > I use a spot light to illuminate this scene. The spot light is positinoned 1 > meter above the submarine, the submarine is 10 meters above the seabed. > > My Submarine is a 3ds file correctly imported. > > My light is defined as : > > Code: > > osg::ref_ptr< osg::LightSource >m_spotAvant; > osg::ref_ptr< osg::Light> m_lumSpotAvant; > m_spotAvant = new LightSource; > m_lumSpotAvant = m_spotAvant->getLight(); > m_lumSpotAvant->setLightNum(0); > m_lumSpotAvant->setPosition(Vec4f(0,0,-89,1)); > m_lumSpotAvant->setDirection(Vec3f(0,0,-1)); > m_lumSpotAvant->setSpotCutoff(90.); > m_lumSpotAvant->setSpotExponent(50); > m_lumSpotAvant->setConstantAttenuation(0.1); > m_lumSpotAvant->setDiffuse(osg::Vec4(1.0f,0.0f,1.0f,1.0f)); > m_spotAvant->setLocalStateSetModes(osg::StateAttribute::ON); > > > > > I suppose to have a part of my submarine illuminated (because of the > spotCutOff and the Spot exponent), and part of the seabed illuminated to. > > My Submarine is illuminated, but not the sea bed... It is completly black ! > > I decide to positione a cylinder created in this way : > > Code: > > osg::ref_ptr< osg::Cylinder > m_testCylindre = new > osg::Cylinder(osg::Vec3f(0,0,-95), 5, 2); > osg::ref_ptr< osg::Geode> m_gCylindre = new Geode; > m_gCylindre->addDrawable(new osg::ShapeDrawable(m_testCylindre)); > scene->addChild(m_gCylindre); > > > > > So this cylinder is 5 meter below the submarine, and 5 meter above the seabed. > > The cylinder is well illuminated ! > > So why my cylinder is well illuminated, and not my seabed ? Both objects are > osg::ShapeDrawable... > > > Of course I try to find answer to this question looking in the OSG Examples. > I try to run the osgspotlight example, and this sample seems to have the same > behaviour. The HeightMaps is black, I can't see the spot light ! > > > Best regards, > > A. BARRAL. > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=31926#31926 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org