We have been working on partitioning the media in a KD-tree to speed up the image rendering time as well as the contruction time of the photon beam map.
We define the space of the media with a bounding volume. This volume as well as any nodes/leaves in the tree are axis-alligned.
At the moment we find out wich axis to split along by just taking the longest side of the bounding volume. This should probably be changed, so we analyze the best split along all three axis instead of just one.
When the axis is found, just like the paper, we construct a graph describing the "thickness" of the media along the given split axis.
Say the split axis is the x-axis, see image above. To construct this graph, we move along the x-side of the bounding volume of the tree-node in small steps.
Each step is an x-coordinate and this defines a plane or "slice" through the media perpendicular to the x-axis. We take a number of samples in this slice, the red dots in the image above. We keep track of the largest (max) and smallest (min) extinction value found in each slice, and the value
graph(x-coordinate) is then max-min.
The graph could the e.g. look something like this:

Meaning the media is thicker with higher x-values.
To find the x-coordinate to split along, we attempt to solve the largest empty square problem.
The idea is that we want to create a split, which would divide the media in two: a volume with high extinction and a volume with low. We want to find the largest square above the graph, as shown in the picture.
A division of the above graph could e.g. be ~1/3 in, as marked with the blue line. This will give us the x-coordinate and plane to use to subdivide a node in the kd-tree.
To determine whether to subdivide or not, we have a cost function:
area of rectangle - 1
If this is > 0, we split.
We now need to use this tree when rendering and constructing the KD-tree, to see if it speeds things up.