Sunday, April 22, 2012

k-d Visualization

Just as a sanity check, I decided to make sure that my k-d implementation is actually working.  I visualized the "work" that each pixel is doing (where work is the number of kd cell traversals).

Here's an image of the asteroid scene with this visualization:


Indeed, it works!  Not only that, but I was amazed by how precise the tree was.  If you look closely you can see the grid-like structures of the k-d splitting planes.  I had no idea that they could partition the scene so effectively!  No wonder I haven't been able to get any improvements by tweaking the construction (I'm using the surface area heuristic, so I should be getting almost-optimal trees).

Well, that's good...but it's getting really hard to figure out where I'm going to find that last 2-3x performance boost that I need.  I've tried several types of data compression (in particular, I cut down the scene size by half using fixed-point shorts, but that only lowered performance).  I've tried refactoring the shader in many different ways to no avail.  I've tried adding an index buffer to conserve vertex storage...which hurt performance.

I'm unsure of where I'm losing performance.  I thought I was bandwidth-limited, but attempts at compression seem to reveal otherwise.  Yet arithmetic optimization isn't yielding any fruit either.  Where are you hiding, you sneaky clock cycles?  Is this really as good as it's going to get without CUDA?  I hope not.

No comments:

Post a Comment