I want to display several hundred thousands of boxes (maybe millions) of various sizes and colours (but all in the same orientation) and thininstances seems to work really well for this.
However, I want an option to use clipping planes, and when the thininstances are clipped, I want the intersection of the boxes with the planes to be filled in, with their own colour, so they still appear solid. The clipping planes might be at any orientation and the plane normals might not be orthogonal to the boxes. There might be just one or two parallel clipping planes.
A simple illustrative data example of just 10 boxes and two clipping planes is here:
[ https://playground.babylonjs.com/#SAQ3YA#4 ] (https://playground.babylonjs.com/#SAQ3YA#4)
I have struggled with using stencils and am not even sure this approach can be used with thin instances.
Can anyone tell me the correct approach, would a CSG approach work (bearing in mind the number of boxes) or do I have to revert to calculating the polygons of intersection myself. If calculating the intersection, I am probably OK with the maths to do the calculation but I don’t know the best way to construct/architect and minimize the calculations within the BJS framework.
Or perhaps some other approach is possible.
I’ve had a look at similar questions but they all seem to relate to a single mesh and don’t address the multi-colour aspect of my requirement. (e.g. https://www.babylonjs-playground.com/#95MJI8#178 , https://www.babylonjs-playground.com/#M3RNVC#6 , https://playground.babylonjs.com/#95RAN4#4 )
Any help would be much appreciated as I’m new to BJS.