Jump to content
  • Advertisement
Sign in to follow this  
Calefaction

Terrain coordinates to heightmap coordinates

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

Given an object's coordinates on a block of terrain, what is the most effecient mathematical way to project those coordinates back to the approximate x,y on the terrain's heightmap? This is basically for minimap functionality in an RTS. The terrain is not infinite (of course), and I have all of it's size and bounding information available (of course).

Share this post


Link to post
Share on other sites
Advertisement
the x,y coordiantes of the terrain points are those of the height map multiplied by a specific ratio. this ratio is determined when you are generating your terrain.for example, if the width of the terraing is 900 meters (or any other unit,depending on the units of measurment you are using in your engine).if the hight map is 800x600, then the x multiplicaiton ratio is 900/800 meter/pixel.and the same concept applies for the y multiplication ratio.
to map a point on the terrain to a point on the hight map, divid the point's x and y coordinates with the x and y ratioes mentioned later.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!