Fast raycasting and other spatial queries

I’m not quiet sure what the numbers tell, i mean there are no other specs like your hardware and this is very scene dependend. The complexity of the scene, it’s content and the indexing technique are crucial how effective it is. I think in your game you benefit from a top-down perspective what reduces the traversal generally. A compasion of with and without index would give a better overview.

The spatial index (IndexedVolume) i made uses different techniques to effectively hierarchically perform culling, but is also used for raycasting and accessing the scene content spatially, what is very important for collisions, since every object will know everytime which objects it can collide with very reduced, without testing the tree top-down. By storing objects related to their size this also helps for distance culling and raycasting. Generally how dense the index tree is will determine how efficient it will work as well.

I’ll give some numbers when i made a new test scene and a comparsion with and without index. In some comparsion tests the results were from 1-8 fps to crash without index and stable 60 with, though it uses more techniques such as auto-instancing, impostor etc. The only real downside of a index is the insertion time, depending on if it works dynamic though. Generating a forest with a few million trees can take a while, you wouldn’t do this in production though. Instead the scene gets either serialized indexed, or it also supports a progressive chunked insertion for procedural or streamed content. As mentioned it uses more techniques for distanced content what changes the representation of the content itself, but that’s not really relevant for this topic.

btw, shouldn’t this rather go in Discussion?

2 Likes