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.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to