简体   繁体   中英

How can I set shininess on an osg::Geometry without setting a material in OpenSceneGraph

I have an osg::Geometry on whose state set I used to set a material that I made shiny via osg::Material::setShininess(). The problem is that now I have the need to set various colors across the geometry. I tried doing this with the geometry's color array, but that approach didn't work unless I stopped setting a material on the geometry's state set.

I understand the logic here, that a material should override a color array, but I'm curious if there's some other way to make the geometry shiny now that I can't set a material on its state set?

I asked the same question on the OSG forum (which was not working in August, which was the only reason I asked this question on SO since this is not really a good place to ask OSG questions...)

If you set the color mode on the material to AMBIENT_AND_DIFFUSE, you can still use a color array and set the shininess too.

pMaterial->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE)

The original answer on the OSG forum:

original answer on the OSG forum

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM