I’m working on ray-tracing applied to ultra-sonic wave simulation. The results OptiX produce are stored into a 3D buffer that is transferred to the CPU memory in order to be read by a C++ program.
My problem is the following : I don’t exactly know how to get the (x,y,z) element from my buffer once it’s mapped.
First, I wrote an accessor like this :
size_t global_id_element = x * n_y * n_z + + y * n_z + z;
It didn’t work so my new accessor is the following :
size_t global_id_element = x + n_x * (y + n_y * z);
Is it correct ?