Hi
I have been playing with using meshes to create uneven ground for a 3D game. So a tiled background has a mesh set on it and then the Z elevation of each mesh point is randomised.
I then obviously want the player and NPCs to adjust their Z elevation depending on where they are on the mesh.
So I thought that Bilinear Interpolation would be the solution, however I'm finding there are a number of cases where it falls down. Namely when there is a diagonal 'fold line', either a 'ridge' or 'valley', across that section of the mesh.
Here is an example of what I mean. The numbers represent the Z elevation of each of the surrounding 4 mesh points. The dotted line is a 'ridge' that passes diagonally across this section of the mesh.
If I want to find the Z elevation of the centre of this section of the mesh Bilinear Interpolation will return the value 1.5 but the correct answer is clearly 2.
I also gave Cubic Interpolation a try (though I'm not completely sure I'm doing it right) and that returned 1.75. Better but still not correct.
Open to any assistance or suggestions of how to do this correctly.
Thanks!