Offsetting models with generated heightmap, not aligning with terrain

So I’ve been trying to recreate the old Warcraft 3 cliff system for a few days using a material and using the “World Position Offset” and the picture attached is the closest I’ve come having the “cliffs” matching the auto generated terrain. I’ve tried everything I can think off and I can’t get it to work, the current picture only works with these exact values, if I change the terrain generation values the “cliffs” won’t match anymore and I’m at my wits end.

The texture is created using the values from the generated terrain, but remapped to the range of 0-1 this is then made into a color and saved in an array, it’s padded with black pixels in between the real values to better match the lines of the models. The texture is then created using Rama’s plugin and then in the material I just multiply the red channel by 200, the same value the terrain is multiplied by and that is plugged into the world position offset. It should be noted that the terrain has a value of 200 added to it since that’s the height of the model.

Do anyone have any idea on how to do this? Is it even possible? I would really like to refrain from creating the cliffs using procedural meshes too since that would be a pain in the *** to create, but at the moment that looks like my only option.

Edit: I decided to write a c++ function to read the obj wavefront files to get the data and do some simple math to it instead, and the result you can see in the third picture. If anyone is interested I could release the plugin and/or code once it’s done.