Team Ai
Datasetpublic

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.

sourceHugging Faceotherupdated 29d agoView on Hugging Face
0likes3.7kdownloads
Diamond.mdl236 linesDownload Raw Back to Gems
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 ::df::*;40import ::base::*;41import ::math::*;42import ::nvidia::core_definitions::apply_colorfalloff;43import ::nvidia::core_definitions::thick_glass;44import ::state::normal;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/*60bsdf apply_colorfalloff_v2(61    material base = scratched_metal_v2(metal_color: color(1.)),62    uniform color color_0 = color(1.,0.,0.),63    uniform color color_1 = color(0.,1.,0.),64    uniform color color_2 = color(0.,0.,1.),65    uniform color color_3 = color(1.,0.,0.),66    uniform color color_4 = color(0.,1.,0.)67)68 =  material(69    surface: material_surface(70        scattering: df::measured_curve_factor(71            curve_values: color[](color_0,color_1,color_2,color_3,color_4),72            base: base.surface.scattering73        ),74        emission: base.surface.emission75    ),76    volume: base.volume,77    ior: base.ior,78    thin_walled: base.thin_walled,79    geometry: base.geometry80);81 82 83material gem_definition(84	color transmission_color = color(1.0),85    uniform color glass_color = color(.95),86    float roughness = 0.0,87    uniform float volume_ior = 1.4f,88    uniform bool dispersion = true,89    uniform float abbe_number = 1.4f,90    uniform float base_thickness = .1,91    float3 normal = ::state::normal()92)93[[94	::anno::hidden()95]]96 = let{97	 98    bsdf glossy_bsdf = ::df::simple_glossy_bsdf(99        mode: ::df::scatter_reflect,100        tint: color(1.),101        roughness_u: roughness102    );103    bsdf glossy_bsdf_transmission = ::df::simple_glossy_bsdf(104        mode: ::df::scatter_transmit,105        tint: transmission_color,106        roughness_u: roughness107    );108	109	bsdf surface_bsdf = ::df::weighted_layer(110            normal: normal,111            weight: 1.,112            layer: ::df::color_fresnel_layer(113                layer: glossy_bsdf,114                base: glossy_bsdf_transmission,115                ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)116            )117        );118		119} in material(120    thin_walled: false,121    surface: material_surface(scattering: surface_bsdf ),122    volume: material_volume(123        absorption_coefficient: (base_thickness <= 0)? color(0): ::math::log(glass_color) / -base_thickness124    ),125    ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)126);127*/128 129export material Diamond(130    color transmission_color = color ( 1.f , 1.f , 1.f)131    [[132        ::anno::display_name("Transmission Color"),133        ::anno::description("Color effect for transmission independent of thickness of the object."),134        ::anno::in_group("Appearance")135    ]],136    uniform color volume_color = color ( 1.f , 1.f , 1.f)137    [[138        ::anno::display_name("Volume Color"),139        ::anno::description("Color effect for volume of the object reached at transmission distance."),140        ::anno::in_group("Appearance")141    ]],142    uniform float clarity =  1.f143    [[144        ::anno::display_name("Clarity"),145        ::anno::description("Use to adapt to size of gem, smaller numbers darken the gem."),146        ::anno::soft_range(0.1,10.0),147        ::anno::in_group("Appearance")148    ]],149    uniform bool dispersion = true150    [[151        ::anno::display_name("Dispersion"),152        ::anno::description("Enable or disable the dispersion."),153        ::anno::in_group("Advanced")154    ]])155[[156    ::anno::display_name("Diamond"),157    ::anno::description("Diamond gem material (Default values based on 2cm stone size.)"),158    ::anno::author("NVIDIA vMaterials"),159	::anno::contributor("Rüdiger Raab"),160	::anno::contributor("Maik Rohland"),161    ::anno::copyright_notice(COPYRIGHT),162	::anno::thumbnail("./.thumbs/Diamond.Diamond.png"),163	::anno::key_words(string[]("gem", "jewelry", "gemstone", "transmissive", "new", "design", "transparent", "diamond", "purple"))164]] = 165let{166	// Gem definition167	// uniform color glass_color = color(.95),168	float roughness = 0.0;169	float volume_ior = 2.42f;170	float abbe_number = 55.f;171	float base_thickness = clarity * 0.1f;172	// float3 normal = ::state::normal()173 174	bsdf glossy_bsdf = ::df::simple_glossy_bsdf(175        mode: ::df::scatter_reflect,176        tint: color(1.),177        roughness_u: roughness178    );179    bsdf glossy_bsdf_transmission = ::df::simple_glossy_bsdf(180        mode: ::df::scatter_transmit,181        tint: transmission_color,182        roughness_u: roughness183    );184	185	bsdf surface_bsdf = ::df::weighted_layer(186            //normal: normal, // is state::normal anyways, can be omitted187            weight: 1.,188            layer: ::df::color_fresnel_layer(189                layer: glossy_bsdf,190                base: glossy_bsdf_transmission,191                ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)192            )193    );194	195	bsdf falloff_bsdf =  df::measured_curve_factor(196            curve_values: color[](color( 0.9529412f , 0.972549f , 1.f),197								color( 1.f , 0.9529412f , 0.9960784f),198								color( 0.9529412f , 0.9764706f , 1.f),199								color( 0.9529412f , 1.f , 0.9960784f),200								color( 1.f , 0.9529412f , 0.9843137f)201								),202            base: surface_bsdf203	);204	205 206	// the apply color falloff function does nothing but add a color gradient while keeping the material'sample207	// other properties208	209	/*210	::nvidia::core_definitions::apply_colorfalloff(211    base:  gem_definition(212        transmission_color:  transmission_color, 	// CHECK213        glass_color:  volume_color,					// CHECK		was modified in the material+_colume expresion	214        roughness:  0.f,							// CHECK				215        volume_ior:  2.42F, 						// CHECK216        dispersion: dispersion,						// CHECK217        abbe_number: 55.f,							// CHECK218        base_thickness:  clarity * 0.1f,			// CHECK219        normal:  ::state::normal ()),				// CHECK220    color_0:  color( 0.9529412f , 0.972549f , 1.f),	// CHECK221    color_1:  color( 1.f , 0.9529412f , 0.9960784f),// CHECK222    color_2:  color( 0.9529412f , 0.9764706f , 1.f),// CHECK223    color_3:  color( 0.9529412f , 1.f , 0.9960784f),// CHECK224    color_4:  color( 1.f , 0.9529412f , 0.9843137f));// CHECK225	*/226	227} in material(228    thin_walled: false,229    surface: material_surface(scattering: falloff_bsdf ),230    volume: material_volume(231        absorption_coefficient: (base_thickness <= 0)? color(0): ::math::log(volume_color) / -base_thickness232    ),233    ior: dispersion?::base::abbe_number_ior(volume_ior, abbe_number):color(volume_ior)234);235 236 
AVSim/simulation-package · Team Ai