Gordon
__________________________________________________________
Gordon Tomlinson
Product Manager 3D
Email : gtomlinson @ overwatch.textron.com
__________________________________________________________
(C):
(+1) 571-265-2612
(W):
(+1) 703-437-7651
"Self defence is not a
function of learning tricks
but is a function of how
quickly and intensely one
can arouse one's instinct
for survival"
- Master Tambo Tetsura
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
osg::ref_ptr< osg::LightModel > pLightModel = new osg::LightModel();
pLightModel->setTwoSided( true );
pState->setAttributeAndModes( pLightModel.get(), osg::StateAttribute::ON );
osg::ref_ptr<osg::Material> pMaterial = new osg::Material();
pMaterial->setColorMode( osg::Material::DIFFUSE );
pMaterial->setAmbient( osg::Material::FRONT_AND_BACK, osg::Vec4( 0.0, 0.0, 0.0, 1.0 ) );
pMaterial->setSpecular( osg::Material::FRONT_AND_BACK, osg::Vec4( 1.0, 1.0, 1.0, 1.0 ) );
pMaterial->setShininess( osg::Material::FRONT_AND_BACK, 64.0f );
pState->setAttributeAndModes( pMaterial.get(), osg::StateAttribute::ON );
I have never tried this for data like you have but it seems to me like
it should work.
Frank
On Mon, Jan 26, 2009 at 04:21:41PM +0100, alessandro terenzi wrote:
> Problem is that the models that come to my application are already prepared
> by people that do not (and unfortunately won't) think about normals issues,
> so maybe the best thing to do would be to really render both front and back
> faces, I'm not an expert, but the only approach I can think is to double the
> geometry so to have both faces, but it would be really a waste (not to
> mention performace problems that may arise..and other unexpected
> visualization problems I cannot think of..)
> Regards.
> Alessandro
>
> On Mon, Jan 26, 2009 at 1:37 PM, Tomlinson, Gordon <
> GTOML...@overwatch.textron.com> wrote:
>
> > your triangles all need to be wound the same way (anticlockwise by
> > default for OSG & Opengl), whether or not your normal's are correct
> >
> > The easiest fix would be to ensure that your modeling package sets up
> > correct normal's before you get to OSG
> >
> > Assuming your triangles are wound the same way ( if not you will have to
> > fix that ) try using the SmoothingVistor on the data see
> >
> > include\osgUtil\SmoothingVisitor
> >
> >
> > *Gordon*
> >
> > __________________________________________________________
> > *Gordon Tomlinson*
> >
> > *Product Manager 3D
> > **Email * : gtomlinson @ overwatch.textron.com
> > __________________________________________________________
> > *(C): (+1) 571-265-2612
> > (W)**: (+1) 703-437-7651*
> >
> > "Self defence is not a function of learning tricks
> > but is a function of how quickly and intensely one
> > can arouse one's instinct for survival"
> > - *Master Tambo Tetsura*
> >
> >
> >
> > ------------------------------
> > *From:* osg-user...@lists.openscenegraph.org [mailto:
> > osg-user...@lists.openscenegraph.org] *On Behalf Of *alessandro
> > terenzi
> > *Sent:* Monday, January 26, 2009 7:09 AM
> > *To:* OpenSceneGraph Users
> > *Subject:* [osg-users] Rendering double-sided surfaces.
Gordon
__________________________________________________________
Gordon Tomlinson
Product Manager 3D
Email : gtomlinson @ overwatch.textron.com
__________________________________________________________
(C):
(+1) 571-265-2612
(W):
(+1) 703-437-7651
"Self defence is not a
function of learning tricks
but is a function of how
quickly and intensely one
can arouse one's instinct
for survival"
- Master Tambo Tetsura
Note that two sided lighting is deprecated in OpenGL 3.0, so you should
consider looking for a shader-based solution instead. In the shader, if the
dot product of the normal and eye vector is negative, just negate it, then
calculate lighting as usual.
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466
-----Original Message-----
From: osg-user...@lists.openscenegraph.org
[mailto:osg-user...@lists.openscenegraph.org] On Behalf Of
frank...@jhmi.edu
Sent: Monday, January 26, 2009 8:44 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Rendering double-sided surfaces.
osg::ref_ptr< osg::LightModel > pLightModel = new osg::LightModel();pLightModel->setTwoSided( true );pState->setAttributeAndModes( pLightModel.get(), osg::StateAttribute::ON );
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org