Archived

This topic is now archived and is closed to further replies.

gahre

storing a heightmap in an octree

Recommended Posts

Any idea how to store a heightmap in an octree? I know how to store "normal" models in an octree, but a heightmap??? My problem is: a heightmap is not stored as triangles, it is stored as an array of y-values. I would love to have the source of the glVelocity engine, but Tim Shroeter''s site (glvelocity.gamedev.net) doesn''t work!

Share this post


Link to post
Share on other sites
For my purposes I should say:
I actually want to prevent heightmaps, but want to speed up my game, so the other question:
LOD/ROAM with polygon soups (non-heightmaps, just simple models)???

Share this post


Link to post
Share on other sites
How about if you use squares instead? Would it make more sense then? You shouldn''t lose sight of the forest for all the trees in the way. Hehe, I made a pun. Oh well, I don''t know anything about octrees, but I have been programming for a long time. So I suggest taking a step back and looking at it from a differant perspective. Chances are you have buried yourself in the code for awhile and when you do that it is easy to forget that sometimes you have to look at things from a more abstract level.

If you have a 2D array that is 2^n X 2^n then you can view that as one big square. You can divide that into four, eight, 16, 32 squares. Although I don''t know anything about octrees I do know that is enough to start loading it into a tree. Due to how you access it a binary tree wouldn''t quite suite the needs, but a tree where each node has four children would. Instead of left and right you have top-left, top-right, bottom-left and bottom-right. If you are going for level of detail then the node would make a good place to summarize what happened below the node. It is also a good place for compression since if all the heights in a subtree where the same you could skip the entire subtree by storing one height in the node.

Share this post


Link to post
Share on other sites