Using applyDisplacementMap then CSG to subtract mesh

I’m trying to apply a displacement map to a mesh, then use CSG to subtract another mesh from it, but unfortunately the displacement map isn’t retained in the boolean/CSG operation. Is there a way to “render” or clone the mesh and keep the displacement data before using CSG to subtract another mesh?

Attempted here: https://www.babylonjs-playground.com/#WUYDVT#31

Due to the way displacement map works, it is an asynchronous process. Meaning, running code right after calling the function won’t work.

You will need to use the onSuccess callback to get that to work correctly:

Displacement Map + CSG test | Babylon.js Playground (babylonjs-playground.com)

3 Likes

Perfect! Thank you for the help!

1 Like