april 4-7, 2016 | silicon valley implement physically ......april 4-7, 2016 | silicon valley detlef...
TRANSCRIPT
![Page 1: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/1.jpg)
April 4-7, 2016 | Silicon Valley
Detlef Röttger, 4/4/2016
Implement Physically Based Ray Tracing with OptiX and MDL
![Page 2: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/2.jpg)
2
AGENDA
OptiX
Material Definition Language
MDL SDK
Shader Code Generation
Path Tracer Implementation
![Page 3: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/3.jpg)
3
OptiX
![Page 4: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/4.jpg)
4
NVIDIA OptiX SDK GPU ray tracing „to the algorithm“
OptiX is a ray casting engine, not a renderer
C-API to setup scene graph and data on host
CUDA C++ to implement ray tracing algorithms on device
OptiX does the heavy lifting!
Acceleration Structures, Recursions, GPU resource management
Multi-GPU and NVIDIA VCA support
Get it here: https://developer.nvidia.com/designworks
4/3/2016
![Page 5: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/5.jpg)
5
OptiX Scene Hierarchy Use the OptiX C-API to create and connect scene data
4/3/2016
GeometryGroup
GeometryInstance
Geometry
Material
Acceleration
Instancing with Transforms Sharing Geometry and
Acceleration Structures Group
Transform Transform
Acceleration
![Page 6: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/6.jpg)
6
OptiX Program Domains Developer controls the algorithm via CUDA C++ programs
RayGeneration
4/3/2016
Intersection
BoundingBox
ClosestHit
Miss
AnyHit
![Page 7: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/7.jpg)
7
Material Definition Language
![Page 8: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/8.jpg)
8
Material Definition Language
A domain-specific language for abstract declarative material description
Independent of a specific rendering system
Procedural programming language to customize texture image lookups or procedural textures
MDL Handbook and Specifications: http://www.mdlhandbook.com More Information: https://developer.nvidia.com/designworks
4/3/2016
![Page 9: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/9.jpg)
9
MDL Code Example
mdl 1.2; import df::*; export material my_diffuse( uniform float par_roughness = 0.0, uniform color par_color = color(0.5) ) = material( surface: material_surface( scattering: df::diffuse_reflection_bsdf( roughness: par_roughness, tint: par_color ) ) );
Name
Parameters
Definition
Version and Imports
![Page 10: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/10.jpg)
10
MDL Basic Building Blocks Bidirectional Scattering Distribution Functions (BSDF)
diffuse reflection diffuse transmission specular(reflect) specular(transmit) specular(reflect_transmit)
measured glossy backscattering glossy(reflect) glossy(transmit) glossy(reflect_transmit)
![Page 11: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/11.jpg)
11
MDL Basic Building Blocks Layers
weighted_layer fresnel_layer custom_curve_layer measured_curve_layer
![Page 12: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/12.jpg)
12
MDL Basic Building Blocks Modifiers
tint thin_film directional_factor measured_curve_factor
![Page 13: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/13.jpg)
13
MDL Basic Building Blocks Mixers
normalized_mix
clamped_mix
0.25/0.25 0.5/0.5 0.75/0.75 1.0/1.0
![Page 14: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/14.jpg)
14
MDL Basic Building Blocks Emission Distribution Functions (EDF)
diffuse_edf spot_edf
measured_edf (IES profiles)
mixer on edf_component[]
![Page 15: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/15.jpg)
15
MDL Basic Building Blocks Volume Distribution Functions (VDF)
anisotropic_vdf
0.0
1.0 0.75 0.5
-1.0 -0.75 -0.5
Henyey-Greenstein phase function
vdf()
![Page 16: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/16.jpg)
16
Material Definition Language SDK
![Page 17: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/17.jpg)
17
MDL SDK Compiler and API
Compile materials into internal data structures (Directed Acyclic Graph, DAG)
Different compilation methods
instance compilation, class compilation
Optimizations
Inlining, dead code elimination, complete evaluation of uniform sub-graphs
Easy to inspect view on the material definition, full traversal of the DAG
Code generation backends for use on GPU or CPU (LLVM, PTX, GLSL)
More information: https://developer.nvidia.com/designworks
4/3/2016
![Page 18: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/18.jpg)
18
Shader Code Generation
![Page 19: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/19.jpg)
19
Shader Code Generation
4/3/2016
<name>.mdl MDL SDK Compiled
Material
Builder
Class
DAG
Nodes
Texture
References
Parameter
Interface
Parameter
Macros Header
Traverser
Code
Getter
Classes
Hierarchy
Typedefs
Material
Constructor
Description
<name>.txt
Traverser
<hash>.cu
Using the MDL SDK
![Page 20: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/20.jpg)
20
Parameter Macros and Getter Classes
4/3/2016
#define par_color_macro (make_float3(sys_Parameters[index].u.f4[0])) #define par_roughness_macro (sys_Parameters[index].u.f1[3]) class DiffuseReflectionGetter_1 // df::diffuse_reflection_bsdf { public: RT_FUNCTION float3 getTint(State const& state, const int index) const { return par_color_macro; } RT_FUNCTION float getRoughness(State const& state, const int index) const { return par_roughness_macro; } };
Connecting variable expressions with hardcoded building blocks
![Page 21: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/21.jpg)
21
Material Hierarchy as Typedefs
typedef bsdf_diffuse_reflection< DiffuseReflectionGetter_1 > DiffuseReflection_6; typedef material_emission< edf, EmissionGetter_2 > Emission_7; typedef material_surface< DiffuseReflection_6, Emission_7 > Surface_8; typedef material_emission< edf, EmissionGetter_3 > Emission_9; typedef material_surface< bsdf, Emission_9 > Surface_10; typedef material_volume< vdf, VolumeGetter_4 > Volume_11; typedef material_geometry< GeometryGetter_5 > Geometry_12; typedef material< Surface_8, Surface_10, Volume_11, Geometry_12, MaterialGetter_0 > Material_13;
Match MDL material structure with C++ class implementation
![Page 22: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/22.jpg)
22
Material Hierarchy Traversal Function
RT_CALLABLE_PROGRAM void traverser(State, Traversal, PerRayData, modifier, probability, normal) { const Material_13 theMaterial = Material_13( Surface_8( DiffuseReflection_6(), Emission_7( edf() ) ), Surface_10( bsdf(), Emission_9( edf() ) ), Volume_11( vdf() ), Geometry_12() ); theMaterial.traverse(state, traversal, prd, modifier, probability, normal); }
Single function to evaluate material hierarchy and parameters
![Page 23: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/23.jpg)
23
Material Hierarchy Traversal Traversal and Data Storage (layered example)
4/3/2016
weighted
layer
material
glossy
bsdf
diffuse
reflection
bsdf
material
surface
base layer
theMaterial.traverse() Traversal.nodes[] data array
(Inner nodes‘ data stored at end, BSDF and EDF node data stored at begin)
...
dfIndex dataIndex
![Page 24: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/24.jpg)
24
Forward Path Tracer Implementation
![Page 25: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/25.jpg)
25
Ray Generation
4/3/2016
Per Launch-Index Initialization
Lens Shader
Integrator
Accumulate Result
![Page 26: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/26.jpg)
26
Closest Hit Program
4/3/2016
State Calculation, Traversal Setup
Material Hierachy Traversal
(for parameters, emission, estimation, calculation)
BSDF Sampling
Inlined Code
Bound Callable Program (per material shader,
called multiple times)
Bindless Callable Programs (per BSDF)
Bindless Callable Programs (per light type)
Bindless Callable Programs (per diffuse BSDF)
Light Sampling
BSDF Evaluation
Diffuse Reflection
BSDF?
A single program for all materials!
![Page 27: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/27.jpg)
27
Any Hit Program
4/3/2016
State Calculation, Traversal Setup
Material Hierachy Traversal
(for cutout opacity value only)
Inlined Code
Bound Callable Program (per material shader)
Stochastic Transparency
if (opacity < RNG) ignore intersection;
A single program only present for cutout opacity materials!
![Page 28: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/28.jpg)
28 4/3/2016
![Page 29: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/29.jpg)
29 4/3/2016
![Page 30: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/30.jpg)
30
EDF examples Blackbody Radiation
1900 K 3000 K 5000 K 7000 K
![Page 31: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/31.jpg)
31 4/3/2016
![Page 32: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/32.jpg)
32
Future Development „Cameras? Lights? Shading!“
Add MDL 1.3 BSDFs
Runtime compilation of generated code
Use MDL SDK PTX backend for code generation
measured_bsdf sampling
measured_edf evaluation
Different camera implementations
4/3/2016
![Page 33: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/33.jpg)
33
Summary Takeaways from this Presentation
Overview of the MDL material features and capabilities
Example how to use the MDL SDK to convert MDL materials to a custom renderer
Implementing an MDL-capable global illumination renderer with OptiX
Single ClosestHit and AnyHit programs configured by callable programs
Easy to extend with more distribution functions
4/3/2016
![Page 34: April 4-7, 2016 | Silicon Valley Implement Physically ......April 4-7, 2016 | Silicon Valley Detlef Röttger, 4/4/2016 Implement Physically Based Ray ... Henyey-Greenstein phase function](https://reader035.vdocument.in/reader035/viewer/2022071508/61291c91ee3eb17bad08aff8/html5/thumbnails/34.jpg)
April 4-7, 2016 | Silicon Valley
THANK YOU
JOIN THE NVIDIA DEVELOPER PROGRAM AT developer.nvidia.com/join
Hangout session H6140: OptiX, Physically Based Ray Tracing, and the Material Definition Language
Wednesday, April 6th at 4:00 pm in Pod C