[osg-users] Several clipping planes

Robert Osfield robert.osfield at gmail.com
Thu Feb 4 04:40:13 PST 2021


Hi Claudio,

Welcome to the OSG community. For your first post you sure are diving into
an advanced topic :-)

Conventionally one would do clipping using gl_ClipPlane, this is set by
osg::ClipPlane state attribute and osg::ClipNode to place one or more
ClipPlane in a final position in space,  I think OpenGL implementations
provide at least 6 clip planes, but It's while since I've head my head deep
in OpenGL as I'm mostly working with Vulkan these days.  There is a hard
limit though that is driver/hardware dependent.  This type of clipping gets
applied during the traseration step just prior to the fragment shader.  It
can be used with fixed function and shader pipelines.

>From your description it sounds like something custom will be best, which
in essence would be to use a fragment shader test to discard/fade out
fragments based on some combination of uniform or vertex attribute settings.

Is the clipping always going to base on a horizontal plane?  If so then you
just need to encode the height to clip at for each object via a uniform or
more efficiently with a vertex attribute bound with BIND_OVERALL.  Uniforms
have a higher overhead than vertex attributes in OSG/OpenGL so general best
used for rarely changing values, with values that change with high
frequency i.e. different for each object using vertex attributes will be
more efficient.

Cheers,
Robert.

-- 
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/CAFN7Y%2BU4FGbc3ddWPyME6xjDd9CmuZz8134HMNK3PD1L4%3D2QZw%40mail.gmail.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20210204/4e707c53/attachment-0001.html>


More information about the osg-users mailing list