Setting accel structure to context


I am beginner using Optix. I need to build bvh fast, so I use sample codes “Traversal”.

I don’t know which structure for acceleration. But, it is too slow.

So I set the acceleration to use “LBvh” and

in guide pdf , RTresult RTAPI rtuTraversalSetAccelData ( RTUtraversal traversal, const void ∗ data, RTsize data_size )

i want to use this api. Which type or data does fit to “const void* data” and “RTsize data_size”

From the API documentation :
Specify acceleration data for current geometry. Input acceleration data should be result of rtuTraversalGetAccelData or rtAccelerationGetData call.

From what I understood, what this could do to help you is to provide a way to keep your accelerating structure somewhere and to reload it whithout re-building it when needed.
So tha data parameter should be set to a pointer to the memory space containing your accelerating structure.

For example, after setting an accelerating structure accel, you could do that :

RTsize data_size;
rtAccelerationGetDataSize(accel, &data_size);
void * data = malloc(data_size);
rtAccelerationGetData(accel, data);

Which would store your acceleration structure in memory space data.
And after, when you’d need to reload it :

RTacceleration new_accel; // Which won't be built but set.
rtAccelerationSetData(new_accel, data, data_size);

If your memory space is not altered, that should give you the same acceleration structure as before.
The procedure should be the same pour traversal data.

I hope it helps.