Hi,
is it possible reset a displacement added with applyDisplacementMap?
Every time I reapply it the mesh gets higher so I guess it’s not an absolute value but a relative one. I tried using a black image to reset but because is relative it has no effect. How can I bring back the ground to the original flat state?
Thanks
I add a function to the mesh after creating it:
const vertices = tiles.getVerticesData(VertexBuffer.PositionKind)
tiles.resetVertices = () => {
tiles.setVerticesData(VertexBuffer.PositionKind, vertices, true)
computeNormals(tiles, true, false)
}
const computeNormals = async (object, updateable, rightHanded) => {
let normals = []
const positions = object.getVerticesData(VertexBuffer.PositionKind)
const indices = object.getIndices()
VertexData.ComputeNormals(positions, indices, normals, { useRightHandedSystem: typeof rightHanded !== "undefined" ? rightHanded : true })
object.setVerticesData(VertexBuffer.NormalKind, normals, typeof updateable !== "undefined" ? updateable : false)
}
1 Like
That’s a very cool solution, thanks a lot for sharing it 
1 Like