What does Aabb mean?
I find it is used in BoudingBoxProgram.

optix::Aabb* aabb = (optix::Aabb*)result;

where result[6] is the two points to form the box?
Where can I set these values? I couldn’t find it in the SDK examples.

I also find in BoundingBoxProgram for a box (Optix SDK example, sample2):

aabb->set(boxmin, boxmax);

where boxmin and boxmax are also the vertex of the box.

What is aabb->set() intended for?


To quote the Optix API Reference which is in the OptiX doc directory:

“Aabb is a utility class for computing and manipulating axis-aligned bounding boxes (aabbs).”

You can set the values of the aabb object using aabb->set(). The first three values of result[6] will be filled by the three components of boxmin, and the last three will be filled by the three components of boxmax.

Thanks for explanation of aabb.

I just read more examples and found they either use



aabb->m_min = ...;
aabb->m_max = ...;

It seems result[6] is not used. What is it intended for?

in the programming guide
they set:
result[0] = min.x;
result[1] = min.y;
result[2] = min.z;
result[3] = max.x;
result[4] = max.y;
result[5] = max.z;

instead of:
optix::Aabb* aabb = (optix::Aabb*)result;
aabb->m_min = min;
aabb->m_max = max;

the ObjectLoader has also a m_aabb to center the objekts. i am not sure if there the boundingbox from the triangle_mesh.cu is used.
in a sample with sphere i have cuted the boundingbox by half (/2) and the sphere becomes a quadrat.
but when i try to cut a triangle it stays a triangle…

It is used. result and aabb are both pointers to the same location in memory, so if you use one, you use them both.

Specifically, result is used to pass back the values that were set in aabb.

i have to extend the boundingbox of a triangle, but its not working. tried to make the boundingbox smaller but its not working as well.
The change of the intersection programm of the mesh_triangle works.
the triangle is now a biqaudratic patch.
whats going wrong? is there a bug xD?

maybe it make sense not allow the boundingbox beeing smaller, so that the vertices would lay outside the boundingbox.
but making it bigger shouldnt be a problem.
if i choose the vertices that makes the biggest bounding box, i have no problems with my patch.
(v1(0.5 0.0 0.0), v2(0.0 0.5 0.0), v3(0.0 0.0 0.5))

but if i take vertices all lay on an axis, i ll get trouble with the patch. it seems to be cutted by the boundingbox.

tried different ways to make the boundingbox greater e.g.:

float3 tmp_min = fminf( fminf( v0, v1), v2 );
float3 tmp_max = fmaxf( fmaxf( v0, v1), v2 );
aabb->m_min = make_float3(tmp_min.x-1000,tmp_min.y-1000,tmp_min.z-1000));
aabb->m_max = make_float3(tmp_max.x+1000,tmp_max.y+1000,tmp_max.z+1000));

i checked if i made mistakes with the setup of the right bounding box:
1.loading the right .cu files with correct programm name

std::string path = std::string(sutilSamplesPtxDir()) + "/MyProject_generated_triangle_mesh.cu.ptx";
m_bbox_program = m_context->createProgramFromPTXFile( path, "mesh_bounds" );

same path like the intersectionprogramm, which is working.

2.set the boundingbox

mesh = m_context->createGeometry();
mesh->setPrimitiveCount( num_triangles );
mesh->setIntersectionProgram( m_intersect_program);
mesh->setBoundingBoxProgram( m_bbox_program );

where could be a mistake?

in sample 7 iam be able to cut the sphere to a cube by changing the boundingbox like that:

aabb->m_min = cen - rad/2;
aabb->m_max = cen + rad/2;

and made the parallelogram smaller:

aabb->m_min = fminf( fminf( p00, p01 ), fminf( p10, p11 ))+ make_float3(0.3,0,0.3);
aabb->m_max = fmaxf( fmaxf( p00, p01 ), fmaxf( p10, p11 ))- make_float3(0.3,0,0.3);

But i have not managed to change the boundingbox of the triangle_mesh.cu.
The sample primitiveIndexOffsets could be used to try this. but i have no success with it.
i cant change the boundingbox of such a triangle. Or i can change it but a result is not displayed.
is there a global setting or something like that why its not working?
hope i could point out my problem.

if “NoAccel” is used for the traverser and the Builder no boundingbox is used. so in the primitiveIndexOffsets sample makes no use of the programm mesh_bounds.

if i set no acceleration, my biqaudratic patches arent cutted by a bounding box , cause its not used.
but it works only with a low count of patches.

in sample 7 bvh/bvh is used, which uses the boundingbox programms of the sqhere and the parallelogram.

i think Sbvh/bvh is not useing the boundingbox programm. my extended boundingbox seems not to work with it.
i tried bvh/bvh, its working. my extended boundingbox works. havent set any refine or refit.
sbvh “can be used for any type of geometry”, but it seems that if the specialized properties (acceleration->setProperty( “vertex_buffer_name”, “vertex_buffer” );acceleration->setProperty( “index_buffer_name”, “vindex_buffer” );)
are set, the bounding box programm is not used any more.

which builder and traverser should i use? i have a mesh of biqaudratic patches. every patch has 3 vertices, 3 normals. the boundingbox is a little bigger than the boundingbox of a triangle would be.

tried to run sbvh/bvh without setting the specialized properties, but its not working.
boundingbox is not extended.