Method for rendering heightmap from a 3D scene
Using OpenGL, or any such library, you could transform your scene with an orthogonal matrix and move your camera view point to be looking above (and parallel to) the scene (in a vertex shader) and then use an empty fragment shader which is going to write to the depth buffer of the current attached framebuffer. Finally retrieving this depth buffer gives you the heightmap of the current view.

If your scene is too big, you could move the camera higher and also move it around taking "chunks" of the map at a time and assembling your heightmap manually by "stitching" these "chunk" heightmaps together.

Hope this helps.