Permalink
Browse files

BRDF Explorer

  • Loading branch information...
gregnichols authored and davvid committed Aug 27, 2011
0 parents commit cbebaa445261c98d2bea92f4adf5b8f695d0d08d
Showing with 37,750 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +2 −0 .release
  3. +1 −0 .workonrc.products
  4. +43 −0 LICENSE
  5. +149 −0 README
  6. +7 −0 README-DISNEY
  7. +49 −0 brdf.spec.in
  8. +3 −0 main.pro
  9. +3 −0 src/brdf/.gitignore
  10. +124 −0 src/brdf/BRDFAnalytic.cpp
  11. +74 −0 src/brdf/BRDFAnalytic.h
  12. +688 −0 src/brdf/BRDFBase.cpp
  13. +229 −0 src/brdf/BRDFBase.h
  14. +144 −0 src/brdf/BRDFImageSlice.cpp
  15. +87 −0 src/brdf/BRDFImageSlice.h
  16. +167 −0 src/brdf/BRDFMeasuredAniso.cpp
  17. +81 −0 src/brdf/BRDFMeasuredAniso.h
  18. +185 −0 src/brdf/BRDFMeasuredMERL.cpp
  19. +85 −0 src/brdf/BRDFMeasuredMERL.h
  20. +125 −0 src/brdf/ColorVarWidget.cpp
  21. +100 −0 src/brdf/ColorVarWidget.h
  22. +269 −0 src/brdf/DGLFrameBuffer.cpp
  23. +123 −0 src/brdf/DGLFrameBuffer.h
  24. +536 −0 src/brdf/DGLShader.cpp
  25. +255 −0 src/brdf/DGLShader.h
  26. +164 −0 src/brdf/FloatVarWidget.cpp
  27. +115 −0 src/brdf/FloatVarWidget.h
  28. +1,029 −0 src/brdf/IBLWidget.cpp
  29. +201 −0 src/brdf/IBLWidget.h
  30. +198 −0 src/brdf/IBLWindow.cpp
  31. +86 −0 src/brdf/IBLWindow.h
  32. +315 −0 src/brdf/ImageSliceWidget.cpp
  33. +120 −0 src/brdf/ImageSliceWidget.h
  34. +101 −0 src/brdf/ImageSliceWindow.cpp
  35. +75 −0 src/brdf/ImageSliceWindow.h
  36. +314 −0 src/brdf/LitSphereWidget.cpp
  37. +108 −0 src/brdf/LitSphereWidget.h
  38. +108 −0 src/brdf/LitSphereWindow.cpp
  39. +75 −0 src/brdf/LitSphereWindow.h
  40. +182 −0 src/brdf/MainWindow.cpp
  41. +86 −0 src/brdf/MainWindow.h
  42. +498 −0 src/brdf/ParameterGroupWidget.cpp
  43. +128 −0 src/brdf/ParameterGroupWidget.h
  44. +403 −0 src/brdf/ParameterWindow.cpp
  45. +130 −0 src/brdf/ParameterWindow.h
  46. +70 −0 src/brdf/Paths.cpp
  47. +56 −0 src/brdf/Paths.h
  48. +418 −0 src/brdf/Plot3DWidget.cpp
  49. +106 −0 src/brdf/Plot3DWidget.h
  50. +459 −0 src/brdf/PlotCartesianWidget.cpp
  51. +127 −0 src/brdf/PlotCartesianWidget.h
  52. +192 −0 src/brdf/PlotCartesianWindow.cpp
  53. +93 −0 src/brdf/PlotCartesianWindow.h
  54. +301 −0 src/brdf/PlotPolarWidget.cpp
  55. +103 −0 src/brdf/PlotPolarWidget.h
  56. +75 −0 src/brdf/SharedContextGLWidget.cpp
  57. +76 −0 src/brdf/SharedContextGLWidget.h
  58. +86 −0 src/brdf/ShowingBase.h
  59. +66 −0 src/brdf/ShowingDockWidget.cpp
  60. +64 −0 src/brdf/ShowingDockWidget.h
  61. +337 −0 src/brdf/SimpleModel.cpp
  62. +117 −0 src/brdf/SimpleModel.h
  63. +60 −0 src/brdf/angleConvert.h
  64. +117 −0 src/brdf/bitmapContainer.h
  65. 0 src/brdf/brdf.pc
  66. +73 −0 src/brdf/brdf.pro
  67. +101 −0 src/brdf/geodesicHemisphere.h
  68. +100 −0 src/brdf/main.cpp
  69. +419 −0 src/brdf/ptex/PtexCache.cpp
  70. +300 −0 src/brdf/ptex/PtexCache.h
  71. +598 −0 src/brdf/ptex/PtexDict.h
  72. +105 −0 src/brdf/ptex/PtexHalf.cpp
  73. +120 −0 src/brdf/ptex/PtexHalf.h
  74. +346 −0 src/brdf/ptex/PtexHashMap.h
  75. +120 −0 src/brdf/ptex/PtexIO.h
  76. +57 −0 src/brdf/ptex/PtexInt.h
  77. +79 −0 src/brdf/ptex/PtexMutex.h
  78. +160 −0 src/brdf/ptex/PtexPlatform.h
  79. +1,376 −0 src/brdf/ptex/PtexReader.cpp
  80. +641 −0 src/brdf/ptex/PtexReader.h
  81. +677 −0 src/brdf/ptex/PtexUtils.cpp
  82. +199 −0 src/brdf/ptex/PtexUtils.h
  83. +994 −0 src/brdf/ptex/Ptexture.h
  84. +70 −0 src/brdf/trim.h
  85. +58 −0 src/brdfs/ashikhman_shirley.brdf
  86. +55 −0 src/brdfs/blinn.brdf
  87. +31 −0 src/brdfs/blinnphong.brdf
  88. +158 −0 src/brdfs/compare.brdf
  89. +69 −0 src/brdfs/cooktorrance.brdf
  90. +64 −0 src/brdfs/dAniso.brdf
  91. +40 −0 src/brdfs/d_beckmann.brdf
  92. +36 −0 src/brdfs/d_blinnphong.brdf
  93. +44 −0 src/brdfs/d_exponential.brdf
  94. +33 −0 src/brdfs/d_gaussian.brdf
  95. +37 −0 src/brdfs/d_ggx.brdf
  96. +32 −0 src/brdfs/d_nishino.brdf
  97. +39 −0 src/brdfs/d_phong.brdf
  98. +45 −0 src/brdfs/d_trowbridge_reitz.brdf
  99. +43 −0 src/brdfs/edwards06.brdf
  100. +33 −0 src/brdfs/f_cooktorrance.brdf
  101. +33 −0 src/brdfs/f_schlick.brdf
  102. +32 −0 src/brdfs/f_schlick_f0.brdf
  103. +31 −0 src/brdfs/g_ap07.brdf
  104. +35 −0 src/brdfs/g_as00.brdf
  105. +33 −0 src/brdfs/g_cooktorrance.brdf
  106. +35 −0 src/brdfs/g_duer.brdf
  107. +31 −0 src/brdfs/g_kelemen.brdf
  108. +33 −0 src/brdfs/g_kurt10.brdf
  109. +30 −0 src/brdfs/g_neumann.brdf
  110. +37 −0 src/brdfs/g_schlick.brdf
  111. +34 −0 src/brdfs/g_walter07.brdf
  112. +30 −0 src/brdfs/g_ward.brdf
  113. +23 −0 src/brdfs/lambert.brdf
  114. +24 −0 src/brdfs/minnaert.brdf
  115. +41 −0 src/brdfs/modifiedphong.brdf
  116. +43 −0 src/brdfs/orennayar.brdf
  117. +43 −0 src/brdfs/phong.brdf
  118. +26 −0 src/brdfs/schlick.brdf
  119. +58 −0 src/brdfs/showAngles.brdf
  120. +45 −0 src/brdfs/showVectors.brdf
  121. +44 −0 src/brdfs/stretchedphong.brdf
  122. +55 −0 src/brdfs/walter.brdf
  123. +49 −0 src/brdfs/ward.brdf
  124. +16,217 −0 src/data/teapot.obj
  125. BIN src/images/closeSmall.png
  126. BIN src/images/folderSmall.png
  127. BIN src/images/imageSmall.png
  128. BIN src/images/modelSmall.png
  129. BIN src/images/reloadSmall.png
  130. BIN src/images/resetSmall.png
  131. BIN src/images/soloColorsSmall.png
  132. BIN src/images/soloSmall.png
  133. BIN src/probes/beach.penv
  134. BIN src/probes/furnace.penv
  135. BIN src/probes/spot.penv
  136. +55 −0 src/shaderTemplates/IBLComp.frag
  137. +96 −0 src/shaderTemplates/IBLResult.frag
  138. +393 −0 src/shaderTemplates/brdfIBL.frag
  139. +76 −0 src/shaderTemplates/brdfIBL.vert
  140. +55 −0 src/shaderTemplates/brdftemplate2D.frag
  141. +102 −0 src/shaderTemplates/brdftemplate2D.vert
  142. +68 −0 src/shaderTemplates/brdftemplate3D.frag
  143. +96 −0 src/shaderTemplates/brdftemplate3D.vert
  144. +55 −0 src/shaderTemplates/brdftemplateAnglePlot.frag
  145. +104 −0 src/shaderTemplates/brdftemplateAnglePlot.vert
  146. +58 −0 src/shaderTemplates/brdftemplateAnglePlotAlbedo.frag
  147. +264 −0 src/shaderTemplates/brdftemplateAnglePlotAlbedo.vert
  148. +55 −0 src/shaderTemplates/brdftemplateAnglePlotThetaD.frag
  149. +99 −0 src/shaderTemplates/brdftemplateAnglePlotThetaD.vert
  150. +55 −0 src/shaderTemplates/brdftemplateAnglePlotThetaH.frag
  151. +101 −0 src/shaderTemplates/brdftemplateAnglePlotThetaH.vert
  152. +130 −0 src/shaderTemplates/brdftemplateImageSlice.frag
  153. +53 −0 src/shaderTemplates/brdftemplateImageSlice.vert
  154. +192 −0 src/shaderTemplates/brdftemplatesphere.frag
  155. +57 −0 src/shaderTemplates/brdftemplatesphere.vert
  156. +53 −0 src/shaderTemplates/imageSlice.func
  157. +128 −0 src/shaderTemplates/measured.func
  158. +99 −0 src/shaderTemplates/measuredAniso.func
@@ -0,0 +1,4 @@
+*.o
+moc_*
+Makefile
+Linux-*
@@ -0,0 +1,2 @@
+bin
+share
@@ -0,0 +1 @@
+brdf
43 LICENSE
@@ -0,0 +1,43 @@
+BRDF Explorer
+Copyright Disney Enterprises, Inc. All rights reserved.
+
+This license governs use of the accompanying software. If you use the software, you
+accept this license. If you do not accept the license, do not use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have
+the same meaning here as under U.S. copyright law. A "contribution" is the original
+software, or any additions or changes to the software. A "contributor" is any person
+that distributes its contribution under this license. "Licensed patents" are a
+contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- 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.
+(B) Patent Grant- 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 license under its licensed patents to make, have made,
+use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the
+software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that you claim
+are infringed by the software, your patent license from such contributor to the
+software ends automatically.
+(C) If you distribute any portion of the software, you must retain all copyright,
+patent, trademark, and attribution notices that are present in the software.
+(D) If you distribute any portion of the software in source code form, you may do
+so only under this license by including a complete copy of this license with your
+distribution. If you distribute any portion of the software in compiled or object code
+form, you may only do so under a license that complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors
+give no express warranties, guarantees or conditions. You may have additional
+consumer rights under your local laws which this license cannot change.
+To the extent permitted under your local laws, the contributors exclude the
+implied warranties of merchantability, fitness for a particular purpose and non-
+infringement.
149 README
@@ -0,0 +1,149 @@
+The Disney BRDF Viewer 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 viewer 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 BRDF viewer. 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 viewer 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 viewer 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 viewer 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
+viewer doesn't enforce this). Float parameters come in as uniform floats,
+color parameters as vec3s, and boolean parameters as bools. The viewer
+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 1988 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/
+
+
@@ -0,0 +1,7 @@
+To produce a Disney-friendly, attach-able product:
+ qmake
+ make install
+
+NOTE: if building against the system, use 'qmake-qt4' instead of just 'qmake',
+ or else you might end up using the qt3.3 qmake.
+
@@ -0,0 +1,49 @@
+# RPMs can be built using 'git make-rpm'
+Name: brdf
+Version: __VERSION__
+Release: __RELEASE__%{?dist}
+Summary: BRDF Viewer
+
+Group: Applications/Multimedia
+License: Disney
+URL: http://gitweb/projects/%{name}
+Source0: http://gitweb/projects/%{name}-%{version}.tar.gz
+
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: glew
+BuildRequires: glew-devel
+BuildRequires: qt
+BuildRequires: qt-devel
+BuildRequires: pkgconfig-disney
+
+Requires: glew
+Requires: qt
+
+prefix: %{_prefix}
+BuildRoot: %{_topdir}/BUILDROOT/%{name}-%{version}
+
+%description
+The BRDF viewer is the best way to quickly get a feel for
+how shader controls work and quickly dial in material settings
+
+%prep
+%setup -q
+
+%build
+
+%install
+qmake-qt4 prefix=%{_prefix}
+make INSTALL_ROOT=%{buildroot} install
+
+%clean
+rm -rf %{buildroot}
+
+%post
+
+%postun
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/brdf
+%{_datadir}/brdf
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS += src/brdf
@@ -0,0 +1,3 @@
+brdf
+*.o
+*.swp
@@ -0,0 +1,124 @@
+/*
+Copyright Disney Enterprises, Inc. All rights reserved.
+
+This license governs use of the accompanying software. If you use the software, you
+accept this license. If you do not accept the license, do not use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have
+the same meaning here as under U.S. copyright law. A "contribution" is the original
+software, or any additions or changes to the software. A "contributor" is any person
+that distributes its contribution under this license. "Licensed patents" are a
+contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- 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.
+(B) Patent Grant- 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 license under its licensed patents to make, have made,
+use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the
+software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that you claim
+are infringed by the software, your patent license from such contributor to the
+software ends automatically.
+(C) If you distribute any portion of the software, you must retain all copyright,
+patent, trademark, and attribution notices that are present in the software.
+(D) If you distribute any portion of the software in source code form, you may do
+so only under this license by including a complete copy of this license with your
+distribution. If you distribute any portion of the software in compiled or object code
+form, you may only do so under a license that complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors
+give no express warranties, guarantees or conditions. You may have additional
+consumer rights under your local laws which this license cannot change.
+To the extent permitted under your local laws, the contributors exclude the
+implied warranties of merchantability, fitness for a particular purpose and non-
+infringement.
+*/
+
+#include <stdio.h>
+#include "BRDFAnalytic.h"
+
+
+
+BRDFAnalytic::BRDFAnalytic()
+{
+}
+
+
+
+BRDFAnalytic::~BRDFAnalytic()
+{
+}
+
+
+bool BRDFAnalytic::canReadSectionType( std::string type )
+{
+ if( type == "shader" )
+ return true;
+
+ if( type == "isFunc" )
+ return true;
+
+ return false;
+}
+
+
+bool BRDFAnalytic::beginSection( std::string section )
+{
+ if( section == "shader" )
+ shader = "";
+
+ if( section == "isFunc" )
+ isFunc = "";
+
+ return true;
+}
+
+
+bool BRDFAnalytic::processLineFromSection( std::string section, std::string line )
+{
+ if( section == "shader" )
+ shader = shader + line + std::string("\n");
+ else if( section == "isFunc" )
+ isFunc = isFunc + line + std::string("\n");
+ return true;
+}
+
+bool BRDFAnalytic::endFile()
+{
+ return true;
+}
+
+
+std::string BRDFAnalytic::getBRDFFunction()
+{
+ return shader;
+}
+
+
+std::string BRDFAnalytic::getISFunction()
+{
+ // return the custom function if we have one
+ if( isFunc.length() )
+ return isFunc;
+
+ // otherwise, return the base function
+ return BRDFBase::getISFunction();
+}
+
+
+bool BRDFAnalytic::hasISFunction()
+{
+ if( isFunc.length() )
+ return true;
+ return false;
+}
+
Oops, something went wrong.

0 comments on commit cbebaa4

Please sign in to comment.