Need help in cap setting for the imported meshes

Hi,

I am new to babylon js, I saw the following example on clip planes https://www.babylonjs-playground.com/#Y6W087#0, how do I set the CAP_ALL on the mesh as soon as it is clipped?

Could you please help me in this?

Thanks

It is unfortunately not possible, clipping is purely a gpu functionnality to prevent rendering some of the pixels, it can not create new geometries.

Thanks for the confirmation, is there any other alternative to achieve the same result without using clipping?

You might try to rely on CSG to construct meshes dynamically but as it is a slow process I would advise to not do it every frame.

https://doc.babylonjs.com/api/classes/babylon.csg

Thanks for the suggestion sebavan :slight_smile:

Here my code is shitty, but you may try to duplicate your mesh and apply an unlighted material to fake an uniform cutted surface : https://www.babylonjs-playground.com/#Y6W087#13
(l. 19 to 27)
It’s not a perfect solution as it could generate some visual artefacts, depending of the mesh complexity.

(on my example I wanted to flip the duplicated mesh normals, instead of using backface + zOffset, but don’t know how to do)

3 Likes

Interesting approach, thanks a lot for the suggestion, I will try this.