Spectral Transmittance Database
===============================

This README file documents the spectral transmittance database associated with
the following publication:

> Varsa, P.M.; Baranoski, G.V.G., *Rendering the bluish appearance of snow: When
> light transmission matters*, IEEE Computer Graphics and Applications, Vol. 44,
> No. 1, pp. 50-61, January/February 2024. 

The database is provided as a comma-separated value text file of spectral
transmittance values. Each column in the file represents a spectral wavelength,
as discussed in our work. Each row in the database represents the spectral
transmittance values for a particular set of parameters, namely, a spectral
sample.

A Matlab file is also provided to aid in the use of this dataset. The Matlab
file contains functions that aid in loading and understanding the data. These
functions are described below.

Example code is provided that demonstrates how to load the contents of the
database into a Matlab matrix. Then the index of a particular spectral sample is
computed using the provided *getIndex()* function. Finally, the specified
spectrum is retrieved from the loaded spectral transmittance database. For
simplicity, the retrieved spectrum is not utilized for any purpose.
Consequently, no output is generated.

**NB**: Recall that Matlab arrays and matrices are one-based.

getLambda()
-----------
Input arguments: none

This function returns an array of wavelengths associated with the columns in the
database. The wavelengths are given in nanometres (nm). It is hard-coded to
return 31 wavelengths from 400 nm to 700 nm (inclusive) with a spectral
resolution of 10 nm.

getSpectra()
------------
Input arguments: none

This function loads the spectral database and returns it as a matrix. Each row
of the matrix represents a spectral sample. Each column in the matrix is
associated with a wavelength returned by the *getLambda()* function.

getSampleConstants()
--------------------
Input arguments: none

This function returns an object that contains the constants used to specify an
entry in the spectral transmittance database. Members of the object that are
used to specify a spectral sample are described in the table below. The object
also contains some computed values that are used to determine the index of a
specified spectral sample.

The *constants* object contains the following values that can be used to specify
a spectral sample.

| Object Member   | Description                                       |
| --------------- | ------------------------------------------------- |
| facetnesses     | Stores five values of facetness as numeric values |
| grain_sizes     | Stores nine grain sizes as numeric values         |
| densities       | Stores five densities as numeric values           |
| incident_angles | Stores ten incident angles as numeric values      |
| thicknesses     | Stores 11 thicknesses as string values            |

getIndex()
----------
Input arguments: grain size, density, facetness, incident angle, thickness

The five input parameters may be specified as values obtained from the object
returned by the *getSampleConstants()* function. The function computes the
index of the row in the matrix returned by the *getSpectra()* function that is
associated with the specified parameters. This index may then be used to access
the spectral values in the database.

Since Matlab matrices are one-based, this function will need to be adapted if
ported to a programming language that is zero-based, such as C++ or Java.

