Skip to main content
gamedev.net
🔒 Locked

Rendering a Height Map

Started by BlackWind Feb 20, 2007 at 1:14 PM 7 replies 1.4k views
Original Post
BlackWind
BlackWind
Hi, i followed the tutorial from gametutorials.com for rendering a height map from a .RAW file (using photoshop for creating it -- with the clouds rendering option --). I want to modify it, so i can load a height map either from a BMP, TGA or JPEG file, but i have no idea of how doing it. I'm using Opengl and C++ Any help would be nice. thanks,
Zao
Zao
  1. Download a suitable library for the file format you want to read.

  2. Unpack and build said library.

  3. Read the fine manual for the library.

  4. Include and link against library and call suitable functions in library.

  5. Get a buffer from the library with the raw image data.

  6. Enjoy.
To make it is hell. To fail is divine.
BlackWind
BlackWind
hi,

well.....assuming that i have the buffer with the image data loaded... how can i render it so it can be display as a height map?
Lord_Evil
Lord_Evil
Build a grid of vertices and iterate over the image buffer to get the corresponding y-values (height). Use the width and height information provided by the image formats you mentioned. The library you use should provide that information somewhere in the object you use to access the image buffer.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
BlackWind
BlackWind
thanks a lot!
xycsoscyx
xycsoscyx
Basically, it shouldn't matter your source format, when you're rendering the terrain. Your terrain data should just be a bit array of heights, the height values are pulled fro your source image (either averaging the color per pixel, or taking one value, or the max value, or etc). If you started out with the raw image, then you don't have to worry about encoding, you just pick a way of getting a height from each pixel, and use that. For specific image formats, just add the decoding/loading step before that. Load the image into your raw buffer, then read your height out from that. :D
BlackWind
BlackWind
yep, i got a good tutorial on that, now that's clear to me.

Now i have another question:

1.- Does anybody knows a good program for creating height maps?
2.- How would be an algorithm for creating random height maps?

silothesuper
silothesuper
Quote:
Original post by BlackWind
1.- Does anybody knows a good program for creating height maps?

Heres a couple you could try:
L3DT
EarthSculptor

Quote:
Original post by BlackWind
2.- How would be an algorithm for creating random height maps?

Theres some articles here on GameDev about generating random heightmaps.



BlackWind
BlackWind
thank you!
i'm gonna take a look on those......

Topic Locked

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

Sign in to reply to this topic.