<div dir="ltr"><div>It seems there is a bug with osg::ClipNode, by using osg::ClipPlane it fixes the issue. <br></div><div><br></div><div>OSG 3.6.3<br>
</div><h2 id="gmail-:16t" class="gmail-hP" tabindex="-1"><br></h2></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 23 Oct 2019 at 13:48, Catalin <<a href="mailto:inbox.icf@gmail.com">inbox.icf@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I have an issue with clipping planes, if you set 2 different
clipping planes to 2 different objects, only the last clipping plane is used. I was expecting each object to be drawn with its clipping plane.<br></div><div><br></div><div>osg::ref_ptr<osg::ClipNode> clipNode1 = new osg::ClipNode;<br> clipNode1->addClipPlane(new osg::ClipPlane(0));<br> clipNode1->getClipPlane(0)->setClipPlane(1.0, 0.0, 0.0, -2000.0);<br><br> osg::ref_ptr<osg::ClipNode> clipNode2 = new osg::ClipNode;<br> clipNode2->addClipPlane(new osg::ClipPlane(0));<br> clipNode2->getClipPlane(0)->setClipPlane(-1.0, 0.0, 0.0, -2000.0);<br><br> osg::ShapeDrawable* s1 = new osg::ShapeDrawable(new osg::Box(osg::Vec3(2000, 0, 0), 500));<br> clipNode1->addChild(s1);<br> osg::ShapeDrawable* s2 = new osg::ShapeDrawable(new osg::Box(osg::Vec3(-2000, 0, 0), 500));<br> clipNode2->addChild(s2);</div><div><br></div><div>Every box is shown in half because of the clipping plane.<br></div><div><br></div><div><b>Case 1</b><br></div><div>root->addChild(clipNode1);<br>//root->addChild(clipNode2);</div><div><br></div><div><div><img src="cid:ii_k235elal0" alt="image.png" width="411" height="273"></div><div><br></div><div>
<div><b>Case 2</b><br></div><div>//root->addChild(clipNode1);<br>root->addChild(clipNode2);</div><div><br></div><div><div><img src="cid:ii_k235g3v51" alt="image.png" width="412" height="277"></div><div><br></div><div>
<div><b>Case 3</b><br></div><div>root->addChild(clipNode1);<br>root->addChild(clipNode2);</div><div><br></div><div><div><img src="cid:ii_k235hcol2" alt="image.png" width="414" height="275"></div><div><br></div><div>I was expecting both boxes, S1 and S2 to be drawn.<br></div><div><br></div></div>
</div></div>
</div></div></div>
</blockquote></div>