P.S.: A little bit more mathematical would be this idea.
In the Formula Shader we can type in x, y and z values for local values. It creates a “pixel” value for this surface based on the distance to the object axis.
In this way we have the surface xyz and the object XYZ. Each point is related to the object axis. To get the distance between these two values each time, we just put xyz each time to square and pull the square root out of it. Since the object Axis is the origin of all points we done’ have to care about it, it will be always zero from a points view. Anyway, the formula would be something this
Whereby the 1000 is more an adjustment based on the object size, but more for human view than needed mathematical.
When we now use the original shape of the object and bake that into a 32bit/channel linear Open EXR file, (which should be well set in UV(W) terms, no overlapping.) we have stored the original positions in RGB values.
The Formula Shader needs now to be set into a Layer Shader and on top of that the Open EXR file set to Layer: Difference. (Note a good resolution should be given)
Now we can see the change of the xyz of the surface. To push the visibility, we can multiply the Layer-Shader with the Brightness of that channel, perhaps use a Colorizer as well for that.
Sounds perhaps complicated, but once it was done it is simple.
The rendered xyz map works with any sphere in this example, independent from the mesh density!
Testing it with a Torus, have a look at the one minute clip:
Note that the example is more a low res, object as well the “reference texture”.