[Bf-committers] BIH, BVH news and a question

Yves Poissant ypoissant2 at videotron.ca
Sat May 10 01:01:59 CEST 2008

After some time fiddling with the BIH and then reading some more papers, 
thesis and ompf forum threads, I came to the conclusion that the BIH 
implementation that was ripped from SunFlow and adapted to Blender was 
optimal. But I was not satisfied with the results so I implemented a BVH 
just to compare. The BVH alone is faster than the BIH for half of the scenes 
I had for testing purposes. Then I implemented SAH (Surface Area Heuristic) 
BVH and this one is clearly the winner. It is always faster than the BIH. 
And it is as fast to much faster than the octree. So that is good news. I 
still need to implement other triangle intersection functions and test them. 
I'm convinced I can get even more speed with a good implementation of the 
barycentric test. And I still haven't attempted to use SSE optimization yet.

Here is the question: There are a few bugs though and I need to trace the 
execution for specific pixels. What is the technique for tracing the code 
execution for specific pixels? Say I want to break into to code at pixel 
x:10,y:20. Is there a known way to do that? I can certainly find this out 
but if someone already knows the trick, that would help me. I plan to do 
that bug hunting this week-end.

BTW, the bug is related to processing shadow rays vs non-shadow rays. 
Non-shadow rays are much slower to process than shadow rays and there are no 
reasons for that especially given that the non-shadow rays are quite slower 
with BIH or BVH than with the octree. For example, it is no uncomon to get 3 
to 6 times speed improvement with scenes that uses soft raytraced shadows 
but that same improvement is difficult to get with scene that have a lot of 
reflections. So I think there is a bug with the data returned by the 
intersector when intersecting non-shadow rays.

Yves Poissant 

More information about the Bf-committers mailing list