Instancing for Geometry

In OptiX, Transform can only have child of type Group, GeometryGroup, Selector and Transform. To support geometry instancing, I need to create a GeometryGroup before I can apply Transform on the Geometry. But according to OpitX’s Performance Guidelines, scene graph should be made as shallow and minimal as possible (for static scenes, a single GeometryGroup is the best).

Alternatively, I can store a transform matrix on GeometryInstance and transform the ray manually in Intersection program and Closest Hit program. But then I may need to do the transform for many times if there are many triangles in the mesh, although the transform matrix is the same for all triangles in that mesh.

So which method is better? And why OptiX doesn’t allow Transform Node to directly have Geometry Object as its child? Thanks!

Each geometry group has an acceleration structure. And the transform must be above the geometry group in the hierarchy, because OpitX transforms work with two ASs in case. The transforms must be in between high level AS and ASs of geometry groups to mark dirty and rebuild only higher AS, when the transforms change.

For static scenes for the best perf, you can shallow the hierarchy. You should have one big Geometry and there will be just one AS in the hierarchy. You don’t have to duplicate all geometry data of all the instances, but you have to provide correct intersection and bbox programs, say, it’s duplication of the primitives.

Thank you. I now realize that bundling geometry(ies) into a group and applying Transform on the group is very reasonable in my case.