Brdf2
=====

Keywords: brdf, sqt

== Summary ==
This demo uses a DIRSIG spherical quad-tree (SQT) to describe a measured
blue paint bi-directional reflectance distributon function (BRDF) that is
attributed to a unmanned airbone vehicle (UAV).  

== Details ==
This scenario focuses on the data-driven BRDF model at the core of
DIRSIG5, but which was back-ported to DIRSIG4 for comparisons and
DIRSIG4 utility.  It stores the BRDF using a spherical quad-tree (SQT)
data structure, which has some unique and powerful features including
adaptive resolution (level of detail), efficient storage, efficient
hemispherical integration and efficient sampling mechanisms.

== Important Files ==
This section highlights key files important to the simulation.

=== The Blue Paint BRDF ===
The blue paint used on the vehicle in the scene was imported from the
Cornell University Program of Computer Graphics (PCG) database.  A
description and the original measurements for this paint can be found
http://www.graphics.cornell.edu/online/measurements/reflectance/housepaints[here].
The measurements were converted into a file that could be ingested by the
DIRSIG5 *raw2sqt* tool.  The input "raw" file and produced SQT file are
in the `matrials` folders (see `materials/blue_paint.raw` and
`materials/blue_paint.sqt`, respectively).

=== The Material Database ===
The BRDF for the blue paint is supplied to DIRSIG using the *SphericalBRDF*
optical property and SQT input in the `materials/demo.mat`:

----
MATERIAL_ENTRY {
    ID = test_mat
    NAME = Blue paint
    EDITOR_COLOR = 0.5, 0.5, 0.5
    DOUBLE_SIDED = TRUE

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = SphericalDataBRDF
        REFLECTANCE_PROP {
            DATA_FILENAME = blue_paint.sqt
        }
    }

    RAD_SOLVER_NAME = Generic
    RAD_SOLVER {
        INITIAL_SAMPLE_COUNT = 100
        SAMPLE_DECAY_RATE    = 5
        MAX_BOUNCES          = 2
        MU_SAMPLES           = 8
        PHI_SAMPLES          = 12
        MIN_QUAD_SAMPLES     = 1
    }
}
----


== Setup ==
There are two simulation scenarios in this demo:

. A single-frame simulation
. A multi-frame (video) simulation

=== Running the Single-Frame Simulation ===
This single-frame simulation produces a single image file.
To run the simulation, perform the following steps:

. Run the DIRSIG `demo.sim` file
. Load the resulting `demo-t0000-c0000.img` file in the image viewer.


=== Running the Multi-Frame Simulation ===
The multi-frame simulation produces 41 image files.
To run the simulation, perform the following steps:

. Run the DIRSIG `video.sim` file
. Load the resulting `demo-t0000-c0000.img`, `demo-t0000-c0001.img`, etc.
  files in the image viewer.




== Results ==

=== Single-Frame Simulation ===
The single-frame simulation produces the single-frame simulation shown
below:

.Output of the single-frame simulation (two percent scaling).
image::images/demo.png[]

=== Multi-Frame Simulation ===
The output of the multi-frame simulation is a series individual image files.  
The frames can be scaled and encoded into a video format for viewing using
a variety of 3rd party software tools (ffmpeg, mpeg_encode, etc.).

.Animation of the multi-frame "video" collection.
image::images/video.gif[]

