ALTA  alpha
A simple 1D rational fitting

In this tutorial, we will see how to use commands from the command line to approximate a 1D function described by a set of points. For this, we will use the Kirby2 dataset from the US National Institute of Standards and Technology. There are certified values for a rational approximation of this dataset:

\( y = \frac{b_1 + b_2 x + b_3 x^2}{(1 + b_4 x + b_5 x^2)} + \epsilon, \)

where \( b_1 \simeq 1.67, \; b_2 \simeq -1.39e^{-1}, \; b_3 \simeq 2.59e^{-3}, \; b_4 \simeq -1.72e^{-3} , \;\mbox{and}\; b_5 \simeq 2.16e^{-5} \).

The data2brdf allows to perform a fitting procedure by converting a Data object into an approximate function object.

First, we need to download the Kirby2 dataset in ALTA format: Kirby2.dat. Save this file in $ALTA/Kirby2.dat.

$ data2brdf --input Kirby2.dat --output Kirby2.brdf --fitter rational_fitter_eigen

The result can be exported using the brdf2data commands.

$ brdf2data --input Kirby2.brdf --output rational-example-01.dat --data-file Kirby2.dat

The brdf2data allows you to export a function into a data file. If no data plugin is specified, the ALTA format is used which is gnuplot compliant. The position of evaluation for the function are taken from a specified data file (here the original Kirby2 file).

Using gnuplot for example it is possible to visualize the resulting function approximation. Here is a plot of the original data and exported data:


To convert this brdf file to be used in another software (here matlab), you will need the following command:

$ brdf2brdf --input Kirby2.brdf --output Kirby2.m --export matlab

brdf2brdf converts an ALTA brdf file into another format such as Matlab m file, C++ code, or BRDF Explorer shader. Note that this tool cannot convert to another ALTA file (e.g., converting a Blinn lobe to a Beckmann distribution).

Here we provide the resulting BRDF file and the XML script used to generate it:

BRDF file BRDF file