Archived

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

ZitherMan

Heightmap problems

Recommended Posts

I am making a heightmap-system for my game-engine. All heights should be based on values from an image-file that i load. I have tried to get the value from a LPDIRECT3DTEXTURE8 structure (some kind of surface right?) but i havnt had any success. Does anyone know if it''s possible to get the data from a d3d-surface or do i have to load the file manually? If so, how does a bitmap-structure look?

Share this post


Link to post
Share on other sites
By far the easiest way of loading heightmaps is to use a raw file. It''s just a bitmap but with no header. As a result it is extremely easy to load and most image editing packages will load/export to them.

I certainly wouldn''t advise using D3D surfaces, it''s so much easier to do it with raw files and making the code portable will be easier in the future, if needed.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I recommend loading it yourself. However, using a well-known image format will make creation much easire (plus you can support different sizes).

The easiest file format is TGA. The header is 9 "unsigned short" values, most of which you can set to 0 when writing. The "BMP" file format is somewhat more complex, but not much (there are two structs in the file, followed by data). Another contender is DDS, which starts with a 128 byte header, followed by data.

I suggest www.wotsit.org for documentation on different file formats.

Share this post


Link to post
Share on other sites