Good analysis. It occurs to me that there might be room for an enhancement to the back-to-front sorting in the transparent bin such that it sorts based on minimum distance rather than bounding volume center. -Paul
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Paul Speed > Sent: Wednesday, April 18, 2007 9:32 PM > To: osg users > Subject: Re: [osg-users] translucent objects disappear > > (Two Pauls double-teaming...) > > I believe this comes down to the brute force way that OSG > sorts drawables in the transparent bin. This is not always > sufficient to ensure proper rendering order... and there's > really not much OSG can do about either. At least not and > still render in real time. > > If all of one type of object is inside of another and is > frequently obscured by the outer object then you can use the > bin numbers (setRenderBinDetails if my memory is good) to > make sure the inside objects are always drawn before the > outer. The problem you see happens because the outer object > is drawn first and fills the Z-Buffer... when the interior > objects go to draw they are obscured since the z-buffer > doesn't know about that. > > Hopefully that isn't review. I think everyone on this list > has hit this one time or another and the work-arounds always > depend on the situation. > Sometimes controlling rendering order with the relative bin > numbers is a work-around. > > -Paul > > Netschke, Greg wrote: > > Thanks for the reply Paul. I did what you said but I don't see > > anything really wrong. > > > > Each object is its own node so the Drawable/Geometry is separate. > > However a particular shape may be referenced thru a transform more > > than once. In other works I use a library of objects and > place them > > through transforms multiple times. Could it be the last > reference is > > applied to all? > > > > I think my StateSets are setup much like the samples, except I have > > lighting turned ON. I can see any difference if I turn it > off though. > > All my translucent StateSets are setup as follows. The > colors change > > but the rest is the same. > > > > osg::Vec4 auxClr( 0.5f, 0.5f, 0.5f, 0.4f ); > > osg::Material* auxMat = new osg::Material(); > > auxMat->setAmbient( osg::Material::FRONT_AND_BACK, auxClr ); > > auxMat->setDiffuse( osg::Material::FRONT_AND_BACK, auxClr ); > > auxMat->setSpecular( osg::Material::FRONT_AND_BACK, > osg::Vec4(1, > > 1, 1, 1)); > > auxMat->setShininess( osg::Material::FRONT_AND_BACK, 64.0f); > > > > osg::StateSet* auxSS = new osg::StateSet(); > > auxSS->setAttributeAndModes(auxMat, > osg::StateAttribute::ON > > | osg::StateAttribute::OVERRIDE ); > > auxSS->setRenderingHint( > osg::StateSet::TRANSPARENT_BIN > > | osg::StateAttribute::OVERRIDE ); > > auxSS->setMode( GL_BLEND, > osg::StateAttribute::ON > > | osg::StateAttribute::OVERRIDE ); > > auxSS->setMode( GL_LIGHTING, > osg::StateAttribute::ON > > | osg::StateAttribute::OVERRIDE ); > > > > auxNode->setStateSet(auxSS); > > > > Greg > > > > > ---------------------------------------------------------------------- > > -- > > *From:* [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] *On Behalf Of *Paul > > Martz > > *Sent:* Wednesday, April 18, 2007 3:31 PM > > *To:* 'osg users' > > *Subject:* RE: [osg-users] translucent objects disappear > > > > Sounds like you either didn't set the rendering hint for > transparency, > > or all your geometry is within a single Drawable/Geometry > object, or > > both. As a result, some of your geometry is losing the > depth test to > > other geometry. > > > > To set the render hint correctly, try searching the example > code for > > "setRenderingHint". > > > > Once that's set, any geometry that could be in front of or behind > > other transparent geometry must be separated out from each > other and > > placed in their own individual Drawables. > > > > Then it should work. > > -Paul > > > > > > > ---------------------------------------------------------------------- > > -- > > *From:* [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] *On Behalf Of > *Netschke, > > Greg > > *Sent:* Wednesday, April 18, 2007 3:10 PM > > *To:* osg users > > *Subject:* [osg-users] translucent objects disappear > > > > I have a scene where I have translucent objects inside of > > translucent object. This causes the interior objects > to disappear > > entirely. If I hide the containing translucent object, then the > > interior ones show just fine. > > > > This is only some of the contained objects. Other > contained objects > > show just fine. As I rotate the view, objects are > flashing in and out. > > > > Any ideas what is causing this? > > > > I attached a couple of small images to show what I mean. > > > > Thanks, > > Greg > > > > > > > ---------------------------------------------------------------------- > > -- > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
