What is the best way to collide a ray with a USD scene and get the normal (and location) of the hit position? I can see a TestIntersection call on the UsdImagingGLEngine interface, but i’m not sure that does quite what I think.
Ideally I would define a ray in world space and ask the stage for the first collision with the underlying geometry. I guess I could probably do this with some AOV passes, but wondered if you could do it directly “raycast” style.
Hi @scsmith ,
I’m sending this over to the Hydra category to see if the path you are trying may bear riper fruit. We don’t really want to put any raycasting abilities down as low-level as UsdStage, because doing that efficiently brings up all kinds of issues that require the kind of thought and infrastructure that goes into renderers. You may rightly point out that in various of the schema libraries like UsdGeom, we do provide reference implementations of various algorithms with the disclaimer that they are not particularly efficient and should not be used at scale. The most complicated one of computing bounding boxes, and raycasting is several levels of complexity beyond that (especially given that core USD does not include comprehensive triangulation algorithms… we address that as part of the imaging infrastructure.