[osg-users] Clipping osgText::Text

2019-10-24 Thread Catalin
Hi,

Is there a way to clip the rendering of Text by a rectangle without using
stencil buffer or clipping planes?

Thank you.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] why the "adaptedlum->addChild(brightpass)" code is doing what it does In the osgPPU hdr example

2019-10-24 Thread Mirro Xu
Hi,

// The adapted luminance ppu do compute it. However if you
// can follow me for now, you maybe encounter, that this ppu do
// have to write into the same texture as it also read from.
// To prevent this, we just generate an inout ppu which do
// nothing than render the copy of input to the output.
// We will use the output of this ppu as input for the
// adapted luminance ppu. In this way we do not write to the
// same texture as we have readed from.
osgPPU::UnitInOut* adaptedlumCopy = new osgPPU::UnitInOut();
adaptedlumCopy->setName("AdaptedLuminanceCopy");
adaptedlumCopy->addChild(adaptedlum);

// now connect the output of the adaptedlum with the rest where it 
is needed
adaptedlum->addChild(adaptedlumCopy);

adaptedlum->addChild(brightpass);
brightpass->setInputToUniform(adaptedlum, "texAdaptedLuminance");

adaptedlum->addChild(hdr);
hdr->setInputToUniform(adaptedlum, "texAdaptedLuminance");

Thank you!

Cheers,
Mirro

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76854#76854





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] clear stencil buffer

2019-10-24 Thread Catalin
Hi,

Is there a way to clear the stencil buffer while drawing happens between
nodes?

Every node needs its stencil buffer to be cleared in order to use it
properly.

Thank you,
Catalin
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clip plane with osg::ClipNode

2019-10-24 Thread Robert Osfield
HI Catalin,

OpenGL clip planes are positional state which requires them to be applied
with the current modelview matrix to position them in in eye coordinates
where the clipping is done on the GPU.  This positioning means that each
individual OpenGL clip plan can only be in one place at one time, which in
turn means that when the OSG applies the clipplane only the last one
applied will be the one that is effective.

Robert.

On Wed, 23 Oct 2019 at 11:48, Catalin  wrote:

> Hi,
>
> 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.
>
> osg::ref_ptr clipNode1 = new osg::ClipNode;
> clipNode1->addClipPlane(new osg::ClipPlane(0));
> clipNode1->getClipPlane(0)->setClipPlane(1.0, 0.0, 0.0, -2000.0);
>
> osg::ref_ptr clipNode2 = new osg::ClipNode;
> clipNode2->addClipPlane(new osg::ClipPlane(0));
> clipNode2->getClipPlane(0)->setClipPlane(-1.0, 0.0, 0.0, -2000.0);
>
> osg::ShapeDrawable* s1 = new osg::ShapeDrawable(new
> osg::Box(osg::Vec3(2000, 0, 0), 500));
> clipNode1->addChild(s1);
> osg::ShapeDrawable* s2 = new osg::ShapeDrawable(new
> osg::Box(osg::Vec3(-2000, 0, 0), 500));
> clipNode2->addChild(s2);
>
> Every box is shown in half because of the clipping plane.
>
> *Case 1*
> root->addChild(clipNode1);
> //root->addChild(clipNode2);
>
> [image: image.png]
>
> *Case 2*
> //root->addChild(clipNode1);
> root->addChild(clipNode2);
>
> [image: image.png]
>
> *Case 3*
> root->addChild(clipNode1);
> root->addChild(clipNode2);
>
> [image: image.png]
>
> I was expecting both boxes, S1 and S2 to be drawn.
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clip plane with osg::ClipNode

2019-10-24 Thread Catalin
It seems there is a bug with osg::ClipNode, by using osg::ClipPlane it
fixes the issue.

OSG 3.6.3


On Wed, 23 Oct 2019 at 13:48, Catalin  wrote:

> Hi,
>
> 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.
>
> osg::ref_ptr clipNode1 = new osg::ClipNode;
> clipNode1->addClipPlane(new osg::ClipPlane(0));
> clipNode1->getClipPlane(0)->setClipPlane(1.0, 0.0, 0.0, -2000.0);
>
> osg::ref_ptr clipNode2 = new osg::ClipNode;
> clipNode2->addClipPlane(new osg::ClipPlane(0));
> clipNode2->getClipPlane(0)->setClipPlane(-1.0, 0.0, 0.0, -2000.0);
>
> osg::ShapeDrawable* s1 = new osg::ShapeDrawable(new
> osg::Box(osg::Vec3(2000, 0, 0), 500));
> clipNode1->addChild(s1);
> osg::ShapeDrawable* s2 = new osg::ShapeDrawable(new
> osg::Box(osg::Vec3(-2000, 0, 0), 500));
> clipNode2->addChild(s2);
>
> Every box is shown in half because of the clipping plane.
>
> *Case 1*
> root->addChild(clipNode1);
> //root->addChild(clipNode2);
>
> [image: image.png]
>
> *Case 2*
> //root->addChild(clipNode1);
> root->addChild(clipNode2);
>
> [image: image.png]
>
> *Case 3*
> root->addChild(clipNode1);
> root->addChild(clipNode2);
>
> [image: image.png]
>
> I was expecting both boxes, S1 and S2 to be drawn.
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org