# possible inconsistency of bin numbers between BSDF and kelms_int.cal

Hi all:

I have a question about the bin number.

To calculate view matrix: (south-facing window)
\$ rtcontrib < test.pts -f klems_int.cal -bn Nkbins -b kbinS -bn Nkbins -m
window_mat -I+ -ab 3 -ad 2000 -lw 1e-4 interior.oct > south.vmx

kbinS uses the (0, 1, 0) as normal (pointing to inside room).

For a ray direction (-1, -1, 0), using klems_int.cal to calculate the bin
number, the bin number is about #57 (I did it manually).

Klems_init.cal<https://dl.dropbox.com/u/15562376/klems_int.cal>)
seems use "z" hemisphere (see this figure:
https://dl.dropbox.com/u/15562376/coordinate.jpg). From the figure, we can
see "z" hemisphere points to the room (that is, the hemisphere is located
in the room) "zr" (z reverse) hemisphere is towards outside (the hemisphere
is outside the room).

The possible inconsistency is:

(1) Klems_int.cal uses "z" hemisphere to calculate the bin number, for
example, for ray direction (-1, -1, 0), the bin number is #57 for "z"
hemisphere coordinate. (see this figure:
https://dl.dropbox.com/u/15562376/bin.jpg)

(2) The "Transmission Back" data in the BSDF .XML is used in the three
phase DC method (see Greg's
and thus the calculation is based on "zr" (z reverse) hemisphere , for ray
direction (-1, -1, 0), the bin number is about #69 according to the "z
reverse" hemisphere coordinate (see this figure:
https://dl.dropbox.com/u/15562376/bin.jpg).

So my questions are:

(a) Given the ray direction, which hemisphere ( "z" or "zr" ) does
"Klems_init.cal" use?

(b) whether the bin numbers (for the same ray direction) between
"Klems_int.cal" and BSDF .xml are inconsistent or not?

(c) if they are using different bin numbers, how to handle ViewMatrix *
BSDF in the calculation?