0

I'm looking for the best way to render the outline for a cap of a sliced object.

To illustrate what I mean let's use this example from threejs: https://threejs.org/examples/?q=clip#webgl_clipping_stencil and set it up such that we slice it only from one end like so: Sliced object

This example uses the stencil buffer to generate the pink cap which is rendered onto a plane. I want to see just this cap, so if we turn off the object itself we get this: Cap only

But we're not there yet, because I want not the cap, but the outline of this cap, like in this fabricobbled example: Cap outline

And that is where I'm not sure what direction to take. Since the caps are rendered on a plane, most existing outline techniques won't work, since that will give me the outlines of the plane. I could maybe do some sort of edge finding on the stencil, but there's probably a smarter and better way.

SeeDoubleYou
  • 1,253
  • 2
  • 15
  • 25
  • 1
    Try this plugin: https://discourse.threejs.org/t/three-mesh-bvh-a-plugin-for-fast-geometry-raycasting-and-spatial-queries/26394/18 – prisoner849 Aug 02 '22 at 08:56
  • 1
    Thanks prisoner849, that plugin got me what I needed. I'd still be interested to learn other approaches if people have ideas, but for now, I'll go with this. – SeeDoubleYou Aug 02 '22 at 12:49
  • @SeeDoubleYou You could write your own edge-detection shader. Learning shaders is a long and challenging road. Yet super rewarding :) https://thebookofshaders.com/ – M - Aug 02 '22 at 18:37
  • @Marquizzo, thanks. Yes, a shader is definitely an option as well. – SeeDoubleYou Aug 04 '22 at 14:27

0 Answers0