Skip to main content
gamedev.net
🔒 Locked

Height map problems

Started by ccanan Oct 10, 2006 at 1:44 AM 3 replies 900+ views
Original Post
ccanan
ccanan
errr, why we use height map and generate terrain in the program? I think if we edit the heightmap, then generate the vertices, store them in .3ds file or something like that, that's better! So any reason why we always generate at loading time! thx in advance!
RAZORUNREAL
RAZORUNREAL
Generating the geometry in the program guarantees that the terrain is a regular grid, which makes culling, level of detail and collision detection much simpler and faster. Not to mention a height map is more efficient than a model in terms of size.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
haegarr
haegarr
Quote:
Original post by ccanan
errr, why we use height map and generate terrain in the program?

Height maps use (EDIT: usually, not necessarily) an orthogonal grid, where the height values are given on the grid points. Due to this, the other 2 dimensions can be computed from the index of the grid point and a reference frame. On a large terrain (i.e. with many vertices, not necessarily large in size) the additional costs of the frame can be neglected, leading to a storage amount of 1/3 for vertex co-ordinates compared to a full blown vertex. Often also the range of height can be expressed in e.g. a word instead of a float.

Reducing the storage amount can have advantages for faster loading from harddisk, faster loading into the VRAM (both things senseful if streaming "continuous" terrain), and reducing memory footprint in VRAM. (Here I assume that your "inside the program" includes shader programs as well.)

Quote:
Original post by ccanan
I think if we edit the heightmap, then generate the vertices, store them in .3ds file or something like that, that's better!

This depends on the sense. Better in what sense do you mean?

[Edited by - haegarr on October 10, 2006 2:02:32 AM]
ccanan
ccanan
thank you guys!
I feel much clearer about height map.
and haegarr, I always think the generating vertices during loading time is a waste, so I think if the generating process is done just after the map is made , it will be better.
well, now, I know I am naive about that!
thx a lot!
Emmanuel Deloget
Emmanuel Deloget
Quote:
Original post by ccanan
thank you guys!
I feel much clearer about height map.
and haegarr, I always think the generating vertices during loading time is a waste, so I think if the generating process is done just after the map is made , it will be better.
well, now, I know I am naive about that!
thx a lot!

Since accessing memory is a lot cheaper than accessing the disk, it will be far faster to load a heightmap and to recreate the mesh at runtime than to load a mesh directly. The difference will be quite small for a small heightmap, but will increase when it gets bigger. It is a lot like loading a compressed image vs. loading an uncompressed one: if the decompression algo is fast and if the image is quite large, loading the compressed image + applying the decompression algo will be faster than loading the uncompressed image.

Regards,

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.