Getting a picked point's normal from a normal map

Hi, is it possible when picking a mesh to get the normal from a map, instead of the mesh/geometry?

The documentation here, especially the second argument passed to PickingInfo.getNormal(), suggests this is the default behaviour, but I cant get it to work.

Here is a playground (pieced together from a few other playgrounds) showing the issue. Im expecting the yellow lines that appear when you click on the mesh to be perturbed do to the normal map (which is applied via a node material):

If this works, im then curious whether this output normal direction can be applied even in a shader where the normal map isnt connected to the light/colour (ie has no visible output), but thats another step…

Many thanks :slight_smile:

The normal provided is from the geometry (which is flat) and not the normal texture (which is an image).

A very naive approach would be to sample the texture (just like babylon does) and use the texture data to generate the normal:

Pick Up Mesh | Babylon.js Playground (babylonjs.com)

Architecture should be improved of course :slight_smile:
And I guess there are simpler ways to get the rgb data

2 Likes