implement physically based ray
play

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


  1. April 4-7, 2016 | Silicon Valley Implement Physically Based Ray Tracing with OptiX and MDL Detlef Röttger, 4/4/2016

  2. OptiX Material Definition Language AGENDA MDL SDK Shader Code Generation Path Tracer Implementation 2

  3. OptiX 3

  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 4/3/2016

  5. OptiX Scene Hierarchy Use the OptiX C-API to create and connect scene data Sharing Geometry and Instancing with Transforms Acceleration Structures Acceleration Group Transform Transform GeometryGroup Acceleration GeometryInstance Material Geometry 5 4/3/2016

  6. OptiX Program Domains Developer controls the algorithm via CUDA C++ programs RayGeneration Miss Intersection BoundingBox ClosestHit AnyHit 6 4/3/2016

  7. Material Definition Language 7

  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 8 4/3/2016

  9. MDL Code Example Version and Imports mdl 1.2; import df::*; Name export material my_diffuse( uniform float par_roughness = 0.0, Parameters uniform color par_color = color(0.5) ) = Definition material ( surface: material_surface ( scattering: df::diffuse_reflection_bsdf ( roughness: par_roughness, tint: par_color ) ) ); 9

  10. MDL Basic Building Blocks Bidirectional Scattering Distribution Functions (BSDF) specular(transmit) diffuse reflection diffuse transmission specular(reflect) specular(reflect_transmit) 10 glossy(transmit) measured glossy backscattering glossy(reflect) glossy(reflect_transmit)

  11. MDL Basic Building Blocks Layers weighted_layer fresnel_layer custom_curve_layer measured_curve_layer 11

  12. MDL Basic Building Blocks Modifiers tint directional_factor measured_curve_factor thin_film 12

  13. MDL Basic Building Blocks Mixers normalized_mix 0.25/0.25 0.5/0.5 0.75/0.75 1.0/1.0 clamped_mix 13

  14. MDL Basic Building Blocks Emission Distribution Functions (EDF) diffuse_edf spot_edf mixer on edf_component[] measured_edf (IES profiles) 14

  15. MDL Basic Building Blocks Volume Distribution Functions (VDF) anisotropic_vdf -0.5 -0.75 -1.0 vdf() 0.0 Henyey-Greenstein phase function 0.5 0.75 1.0 15

  16. Material Definition Language SDK 16

  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 17 4/3/2016

  18. Shader Code Generation 18

  19. Shader Code Generation Using the MDL SDK Compiled Builder DAG <name>.mdl MDL SDK Material Class Nodes Texture Parameter Getter Header References Macros Classes Material Parameter Hierarchy Traverser Constructor Interface Typedefs Code Traverser Description <hash>.cu <name>.txt 19 4/3/2016

  20. Parameter Macros and Getter Classes Connecting variable expressions with hardcoded building blocks #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; } }; 20 4/3/2016

  21. Material Hierarchy as Typedefs Match MDL material structure with C++ class implementation 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; 21

  22. Material Hierarchy Traversal Function Single function to evaluate material hierarchy and parameters 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); } 22

  23. Material Hierarchy Traversal Traversal and Data Storage (layered example) Traversal.nodes[] data array material theMaterial.traverse() (Inner nodes‘ data stored at end, BSDF and EDF node data stored at begin) ... material surface dfIndex dataIndex weighted layer layer base diffuse glossy reflection bsdf bsdf 23 4/3/2016

  24. Forward Path Tracer Implementation 24

  25. Ray Generation Per Launch-Index Initialization Lens Shader Integrator Accumulate Result 25 4/3/2016

  26. Closest Hit Program A single program for all materials! Inlined Code State Calculation, Traversal Setup Bound Callable Program Material Hierachy Traversal (per material shader, (for parameters, emission, estimation, calculation) called multiple times) Bindless Callable Programs BSDF Sampling (per BSDF) Bindless Callable Programs Light Sampling (per light type) Diffuse Reflection BSDF? Bindless Callable Programs BSDF Evaluation (per diffuse BSDF) 26 4/3/2016

  27. Any Hit Program A single program only present for cutout opacity materials! Inlined Code State Calculation, Traversal Setup Material Hierachy Traversal Bound Callable Program (per material shader) (for cutout opacity value only) Stochastic Transparency if (opacity < RNG) ignore intersection; 27 4/3/2016

  28. 28 4/3/2016

  29. 29 4/3/2016

  30. EDF examples Blackbody Radiation 1900 K 3000 K 5000 K 7000 K 30

  31. 31 4/3/2016

  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 32 4/3/2016

  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 33 4/3/2016

  34. 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 droettger@nvidia.com

Recommend


More recommend