🔒 Locked
Rendering a Height Map
Advertisement
Original Post
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,
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.
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
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.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement