# Background

This section provides a brief overview of the Kubelka-Munk model and describes the paint data used in this simulation.

Kubelka-Munk

The Kubelka-Munk model is a mathematical model for describing the internal reflectance of a pigmented substance, such as paint. A full discussion is beyond the scope of this summary, though the details are presented in several places including [Okumura, Budsberg]. Essentially, Kubelka-Munk models the absorption and scattering of light as it travels perpendicularly up and down through a medium. The model is characterized by two constants: K, the absorption coefficient and S, the scattering coefficient. These two coefficients (once measured) can then be used to calculate the (theoretical) reflectance of a substance, such as a layer of paint. If it is assumed that the paint is opaque (hence, light will not reach and be reflected off of the canvas) the paint can be treated as having infinite thickness which allows the reflectance to be calculated as:

R = 1 + (K/S)-[(K/S)^2+2(K/S)]^0.5

This, however, applies to only a substances with a single K and S value, but we wish to model mixing several such substances together. The K and S values of a mixture can be calculated as a weighted sum of the K and S values of the components:

K = c1 k1 + c2 k2 + … + cn kn
S = c1 s1 + c2 s2 + … + cn sn

Where kn, sn are the K and S values of each component of the mixture and each cn is the relative concentrations of each component in the overall mixture, with the cn's summing to 1.

The Kubelka-Munk theory only models the internal reflectance of paint and does not take into account surface reflection. [Okumura] applies the Saunderson equation to account for this. A reflectance value, K1, is defined to account for light reflected from the surface of the paint (for, example, due to Fresnel's law). A second value, K2, is defined to characterize the diffuse reflection at the top boundary due to light scattering in the paint. The measured reflectance, Rm, can then be expressed as:

Rm = [(1-K1)(1-K2)R]/(1-K2R)

Specular Highlights

Since Kubelka-Munk only calculates the diffuse reflectance, we add in some specular highlights based on the method in [Budsberg] which applies Blinn-Phong:

X = X(n·l)+Ex(n·h)^k (and similarly for Y and Z)

where: n is the canvas normal, l is the vector from the canvas point to the light, h = (l+e)/2, with e the vector from the canvas point to the camera, E is the spectral distribution of the current illuminant, x is the observer matching function and k is the specular exponent.

Paint Data

The paint data used for this simulation was obtained from here which was the data developed by [Okumura]. The dataset represents 27 acrylic paints (GOLDEN Matte Fluid Acrylic Paints) and contains reflectance measurements and the calculated K and S coefficients.

Paint Simulation

The physical paint simulation was based on [Baxter, Impasto]. There are two components to the simulation: transfer of paint between the brush and canvas and advection of paint between between neighbouring canvas cells (paint pixels).

Paint Transfer

Moving paint between brush and canvas (and vice versa) uses the algorithm presented in [Impasto]. The essentials of the algorithm are:

• The direction that paint is moved depends on whether there is more paint on a brush bristle or a canvas pixel

• For a single bristle/pixel, paint only moves one direction at a time (but since each bristle is evaluated separately, the brush as a whole may still have paint moving to and from it at the same time)

• Paint transfer rates are smoothed out when near certain thresholds, defined in the pseudo code provided in the Impasto paper

It should be noted that [Impasto] has a more detailed simulation of a physical brush and calculates how much of the brush penetrates into the paint. I deal with a simple 2D brush and, as such, use a single constant value for the degree of penetration of the brush into the paint which seems to work reasonably well.

When paint is transferred, either to or from a pixel or a brush bristle, the total volume of paint in the destination is increased by the calculated transfer amount and the concentrations of each paint are readjusted accordingly. This triggers the pixel's reflectance (and hence, colour) to be recalculated according to Kubelka-Munk during the next render pass.

This is the process by which paint can be pushed around the canvas by the brush while painting. [Impasto] uses a simplified cell-based (ie, pixel-based) fluid simulation and this is what I base my implementation on. As with paint transfer, my version is simplified somewhat due to the simplified brush model. In [Impasto], brush pressure plays a part in the computation of the velocity field. Since I do not simulate the individual motion of brush bristles or make use of haptic or other more complex input devices than the standard mouse as in [Baxter], I omit the pressure contribution to paint velocity – my velocity is, essentially, just the velocity of the mouse.

As with paint transferal, advection causes paint to be added to or removed from pixels which causes paint concentrations, and thus reflectance, to be recalculated. One thing to note is that as with [Impasto], this simulation also prevents the advection process from completely removing paint from a pixel.

References

[Baxter] Baxter, William, 2004. “Physically-Based Modeling Techniques for Interactive Digital Painting.” PhD Thesis, University of North Carolina at Chapel Hill.

[Impasto] Baxter, William, Wendt, Jeremy, Lin, Ming C. “IMPaSTo: A Realistic, Interactive Model for PaintIn the proceedings of NPAR 2004.

[Okumura] Okumura, Yoshio, 2005. “Developing a Spectral and Colorimetric Database of Artist Paint MaterialsMasters Thesis, Rochester Institute of Technology.

[Budsberg] Budsberg, Jeffrey, 2007. “Pigmented Colorants: Dependence on Media and TimeMasters Thesis, Cornell University.