Skip to main content
gamedev.net
🔒 Locked

Extracting *real* values from heightmap

Started by edotorpedo Aug 2, 2002 at 7:24 AM 2 replies 250+ views
Original Post
edotorpedo
edotorpedo
Hello, I have this problem: My terrain size is about 70000 opengl *units*. My heightmap size is 1024*1024. Now when I create a mesh and try to extract height values from heightmap, very often the location of a vertex is in between two heightmap pixels. Because of this some triangles in my mesh (for example on a terrain hill) are flat, because all vertices relate to the same heightmap pixel. How can I interpolate between pixels. Say I want to extract a pixel from heightmap at location 343.23423, 566.634645 ?? A clue anyone ? Thanks, Edotorpedo
Edo
JonnyQuest
JonnyQuest
Don''t use a byte-heightmap. To get more detail, just use, say 16 bits per vertex. That gives you 256 times the precision, which should be more than enough. If not, you definitely have good eyes

- hillip@xenoage.de''>JQ
Full Speed Games. Period.
~phil
Darjk
Darjk
Or you could just add both height values from the 2 neighbouring pixels and divide it by 2 ?
Or if its on a cornor add all 4 neighbouring pixel height values and divide by 4.
JackNathan
JackNathan
Look into bilinear interpololation to get values between your height map samples.

Jack

Topic Locked

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

Sign in to reply to this topic.