ALTA  alpha
Non-Linear Fitting Tutorial

In this tutorial, we will see how to fit a Blinn-Phong BRDF model to the blue-metallic-paint dataset from the MERL library (please click on the picture to change the horizontal position of the vertical cut):


Data conversion

The first step is download and convert the dataset into ALTA internal format. This will ease the manipulation of data afterwards:

$ wget

will download the dataset and

$ data2data --input blue-metallic-paint.binary --in-data data_merl --output blue-metallic-paint.dat

this conversion requires to use the data_merl plugin to load MERL binary files and convert them into ALTA's internal format. This format allows to filter elements using the min and max option for example. Those options enable to specify the minimun and maximum abscissa of the data used during fitting. For example:

$ data2data --input blue-metallic-paint.dat --max [0.8, 0.01, 0.01] --output blue-filtered.dat

will remove data elements such that \( \theta_H > 0.8 \;\mbox{rad} \), \( \theta_D > 0.01 \;\mbox{rad} \), and \( \phi_D > 0.01 \;\mbox{rad} \). This will allow us to fit only the configuration close to \( L = V \).


Finally, we fit the sum of a Lambertian term and the Blinn-Phong lobe. To generate this compound we use the bracket operator in command line and the nonlinear_function_diffuse and nonlinear_function_blinn plugins:

$ data2brdf --input blue-filtered.dat --output blue-metallic-paint.func --func [nonlinear_function_diffuse, nonlinear_function_blinn] --fitter nonlinear_fitter_ceres

In this example, we used the nonlinear_fitter_ceres fitting plugin, but any other nonlinear fitter would be good as well. Notice that you might experience different results depending of the fitter you used, due to the difference in the underlying fitting procedure (CERES uses a Levenberg-Marquardt algorithm).

Here we provide the resulting BRDF file and the associated Python and XML scripts:

BRDF file Python script XML script