April 4-7, 2016 | Silicon Valley
Detlef Röttger, 4/4/2016
Implement Physically Based Ray Tracing with OptiX and MDL Detlef - - PowerPoint PPT Presentation
April 4-7, 2016 | Silicon Valley Implement Physically Based Ray Tracing with OptiX and MDL Detlef Rttger, 4/4/2016 OptiX Material Definition Language AGENDA MDL SDK Shader Code Generation Path Tracer Implementation 2 OptiX 3 NVIDIA
April 4-7, 2016 | Silicon Valley
Detlef Röttger, 4/4/2016
2
OptiX Material Definition Language MDL SDK Shader Code Generation Path Tracer Implementation
3
4
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
5
4/3/2016
GeometryGroup GeometryInstance Geometry Material Acceleration
Instancing with Transforms Sharing Geometry and Acceleration Structures
Group Transform Transform Acceleration
6
RayGeneration
4/3/2016
Intersection BoundingBox ClosestHit Miss AnyHit
7
8
A domain-specific language for abstract declarative material description Independent of a specific rendering system Procedural programming language to customize texture image lookups
MDL Handbook and Specifications: http://www.mdlhandbook.com More Information: https://developer.nvidia.com/designworks
4/3/2016
9
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
10
diffuse reflection diffuse transmission specular(reflect) specular(transmit) specular(reflect_transmit) measured glossy backscattering glossy(reflect) glossy(transmit) glossy(reflect_transmit)
11
weighted_layer fresnel_layer custom_curve_layer measured_curve_layer
12
tint thin_film directional_factor measured_curve_factor
13
normalized_mix clamped_mix
0.25/0.25 0.5/0.5 0.75/0.75 1.0/1.0
14
diffuse_edf spot_edf measured_edf (IES profiles) mixer on edf_component[]
15
anisotropic_vdf
0.0 1.0 0.75 0.5
Henyey-Greenstein phase function vdf()
16
17
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
18
19
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
20
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; } };
21
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;
22
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); }
23
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
24
25
4/3/2016
Per Launch-Index Initialization Lens Shader Integrator Accumulate Result
26
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?
27
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;
28 4/3/2016
29 4/3/2016
30
1900 K 3000 K 5000 K 7000 K
31 4/3/2016
32
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
33
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
April 4-7, 2016 | Silicon Valley
JOIN THE NVIDIA DEVELOPER PROGRAM AT developer.nvidia.com/join droettger@nvidia.com Hangout session H6140: OptiX, Physically Based Ray Tracing, and the Material Definition Language Wednesday, April 6th at 4:00 pm in Pod C