[osg-users] Two-sided surfaces not having correct display

Netschke, Greg greg_netschke at mentor.com
Mon Feb 4 15:39:29 PST 2008


I have a few geometries where I would like the material to display on
both sides and having the correct normals.

I have tried to just turn on the two sided light model, but things get
really ugly then.

Here is the material used...

        osg::Material * matPin = new osg::Material();
        matPin->setAmbient(     osg::Material::FRONT_AND_BACK, OHole );
        matPin->setDiffuse(     osg::Material::FRONT_AND_BACK, OHole );
        matPin->setSpecular(    osg::Material::FRONT_AND_BACK, OHole );
        matPin->setShininess(   osg::Material::FRONT_AND_BACK, 64.0f);

        osgHCore->m_OtherHoleSS = new osg::StateSet();
        osgHCore->m_OtherHoleSS->setAttributeAndModes(    matPin,
osg::StateAttribute::ON );

    /************************************
        osg::LightModel* lightmodel = new osg::LightModel;
        lightmodel->setTwoSided( true );
        osgHCore->m_OtherHoleSS->setAttributeAndModes(lightmodel,
osg::StateAttribute::ON );
    ************************************/

I've attached 2 images.  cyl-wo-lightmodel.jpg has the lightmodel
commented out as shown above.  cyl-w-lightmodel.jpg is with it
uncommented. (-with- & -without-).

Notice the weird lighting of the square pads.  This material is only
attached to the hole cylinder geode.

Ideas?

Thanks,
Greg



-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyl-wo-lightmodel.jpg
Type: image/jpeg
Size: 17951 bytes
Desc: cyl-wo-lightmodel.jpg
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080204/41086c21/attachment.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyl-w-lightmodel.jpg
Type: image/jpeg
Size: 16205 bytes
Desc: cyl-w-lightmodel.jpg
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080204/41086c21/attachment-0001.jpg 


More information about the osg-users mailing list