After the displacement map has been applied, the mesh.getVerticesData("position") and mesh.getVerticesData("normal") will retrieve the updated positions and normals in local space.
In your PG, you apply a rotation to the mesh, so if you want that showNormals shows the correct normals, you should transform the positions and normals by the mesh transformation matrix. Or, easier, just make the source mesh parent of the LineMesh so that the latter inherits the mesh transformation.
In your example the normals still not look right. I printed out meshPositions, and found no matter you apply a displacement texture or not (toggle line 24) the meshPosition prints out the exact same values. So my understanding is mySphere.getVerticesData(BABYLON.VertexBuffer.PositionKind); didn’t get the updated vertex positions after displacement.
Also, the showNormals function seems using the same approach to get the vert positions. So this may explain why the normal visualizer is not showing the updated normal either.
Please see my PG:
Am I understand it correctly? Is there a way to get updated mesh info after displacement?
I think the issue comes from the fact “applyDisplacementMap” is asynchronous - it needs to load the texture-, so you need to wait for it to complete before doing the RecomputeNormals step, which is why there’s a “callback” parameter.
Its a timing thing. Wait till after the matrix of the mesh has been updated after the displacement and then you should be good, or use the callback to compute the normals after the displacement has fully been applied.