PDA

View Full Version : Picking on a Height Map



Eggman
12-19-2005, 06:55 AM
I am trying to figure out how I can select a single vertex or face on a height map. The height map could have many many vertexes, and standard picking only supports 64-128 objects, so that won't work (a sample height map has 4096 vertices). So I am wondering what the best way do do this is. One option would be to divide the height map into regions with 64 vertices each, do the picking each region, and compare the results, but that seems like it might be slow. Are there other options?

Stroma
12-21-2005, 04:41 AM
you can test the height of terrain at some points about the line that generated from cursor's screen coordinates or simply use line-boundingvolume collison detection.

Eggman
12-21-2005, 12:15 PM
Actually, I figured it out. I wound up drawing each square in the back buffer in a unique color, and then using glReadPixels to detect which color the mouse had clicked on. Seemed to work really well.