assuming your mesh is Mesh_Width verts wide & deep this should work (greyscale ,height =0 to 255 or use all RGB components to allow a much greater range )...I haven't tested this although it is similar to the code I use in my terrain editor
Function BuildHeightMap(mesh) surface = GetSurface ( mesh, 1 ) min=0:max=0 For index=0 To CountVertices ( surface )-1 If VertexY# ( surface,index )< min Then min = index If VertexY# ( surface,index )> max Then max = index Next factor = (VertexY# ( surface,max)-VertexY# ( surface,min))/256 hm = CreateImage(Mesh_Width,Mesh_Width) SetBuffer ImageBuffer( hm ) For index=0 To CountVertices ( surface )-1 Color VertexY# ( surface,index )*factor,VertexY# ( surface,index )*factor,VertexY# ( surface,index )*factor Plot index Mod Mesh_Width,index/ Mesh_Width Next Return hm End Function