Sign in to follow this  
Burnhard

Intersection of a ray and a height-field

Recommended Posts

Burnhard    96
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
Burnhard    96
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this