This directory contains data from the paper:
"Predicting Appearance from Measured Microgeometry of Metal Surfaces", by Dong, Walter, Marschner, and Greenberg, ACM Transactions on Graphics, Dec 2015
http://dl.acm.org/citation.cfm?id=2815618

*** Update May 16, 2017: Fixed a software bug that had corrupted many of the patch data files, incorrectly replacing many with duplicates of prior patch data.  If you downloaded the archive before then, please discard old version and re-download the corrected data archive. ***

For each of the five metal surface samples in the paper, this archive contains two types of data: NDFs (normal distribution functions) and surface microgeometry (encoded as a height-fields).  The three NDFs per sample included are:

---NDF---(Normal-distribution-functions)--------------

- Gonio NDF: Normal distribution interpolated from measurements on a gonioreflectometer.  This instrument measures BRDF values at discrete angles and a simple inversion of the microfacet BRDF model was used to convert from the measured BRDF values to NDF values.  

- Geometric NDF: Normal distribution estimated from the measured surface microgeometry using the filtered surface normal reconstruction procedure described in the paper.

- Kirchhoff NDF:  Effective normal distribution computed by numerically evaluating the "Kirchhoff distribution" integral from the paper on the measured surface microgeometry.  The integral was evaluated for each patch and the resulting NDFs then averaged over all the patches for that surface.

To keep the data formats simple, we store a full hemisphere for each NDF, however to save computation, we only actually computed the NDFs within a subset of the hemisphere that was chosen to cover the most interesting and significant parts of the NDF.  The remainder of the hemisphere has been set to zero in this data.  The geometric and Kirchhoff NDFs given here have not been filtered by the instrument signature of our gonioreflectometer and thus may include features which are smaller than our gonioreflectometer can resolve.  The are also based on a data from relatively small surface areas and are not yet fully converged to the stationary BRDF for the surface (i.e. may contain noise-like features that could be reduced by averaging data over a larger surface area).

The resolution of our gonioreflectometer is limited by its light source and detector aperture sizes.  We esimated this limit (called the instrument signature) by measuring the NDF of a mirror and include the resulting kernel in the gonioSignatureKernel.txt file.  The geometric and kirchhoff NDFs should be convolved with this kernel before comparing them to the gonioreflectometer derived NDF to account for the gonioreflectometers resolution limitation.

---Surface-Microgeometry-Patches---------------

For each metal surface sample, we measured multiple surface patches using an optical profilometer as described in the paper.  These are included in the Patches directory for each sample.  Each patch is a 640x480 heightfield measured with a 0.11 micron horizontal spacing between pixels (so each patch spans roughly 70x53 microns of the surface).  The surface heights are given in microns.  The patches are intented to be contiguous, but due to mechanical limitations of the profilometer's translation table, there is a small horizontal misalignment between the edges of neighboring patches.  Sometimes there is also a vertical misaligment between neighboring patches, likely due to the automated profilometer rerunning calibation procedures.  The methods described in the paper are not sensitive to these inter-patch misaligments, but they would need to be corrected if one wants to stitch the patches together into larger surface regions.

--Data--Formats----------------------------------

All the data are stored as 2D matrices in a simple ascii format (or equivalently as single channel floating point images).  The first line gives the dimensions of the image and then the remaining lines give the image data, one scanline per text line (from left to right and top to bottom).  In our convention the x dimension increases along a scanline and the y dimension increases with each successive scanline.  An example file with small 2x3 checkerboard with a white square in the upper left is:
AsciiMatrix 3 2
1.0 0.1 1.0
0.1 1.0 0.1

NDFs are defined over the hemisphere around the positive z-axis.  Here they are encoded by projecting the hemisphere onto the unit disk in the XY plane.  If we think of each point on the hemisphere as being a unit vector encoding a direction, this projection simply discards the vector's z component to get its XY projection.  Then we embed this disk in a square and store the result as a 2D matrix.  Points which lie outside the disk are set to zero.  To reconstruct the direction (as a unit vector) corresponding to a pixel in an NDF image, first map the XY coordinates to the range [-1,1]x[-1,1] to compute the x and y components of the direction vector, then set its z coordinate to sqrt(1 - x*x -y*y).

Surface microgeometry is encoded as a heightfield where each surface point (aka pixel) gives the height of the surface in microns.  In some cases the profilometer is unable to determine a height for a surface points and these points are recorded as a floating point NaN (Not-a-number) in the file.

