Archived

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

Using TGA's as Heightmaps

This topic is 5014 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

Hi again I have loaded a TGA image using an adaption of the NeHe TGA loader and I am trying to use color values to determine heights for my heightmap. As i make the TGA heightmaps grey, all colors (RGB) are the same, so i just use one color value. Basically i just get every third byte of the image data (so its the same color value) and store this in my height array. The problem is, well it does not work. Is there anything I am missing here? Is there something else that needs to be done? Can the raw byte image data simply be used for heights?

Share this post


Link to post
Share on other sites
You can do whatever you like as long as you do it right. ;-)
When you draw your heightmap, what happens? Do it look like a big flat plane? If you bypass the height data and just send a o (zero) to the heightmap, does it work then?
Can it be that your height map ( the TGA file ) is very bright? The first time I did a heightmap I screwed it because I just sended the height data directly which became really wrong because the white pixels sended the vertex 255 units straight up the y-axle. Because that the heightmap file was really light I didn''t see a thing.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ohh my god, you converted your rgb heightmap to greyscale, now your landscape will be totally fucked up!!!!

just do it

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The problem was solved. An off by one error was screwing everthing up...

I have to have the terrain be the exact same size as the heightmap+1 or else things dont work as they should, so if terrain is 128x128 the heightmap needs to be 129x129

Share this post


Link to post
Share on other sites