Height Map from Mesh

Started by
4 comments, last by kosmon_x 18 years, 8 months ago
Hi Is there a way to generate a height map from a mesh for a terrain?
Advertisement
There is a way...one solution would be to find what height the terrain/mesh is at a certain point, then simply output this to a file.
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
Just render an orto-view of the mesh from above and save the depthbuffer to an image-file. There is your heightmap!!

/Mike
IS it possible to read the depth buffer in openGL?
I haven't tried it, but it could work like this (after switching to top view ortho mode)

float pixels[<screenwidth>][<screenheight>];glReadPixels(0,0,<screenwidth>,<screenheight>,GL_DEPTH_COMPONENT,GL_FLOAT,&pixels);


If that works, it would be enough information to build up a grayscale image file.

Greets

Chris
double post

This topic is closed to new replies.

Advertisement