Whereas huge computational effort would be necessary to predict the colour of a dye starting from the physics of the molecules, in those cases where the colour is due to interference or refraction, we can test our understanding by doing model calculations.
Images showing the results of such calculations have been included in the other sections; here now I show the details of the calculations and also give the source codes of the images.
To compute a colour, in the first step one has to obtain the spectrum of the colour stimulus, i.e. its intensity as a function of wavelength. In the second step, the colour matching functions of the CIE 1931 standard observer are used to project the spectral information on the three dimensional colour space, to obtain the tristimulus values X, Y, and Z.. In the third and last step, X, Y, and Z are transformed to the R, G, B values for the sRGB primaries which are standard for computer screens.
The sample PostScript figures given are not suited for inclusion in any document as they may need several minutes of computing. They should be converted to png or jpeg before.
Without much physics a simple approximation for the colour stimulus is used to demonstrate in some detail how colour is computed for rendering in print or on the screen. The Fortran code. An EPS figure (encapsulated PostScript).
Using the refractive indices and absorption coefficients of the substances, the exact expressions for the reflected and transmitted intensity distributions are obtained in a straightforward way and applied to thin films on a substrate, thin metal films . . . Sample EPS (gold foil)
Here now the general case (arbitrary angle of incidence) is treated with the transfer matrix method. Colour as a function of angle of incidence: Sample EPS. Colour as a function of periodicity interval: Sample EPS.
|Reflection of light by screw structures|
This section contains codes and samples based on the Bohren-Huffman Mie scattering subroutine: colloidal metal solutions (gold ruby glass), rainbow, glory, aureole around the sun.