Datasets:

ArXiv:
License:
File size: 36,357 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
/******************************************************************************
 *	 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.7;

import ::anno::*;
import ::base::*;
import ::df::*;
import ::math::*;
import ::state::*;
import ::tex::*;
import ::nvidia::core_definitions::blend_colors;
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";

annotation preview_scale( float f);

color vmat_file_texture(
	uniform texture_2d texture,
	::base::texture_coordinate_info uvw = ::base::texture_coordinate_info(),
	uniform float2 crop_u = float2(0.0, 1.0),
	uniform float2 crop_v = float2(0.0, 1.0),
	uniform tex::wrap_mode wrap_u = tex::wrap_repeat,
	uniform tex::wrap_mode wrap_v = tex::wrap_repeat
)
{
	return color(tex::lookup_float3(texture, float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v));
}

// Returns the normal n in tangent space, given n is in internal space.
float3 transform_internal_to_tangent(float3 n)
[[ 
	::anno::hidden() 
]]
{
	return
		n.x* float3(state::texture_tangent_u(0).x,state::texture_tangent_v(0).x,state::normal().x)+
		n.y* float3(state::texture_tangent_u(0).y,state::texture_tangent_v(0).y,state::normal().y)+
		n.z* float3(state::texture_tangent_u(0).z,state::texture_tangent_v(0).z,state::normal().z);
}

// Returns the normal n in internal space, given n is in tangent space.
float3 transform_tangent_to_internal(float3 n)
[[ 
	::anno::hidden() 
]]
{
	return  state::texture_tangent_u(0) * n.x +
			state::texture_tangent_v(0) * n.y +
			state::normal() * n.z ;
}



// Returns a normal by adding a detail normal to a global normal.
// If detail blending of two normal maps gives visual artifacts, check if texture_2d are loaded
// correctly with tex::gamma_linear
 float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal())
{
	// http://blog.selfshadow.com/publications/blending-in-detail/
	float3 n_t = transform_internal_to_tangent(n);
	float3 nd_t = transform_internal_to_tangent(nd);

	n_t=n_t + float3(0.,0.,1.);
	nd_t = nd_t *  float3(-1.,-1.,1.);
	n = n_t*math::dot(n_t, nd_t)/n_t.z - nd_t;
	return ::math::normalize(transform_tangent_to_internal(n));
}

float histogram_range(float input, float range = 1.0f, float position = 0.5f)
{	
	float low = ::math::clamp(1.0 - ::math::min(((1.0 - position) + range * 0.5), (1.0 - position) * 2), 0.0, 1.0);
	float high = ::math::clamp(math::min((position + range * 0.5 ), position * 2.0), 0.0, 1.0);
	return ::math::lerp(low, high, input);
}



float3 normalmap_normal(
	uniform texture_2d texture,
	float factor = 1.0,
	::base::texture_coordinate_info uvw = ::base::texture_coordinate_info()
)
{
	float3 lookup = (::tex::lookup_float3(texture, float2(uvw.position.x, uvw.position.y)) - float3(0.5)) * (factor * 2.0);
	return ::math::normalize(uvw.tangent_u * lookup.x + uvw.tangent_v * lookup.y + state::normal() * (lookup.z + (1.0 - factor)));
}


::base::texture_coordinate_info transform_coordinate_2(
	float4x4 transform										 
		[[ ::anno::description("A transformation to be applied to the source coordinates. rotation_translation_scale() is a suggested means to compute the transformation matrix.") ]],
	::base::texture_coordinate_info coordinate = ::base::texture_coordinate_info()
		[[ ::anno::description("Coordinate, typically sourced from coordinate_source or coordinate_projection.") ]]
) [[ 
	::anno::description("Transform a texture coordinate by a matrix.") ,
	::anno::noinline()
  ]]
{
	// Version 2
	float4 r_position = transform * float4(coordinate.position.x,coordinate.position.y,coordinate.position.z,1);
	float4 u = transform[0];
	float3 ru = ::math::normalize(float3(u.x,u.y,u.z));
	float cos =  ru.x; 
	float sin =  -ru.y;
	
	return ::base::texture_coordinate_info(
		float3(r_position.x,r_position.y,r_position.z),
		math::normalize(cos * coordinate.tangent_u - sin * coordinate.tangent_v),
		math::normalize(cos * coordinate.tangent_v + sin * coordinate.tangent_u));
}


// Takes the standard input that every material has. It combines a couple of
// functions in one convenience function.
::base::texture_coordinate_info vmat_transform(
								float2 translation = float2(0.0, 0.0),
								float rotation	 = 0.0,				// rotation in degrees
								float2 scaling	 = float2(1.0, 1.0),
								uniform ::base::texture_coordinate_system system = ::base::texture_coordinate_uvw,
								uniform int uv_space	   = 0
)
{
	float rotation_rad = (rotation * 3.1415926535897932384626433832f) / 180.f;
	float4x4 scale =
	float4x4(1.0 /scaling.x, 0.			 ,  0. ,	 0.,
			 0.			, 1.0 /scaling.y ,  0. ,	 0.,
			 0.			, 0.			 ,  1.0,	 0.,
			 translation.x , translation.y  ,  0.0,	 1.);

	float s = ::math::sin(rotation_rad);
	float c = ::math::cos(rotation_rad);
	float4x4 rotate =
	float4x4(  c  ,  -s   , 0.0 , 0.0,
			   s  ,   c   , 0.0 , 0.0,
			   0.0,   0.0 , 1.0 , 0.0,
			   0. ,   0.0 , 0.0 , 1.);
	
	return transform_coordinate_2(scale*rotate, ::base::coordinate_source(system, uv_space));
}

::base::texture_coordinate_info vmat_transform_post_scale(
	::base::texture_coordinate_info uvw,
	float2 scale = float2(1.0f)
)
{
	return ::base::texture_coordinate_info(
		position: float3(uvw.position.x / scale.x,
						uvw.position.y  / scale.y,
						uvw.position.z  / scale.x),
		tangent_u: uvw.tangent_u,
		tangent_v: uvw.tangent_v
	);
}


float3 rgb2hsl(float3 c)
[[
	::anno::description("Converts a color value to HSL. The function outputs the hue to \n"
						"lie in the range from 0.0-1.0."),
	::anno::author("NVIDIA vMaterials")
]]
{
	float3 hsl;
	float cMax = ::math::max(::math::max(c.x, c.y), c.z);
	float cMin = ::math::min(::math::min(c.x, c.y), c.z);
	float delta = cMax - cMin;
	
	hsl.z = (cMax + cMin) / 2.0;	
	hsl.x = ((cMax == cMin) ? 0 :
		(cMax == c.x) ? (c.y - c.z) / delta + ((c.z > c.y) ? 6.0f : 0.0f):
		(cMax == c.y) ? (c.z - c.x) / delta + 2.0 : (c.x - c.y) / delta + 4.0) / 6.0f;
	hsl.y = (hsl.z == 0.0 || hsl.z == 1.0) ? 0.0 : delta / (1.0 - ::math::abs(2.0 * hsl.z - 1.0));
	return hsl;
}

float f_n(float n, float a,  float h, float l) {
	float k = ::math::fmod(n + h * 12.f, 12.f);
	
	return l - a * ::math::max(-1.0f, ::math::min(::math::min(k-3.0f, 9.0f-k), 1.0f));
}

color hsl2rgb(float3 hsl)
[[
	::anno::description("Converts a HSL value back to a color. Note that the hue is expected to \n"
						"lie in the range from 0.0-1.0."),
	::anno::author("NVIDIA vMaterials")
]]
{
	float h = hsl.x, s = hsl.y, l = hsl.z;
	float a = s * ::math::min(l, 1.0f - l);
	return color(f_n(0.0, a, h, l),
				f_n(8.0, a, h, l),
				f_n(4.0, a, h, l));	
}



//
// flake noise utilities
//
// constants for numerical fitted curve to observed flake noise density behavior
// 1. no jitter, maximum flake diameter
const float4 ABCD = float4(-26.19771808f, 26.39663835f, 85.53857017f, -102.35069432f);
const float2 EF = float2(-101.42634862f, 118.45082288f);
// 2. jitter scale of 0.5f, maximum flake diameter
const float4 ABCD_J = float4(-0.87962159f, 0.91006603f, 0.76088203f, -0.24953308f);
const float2 EF_J = float2(-3.11456809f, 2.63430594f);

float density_to_probability(
	float4 abcd,
	float2 ef,
	float x)
{
	float xx = x * x;
	return (abcd.x * xx + abcd.y * x) / (abcd.z * xx * x + abcd.w * xx  + ef.x * x + ef.y);
}


int hash(int seed, int i)
{
	return (i ^ seed) * 1075385539;
}
int rnd_init(int3 pos)
{
	return hash(hash(hash(0, pos.x), pos.y), pos.z);
}

int rnd_next(int seed) {
	// xorshift32 using signed int
	seed ^= seed << 13;
	seed ^= seed >>> 17;
	seed ^= seed << 5;
	return seed;
}

float rnd_value(int seed)
{
	return ::math::abs(float(seed) * 4.6566e-10f);
}

// apply random rotation (using "Fast Random Rotation Matrices" by James Arvo)
float3 rotate_pos(float3 pos, float3 xi)
{
	float theta = ::math::PI * 2.0f * xi.x;
	float phi = ::math::PI * 2.0f * xi.y;
	float z = xi.z * 2.0f;

	float r = ::math::sqrt(z);
	float[2] sp_cp = ::math::sincos(phi);
	float Vx = sp_cp[0] * r;
	float Vy = sp_cp[1] * r;
	float Vz = ::math::sqrt(2.0f - z);

	float[2] st_ct = ::math::sincos(theta);
	float Sx = Vx * st_ct[1] - Vy * st_ct[0];
	float Sy = Vx * st_ct[0] + Vy * st_ct[1];

	float3x3 M(
		Vx * Sx - st_ct[1], Vx * Sy - st_ct[0], Vx * Vz,
		Vy * Sx + st_ct[0], Vy * Sy - st_ct[1], Vy * Vz,
		Vz * Sx, Vz * Sy, 1.0f - z);

	return M * pos;
}

struct flake_noise_value {	
	// flake priority (in [0..1], 0: no flake, flakes with higher priority shadow flakes "below" them)
	float priority;
	// Stores values from the functions (once normal, another time the color)
	// current pseudo random number generator seed
	int   rnd_seed;
	float4 carrier; 
};

// flake noise function with controllable regularity, flake size, and probability
flake_noise_value flake_noise(
	float3 pos,
	float jitter_scale	  = 1.0f,
	float flake_diameter	= 0.75f,
	float flake_probability = 1.0f)
{
	float3 base_pos = ::math::floor(pos);
	int3 base_pos_i = int3(base_pos);

	// limit the flake size to the allowed maximum (such that looking at all neighbors is sufficient)
	flake_diameter = ::math::min(flake_diameter, (1.5f - 0.5f * jitter_scale) / ::math::sqrt(3.0f));
	
	flake_noise_value val(0.0f, 0, float4(0.0));

	for (int i = -1; i < 2; ++i) {
		for (int j = -1; j < 2; ++j) {
			for (int k = -1; k < 2; ++k) {

				int seed = rnd_init(base_pos_i + int3(i, j, k));

				seed = rnd_next(seed);
				if (rnd_value(seed) > flake_probability)
					continue;

				seed = rnd_next(seed);
				float priority = rnd_value(seed);
				if (priority < val.priority)
					continue;				

				float3 flake_pos = base_pos + float3(i, j, k) + float3(0.5f);

				if (jitter_scale > 0.0f) {
					seed = rnd_next(seed);
					flake_pos.x += (rnd_value(seed) - 0.5f) * jitter_scale;
					seed = rnd_next(seed);
					flake_pos.y += (rnd_value(seed) - 0.5f) * jitter_scale;
					seed = rnd_next(seed);
					flake_pos.z += (rnd_value(seed) - 0.5f) * jitter_scale;
				}

				float3 p = pos - flake_pos;
				if (math::dot(p, p) >= flake_diameter * flake_diameter * 4.0f)
					continue;

				float3 xi_rot;
				seed = rnd_next(seed);
				xi_rot.x = rnd_value(seed);
				seed = rnd_next(seed);
				xi_rot.y = rnd_value(seed);
				seed = rnd_next(seed);
				xi_rot.z = rnd_value(seed);
				p = rotate_pos(p, xi_rot);
				
				if (math::abs(p.x) <= flake_diameter &&
					::math::abs(p.y) <= flake_diameter &&
					::math::abs(p.z) <= flake_diameter)
				{
					val.priority = priority;
					val.rnd_seed = seed;
				}
			}
		}
	}

	return val;
}

flake_noise_value flake_noise(
	float3 position,
	float density = 0.5f,
	bool jittered = false) // jittered: slightly slower and slightly less uniform
{
	float probability = density_to_probability(jittered ? ABCD_J : ABCD, jittered ? EF_J : EF, ::math::saturate(density));

	return flake_noise(pos: position, jitter_scale: jittered ? 0.5f : 0.0f, flake_diameter: (jittered ? 1.25f : 1.5f) / ::math::sqrt(3.0f), flake_probability: probability);
}

// create a flake normal by importance sampling the Beckmann distribution with given roughness
flake_noise_value flake_normal(
	flake_noise_value val,
	float spread)
{
	if (val.priority <= 0.0f)
	{
		val.carrier = float4(::state::normal().x, ::state::normal().y, ::state::normal().z, 1.0);
		return val;
	}
	
	int seed  = rnd_next(val.rnd_seed);
	float xi0 = rnd_value(seed);
	seed = rnd_next(seed);
	float xi1 = rnd_value(seed);
	
	float phi = ::math::PI * 2.0f * xi0;

	float roughness = spread * spread;

	float tantheta = ::math::sqrt(-roughness * roughness * ::math::log(1.0f - xi1));
	float sintheta = tantheta / ::math::sqrt(1.0f + tantheta * tantheta);
	float costheta = ::math::sqrt(1.0f - sintheta * sintheta);

	float[2] scphi = ::math::sincos(phi);
	
	val.rnd_seed = seed;
	
	float3 normal = ::state::texture_tangent_u(0) * scphi[1] * sintheta +
		::state::texture_tangent_v(0) * scphi[0] * sintheta +
		::state::normal() * costheta;
	
	val.carrier = float4(normal.x, normal.y, normal.z, 1.0);
		
	
	return val;	
}





export material Polyester_Crepe_de_Chine(
	color fabric_color = color(0.799103f, 0.799103f, 0.799103f) [[
		::anno::description("Choose the color of the fabric."),
		::anno::display_name("Fabric  Color"),
		::anno::in_group("Appearance"),
		::anno::ui_order(0)
	]],
	float color_deviation = 0.f [[
		::anno::description("Adds a variation to the reflection colors of the fabric. Higher values lead to more drastical color changes."),
		::anno::display_name("Color Deviation"),
		::anno::in_group("Appearance"),
		::anno::hard_range(0.f, 1.f),
		::anno::ui_order(1)
	]],
	float highlight_saturation = 0.9f [[
		::anno::description("Higher values cause reflected light to be tinted in the color of the material."),
		::anno::display_name("Highlight Saturation"),
		::anno::in_group("Appearance"),
		::anno::hard_range(0.f, 1.f),
		::anno::ui_order(2)
	]],
	float diffuse_weight = 0.21f [[
		::anno::description("Increasing the diffuse contribution make the material appear more flat and takes away some of its shininess."),
		::anno::display_name("Diffuse Amount"),
		::anno::in_group("Appearance"),
		::anno::hard_range(0.f, 1.f),
		::anno::ui_order(3)
	]],
	float transmissive_weight = 0.16f [[
		::anno::description("Lets light pass through the material and illuminate it from the other side."),
		::anno::display_name("Translucency"),
		::anno::in_group("Appearance"),
		::anno::hard_range(0.f, 1.f),
		::anno::ui_order(4)
	]],
	float bump_strength = 0.70f [[
		::anno::description("Specifies the strength of the bump."),
		::anno::display_name("Bump Strength"),
		::anno::in_group("Appearance"),
		::anno::hard_range(0.f, 1.f),
		::anno::ui_order(5)
	]],
	float2 texture_translate = float2(0.f) [[
		::anno::description("Controls the position of the texture."),
		::anno::display_name("Texture Translate"),
		::anno::in_group("Transform"),
		::anno::ui_order(6)
	]],
	float texture_rotate = 0.f [[
		::anno::description("Rotates angle of the texture in degrees."),
		::anno::display_name("Texture Rotate"),
		::anno::in_group("Transform"),
		::anno::soft_range(0.f, 360.f),
		::anno::ui_order(7)
	]],
	float2 texture_scale = float2(1.f) [[
		::anno::description("Larger numbers increase the size."),
		::anno::display_name("Texture Scale"),
		::anno::in_group("Transform"),
		::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)),
		::preview_scale(2.5f),
		::anno::ui_order(8)
	]],
	uniform int uv_space_index = 0 [[
		::anno::description("Uses selected UV space for material."),
		::anno::display_name("UV Space Index"),
		::anno::in_group("Transform"),
		::anno::ui_order(9)
	]]


)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - White"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "white", "light", "neutral"))
]]
 = 
	let {
		// These parameters could be exposed globally, however, they are set as constants in the material		
		float weft_deviation 	= 0.41f;  	// note that a stronger deviation will lead to clipping behavior of the
											// bsdfs when viewing them at grazing angles
		float warp_to_weft 		= 0.22f;
		float warp_weft_power		= 2.7f;	// controls the contrast of the mixing of the warp and weft with the AO texture
		
		
		// The next parameters control the width of the highlight
		float warp_roughness = 0.2f;			// Width of the warp roughness
		float weft_roughness = 0.14f;			// Width of the weft roughness
		float warpweft_noise_amount = 1.0f; 	// we use noise to introduce irregularities in the appearance of the
												// BDSF across the material surface
		
		texture_2d weave_normal_texture = 	texture_2d("./textures/crepe_de_chine_norm.jpg", ::tex::gamma_linear);
		texture_2d weave_var_texture = 	texture_2d("./textures/crepe_de_chine_var.jpg", ::tex::gamma_linear);
		texture_2d glizz_texture = 			texture_2d("./textures/fabric_noise_multi_R_noise1_G_noise_2.png", ::tex::gamma_linear);
		
		// preparing fabric colors
		// We will be deriving all colors of the fabric from a single color which requires some amount of remapping
		// the values in HSL space and then converting them back to RGB
		float3 fabric_hsl_color = rgb2hsl(float3(fabric_color));
		
		color diffuse_transmission_color = hsl2rgb(
			float3( fabric_hsl_color.x,
					fabric_hsl_color.y * ::math::pow(fabric_hsl_color.z, 0.26f),
					0.76f
			)
		);
		
		float remap_thread_brightness = fabric_hsl_color.z * 0.85 + 0.15;
		
		color warp_color = hsl2rgb(
			float3(	fabric_hsl_color.x - (color_deviation * 0.3),						// - Shifting color by color deviation
					::math::lerp(0.0f, highlight_saturation, fabric_hsl_color.y * 0.85f), //scaling the max saturation down by 15%
					remap_thread_brightness)									// remapping brightness for weft highlight
		);
		
		color weft_color = hsl2rgb(
			float3(	fabric_hsl_color.x + (color_deviation * 0.3),			// + Shifting color by color deviation
					::math::lerp(0.0f, highlight_saturation, fabric_hsl_color.y * 0.85f),
					remap_thread_brightness
			)
		);
		
		// Prepare UV coordinates for texture and noise lookups
		::base::texture_coordinate_info uvw = vmat_transform(
			translation: texture_translate,
			rotation:	texture_rotate,
			scaling:	texture_scale  * 0.4f,  // scale to fit default size of 1m for UV 0...1,
			system:		::base::texture_coordinate_uvw,
			uv_space: 	uv_space_index
		);
		
		::base::texture_coordinate_info uvw_post = vmat_transform_post_scale(uvw: uvw, scale: float2(0.2f));
		
	// Flake normal
		flake_noise_value flake_noise_val = flake_noise(
			position:	float3(uvw.position * 2500.0f),
			density:	0.72f,
			jittered:	true
		);
		
		flake_noise_value flake_noise_val2 = flake_normal(
			val:		flake_noise_val,
			spread:		0.38f		// controllable from outside
		);
		
		float3 flake_normal = float3(flake_noise_val2.carrier.x, flake_noise_val2.carrier.y, flake_noise_val2.carrier.z);
		
	// TEXTURES
		// Glizz noise textures
		float3 glizz_lookup = tex::lookup_float3(
			glizz_texture, 
			float2(uvw.position.x,uvw.position.y)
		);
		
		
		// Weave AO/brightness variation
		float var_val = float3(vmat_file_texture(
			texture: 	weave_var_texture,
			uvw:		uvw_post
		)).x;
		
		float var_val_pow = ::math::pow(var_val, warp_weft_power); // the power values controls the contrast of the lookup
														// and later in the code the mixing of the warp and weft lobe
		
		float3 weave_normal = normalmap_normal(
			texture:	weave_normal_texture,
			factor:		bump_strength, 
			uvw:		uvw_post				// we use the downscaled small UV cordinates here
		);
		
	// BSDFs
		// (single) Warp BSDF
		bsdf warp_bsdf = ::df::simple_glossy_bsdf(
			roughness_u:	0.88f,
			roughness_v:	histogram_range(glizz_lookup.x, warpweft_noise_amount, warp_roughness),	// adjusting noise texture to show some glizzening effect
			tint:			warp_color,
			tangent_u: 		uvw.tangent_u,	// required to rotate the anisotropic highlight correctly
			mode: 			::df::scatter_reflect
		);
		
		// (double) Weft BSDF
		bsdf weft_bsdf = ::df::microfacet_ggx_smith_bsdf(
			roughness_u:	histogram_range(glizz_lookup.y, warpweft_noise_amount, weft_roughness),	// adjusting noise texture to show some glizzening effect
			roughness_v:	0.58f,
			tint:			weft_color,
			multiscatter_tint:	weft_color,
			tangent_u:	uvw.tangent_u	// required to rotate the anisotropic highlight correctly
		);
		
		float3 weft_left_normal = ::math::normalize(::state::normal() - uvw.tangent_u * weft_deviation);
		float3 weft_right_normal = ::math::normalize(::state::normal() + uvw.tangent_u * weft_deviation);
		
		//adding flake detail normals
		float3 weft_left_detail_normal = add_detail_normal(
			n:		weft_left_normal,	// left-shifted normal
			nd:	flake_normal
		);
		
		float3 weft_right_detail_normal = add_detail_normal(
			n:		weft_right_normal,	// right-shifted normal
			nd:	flake_normal
		);
		
		
		// Left lobe with detail normal
		bsdf left_lobe_bsdf = ::df::weighted_layer(
				weight: 1.0f,
				layer:	weft_bsdf,
				base:	bsdf(),
				normal: weft_left_detail_normal	
		);
		
		// Right lobe with detail normal
		bsdf right_lobe_bsdf = ::df::weighted_layer(
				weight: 1.0f,
				layer:	weft_bsdf,
				base:	bsdf(),
				normal: weft_right_detail_normal	
		);

		
		bsdf left_right_lobe_bsdf = ::df::weighted_layer(
			base:	left_lobe_bsdf,
			layer:	right_lobe_bsdf,
			weight: 0.5f
		);
		
		// Warp and Weft BSDF combined and weighted via custom curve layer
		bsdf warp_weft_combined_bsdf = ::df::custom_curve_layer(
			base: df::weighted_layer(
				layer:	warp_bsdf,
				base:	left_right_lobe_bsdf,
				weight:	var_val_pow * (warp_to_weft > 1.0f ? 1.0 - 1.0f / warp_to_weft : warp_to_weft)
			),
			layer:					bsdf(),
			normal_reflectivity:	0.11f,
			grazing_reflectivity:	1.0f,
			exponent:				3.63f,
			weight:					1.0f
		);
		
		
		// Diffuse Transmission BSDF
		bsdf diff_transmission_bsdf = ::df::diffuse_transmission_bsdf(
			tint: diffuse_transmission_color
		);
		
		// Diffuse Reflection BSDF
		bsdf diff_reflection_bsdf = ::df::diffuse_reflection_bsdf(
			tint: fabric_color
		);
		
		// Computing weight contributions for the BSDF components dc_3, dc_2 and dc_1 for final mix
		::df::bsdf_component dc_3(
			weight: (2.0f - transmissive_weight * 0.68f - diffuse_weight * 0.68f),
			component: warp_weft_combined_bsdf
		);
		
		::df::bsdf_component dc_2(
			weight:	transmissive_weight * 0.68f,
			component: diff_transmission_bsdf
		);
		
		::df::bsdf_component dc_1(
			weight: diffuse_weight * 0.68f,
			component: diff_reflection_bsdf
		);
		
		// Final Mix
		bsdf final_bsdf = ::df::normalized_mix(
			components: ::df::bsdf_component[](dc_3, dc_2, dc_1)
		);
		
		/*
		bsdf transmission_warp_weft_mix = ::df::weighted_layer(
			base:	warp_weft_combined_bsdf,
			layer:	diff_transmission_bsdf,
			weight: transmissive_weight * 0.68f
		);
		
		bsdf diffuse_warp_weft_mix = ::df::weighted_layer(
			base:	warp_weft_combined_bsdf,
			layer:	diff_reflection_bsdf,
			weight:	diffuse_weight * 0.68f
		);
		
		bsdf final_bsdf = ::df::weighted_layer(
			base:	transmission_warp_weft_mix,
			layer:	diffuse_warp_weft_mix,
			weight:	0.5f
		);
		*/
	
	} in
		material(
			thin_walled: true,
			surface: material_surface(
				scattering: final_bsdf
				),
			ior: color(1.0f),
			geometry: material_geometry(
				normal: weave_normal
			)
);


// 2
export material Polyester_Crepe_de_Chine_Red(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Red"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Red.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "red", "warm", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.361307f, 0.004777f, 0.004777f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.3f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 3
export material Polyester_Crepe_de_Chine_Orange(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Orange"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Orange.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "orange", "warm", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.830770f, 0.132868f, 0.003035f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 4
export material Polyester_Crepe_de_Chine_Pink(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Pink"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Pink.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "pink", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.838799f, 0.027321f, 0.147027f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 5
export material Polyester_Crepe_de_Chine_Rose(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Rose"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Rose.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "rose", "warm"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.686685f, 0.168269f, 0.278894f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 6
export material Polyester_Crepe_de_Chine_Purple(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Purple"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Purple.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "purple", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.246201f, 0.025187f, 0.177888f),
	color_deviation:		0.05f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 7
export material Polyester_Crepe_de_Chine_Sky_Blue(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Sky Blue"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Sky_Blue.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "sky", "blue", "cool"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.080220f, 0.230740f, 0.558340f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 8
export material Polyester_Crepe_de_Chine_Anthracite(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Anthracite"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Anthracite.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "anthracite", "gray", "dark", "neutral"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.034340f, 0.049707f, 0.052861f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 9
export material Polyester_Crepe_de_Chine_Petrol(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Petrol"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Petrol.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "petrol", "cool", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.003035f, 0.130136f, 0.152926f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 10
export material Polyester_Crepe_de_Chine_Black(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Black"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Black.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "black", "dark", "neutral"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.003035f, 0.003035f, 0.003035f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 11
export material Polyester_Crepe_de_Chine_Dark_Green(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Dark Green"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Dark_Green.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "dark", "green", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.015996f, 0.109462f, 0.015996f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);


// 12
export material Polyester_Crepe_de_Chine_Lime_Green(*)
[[
	::anno::author("NVIDIA vMaterials"),
	::anno::contributor("Rüdiger Raab"),
	::anno::display_name("Polyester Crepe de Chine - Lime Green"),
	::anno::description("A polyester material woven in a Crepe de Chine fashion. It features color deviation to simulate color shifting in the material."),
	::anno::copyright_notice(COPYRIGHT),
	::anno::thumbnail("./.thumbs/Polyester_Crepe_de_Chine.Polyester_Crepe_de_Chine_Lime_Green.png"),
	::anno::key_words(string[]("fabric", "translucent", "polyester", "woven", "crepe", "chine", "iridescent", "fashion", "design", "synthetic", "lime", "green", "saturated"))
]] = Polyester_Crepe_de_Chine(
	fabric_color:			color(0.184475f, 0.597202f, 0.031896f),
	color_deviation:		0.0f,
	highlight_saturation:	0.93f,
	diffuse_weight:			0.21f,
	transmissive_weight:	0.16f,
	bump_strength:			0.70f,
	texture_translate:		float2(0.0f),
	texture_rotate:			0.0f,
	texture_scale:			float2(1.0f),
	uv_space_index:			0
);