Null traversable handle in OptixInstance

Hey @stephen.hqxu,

Yes this is an intentional feature of OptiX that you can set your traversable handle to zero and it will be ignored. Having the 1 value work in place of 0 is undefined behavior, that might not always be the case, and any non-zero value that is not a valid traversable handle is invalid input whether it crashes or not.

The goal behind this feature is to allow hiding and showing of instances when using a BVH update operation (OPTIX_BUILD_OPERATION_UPDATE). So the intended use would be to have all valid & non-zero traversable handles during the initial BVH build operation, and then you can set some to zero and update the BVH when you want to hide them. BVH updates are typically much faster than builds, but updates require that the number of instances remains constant after the initial build.

You want to avoid passing zero for traversable handles during an initial build operation, since that will lead to the empty bounding box being placed somewhere arbitrary in your acceleration structure. If you then pass non-zero during an update operation, you can end up with a wildly non-optimal AS, and tracing might be very slow.

You’re right that this isn’t well documented enough, so we will take the note to improve the documentation in the near future, thanks for pointing it out.


David.