Intersection of a ray and a height-field
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.
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
A suitable supercover algorithm is here:
http://lifc.univ-fcomte.fr/~dedu/projects/bresenham/index.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement