section 5.4 Film and Imaging talks about the implementation of pixel sensor and white balance algorithm used in pbrt4. I feel a bit confused by these correlated concepts.
Let's first talk about how pbrt4 converts sensor response into XYZ coordinates of CIE XYZ color space. Related code is the first constructor in src/pbrt/film.h
// first constructor
PixelSensor(Spectrum r, Spectrum g, Spectrum b, const RGBColorSpace *outputColorSpace,
Spectrum sensorIllum, Float imagingRatio, Allocator alloc);
Here r
, g
, b
in function parameters is something like color matching function(CMF) in sensor's color space. There are many predefined sensor and its color matching function in src/pbrt/util/spectrum.cpp
. For example nikon d850 and canon eos 5d mkiii.
It seems to me that pbrt4 takes it as a optimization problem. There is 24 spectrum in ColorChecker, which can be represented as RGB triplets in sensor and XYZ color space by integrating spectrum using sensor CMF and XYZ CMF separately. Pbrt4 tries to find a 3x3 matrix which converts these 24 RGB triplets in sensor color space to RGB triplets in XYZ color space with least square error. This is the first place where I feel confused. Since we can convert between different color space by a 3x3 matrix, like the matrix between sRGB and XYZ color space. Why do we need to solve an optimization problem here to find this matrix?
Another question is about white balance algorithm used in pbrt4. It seems to me that pbrt4 takes two different white balance algorithms. The first one is Von Kries Transform used in the second constructor in src/pbrt/film.h
// second constructor
PixelSensor(const RGBColorSpace *outputColorSpace, Spectrum sensorIllum,
Float imagingRatio, Allocator alloc);
which basically converts source white defined by sensorIllum
parameter to destination white defined by outputColorSpace
parameter in LMS color space.
Another white balance algorithm used in the first constructor is to use ColorChecker, again, which tries to find a best 3x3 matrix to try to minimize square error when converting RGB value of colors in ColorChecker illuminated by sensorIllum
to RGB value illuminated by standard white illuminant defined in outputColorSpace
.
Here is the second place where I feel confused. What is the difference between these different white balance algorithm, when should I use one or another?