Commit 1146417f authored by Laurent Belcour's avatar Laurent Belcour

Adding tutorials to the documentation.

parent c61e666e
......@@ -9,7 +9,7 @@ OSX's format.
<h2>Fitting using the command line</h2>
<h3>Rational interpolation</h3>
<h3>1D Rational interpolation</h3>
The \a data2brdf allows to perform a fitting procedure by converting a \ref
data object into a brdf object (also named \ref function).
......@@ -22,7 +22,7 @@ First, download the Kirby2 dataset in ALTA format: <a href="http://alta.gforge.i
The result can be exported using the \a brdf2data commands.
\verbatim
$ ./build/data2gnuplot --input Kirby.brdf --output Kirby.dat --in-data ../data/1d/NIST/Kirby2/Kirby2.dat
$ ./build/data2gnuplot --input Kirby.brdf --output Kirby.dat --in-data ../data/1d/NIST/Kirby2/Kirby2.dat
\endverbatim
The \a 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).
......@@ -31,7 +31,7 @@ You should obtain gnuplot data files like the following image:
\image html Kirby2.png
To convert this brdf file to be used in another software (here matlab),
To convert this brdf file to be used in another software (here matlab),
you will need the following command:
\verbatim
$ ./build/brdf2brdf --input Kirby.brdf --output Kirby.m --export matlab
......@@ -44,6 +44,46 @@ distribution).
<br />
<h3>2D Rational interpolation of BRDFs</h3>
In this example, we will show how to perform data conversion and vertical segments interpolation of the <em>gold-metallic-paint</em> material from the MERL database using the command line programs on an OSX platform. First download the binary file <a href="http:///">gold-met.binary</a> and copy it to the <em>$ALTA/data/3d/merl</em> directory.
The first command we will execute will convert the three dimensional data in a 2D slice in the halfway vector parametrization:
\verbatim
$ ./build/data2data --input ../data/3d/merl/gold-met.binary --in-data ./build/libdata_merl.dylib --output ../data/2d/merl/gold-met.exr --out-data ./build/lib
\endverbatim
The \a data_merl plugin permits to represent BRDF slices using HDR image files (.exr format). The output of this command should look like:
\image html gold-met-merl.png "gold-metallic-paint slice"
Then, we perform fitting of this 2D BRDF slice:
\verbatim
$ ./build/data2brdf --input ../data/2d/merl/gold-met.exr --data ./build/libdata_brdf_slice.dylib --output gold-met.brdf --fitter ./build/librational_fitter_parallel.dylib --func ./build/librational_function_chebychev.dylib --min-np 60 -- np 100
\endverbatim
This outputs a BRDF file which cannot be displayed directly. To seen the result of our fitting, we can export this BRDF into the BRDF image slice format:
\verbatim
$ ./build/brdf2data --input gold-met.brdf --output gold-met-rat.exr --data ./build/libdata_brdf_slice.dylib
\endverbatim
It is now possible to perform side by side comparison of the original data, and the interpolated rational function:
<center>
<table border="0" style='text-align:center'>
<tr>
<td>
\image html gold-met-merl.png "gold-metallic-paint slice"
</td>
<td>
\image html gold-met-rat.png "gold-metallic-paint slice fitting using R-BRDFs"
</td>
</tr>
</table>
</center>
<br />
<h3>Non-linear fitting</h3>
In this example, we use Google's <a href="http://code.google.com/p/ceres-solver/">CERES</a> nonlinear fitter to approximate the
blue metallic paint from the <a href="http://www.merl.com/brdf/">MERL database</a> using a Lafortune lobe (Note that we do not provide the data in ALTA package, you will have to download it). The resulting BRDF is exported in a shader format compatible with BRDF Explorer.
......@@ -58,7 +98,7 @@ This command line is rather long. To help you design complex command line in a m
<h3>XML scripts</h3>
Here is the script to perform the same fitting as the previous example. It
Here is the script to perform the same fitting as the previous example. It
performs the fitting of the blue metallic paint from the MERL database using
a Beckmann lobe (note there is no shadowing term, nor Fresnel term):
......@@ -78,7 +118,7 @@ a Beckmann lobe (note there is no shadowing term, nor Fresnel term):
<function name="nonlinear_function_diffuse" />
<function name="nonlinear_function_beckmann">
</function>
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="nonlinear_fitter_ceres" />
......@@ -86,7 +126,7 @@ a Beckmann lobe (note there is no shadowing term, nor Fresnel term):
<plugin type="data" name="data_merl" />
<!-- Parameter -->
<parameter name="export" value="explorer" />
<parameter name="export" value="explorer" />
</action>
</alta>
\endverbatim
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment