Coder Social home page Coder Social logo

brdf's Introduction

The Disney BRDF Explorer is an application that allows the development and analysis
of bidirectional reflectance distribution functions (BRDFs). It can load and plot 
analytic BRDF functions (coded as snippets of OpenGL GLSL programs), measured
material data from the MERL database, and anisotropic measured material data from
MIT CSAIL.

Most of the application should be (hopefully) self explanatory, so the goal here is to
document the less obvious bits of usage, as well as providing some useful info.

WHICH BRDF(S) YOU'RE SEEING
------------------------------------
In the BRDF Parameters window, each BRDF has a colored background. The plotted values
(for the 3D, polar, and cartesian plots) are drawn in the corresponding colors.

In the Image Slice, Lit Object, and Lit Sphere windows, you're seeing the first
(topmost in the parameters window) enabled BRDF.


NAVIGATING POLAR/CARTESIAN PLOTS
------------------------------------
Use the left mouse button to pan around in the plot. Right dragging will zoom in/out
around the centered location. Double-clicking anywhere resets the view to the default
zoom and location. For cartesian plots, Control+left drag stretches ONLY the x-axis,
while Control+right drag stretches only the y-axis.


NAVIGATING 3D PLOTS
------------------------------------
Left-drag spins around the origin (there's no current way to change this). Right drag
zooms in and out. Double clicking resets to the default view.


PARAMETER SLIDERS
------------------------------------
Parameters sliders (a slider plus a text entry box) are all over the application. To
reset one to its default value, Control+Click in the text box.


SOLOING BRDFS
------------------------------------
Pressing the "solo" (circle) button for a given BRDF makes ONLY that BRDF visible,
hiding all the others. The "Solo this BRDF's color channels" button also hides all
the other channels, but shows a separate plot for the red, green, and blue channels
(in their respective colors). Click the solo button again to exit solo mode.


LIT SPHERE VIEW
------------------------------------
You can drag the left mouse button on the surface of the sphere to change the
incident angle. If "Double Theta" is enabled, the specular highlight will track
the position of the mouse.


LIT OBJECT VIEW
------------------------------------
The lit object view allows an arbitrary object to be viewed under with a directional
light from the incident direction (in "No IBL" mode) or under illumination from an
arbitrary environment map. Left dragging rotates the object; right dragging zooms
the object; Control+left dragging rotates the environment probe.

The combo box lets you choose "No IBL", "IBL: No IS" (quasirandom sampling from
the environment map with no importance sampling) and "IBL: IBL IS" (importance
sampling from the IBL). Multiple importance sampling is planned but not implemented.
The "Keep Sampling" mode, when enabled, progressively refines the image until
4096 samples have been applied.

The buttons allow changing out the object (any OBJ should work) and the environment
probe (which must be in ptex format).


ALBEDO VIEW
------------------------------------
Albedo computation by brute force sampling proved too expensive to do interactively,
so the application can use several different sampling strategies to compute the albedo.
Use the combo box on the right to choose between these sampling strategies. The
Resample x10 button adds more samples to that view of the graph.


IMAGE SLICE VIEW
------------------------------------
An "image slice" is an alternative way of looking at BRDF data that we have found
helpful at Disney. Along the x-axis, the half angle is varied from zero to 90
degrees; along the y-axis, the difference angle is varied from 0 to 90 degrees.


BRDF FILES
------------------------------------
.brdf files consist of a set of parameters and a BRDF function written in GLSL.
At runtime, the application creates UI elements for each parameter, and creates
shaders for different views that incorporate the GLSL function.

The BRDF function looks like this (this example is for a lambertian BRDF):

::begin shader
vec3 BRDF( vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y )
{
    return vec3(reflectance / 3.14159265);
}
::end shader

Anything valid in GLSL can go between "::begin shader" and "::end shader" as
long as it's valid GLSL.

The application allows float, color, and boolean parameters. The float parameters
have the form
float [name] [min val] [max val] [default val]
for example:
float reflectance 0.0 1.0 1.0

Boolean parameters have the form
bool [name] [default], where default is 0 or 1 (keywords such as true and
false aren't recognized)
for example:
bool hasDiffuse 0

Color parameters have the form
color [name] [defaultR] [defaultG] [defaultB], where defaultR/G/B are in [0..1]
for example:
color diffuseColor 0.5 0.1 1.0

Parameters are passed into the resulting GLSL shaders as uniforms of the same
name (so parameter names must be valid GLSL variable names, although the
application doesn't enforce this). Float parameters come in as uniform floats,
color parameters as vec3s, and boolean parameters as bools. The application
declares them when constructing shaders, so your GLSL BRDF functions can 
refer to them knowing that they'll exist and have the proper values at runtime.


LIGHT PROBE ATTRIBUTION
------------------------------------
HDR Light Probe Images Copyright 1998 courtesy of Paul Debevec,
www.debevec.org, used with permission.

Please see:
Paul Debevec.  Rendering Synthetic Objects Into Real Scenes: Bridging Traditional and 
Image-Based Graphics With Global Illumination and High Dynamic Range Photography.  
Proceedings of SIGGRAPH 98, Computer Graphics Proceedings, Annual Conference Series, 
July 1998, pp. 189-198.


WHERE TO GET MEASURED BRDF DATA
------------------------------------
MERL data can be requested here:
http://www.merl.com/brdf/

MIT CSAIL data is here:
http://people.csail.mit.edu/addy/research/brdf/


BUILD INSTRUCTIONs
------------------

To install brdf run:

    make install [prefix=<some-directory>]

If you do not specify "prefix=..." then brdf will be installed into the current directory.

brdf's People

Contributors

aselle avatar benardp avatar brentb avatar davvid avatar dbechrd avatar gregnichols avatar h3r2tic avatar jciehl avatar kayru avatar mcnopper avatar selfshadow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brdf's Issues

Couldn't render on Ubuntu 18.04

This error presents on my system. I don't see anything on the screen.
Compiler: g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Qt: QMake 3.1, Qt 5.9.5
GPU: GTX 1050Ti
Driver: NVIDIA 418.56

Screenshot_2019-04-10_17-11-23

Console output

DGLShader: Error reading file ./shaderTemplates/Plots.vert
DGLShader: Error reading file ./shaderTemplates/Plots.vert
opening ./probes/beach.penv... OpenGL Error invalid operation (1282) in file ../../../brdf/src/brdf/IBLWidget.cpp:595
success
opening ./data/sphere.obj...  Time to load OBJ: 383 ms
success
DGLShader: Error reading file ./shaderTemplates/Quad.vert
DGLShader: Error reading file ./shaderTemplates/Quad.vert
libpng warning: iCCP: known incorrect sRGB profile
DGLShader: Error reading file ./shaderTemplates/Plots.vert
OpenGL Error invalid operation (1282) in file ../../../brdf/src/brdf/PlotPolarWidget.cpp:184
OpenGL Error invalid operation (1282) in file ../../../brdf/src/brdf/PlotPolarWidget.cpp:297
OpenGL Error invalid operation (1282) in file ../../../brdf/src/brdf/PlotPolarWidget.cpp:297

Linux build fix

Building brdf on Arch Linux 64 failed on my machine. Adding

LIBS += -lz -lGLEW -lGLU -lglut to src/bin/brdf.pro

fixed that issue. Would be great if you could add that.

Project ERROR: $prefix is undefined. Please pass prefix=<path> to qmake

Hello,

When I try to qmake then make install

I get this error :

cd src/brdf/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /path/to/brdf.pro ) && make -f Makefile 
Project ERROR: $prefix is undefined. Please pass prefix=<path> to qmake
Makefile:44: recipe for target 'sub-src-brdf-make_first-ordered' failed
make: *** [sub-src-brdf-make_first-ordered] Error 3

I tried doing this from : https://stackoverflow.com/questions/14639459/how-to-change-qmake-prefix-location :

qmake -set prefix /path/to/repo

But I still get the same error, so I don't know what to do... Please help?

dont use glsl reserved keywords as variable names

i've made a few modifications to make the radeon driver (fglrx 12.9) compiles brdftemplateAnglePlotAlbedo.vert, and measured.func, ie don't use half as a variable name and proper float litterals (0.0)

Who should I credit?

I'm including some images generated by this program in my thesis. Should I put WDAS as the author of this package, or Andrew Selle?

Question about license - if I create derivative work, does Disney own it?

The license states that:

Subject to the terms of this license, including the license
conditions and limitations in section 3, each contributor grants you a non-exclusive,
worldwide, royalty-free copyright license to reproduce its contribution, prepare
derivative works of its contribution, and distribute its contribution or any derivative
works that you create.

If I create derivative work (i.e. fork on GitHub and make some modifications), does Disney own the copyright to the derivative work? If I create derivative work, am I granting Disney a non-exclusive, worldwide, royalty-free copyright license?

Fails to run on late 2009 iMac with "ERROR: 0:46: '' : version '130' is not supported"

Although the BRDF explorer built and ran fine (after a little .pro file tweaking) it fails when trying to get it to output a 3D graph with this:

ERROR: 0:46: '' :  version '130' is not supported
WARNING: 0:47: extension 'EXT_gpu_shader4' is not supported

System: late 2009-iMac running OSX 10.10 with additional libs installed via MacPorts
Graphics card built-in: ATI Radeon HD 4670 256 MB

Warnings during build on OSX 10.10 due to deprecated functions and stuff

Deprecated functions:

/Users/marko/WC/GIT/brdf/src/brdf/IBLWidget.cpp:68: warning: 'gluErrorString' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
        const char *errDescr = (const char *)gluErrorString(glErr);
                                             ^
/Users/marko/WC/GIT/brdf/src/brdf/IBLWidget.cpp:321: warning: 'gluLookAt' is deprecated: first deprecated in OS X 10.9 - "Use GLKMatrix4MakeLookAt" [-Wdeprecated-declarations]
    gluLookAt( lookVec[0], lookVec[1], lookVec[2],
    ^

/Users/marko/WC/GIT/brdf/src/brdf/IBLWidget.cpp:566: warning: 'gluOrtho2D' is deprecated: first deprecated in OS X 10.9 - "Use GLKMatrix4MakeOrtho" [-Wdeprecated-declarations]
    gluOrtho2D(0.0, (float)width(), 0.0, (float)height());
    ^

/Users/marko/WC/GIT/brdf/src/brdf/Plot3DWidget.cpp:176: warning: 'gluPerspective' is deprecated: first deprecated in OS X 10.9 - "Use GLKMatrix4MakePerspective" [-Wdeprecated-declarations]
    gluPerspective(FOV_Y, float(width()) / float(height()), nearPlane, farPlane);
    ^

Malformed header guards:

/Users/marko/WC/GIT/brdf/src/brdf/MainWindow.h:46: warning: 'MAIMWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]

/Users/marko/WC/GIT/brdf/src/brdf/geodesicHemisphere.h:46: warning: '_GEODESIC_HEMI_H_' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]

Wrong expressions?

/Users/marko/WC/GIT/brdf/src/brdf/ptex/PtexUtils.cpp:48: warning: comparison of constant 2 with expression of type 'Ptex::MeshType' is always false [-Wtautological-constant-out-of-range-compare]
    if (mt < 0 || mt >= int(sizeof(names)/sizeof(const char*)))
                  ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Users/marko/WC/GIT/brdf/src/brdf/ptex/PtexUtils.cpp:57: warning: comparison of constant 4 with expression of type 'Ptex::DataType' is always false [-Wtautological-constant-out-of-range-compare]
    if (dt < 0 || dt >= int(sizeof(names)/sizeof(const char*)))
                  ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Users/marko/WC/GIT/brdf/src/brdf/ptex/PtexUtils.cpp:75: warning: comparison of constant 4 with expression of type 'Ptex::EdgeId' is always false [-Wtautological-constant-out-of-range-compare]
    if (eid < 0 || eid >= int(sizeof(names)/sizeof(const char*)))
                   ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

build fixes for OSX

Hey all, in case it's useful:

To build on OSX, I had to add -lz to the Makefile to pick up the zlib symbols. Also, I had to modify Paths.cpp to allow it to find files. I hardcoded my own path to get past that hurdle, so I'm not providing a patch here, there's probably a proper way to resolve the problem.

Is it possible to use this tool with BTDFs (and thus with BSDFs) ?

I haven't seen any BTDF nor BSDF in the brdfs folder, so I'm wondering if this tool can be used to preview transparent/translucent materials, and how. I admit that accurate refraction cannot be expected from OpenGL --unless very advanced GPU coding is used-- but, even if refractions are non-accurate, reasonable good results (color-wise) could be achieved...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.