We’re coming back to this feature, now that we have a proper acceleration structure implemented in the viewer. The idea now is to change our approach to something very different than trying to cap sections using stencils only. Here’s what we’re trying to do:
Instead of trying to determine the section caps by drawing front and back faces with different stencil values and then just try to filter the caps out, we’ll attempt to actually fill the caps with actual geometry. This is now possible due to our BVH integration. The broken down steps of doing this are:
Here’s an example of how it would look
Now this is all well and fine until we hit a snag. There are cases out there where the clipping plane generates multiple “island” caps on a single object. This wouldn’t be a problem if we could programmatically isolate the islands with 100% precision, since we could just cap them individually. However we can’t. We could use alpha shapes to isolate the island, but there is not way for us to correctly compute the required alpha value so that the islands are separated correctly 100% of the time.
How are we going to determine the “best” α? As far as I can see, α is
found out by trial-and-error, eg. you have something like an “interactive
slider” where you can vary α until the result “looks good:”
To illustrate the issue better here’s an example of a single mesh consisting of three individual primitives
Because we’re building a single hull, the resulting mesh is joined between all three islands.
Now, there might a way to properly identify the individual islands by using the bvh. Like for example, the fact that any island would be separate from another island, if there are no connecting edges between them. But as simple as the notion sounds, it might not be that easy to implement.