Jump to content
  • Advertisement
Sign in to follow this  
Burnhard

Intersection of a ray and a height-field

This topic is 3007 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 a height-field (defined by a displacement map and a tessellated plane), is there a fast, efficient way of finding the position on the displacement map of the intersection between a ray and the height-field? The application for this is quickly determining the X, Z coordinates of the current mouse position hovering over a height-field. So far the best I've come up with is either a "pick render" (render each triangle with a different colour and read back the colour of the pixel under the mouse!) or transforming the ray into model space and then "walking" across the height-field doing triangle intersection tests. I'm sure there must be an easier way, but I can't think of what it could be. Thanks for any tips you can give me.

Share this post


Link to post
Share on other sites
Advertisement
Ok, so far I've found some interesting papers that utilise "acceleration data structures" (quad-trees of peak heights, for example). I'm thinking that a Bresenham style traversal of the field is probably conceptually the simplest though and fast enough for mouse picking, although obviously it wouldn't be if you were wanting to ray-trace the field.

A suitable supercover algorithm is here:

http://lifc.univ-fcomte.fr/~dedu/projects/bresenham/index.html

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!