[OptiX] Validation error saying I'm missing an "internal bounding box program"?

I’m using the OptiX SDK for GPU-accelerated raytracing. My work uses GTX 1080 TI GPUs with the 410 Linux Drivers, so I’m using OptiX 5.1.1. I’m setting up a simple application to get a feel for OptiX and GPU raytracing in general, but I’m getting an error about “GraphNode does not have an internal bounding box program”

My current node graph looks like this:

RTgroup
   |
  \|/
RTgroup -> RTacceleration
   |
  \|/
RTtransform
   |
  \|/
RTgeometrygroup
   |
  \|/
RTgeometryinstance -> RTmaterial
   |
  \|/
RTgeometry

It’s the skeleton of the node graph my application will eventually have to support

My RTgeometry has an intersection program and a bounding box program set on it. My RTmaterial has an any hit and closest hit program set on it. I’m using the Trbhv acceleration structure in my RTacceleration node. The top RTgroup in my node graph is set to the top_object variable on my RTcontext, and my ray generation program launches rays against the top_object variable. As far as I know this is all correct - but when I call rtContextValidate right before rtContextLaunch I get back the validation error about GraphNode not having an internal bounding box program

I’m not sure which GraphNode this error is referring to. I’ve read through the OptiX programming guide a few times and the only nodes that can have bounding box programs attached to them are RTgeometry nodes - and the only one of those that I have definitely has a bounding box program. I’m also not sure about what an “internal” bounding box program is - is there something I have to set other than the RTgeometry’s bounding box program?

I’ve tried a few things to debug this. I’m calling rtContextGetErrorString after almost every OptiX function call and the only error I get is about the missing internal bounding box when I call rtContextValidate right before rtContextLaunch. I’ve also simplified my node graph as much as I can, to this:

RTgroup -> RTacceleration
   |
  \|/
RTgeometrygroup
   |
  \|/
RTgeometryinstance -> RTmaterial
   | 
  \|/
RTgeometry

I get the same error when I do that, however

Which node might the validation error be referring to? How do I set an internal bounding box program?

I have not seen that error message before and don’t find it in the current code branch.

If that is your full scene graph, the RTgroup in the first and the RTgeometrygroup in both graphs are missing the RTacceleration.
All OptiX render graph nodes with “group” in the name must have an RTacceleration assigned.

If all your RTgeometry nodes have an intersection and bounding box program, that’s fine.
If you use motion geometry, the bounding box program needs to have a different signature and implementation.

On your first graph, there is no reason to have a chain of RTgroup->RTgroup nodes in the render graph.
In the second graph the RTgroup can be removed and RTgeometrygroup is the top object.

When starting with OptiX please watch the “OptiX Introduction” presentation from GTC 2018 and work through the accompanying OptiX Advanced Samples code on github. It explains these things step by step, including the layout for minimal render graphs which have the structure you’ll need.
Links here: https://devtalk.nvidia.com/default/topic/998546/optix/optix-advanced-samples-on-github/

This is my full scene graph. Does each RTgroup and RTgeometrygroup node need its own RTacceleration, or is there a way to share them? The programming guide isn’t very clear about what the acceleration structures look like and how they interact with each other

I agree that there’s no reason right now to have two RTgroup nodes, except that I was planning on having one RTgroup for the whole scene, then on RTgroup for static objects and another RTgroup for non-static - the programming guide suggested this to avoid full-scene acceleration structure rebuilds

I’ve been looking at the samples and docs in the OptiX 5.1.1 SDK, but I’ll definitely check out presentation and the samples on GitHub

Update: I’ve added RTaccelerations to all my RTgroups and RTgeometrygroups and I still got an error… then I noticed I was creating one of my acceleration groups with the “Trbhv” builder, instead of the properly-spelled “Trbvh”. Once I fixed that, I was able to get some results!

Thank you very much for your help

Acceleration structures (AS) can be shared among RTgeometrygroup nodes if the geometry underneath them is the same. This AS sharing greatly reduces the required amount of memory and AS build time.
This is normally used when instancing geometry groups with identical geometry but different looks since the material is defined by data at the RTgeometryinstance level.

The OptiX Programming Guide shows an example in figure 3.4
http://raytracing-docs.nvidia.com/optix_6.0/guide/index.html#host#shared-acceleration-structures
and my OptiX Introduction presentation explains that with the minimal necessary scene graphs.
http://on-demand-gtc.gputechconf.com/gtc-quicklink/4JAjAp
The optixIntro examples don’t use instancing that, but it’s very simple to add.