Material clipping plane color and shape outline vertices

Hi everyone,
Here is my screen from aplication where green color is intersection with clipping plane.
image

Question is how calculate outline vertices of green shape that appears?
I have buffer geomerty without indexes.

Hi!
There is no out-of-box solution.
Maybe this SO answer will give you some ideas: javascript - Three JS - Find all points where a mesh intersects a plane - Stack Overflow

Yep, I readed it. Is possible and how to optimise calculation? I have only vertices without indexes and problem is that this model is large but other models will be huge.

Try to combine it with this: Three-mesh-bvh: A plugin for fast geometry raycasting and spatial queries!

1 Like

Thanks, I will do that and come back if I succeed.

Ooh that might be a good example to add :thinking:

3 Likes

Here’s a sneak peek of the new mesh bvh demo with a reasonably complicated piece of geometry:

https://gkjohnson.github.io/three-mesh-bvh/example/bundle/clippedEdges.html

It seems to be about 20-100 times faster to use three-mesh-bvh on this model depending on the hardware / clip direction. Of course in this case the geometry has been specifically merged to replicate a more complicated piece of geometry. If a scene is already split into small chunks you may not need something like this. Of course the BVH itself takes memory and time to compute. It’s fun to see it animate, though.

Thanks for the idea @prisoner849!

4 Likes

This is great! :+1:

1 Like

have you been succeed? Could you share your experience, please?

NOPE. Not yet. When I do this I will post it here. Please be patient.

Are you taking only vertices coordinates? What type of object do you have? And what loader do you use?

@HenryZeroBug have you been successful ?

@gkjohnson I’m trying to outline the edges of the clipped plans based on the stencil demo over there : three.js examples

But I struggle a bit. Any help would be greatly appreciated.

Ok I got it working thanks to your demo @gkjohnson (at least with one plan for now).
Brilliant library !! This should be part of ThreeJS