3 ms·
The other way to do this, which is common in (older?) 3d video games, is to render your scene twice, once normally and once with each object shaded in a unique
by adam-a 13y ago
The other way to do this, which is common in (older?) 3d video games, is to render your scene twice, once normally and once with each object shaded in a unique flat colour. Then sample your second bitmap at the mouse position and map the pixel value back to your list of objects. This is very fast and only falls over when you start to have transparent objects, in which case ray-casting and r-trees become appropriate.
- munificent 13y agoThis is basically a grid[1] where the resolution is down to 1 pixel. Not a bad solution! [1]: http://en.wikipedia.org/wiki/Grid_(spatial_index) http://en.wikipedia.org/wiki/Grid_(spatial_index)