Discussion:
[Opensg-users] Implementing a cutting plane with
Altenhofen, Christian
2015-06-03 11:51:00 UTC
Permalink
Good afternoon everyone,
first of all, http://www.opensg.org/ seems to be down, so I was not able to check the api documentation for anything useful on this topic.

The problem is as follows:
We are currently implementing a cutting plane in our application to cut through geometry and see the inner structures.
This is realized with one or multiple OSG::ClipPlaneChunks with different plane equations combined in one MaterialChunkOverrideGroup.

This works approach works quite well, but here comes the tricky part:
Additionally to clipping the model, we fill the hole by generating new geometry on the plane. When rotating the camera, one can clearly see flickering of the single triangles on this geometry as it gets clipped more or less randomly because of numerical inaccuracy.
The problem can be compared to Z-fighting, but with the clipping plane instead of a second geometry...

Introducing a small delta on the plane equation for the clipping helped a bit, but is more a quick hack than a proper solution.

Is there a technique like polygon offsetting that also works for the ClipPlaneChunks?
Are there some flags or something that can be set in way, that the ClipPlaneChunk ignores one specific child node in the scene graph?


Best regards,
Christian

Btw. We are using OpenSG 2.
Carsten Neumann
2015-06-03 13:58:45 UTC
Permalink
Hello Christian,

On Wed, Jun 3, 2015 at 6:51 AM, Altenhofen, Christian
Post by Altenhofen, Christian
Additionally to clipping the model, we fill the hole by generating new
geometry on the plane. When rotating the camera, one can clearly see
flickering of the single triangles on this geometry as it gets clipped more
or less randomly because of numerical inaccuracy.
have you seen Examples/Simple/clipplanecaps{,2}.cpp which contain
pretty complete examples how one can implement something like this?
Post by Altenhofen, Christian
The problem can be compared to Z-fighting, but with the clipping plane
instead of a second geometry…
Introducing a small delta on the plane equation for the clipping helped a
bit, but is more a quick hack than a proper solution.
Is there a technique like polygon offsetting that also works for the ClipPlaneChunks?
It seems to me that if there is geometry that is co-planar with the
clipping plane applying an offset to the plane equation is pretty much
what polygon offset does.
Post by Altenhofen, Christian
Are there some flags or something that can be set in way, that the
ClipPlaneChunk ignores one specific child node in the scene graph?
You can keep the "exceptional" object in a branch of the scene that
is not a child of MaterialChunkOverrideGroup, that way it will not be
affected by the clip planes. Alternatively you could insert a node
with a MaterialGroup above the exceptional object - everything below a
MaterialGroup uses the material set there, ignoring ChunkOverrides and
(IIRC) local materials.

Cheers,
Carsten

------------------------------------------------------------------------------
Loading...