Many 3d rendering applications have a function to save a depth (distance) pass or ZBuffer render. The terminology for this may vary based on the application. The surfaces are assigned a greyscale value based on the distance from the rendering camera.
Blender can do this, as well as many others. Daylon Graphics Leveller is a 3d landscape/terrain generation application that has this function and its a lot easier to get a greyscale image from it than going through all the various rendering options in a program like Blender.
In Leveller, you load your 3d model (triangulated format only) and save a greyscale image. The resolution of the greyscale image (heightfield) is set when the model is imported. The 3d geometry is rasterized to 16-bits (65536 levels) but you can save an 8-bit (256 levels) image if needed, or you can convert it to 8 bits in Photoshop.
I'm just waiting for a download link to the Leveller program..... paid for it yesterday but haven't got any response. It looks like it should work perfectly.