[osg-users] Several clipping planes

Claudio Benghi claudio.benghi at gmail.com
Wed Feb 3 09:17:31 PST 2021


Hello all,

My first post on the new forum, thanks for accepting my request, and for 
the amazing work on OSG over the years.

I intend to use OSG to display the construction sequence of a building site.
Some elements will just appear at a given frame (that's easy), but others 
I'd like to appear progressively.

I don't mean that they will "move" to their destination, but rather, that 
they will be partially visible in their final position as if being 
partially clipped, until they are entirely visible:

[image: Clipping.svg.png]

Since timing will be different for each object, a few clipping planes would 
not be enough. 

>From what I read, it should be possible to use the fragment shader to cut 
elements fairly arbitrarily. 

I've got a couple of questions:

1) Is it possible to use fragment shaders to cut objects at a custom 
distance from a shared reference plane (the distance should be independent 
for each object, see hA and hB in the image above)?

2) What path would you suggest me to attempt? Is gl_ClipDistance the right 
way to go?
Am I completely wrong thinking of something like:

gl_ClipDistance[0] = dot(u_plane0,vsPos) + *CustomObjectH*;

3) Is the StateSet of an object the right way to pass (and update) a custom 
variable for the fragment shader (i.e. the distance from the reference 
plane)?

Many thanks,
Claudio

-- 
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+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/9173059e-957c-471c-a71b-f0dd52a1afb0n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20210203/ae99f3d7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Clipping.svg.png
Type: image/png
Size: 48796 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20210203/ae99f3d7/attachment.png>


More information about the osg-users mailing list