Slice doesn't hide the edges (part deux)

Hello everyone,

This question/bug report is going to be a continuation of this topic: Slice doesn't hide the Edges

@Evgeni_Popov’s fix works if clip plane is set at the scene level globally for all the meshes:

But if you want to use per-mesh clip planes (as explained here) it stops working:

Neither of the possible values for edgesRenderer.lineShader.options.useClipPlane makes a difference.

If this is truly a bug - can/will this be addressed and fixed?

Thank you!

The edge rendering is a separate step from the mesh rendering, so the mesh events like onBeforeRenderObservable / onAfterRenderObservable won’t work for it.

What you can do is hooking the EdgesRenderer.render function to set/unset the scene clipping planes:

@sebavan / @Deltakosh I wonder if we should add some observers like onBeforeRendering / onAfterRendering in the edge renderer… Also, what about adding clipping plane support to the Material class in addition to the scene.clippingPlaneX properties? We would avoid the use of mesh.onBeforeRenderObservable / mesh.onAfterRenderObservable to set clip planes and we could also reuse the data in the edge renderer to apply the same clipping planes if defined at the material level.

1 Like

I like the idea! (of adding clipping planes to material class)

I am not a fan of anything requiring onBefore/onAfter as it breaks WebGPU perf compat. ClipPlanes at the material levels sounds really coool

Issue created:

You guys rock, thank you!
Will use the suggested workaround for now, but looking forward to this being implemented in the future!