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:
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