I’ve recently been trying to make a script capable of mapping a mesh geometry but I’ve ran into an issue with smooth shaded meshes where the surface normal returned by the raycast is smoothed making it impossible to get the actual surface.
My current approach was to use nearby points to get the relative position but this wouldn’t work if the point is not on the same surface. Here’s what I mean.
If we use the Green point as reference, that is on the same surface we get correct results (Yellow line) but if the Green point wasn’t there and we would only have the two red points that aren’t on the same surface we would get incorrect results (Blue line).
So how would I go about getting the correct normal?