[osg-users] specular highlight with SEPARATE_SPECULAR_COLOR

Riccardo Corsi riccardo.corsi at vrmmp.it
Tue Oct 23 03:14:51 PDT 2007


Hi all,

I'm try to get a specular highlights effect by using the
osg::LightModel::SEPARATE_SPECULAR_COLOR mode.

If I got it straight, this should compute a second color for the
specular component to be added after lighting and texturing.
So for instance, by using a light with white specular component and on a
material with white specular color, I'd expect a white highlight in the
final result. Instead what I get is the highlight modulated by the
texture, as if I were using osg::LightModel::SINGLE_COLOR mode.

Any suggestion on where I might be wrong?

Find attached a modified osgLight example to reproduce the problem with
a sample model.
I basically removed the model animation, set a white specular on the
light number 2, and added these lines of code:

osg::StateSet* pSS = rootnode->getOrCreateStateSet();
// set separate specular color
osg::LightModel* pLightModel =new osg::LightModel;
pLightModel->setLocalViewer(true);
pLightModel->setColorControl(osg::LightModel::SEPARATE_SPECULAR_COLOR);
pSS->setAttributeAndModes(pLightModel, osg::StateAttribute::ON
|osg::StateAttribute::OVERRIDE);

I'm on
osg 1.2
WinXP
nVidia 7900 GTX (tried both older and latest drivers)

Thank you
Ricky


-------------- next part --------------
A non-text attachment was scrubbed...
Name: osglight_example.zip
Type: application/x-zip-compressed
Size: 211917 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071023/546fe9e2/attachment-0002.bin>


More information about the osg-users mailing list