Spatial indexing for querying objects in USD

Hi everyone!

I am currently trying to explore ways to build a spatial index of the objects within a room, so that we can figure out answers to certain types of queries, some of them being whether an object lies within or overlaps with a certain bounding box or another object (which could help us determine if any object we’re about to place on the floor does not overlap with any existing object), finding objects physically near a given object etc.

I can think of certain ways by which we can build a custom solution for this by creating an index using k-d trees, quad trees etc, but before doing that, i tried to look at the existing USD APIs and couldn’t find anything which would help meet our use cases. Do you know of anything built-in in USD which does? Or if you have any alternative suggestions, that would be appreciated as well. Thank you!

Hi @iakash , UsdGeom can transform objects from object space to world space for you, and UsdGeomBBoxCache can compute aggregate bounding boxes at any level of the transform hierarchy. But USD does not provide any further spatial partitioning facilities, nor doe Hydra, because to our knowledge, most renderers are doing this themselves (and want to be doing so for efficiency/special-needs reasons), so it would be largely unused/untested code for us to provide.

1 Like

Really appreciate your prompt and helpful response, thank you!

I could be reading into this too much but it sounds like you’re considering what I believe is object occlusion.

It’s understandable this would fall outside of this spec but if you need some helpers - “occlusion” might help your google-fu :slight_smile: