Clipping when using a shader

21 views
Skip to first unread message

AndrewC

unread,
Apr 30, 2020, 12:18:57 PM4/30/20
to OpenSceneGraph Users
Hi,
I am using a simple displacement vertex shader to animate a displacement field on a geometry.

I am having an issue where during the animation the geometry is getting clipped by the near/far planes that are automatically maintained by OSG - obviously OSG knows nothing about the displacements of the shader.

Any suggestions as to solve this issue in the most simple manner. I would like to avoid having to maintain my own near/far planes. I was hoping OSG had a user-definable "fudge" factor for near/far...

Andrew


OpenSceneGraph Users

unread,
Apr 30, 2020, 1:01:27 PM4/30/20
to OpenSceneGraph Users
Andrew,
You have to override computeBoundingBox on your Geometry and expand it to account for your vertex displacement.

Glenn Waldron


--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/7a43edba-7e8d-4f0c-bcb4-0da8dedc56e3%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

OpenSceneGraph Users

unread,
Apr 30, 2020, 1:07:16 PM4/30/20
to OpenSceneGraph Users
Hi Andrew,

you can use "setInitialBounds" to define your precompiled bounding box.

- Werner Modenbach -

AndrewC

unread,
Apr 30, 2020, 2:01:57 PM4/30/20
to OpenSceneGraph Users
Yes, good idea. That should work. I can't really override the computeBoundingBox as I can't change the object hierarchy easily.


On Thursday, April 30, 2020 at 10:07:16 AM UTC-7, OpenSceneGraph Users wrote:
Hi Andrew,

you can use "setInitialBounds" to define your precompiled bounding box.

- Werner Modenbach -

Am 30.04.2020 um 19:01 schrieb OpenSceneGraph Users:
Andrew,
You have to override computeBoundingBox on your Geometry and expand it to account for your vertex displacement.

Glenn Waldron


On Thu, Apr 30, 2020 at 12:56 PM OpenSceneGraph Users <osg-...@lists.openscenegraph.org> wrote:
Hi,
I am using a simple displacement vertex shader to animate a displacement field on a geometry.

I am having an issue where during the animation the geometry is getting clipped by the near/far planes that are automatically maintained by OSG - obviously OSG knows nothing about the displacements of the shader.

Any suggestions as to solve this issue in the most simple manner. I would like to avoid having to maintain my own near/far planes. I was hoping OSG had a user-definable "fudge" factor for near/far...

Andrew


--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-...@googlegroups.com.

AndrewC

unread,
Apr 30, 2020, 2:26:07 PM4/30/20
to OpenSceneGraph Users
Fix was very simple - get the bounding sphere and box of the geometry. Expand the sphere's radius by a factor. Expand the bbox by this sphere. Then setInitialBound using the expanded box. Nice!

OpenSceneGraph Users

unread,
Apr 30, 2020, 2:32:46 PM4/30/20
to OpenSceneGraph Users
You can use a boundingBoxVisitor on the node in  question.


Am 30.04.2020 um 20:01 schrieb OpenSceneGraph Users:
Yes, good idea. That should work. I can't really override the computeBoundingBox as I can't change the object hierarchy easily.

On Thursday, April 30, 2020 at 10:07:16 AM UTC-7, OpenSceneGraph Users wrote:
Hi Andrew,

you can use "setInitialBounds" to define your precompiled bounding box.

- Werner Modenbach -

Am 30.04.2020 um 19:01 schrieb OpenSceneGraph Users:
Andrew,
You have to override computeBoundingBox on your Geometry and expand it to account for your vertex displacement.

Glenn Waldron


On Thu, Apr 30, 2020 at 12:56 PM OpenSceneGraph Users <osg-...@lists.openscenegraph.org> wrote:
Hi,
I am using a simple displacement vertex shader to animate a displacement field on a geometry.

I am having an issue where during the animation the geometry is getting clipped by the near/far planes that are automatically maintained by OSG - obviously OSG knows nothing about the displacements of the shader.

Any suggestions as to solve this issue in the most simple manner. I would like to avoid having to maintain my own near/far planes. I was hoping OSG had a user-definable "fudge" factor for near/far...

Andrew


--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-...@googlegroups.com.

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages