Height Map from Mesh

Started by
3 comments, last by kosmon_x 18 years, 7 months ago
Hi Is there a way to generate a height map from a mesh for a terrain?
Advertisement
hi, this might not work, never tried this before but you could sample the mesh unit by unit (meter by meter or whatever)...say you have a mesh that would fit a 256x256 heightmap, starting from a corner generate 256x256 perpendicular rays starting from y=0 (or below if needed) and do a ray intersection test with the mesh, then you'll know the height of the mesh in that point. Because you will lose some of the details you could try casting more rays with a shorter increment and interpolate the values.

Although I doubt that you'll get a perfect image of the mesh with this method, hope this helps somehow.
Just render an orto-view of the mesh from above and save the depthbuffer to an image-file. There is your hightmap!

/Mike
Quote:Original post by vx7johmi
Just render an orto-view of the mesh from above and save the depthbuffer to an image-file. There is your hightmap!

/Mike


Now that is just cheating...albeit its a hell of a lot simpler sounding than what I suggested.

Edit: Ok, maybe I forgot to click the post button when I replied to this...
Adventures of a Pro & Hobby Games Programmer - http://neilo-gd.blogspot.com/Twitter - http://twitter.com/neilogd
double post

This topic is closed to new replies.

Advertisement