Jump to content
  • Advertisement
Sign in to follow this  
trdezrek

Terrain: Mesh vs heightmap

This topic is 4901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, it comes down to this. Just which method is best for storing and displaying terrains in games? A DirectX mesh (.x file) or a heightmap? Thus far I've used heightmaps with a bit of LOD and a smattering of frustum and occlusion culling, but it doesn't always give me the performance I'd like to see. So, I'd like to hear what people think the advantages or disadvantages are to each method. Are meshes easier, more efficent, or practical than heightmaps? What should I consider if I attempt to go the mesh way? Also, please forgive me if some of you think this belongs in graphics programming and theory, but I'm more of a DirectX user myself and as such try to gear the question that way.

Share this post


Link to post
Share on other sites
Advertisement
I'd also like to know more about the pros and cons of each technique.

Meshes should give more freedom for creating individual terrain, with varying resolution, where appropriate. They also enable stuff like overhanging cliffs and caves.

Anyhow, collision detection should be a wee bit more demanding, due to the unpredictable distribution of the vertices.

otoh, what do i know...

I'm also using heightmaps for terrain rendering and would like to know, if switching to an mesh-based approach is worth the headache.

Share this post


Link to post
Share on other sites
The uniformity of a height map is both its weakness (as mentioned the unifrom distribution of points can make detail harder etc) and its strength; the uniformity makes *alot* of things easier to implement and in many cases more efficient.

Overhanges etc can be created as seperate models if required so do not worry about this limitation.

Occlusion culling, especially Octrees and Quadtrees is easier to do on a uniform grid; if you are doing a larger outdoor scene you will probably be required to use one of these.

In my opinion determining you location on a height map and the height at this point is alot easier, as is determing UV coords for texturing it.

LOD algorithms are also easier (and more efficient) for uniform grids, especially as the examples around use this as a basis.

Ofcourse, you could potentially create much more varied terrain with non uniform meshes. However, i beleive that you can create nice looking terrains with a regular map and, given that alot of things are easier (and quicker) to do with this I see no reason to change. If you are finding it hard to produce realistic terrain with a heightmap grab yourself a copy of terragen and you will have fantastic looking terrains that are easy to work with very quickly :)

Obviously i am pro heighmaps for terrain, as are many people. I would like to hear the opinions of those that have used meshes for this as I may have missed some useful funcitons of them :)

Matt

Share this post


Link to post
Share on other sites
Why not do both? I think it is World of Warcraft that uses a height map for the general terrain and then uses meshes for overhangs other terrain that can't be built using a height map.

Just a thought.

Share this post


Link to post
Share on other sites
Quote:
Original post by onebeer
Why not do both? I think it is World of Warcraft that uses a height map for the general terrain and then uses meshes for overhangs other terrain that can't be built using a height map.

This is a perfectly good idea, another similar one is to have two heightmaps. A first one to define the shape of the terrain and a second that extrudes from the surface (along the normal's axis usually) to define extra detail. It never struck me as being quite as good as what you suggest (using meshes for overhangs), but it is an alternative.

Anyway, my thoughts on the topic...

It all comes down to what you want to display, and to what detail.

Heightmaps are very well suited to a lot of computer graphics algorithms (as mentioned), and they're relatively easy to program. Another benefit is there are 100's of really good algorithms to generate fairly good looking terrain sets (e.g. "Mid Point Displacement").

Meshes aren't so easy to program for as you will want to handle any decent sized terrain as multiple components rather than one huge mesh. This either means placing limits on the authored content, or sub-dividing a mesh at load-time. However, the do offer the most creative freedom - you can, within reason, model any sort of land feature you can imagine. Which is also a slight problem as you or your artist do actually have to create a suitably decent quality mesh to work with.


I would personally go with using a heightmap foundation, and then adding additional heightmaps (like my original comment) or meshes to define details such as caves/overhangs. You get the advantage of a well understood and (relatively) easy system to define your world, yet maintain the ability to model particularly detailed areas in any way you see fit...

hth
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!