2
$\begingroup$

I am trying to use the techniques discussed in this paper to implement a BTF into PBRT. I am stuck on how to actually interpolate the weights of the four closest sampling directions.

At the BTF, I have converted $w_o$ and $w_i$ from cartesian to spherical coordinates in order to do a lookup in the table of BTFs. The samples are taken with the following properties:

$\theta$ light (and view angles) range from 0 to 75 in 15 degree increments. $\Delta\phi$ at each $\theta$ goes from 0 to (360 - $\Delta\phi$) at -, 60, 30, 20, 18 and 5 degree increments respectively. In a table:

$\theta$ $\Delta\phi$ (0 - (360 - $\Delta\phi$))
0 -
15 60
30 30
45 20
60 18
75 5

How can I determine the four closest sampling directions given $w_o$ and $w_i$? Retrieving the values/weights seems trivial, but I don't really have a clue on how to determine the four nearest directions and just don't know where to start.

$\endgroup$

1 Answer 1

0
$\begingroup$

A simple table could be a good choice. There are a few approach's the suggestion I'll put here is just my take on the description, but it can be tweaked to your needs. In psuedocode:

const float table[6] = {0,60,30,20,18,5};
int table_index = asInt(floor(theta/15.0));
float result = table[table_index] * (theta > range);

The above is implemented as the step function in increments of 15. The last bit of the result is a range check that can be used to zap out of range values. (theta>range) evaluates to zero or one.

If this is a total miss on what you need let me know and I'll tweak it to help get closer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.