jME3 raytracing - BIH collision/picking





This image was generated entirely with AWT and a simple raytracer written for jME3, no OpenGL was used!

This is mainly a test for a newly written Bounding Interval Hierarchy (BIH) scene and mesh partitioning algorithm that will be used for picking and collision detection in jME3. A raytracer is an excellent way to test the performance of a partitioning algorithm which is why I used it to test the system.

Interesting stuff. How much do you think it will improve the collision detection and picking performance?

Alric said:

Interesting stuff. How much do you think it will improve the collision detection and picking performance?

I don't think, I test  :wink:


Loading teapot.obj..
Loading AWT frame
Generating BIH tree for triangle array..
Scene contains 6320 triangles
Generation took: 477.871193 milliseconds
Tree takes up 1491672 bytes
Creating AWT frame contents..
Ray tracing start. # of rays: 786432
Raytracing finish. Took 6.318 seconds
rays/sec: 124474.83380816715
Ray tracing start. # of rays: 786432
Raytracing finish. Took 5.99 seconds
rays/sec: 131290.81803005008
Ray tracing start. # of rays: 786432
Raytracing finish. Took 6.053 seconds
rays/sec: 129924.3350404758
Ray tracing start. # of rays: 786432
Raytracing finish. Took 5.975 seconds
rays/sec: 131620.41841004184

Interesting. Bounding Interval Hierarchy? It is still ray/triangle intersection at its core?

vear said:

Interesting. Bounding Interval Hierarchy? It is still ray/triangle intersection at its core?

Yeah. But the number of triangle/ray intersections are reduced by a lot, instead of checking 6000 triangles per ray (brute force), only 100~ are made with BIH.

BIH is similar to BSP- in bsp, you use 1 arbitrary plane to split a node into two children. In BIH, you use 2 axis aligned planes to split into two children, so the two methods are quite similar.
The benefit is that BIH is generated much much faster than BSP (think minutes vs. days), BIH is more numerically stable, and BIH is simpler to implement.

Right now BIH is only used for mesh partitioning, scene partitioning will probably be done with an octree which works better for scenes where there is a lot of empty space.

I optimized the axis and split function, the structure is now built to be a little more effective. Reduced memory requirements for the collision tree from 1.5MB to 200KB.

Momoko_Fan said:

I don't think, I test


With that point of view you would be the worst tester on the earth :) hehe :) good luck with this implementation.

Wow~. There are so many interesting and attractive stuffs in jme3.