Hello,
I’m having trouble passing a buffer of graph nodes to Optix.
Is it possible?
Do you have code examples showing how to do so or some indications?
More details
We need to trace rays to a set of specific graph nodes (more specifically transform nodes).
This minimal example works for a single node passed as a context variable.
// Host
context["MyTestNode"]->set(myObject.transformNode) // transformNode is an optix::Transform
// Device
rtDeclareVariable(rtObject, MyTestNode, , ); // rtObject on the device side
rtTrace(MyTestNode, ...);
/* this works */
Now we need to support a dynamic set of nodes so we’re trying to send them to the device in a buffer.
// Host
memcpy(nodeBuffer->map(), nodes.data(), sizeof(optix::Transform) * nodes.size()); // nodes is a vector<optix::Transform>
nodeBuffer->unmap(); // Set up as RT_FORMAT_UNSIGNED_INT or Optix warns that the data should be 4-byte long when using USER_FORMAT with sizeof(optix::transform)
context["MyTestBuffer"]->setBuffer(nodeBuffer);
// Device
rtBuffer<rtObject> MyTestBuffer;
for (int i = 0; ...)
{
rtObject node = MyTestBuffer[i];
rtTrace(node, ...);
/* this does not work */
}
I suspect that its’ a type/data size issue.
There are several types available for nodes (rtObject, RTobject, RTtransform, optix::Transform, optix::TransformObj) but I’m pretty confused about the correct ones to use in that case, on the host & device sides.
Thanks