AVSim/simulation-package
Simulation runtime: the third-party half of the AVSim data generation package This repository holds the third-party runtime of the Simulation data generation package, version 3: the pieces the pipeline needs that were not written by the authors. It contains no code and no data of the authors. It is not usable on its own: the private half of the package, AVSim/simulation, downloads this repository into the same directory at a pinned revision with its fetch_runtime.sh script and… See the full description on the dataset page: https://huggingface.co/datasets/AVSim/simulation-package.
03.7k
1/******************************************************************************2 * Copyright 2024 NVIDIA Corporation. All rights reserved. *3 ******************************************************************************4 5Permission is hereby granted by NVIDIA Corporation ("NVIDIA"), free of charge,6to any person obtaining a copy of the sample definition code that uses our 7Material Definition Language (the "MDL Materials"), to reproduce and distribute8the MDL Materials, including without limitation the rights to use, copy, merge,9publish, distribute, and sell modified and unmodified copies of the MDL 10Materials, and to permit persons to whom the MDL Materials is furnished to do11so, in all cases solely for use with NVIDIA's Material Definition Language,12subject to the following further conditions:13 141. The above copyright notices, this list of conditions, and the disclaimer15that follows shall be retained in all copies of one or more of the MDL16Materials, including in any software with which the MDL Materials are bundled,17redistributed, and/or sold, and included either as stand-alone text files,18human-readable headers or in the appropriate machine-readable metadata fields19within text or binary files as long as those fields can be easily viewed by the20user, as applicable.212. The name of NVIDIA shall not be used to promote, endorse or advertise any 22Modified Version without specific prior written permission, except a) to comply23 with the notice requirements otherwise contained herein; or b) to acknowledge24the contribution(s) of NVIDIA.25 26THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS27OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,28FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,29TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR 30ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, 31INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF 32CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE33THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.34*/35 36mdl 1.6;37 38import ::anno::*;39import ::math::*;40import ::base::*;41import ::df::*;42import ::nvidia::core_definitions::flex_material;43import ::state::normal;44 45 46const string COPYRIGHT = 47" Copyright 2024 NVIDIA Corporation. All rights reserved.\n"48" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT,\n"49" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR,\n" 50" THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"51" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n"52" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" 53" COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n"54" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n"55" GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n"56" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n"57" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n";58 59 60material gem_definition(61 color transmission_color = color(1.0),62 uniform color glass_color = color(.95),63 float roughness = 0.0,64 uniform float volume_ior = 1.4f,65 uniform bool dispersion = true,66 uniform float abbe_number = 1.4f,67 uniform float base_thickness = .1,68 float3 normal = ::state::normal()69)70[[71 ::anno::hidden()72]]73 = let{74 75 bsdf glossy_bsdf = ::df::simple_glossy_bsdf(76 mode: ::df::scatter_reflect,77 tint: color(1.),78 roughness_u: roughness79 );80 bsdf glossy_bsdf_transmission = ::df::simple_glossy_bsdf(81 mode: ::df::scatter_transmit,82 tint: transmission_color,83 roughness_u: roughness84 );85} in material(86 thin_walled: false,87 surface: material_surface(88 ::df::weighted_layer(89 normal: normal,90 weight: 1.,91 layer: ::df::color_fresnel_layer(92 layer: glossy_bsdf,93 base: glossy_bsdf_transmission,94 ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)95 )96 )97 ),98 volume: material_volume(99 absorption_coefficient: (base_thickness <= 0)? color(0): ::math::log(glass_color) / -base_thickness100 ),101 ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)102);103 104 105export material Sapphire(106 uniform color transmission_color = color ( 0.509804f , 0.427451f , 0.8196079f)107 [[108 ::anno::display_name("Transmission Color"),109 ::anno::description("Color effect for transmission independent of thickness of the object."),110 ::anno::in_group("Appearance")111 ]],112 uniform color volume_color = color ( 0.001f , 0.03137255f , 0.2392157f)113 [[114 ::anno::display_name("Volume Color"),115 ::anno::description("Color effect for volume of the object reached at transmission distance."),116 ::anno::in_group("Appearance")117 ]],118 uniform float clarity = 1.f119 [[120 ::anno::display_name("Clarity"),121 ::anno::description("Use to adapt to size of gem, smaller numbers darken the gem."),122 ::anno::soft_range(0.1,10.0),123 ::anno::in_group("Appearance")124 ]],125 uniform bool dispersion = true126 [[127 ::anno::display_name("Dispersion"),128 ::anno::description("Enable or disable the dispersion."),129 ::anno::in_group("Advanced")130 ]])131[[132 ::anno::display_name("Sapphire"),133 ::anno::description("Sapphire gem material (Default values based on 2cm stone size.)"),134 ::anno::author("NVIDIA vMaterials"),135 ::anno::contributor("Rüdiger Raab"),136 ::anno::contributor("Maik Rohland"),137 ::anno::copyright_notice(COPYRIGHT),138 ::anno::thumbnail("./.thumbs/Sapphire.Sapphire.png"),139 ::anno::key_words(string[]("gem", "jewelry", "gemstone", "transmissive", "new", "design", "sapphire", "blue", "cool", "dark"))140]] = gem_definition(141 transmission_color: transmission_color,142 glass_color: volume_color,143 roughness: 0.f,144 volume_ior: 1.76f, 145 dispersion: dispersion,146 abbe_number: 72.2f,147 base_thickness: clarity * 0.1f,148 normal: ::state::normal ());