How do I display this intersected edge?

Hello,

I have a problem and I dont know how to solve it. I hope someone of you can help me with that.
As you can see in the attached image, I have created a “XRay-Cube” that displays Objects that lie below the buffergeometry (blue floor).

In the Material-Properties of the Xray-Cube, I set the property “Blending” to “Additive Blending” and set the renderorder to 5. The floor has a renderorder of 10 and the objects below the floor are set to renderorder 0.

Now I want to display the red line from the image. Basically the intersection between the Xray-Cube and the floor. How do I achieve this?

Not super easy to do with just three - but three-mesh-bvh can help you with that. See this (source code) and this (source code) examples.

1 Like

One of solution is adding displaying red square to floor by modifing fragment shader code of material. But its then box fully intersect floor.
Second solution maybe stencil buffer.
Third solition is checking difference of depth between box and floor. Its like into games makes foam at objects intersection with water.