Datasets:

ArXiv:
License:
File size: 11,309 Bytes
ae81f33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/******************************************************************************
 *     Copyright 2024 NVIDIA Corporation. All rights reserved.
 ******************************************************************************
 
Permission is hereby granted by NVIDIA Corporation ("NVIDIA"), free of charge,
to any person obtaining a copy of the sample definition code that uses our 
Material Definition Language (the "MDL Materials"), to reproduce and distribute
the MDL Materials, including without limitation the rights to use, copy, merge,
publish, distribute, and sell modified and unmodified copies of the MDL 
Materials, and to permit persons to whom the MDL Materials is furnished to do
so, in all cases solely for use with NVIDIA's Material Definition Language,
subject to the following further conditions:

1. The above copyright notices, this list of conditions, and the disclaimer
that follows shall be retained in all copies of one or more of the MDL
Materials, including in any software with which the MDL Materials are bundled,
redistributed, and/or sold, and included either as stand-alone text files,
human-readable headers or in the appropriate machine-readable metadata fields
within text or binary files as long as those fields can be easily viewed by the
user, as applicable.
2. The name of NVIDIA shall not be used to promote, endorse or advertise any 
Modified Version without specific prior written permission, except a) to comply
 with the notice requirements otherwise contained herein; or b) to acknowledge
the contribution(s) of NVIDIA.

THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR 
ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, 
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF 
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE
THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.
*/

mdl 1.4;
import ::df::*;
import ::base::*;
import ::anno::*;
import ::nvidia::core_definitions::dimension;

const string COPYRIGHT = 
" Copyright 2024 NVIDIA Corporation. All rights reserved.\n"
" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE  AGREEMENT,\n"
" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE.  IN PARTICULAR,\n" 
" THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n"
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" 
" COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n"
" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n"
" GENERAL, SPECIAL,  INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n"
" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n"
" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n";


// remaps a 0...1 value to lie between min and max
float remap(float x, float min, float max)
{
	return min + x * (max - min);
}


export material Paint_Gun_Metal (
    uniform color base_color  = color(0.08) 
    [[ 
        ::anno::display_name("Base color"),
        ::anno::description("The base color of the material."),
		::anno::in_group("Appearance")
    ]],
    uniform float flake_amount        = .25         
    [[ 
        ::anno::display_name("Flake Amount"),
        ::anno::soft_range(0.0, 1.0),
        ::anno::description("The amount of metal flakes in the material."),
		::anno::in_group("Appearance")
    ]],
    uniform float particle_size = .1           
    [[ 
        ::anno::display_name("Particle Size"), 
        ::anno::soft_range(0.0, 1.0),
        ::anno::description("The size of the particles in millimeters. If the paticles don't appear "
		"at all, check whether you are using the correct units in yout scene. The materials is built to "
		"use meters as scene unit."),
		::anno::in_group("Appearance")
    ]],
	uniform float3 texture_scale = float3(1.0f)
	[[
		::anno::hidden(),
		::anno::display_name("Scale"),
		::anno::description("An additional linear controller for controlling the dimension."),
		::anno::in_group("Flakes Layer"),
		::nvidia::core_definitions::dimension(float3(1.0f, 1.0f, 1.0f))
	]]
) [[ 
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal Paint"),
    ::anno::description("Gun metal material."),
	::anno::key_words(string[]("design", "metal", "gunmetal", "flakes", "effect", "paint", "car", "rim", "new", "automotive", "wheel", "matte")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal.png"),
    ::anno::copyright_notice(COPYRIGHT),
	::anno::hidden()
]] = let
{
    color flake_color               = color(1,1,1);
    float flake_intensity           = .8;
    float flake_roughness           = .3;
    float flake_bumpiness           = .25;
	
	// Scaling the particle size parameters to give the right average size of
	// the particles in the render
	uniform float flake_scale  = particle_size * 0.0008;
	
	float flake_amount_2 = remap(flake_amount, 0.2, 0.6);
    
    ::base::texture_coordinate_info uvw = ::base::coordinate_source(coordinate_system: ::base::texture_coordinate_object);
	
	::base::texture_coordinate_info transformed_uvw = 
								::base::transform_coordinate(
									transform: ::base::rotation_translation_scale(
												rotation: float3(0.0f),
												translation: float3(0.0f),
												scaling: texture_scale
									),
									coordinate: uvw
	);

    bsdf flake         = ::df::simple_glossy_bsdf(
                            roughness_u: flake_roughness,
                            tint: flake_color
    );
    
    bsdf base          = ::df::diffuse_reflection_bsdf (
                            tint: base_color * 0.2
    );
    
    float3 flake_bump  = ::base::flake_noise_bump_texture( 
                            uvw:         transformed_uvw,
                            strength:    flake_bumpiness,
                            scale:       particle_size*flake_scale
    );
    
    float flake_weight = ::base::flake_noise_texture( 
                            uvw:         transformed_uvw,
                            intensity:   flake_intensity,
                            scale:       particle_size*flake_scale,
                            density:     flake_amount_2
    ).mono;
    
} in material (
    surface: material_surface (
        scattering: ::df::weighted_layer(
                weight: flake_weight,
                normal: flake_bump,
                layer: flake,    
                base: base
        )
    )
);


export material Paint_Gun_Metal_Black_0(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Black 0"),
    ::anno::description("A black gun metal effect paint."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "black")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Black_0.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.08),
	flake_amount: 0.0f,
	particle_size: .15
);


export material Paint_Gun_Metal_Black_25(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Black 25"),
    ::anno::description("A black gun metal effect paint."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "black")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Black_25.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.08),
	flake_amount: 0.25f,
	particle_size: .15
);



export material Paint_Gun_Metal_Black_50(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Black 50"),
    ::anno::description("A black gun metal effect paint."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "black")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Black_50.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.08),
	flake_amount: 0.50f,
	particle_size: .15
);



export material Paint_Gun_Metal_Black_75(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Black 75"),
    ::anno::description("A black gun metal effect paint."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "black")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Black_75.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.08),
	flake_amount: 0.75f,
	particle_size: .15
);


export material Paint_Gun_Metal_Gray_0(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Gray 0"),
    ::anno::description("A dark gray gun metal paint material."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "gray", "dark")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Gray_0.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.284),
	flake_amount: 0.0f,
	particle_size: .30
);


export material Paint_Gun_Metal_Gray_25(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Gray 25"),
    ::anno::description("A dark gray gun metal paint material."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "gray", "dark")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Gray_25.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.284),
	flake_amount: 0.25,
	particle_size: .30
);


export material Paint_Gun_Metal_Gray_50(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Gray 50"),
    ::anno::description("A dark gray gun metal paint material."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "gray", "dark")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Gray_50.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.284),
	flake_amount: 0.50,
	particle_size: .30
);


export material Paint_Gun_Metal_Gray_75(*)
[[
	::anno::author("NVIDIA vMaterials"),
    ::anno::display_name("Gun Metal - Gray 75"),
    ::anno::description("A dark gray gun metal paint material."),
	::anno::key_words(string[]("design", "metal", "paint", "flakes", "effect", "car", "automotive", "rim", "wheel", "spraypaint", "shiny", "gray", "dark")),
	::anno::thumbnail("./.thumbs/Paint_Gun_Metal.Paint_Gun_Metal_Gray_75.png"),
    ::anno::copyright_notice(COPYRIGHT)
]] = Paint_Gun_Metal(
	base_color: color(0.284),
	flake_amount: 0.75,
	particle_size: .30
);