Friday, March 2, 2007

Ray Tracing Progress


I have made some progress with my ray tracing endeavor on the SPU. The renderer now renders coloured triangles as you can see in the image on the right. It is still un-shaded, but it renders using 6 SPUs at 19.5 fps at a 480x480 pixel resolution for a 304-triangle model. I use no spatial subdivision, so all triangles are tested if the bounding sphere is hit by the ray. The triangles are tested 8 at a time though. All operations are performed with two SIMD instructions, that each process 4 32-bit floats. I opted to test 8 at a time as opposed to the more natural 4 at a time, because this way I get more independent operations that can be pipelined properly. I have also implemented an algorithm that tests 8 spheres for intersection in a single go. Spatial subdivision will be a challenge, as I should somehow create batches of 8 to test. I really need to find some extra performance. The ray tracer of Jacco Bikker shows what is possible. Also, how on earth am I going to implement CSG in a SIMD-friendly manner without much branching? I need to study the algorithm of S D Roth. Unfortunately, this paper is not online.

1 comment:

Nigel said...

Great job Bram, I was just wondering when an update would apear on your blog :)

I must admit not to be sure what exactly you did, but the image speaks for itself...