Hello there,
I am currently investigating Bullet as a solution for a ray tracer. I do not need real time performance at all but to cast at most 10000 rays / frame. Unfortunately, the performance is not good. There is a linear access to all objects in the scene and the stackless walk seems really slow. Is there any precaution I did not take or is it not really well supported?
[EDIT]
To be more precise, I am using a "optimizedBvh" to accelerate the triangle meshes intersections. There are stg like 16 mesh of about 500 triangles.
[/EDIT]
Ben
Raytracing performance issue
-
- Posts: 3
- Joined: Tue Jul 17, 2007 12:50 pm
Re: Raytracing performance issue
I keep on my investigations. I am using a non-quantified tree and walkStacklessTree seems to have a strange behaviour.
indeed this loop:
is taken more than 1000 times for *one* given ray. Any idea? Maybe I make stg bad with the creation of the BVH mesh but the intersection points are right (i.e. the final result is good). Sounds to me as if all leaves and nodes were visited by the algo.
Ben
indeed this loop:
Code: Select all
while (curIndex < m_curNodeIndex)
{
//catch bugs in tree data
assert (walkIterations < m_curNodeIndex);
walkIterations++;
aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMinOrg,rootNode->m_aabbMaxOrg);
isLeafNode = rootNode->m_escapeIndex == -1;
//PCK: unsigned instead of bool
if (isLeafNode && (aabbOverlap != 0))
{
nodeCallback->processNode(rootNode->m_subPart,rootNode->m_triangleIndex);
}
//PCK: unsigned instead of bool
if ((aabbOverlap != 0) || isLeafNode)
{
rootNode++;
curIndex++;
} else
{
escapeIndex = rootNode->m_escapeIndex;
rootNode += escapeIndex;
curIndex += escapeIndex;
}
}
Ben
-
- Posts: 3
- Joined: Tue Jul 17, 2007 12:50 pm
Re: Raytracing performance issue
Ouch, I've just understood the algorithm. The real ray tracing algo is replaced by a box/box intersection test. Therefore:
1/ the ray is given by src and dst
2/ we compute the bbox [min(src,dst), max(src,dst)]
3/ the proper bvh / ray traversal is replace by a recursve bbox/bbox overlap test.
This is unfortunately extremely inefficient if the rays are "big". Do you plan to write a real intersector? I have my self some code which make this job. Maybe It may help.
Ben
1/ the ray is given by src and dst
2/ we compute the bbox [min(src,dst), max(src,dst)]
3/ the proper bvh / ray traversal is replace by a recursve bbox/bbox overlap test.
This is unfortunately extremely inefficient if the rays are "big". Do you plan to write a real intersector? I have my self some code which make this job. Maybe It may help.
Ben
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Raytracing performance issue
It is best to use the quantized version. It should perform an additional ray-versus-aabb test, and doesn't traverse the subtree if the ray doesn't intersect the aabb.
Contributions are welcome, so if you have some performance improvements and/or better raycast benchmark, let us know.
Thanks,
Erwin
Contributions are welcome, so if you have some performance improvements and/or better raycast benchmark, let us know.
Thanks,
Erwin