imagine-io commited on
Commit
89968b2
·
verified ·
1 Parent(s): 0198593

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +57 -0
  2. simready_assets/826/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  3. simready_assets/826/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  4. simready_assets/826/.metadata/com.nvidia.simready.packaging.bom.json +109 -0
  5. simready_assets/826/.metadata/com.nvidia.simready.root_usds.json +6 -0
  6. simready_assets/826/gltf/pbr.mdl +1027 -0
  7. simready_assets/859/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  8. simready_assets/859/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  9. simready_assets/859/.metadata/com.nvidia.simready.packaging.bom.json +54 -0
  10. simready_assets/859/.metadata/com.nvidia.simready.root_usds.json +6 -0
  11. simready_assets/859/dryer_frontload_7kg.usd +3 -0
  12. simready_assets/859/gltf/pbr.mdl +1004 -0
  13. simready_assets/860/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  14. simready_assets/860/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  15. simready_assets/860/.metadata/com.nvidia.simready.packaging.bom.json +52 -0
  16. simready_assets/860/.metadata/com.nvidia.simready.root_usds.json +6 -0
  17. simready_assets/860/SubUSDs/materials/pbr.mdl +1004 -0
  18. simready_assets/860/gltf/pbr.mdl +1004 -0
  19. simready_assets/861/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  20. simready_assets/861/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  21. simready_assets/861/.metadata/com.nvidia.simready.packaging.bom.json +43 -0
  22. simready_assets/861/.metadata/com.nvidia.simready.root_usds.json +6 -0
  23. simready_assets/861/gltf/pbr.mdl +1004 -0
  24. simready_assets/892/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  25. simready_assets/892/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  26. simready_assets/892/.metadata/com.nvidia.simready.packaging.bom.json +63 -0
  27. simready_assets/892/.metadata/com.nvidia.simready.root_usds.json +6 -0
  28. simready_assets/892/gltf/pbr.mdl +1027 -0
  29. simready_assets/893/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  30. simready_assets/893/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  31. simready_assets/893/.metadata/com.nvidia.simready.packaging.bom.json +43 -0
  32. simready_assets/893/.metadata/com.nvidia.simready.root_usds.json +6 -0
  33. simready_assets/893/gltf/pbr.mdl +1004 -0
  34. simready_assets/894/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  35. simready_assets/894/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  36. simready_assets/894/.metadata/com.nvidia.simready.packaging.bom.json +43 -0
  37. simready_assets/894/.metadata/com.nvidia.simready.root_usds.json +6 -0
  38. simready_assets/894/gltf/pbr.mdl +1004 -0
  39. simready_assets/895/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  40. simready_assets/895/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  41. simready_assets/895/.metadata/com.nvidia.simready.packaging.bom.json +43 -0
  42. simready_assets/895/.metadata/com.nvidia.simready.root_usds.json +6 -0
  43. simready_assets/895/gltf/pbr.mdl +1004 -0
  44. simready_assets/896/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  45. simready_assets/896/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
  46. simready_assets/896/.metadata/com.nvidia.simready.packaging.bom.json +43 -0
  47. simready_assets/896/.metadata/com.nvidia.simready.root_usds.json +6 -0
  48. simready_assets/896/gltf/pbr.mdl +1027 -0
  49. simready_assets/897/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json +39 -0
  50. simready_assets/897/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json +35 -0
.gitattributes CHANGED
@@ -741,3 +741,60 @@ simready_assets/903/office_door.usd filter=lfs diff=lfs merge=lfs -text
741
  simready_assets/892/soap_basket.usd filter=lfs diff=lfs merge=lfs -text
742
  simready_assets/901/plastic_tote_2.92ftx2ft.usd filter=lfs diff=lfs merge=lfs -text
743
  simready_assets/902/plastic_tote_2.92ftx2ft_2.usd filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  simready_assets/892/soap_basket.usd filter=lfs diff=lfs merge=lfs -text
742
  simready_assets/901/plastic_tote_2.92ftx2ft.usd filter=lfs diff=lfs merge=lfs -text
743
  simready_assets/902/plastic_tote_2.92ftx2ft_2.usd filter=lfs diff=lfs merge=lfs -text
744
+ simready_assets/909/plastic_barrel_2.usd filter=lfs diff=lfs merge=lfs -text
745
+ simready_assets/912/wooden_crate_1.usd filter=lfs diff=lfs merge=lfs -text
746
+ simready_assets/904/exit_door.usd filter=lfs diff=lfs merge=lfs -text
747
+ simready_assets/908/plastic_barrel_1.usd filter=lfs diff=lfs merge=lfs -text
748
+ simready_assets/914/dock_shutter_14ftx14ft_open_version.usd filter=lfs diff=lfs merge=lfs -text
749
+ simready_assets/913/dock_shutter_10ftx10ft_open_version.usd filter=lfs diff=lfs merge=lfs -text
750
+ simready_assets/915/stack_nest_tote_1.7x1.25_ft.usd filter=lfs diff=lfs merge=lfs -text
751
+ simready_assets/916/warehouse_pallet_1.usd filter=lfs diff=lfs merge=lfs -text
752
+ simready_assets/917/warehouse_pallet_2.usd filter=lfs diff=lfs merge=lfs -text
753
+ simready_assets/918/warehouse_pallet_3.usd filter=lfs diff=lfs merge=lfs -text
754
+ simready_assets/919/warehouse_pallet_4.usd filter=lfs diff=lfs merge=lfs -text
755
+ simready_assets/920/warehouse_pallet_5.usd filter=lfs diff=lfs merge=lfs -text
756
+ simready_assets/921/warehouse_pallet_6.usd filter=lfs diff=lfs merge=lfs -text
757
+ simready_assets/859/dryer_frontload_7kg.usd filter=lfs diff=lfs merge=lfs -text
758
+ simready_assets/923/warehouse_pallet_8.usd filter=lfs diff=lfs merge=lfs -text
759
+ simready_assets/925/warehouse_pallet_10.usd filter=lfs diff=lfs merge=lfs -text
760
+ simready_assets/924/warehouse_pallet_9.usd filter=lfs diff=lfs merge=lfs -text
761
+ simready_assets/926/warehouse_pallet_11.usd filter=lfs diff=lfs merge=lfs -text
762
+ simready_assets/927/warehouse_pallet_12.usd filter=lfs diff=lfs merge=lfs -text
763
+ simready_assets/928/warehouse_pallet_13.usd filter=lfs diff=lfs merge=lfs -text
764
+ simready_assets/929/warehouse_pallet_14.usd filter=lfs diff=lfs merge=lfs -text
765
+ simready_assets/922/warehouse_pallet_7.usd filter=lfs diff=lfs merge=lfs -text
766
+ simready_assets/931/warehouse_pallet_16.usd filter=lfs diff=lfs merge=lfs -text
767
+ simready_assets/930/warehouse_pallet_15.usd filter=lfs diff=lfs merge=lfs -text
768
+ simready_assets/932/wooden_pallet_4_ft_X_4_ft_2.usd filter=lfs diff=lfs merge=lfs -text
769
+ simready_assets/933/wooden_pallet_4_ft_X_3_33_ft.usd filter=lfs diff=lfs merge=lfs -text
770
+ simready_assets/934/traffic_barrier_gate.usd filter=lfs diff=lfs merge=lfs -text
771
+ simready_assets/937/wooden_crate_3.usd filter=lfs diff=lfs merge=lfs -text
772
+ simready_assets/936/wooden_crate_2.usd filter=lfs diff=lfs merge=lfs -text
773
+ simready_assets/938/wire_mesh_partition.usd filter=lfs diff=lfs merge=lfs -text
774
+ simready_assets/935/tool_box.usd filter=lfs diff=lfs merge=lfs -text
775
+ simready_assets/939/wire_mesh_partition_gate_6.93ftx6.77ft.usd filter=lfs diff=lfs merge=lfs -text
776
+ simready_assets/942/hydraulic_dock_leveler_elevated.usd filter=lfs diff=lfs merge=lfs -text
777
+ simready_assets/940/warehouse_rack_2.usd filter=lfs diff=lfs merge=lfs -text
778
+ simready_assets/943/warehouse_electric_panel.usd filter=lfs diff=lfs merge=lfs -text
779
+ simready_assets/941/hydraulic_dock_leveler.usd filter=lfs diff=lfs merge=lfs -text
780
+ simready_assets/944/Metal_Storage_Locker_12in.usd filter=lfs diff=lfs merge=lfs -text
781
+ simready_assets/945/Metal_storage_Locker_24in.usd filter=lfs diff=lfs merge=lfs -text
782
+ simready_assets/946/office_desk.usd filter=lfs diff=lfs merge=lfs -text
783
+ simready_assets/948/safety_bollard.usd filter=lfs diff=lfs merge=lfs -text
784
+ simready_assets/949/high_bay_led_luminaire_3.usd filter=lfs diff=lfs merge=lfs -text
785
+ simready_assets/947/emergency_exit_sign.usd filter=lfs diff=lfs merge=lfs -text
786
+ simready_assets/950/high_bay_led_luminaire_2.usd filter=lfs diff=lfs merge=lfs -text
787
+ simready_assets/955/Column_guard_1.usd filter=lfs diff=lfs merge=lfs -text
788
+ simready_assets/953/office_chair.usd filter=lfs diff=lfs merge=lfs -text
789
+ simready_assets/951/high_bay_led_luminaire_1.usd filter=lfs diff=lfs merge=lfs -text
790
+ simready_assets/958/traffic_mirror_dome.usd filter=lfs diff=lfs merge=lfs -text
791
+ simready_assets/957/fire_extinguisher.usd filter=lfs diff=lfs merge=lfs -text
792
+ simready_assets/952/semi_trailer.usd filter=lfs diff=lfs merge=lfs -text
793
+ simready_assets/959/Wall_panel_corrugated_metal.usd filter=lfs diff=lfs merge=lfs -text
794
+ simready_assets/960/fire_alarm.usd filter=lfs diff=lfs merge=lfs -text
795
+ simready_assets/961/fire_sprinkler.usd filter=lfs diff=lfs merge=lfs -text
796
+ simready_assets/963/smoke_detector.usd filter=lfs diff=lfs merge=lfs -text
797
+ simready_assets/962/large_first_aid_kit.usd filter=lfs diff=lfs merge=lfs -text
798
+ simready_assets/954/forklift_1.usd filter=lfs diff=lfs merge=lfs -text
799
+ simready_assets/964/scissor_lift.usd filter=lfs diff=lfs merge=lfs -text
800
+ simready_assets/967/iron_and_ironing_board.usd filter=lfs diff=lfs merge=lfs -text
simready_assets/826/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-10T19:04:47",
6
+ "assets": [
7
+ {
8
+ "asset": "outdoor_plant_7.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "6fdc32316dcc9af73acbb1637eb88e64a555f13aa57a610677701d783692c894",
37
+ "blake3": "9cb2de2e7f780a0fafa18f189c5c8c5a2d90de656311a1d277bbaad39ca4050f"
38
+ }
39
+ }
simready_assets/826/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-10T19:04:47",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/826/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///E:/validate/Output/.packages/outdoor_plant_7/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/outdoor_plant_7.usd.png",
7
+ "size": 15362,
8
+ "hash": {
9
+ "sha256-flat-1mb": "f4e0a6c67ae00126be92f342d973046ff0c55fe7c9744a6d74e891f93c351ea8",
10
+ "sha256": "2adb7e0c05bb861fc73ac3371db6ec9f615a0403244c2f1a2b412d7e2376a0d2",
11
+ "blake3": "889fb35748d985422f8f2d609b819398f3a7ff9a11c5c4109f1656d53a679087"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_leaf_diffuse.jpg",
16
+ "size": 443043,
17
+ "hash": {
18
+ "sha256-flat-1mb": "7f00c4353f77102dc338dccc4eb433a353d3ca7f7bf20a88b565ab129125244d",
19
+ "sha256": "f122057cf87f30d6f08f197d190bfa4f01ebfd207914ef76fdf8ed84aa10ba7f",
20
+ "blake3": "701b5f7e812710abd536881c0c21e9ad8d5e4c80e6948d2a733d74f8acfe9d17"
21
+ }
22
+ },
23
+ {
24
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_leaf_normal.jpg",
25
+ "size": 1537169,
26
+ "hash": {
27
+ "sha256-flat-1mb": "8e3366ff8d68185031bb84b9214616b4ba31f426b10c43536e19b31bee1d7463",
28
+ "sha256": "8e944a35e000dab071f7226f017e330c0756c7adb9ec7759af5929d0f73e023d",
29
+ "blake3": "17c0a399ecfaea553d5bffdc34acfc67e5aab38bfefdbc1243b109e64b04bc41",
30
+ "sha256-first1m": "28c2ea106a993edd1cd114917d2db731a34c58abbee154df1a38bc3ebb8784eb"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_soil_diffuse.jpg",
35
+ "size": 630871,
36
+ "hash": {
37
+ "sha256-flat-1mb": "65011932e693247aa6f1f5041dda05db0977b1f010ec8ae9e027ed18609b1c99",
38
+ "sha256": "62f3e6e6b1749b41555c898f4f42f4cc3d82b932a1c1e21e008c9910df34f06d",
39
+ "blake3": "8307e573ddd6702d29fbe463f086ba02c32aed563ea70927da97382e0eed06d7"
40
+ }
41
+ },
42
+ {
43
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_soil_normal.jpg",
44
+ "size": 1162502,
45
+ "hash": {
46
+ "sha256-flat-1mb": "b5e4248e1c74873580fa30a182cec75d6a71f82d28c87d53d3ddbfa2f539a100",
47
+ "sha256": "fa6b8d4eb95ad7991000cdcb822a7b3f5efc17c528918c649b0a7c3aef5880cd",
48
+ "blake3": "7804c771474460387b736ab607ae34e83c30ae9188d5f00eeb468ed1a248c543",
49
+ "sha256-first1m": "d19269bda0c377479e778135eb11f60603d69178e5969334b9eed2a08f0b66a7"
50
+ }
51
+ },
52
+ {
53
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_stem_diffuse.jpg",
54
+ "size": 256535,
55
+ "hash": {
56
+ "sha256-flat-1mb": "8d39c67716f85567dfbc32d7acbffd18ac1f925b68b6026d20c4b78338680520",
57
+ "sha256": "99b97e0e74a4a23dcfd2cb1a4c2d21696fbb508d5234c53b56ed698643a8e498",
58
+ "blake3": "41420af14af25bf289ea8ad3644c25343a777f7a3ba9b04132a5289736e62484"
59
+ }
60
+ },
61
+ {
62
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_thumb.jpg",
63
+ "size": 208387,
64
+ "hash": {
65
+ "sha256-flat-1mb": "6df38171de52cb23deeaaa03987f1e565fe16909873d6087f9f87339adff62b8",
66
+ "sha256": "fd4be58405635b72fcfbe9143f4c0d522ea185e9e922fc4704788dc8a9bc6512",
67
+ "blake3": "2b8c3f81f02365345e6b9ada9a3ecbfa9aa0b50a5a8e664b54b2af867061f859"
68
+ }
69
+ },
70
+ {
71
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_vase_diffuse.jpg",
72
+ "size": 530026,
73
+ "hash": {
74
+ "sha256-flat-1mb": "27640fe4900c6b9c25c3552b591231f8edb753a56d93acef45ace13e1cb17943",
75
+ "sha256": "54cdaacfd2a4a38996e0ca9e8738d410e5c77ef29651bc1a2fb5d6758cef226d",
76
+ "blake3": "3ac8f73541d1a4dc7069e53a8ef6cca83c55b1832599ce54e3f5f4d246cbf47b"
77
+ }
78
+ },
79
+ {
80
+ "relative_path": "SubUSDs/textures/outdoor_plant_7_vase_normal.jpg",
81
+ "size": 1276439,
82
+ "hash": {
83
+ "sha256-flat-1mb": "7cc6ed6b1d808d65898b62b1bbebfa8abcde057f6a706a68351a90b126abab05",
84
+ "sha256": "6701cbd8464584be97385be6bbac2ac5786fe7e570bf9249ebd6d8b45f40b4e2",
85
+ "blake3": "fbc5fba4a5c2933c62f53df8adeb309fb48f41225f2e7c4fa0bcac060760041e",
86
+ "sha256-first1m": "ce99fae28ad137172b733254346cd06c23b0a056d047e9a4254503c6e6f27bad"
87
+ }
88
+ },
89
+ {
90
+ "relative_path": "gltf/pbr.mdl",
91
+ "size": 43800,
92
+ "hash": {
93
+ "sha256-flat-1mb": "f7013dcb99f4ad5c79b3b53c2b379598d790170e11a0aef8891ceef8c9bfc51c",
94
+ "sha256": "2c7c14d7bbf7cacea990f90e8ecc92700d8a7fe9805e44970096796e2be88b78",
95
+ "blake3": "3f0cb5ffe7e319677743a74dba7fdb0b2b11c3e40cc4b2d69277db595f52cbec"
96
+ }
97
+ },
98
+ {
99
+ "relative_path": "outdoor_plant_7.usd",
100
+ "size": 4355777,
101
+ "hash": {
102
+ "sha256-flat-1mb": "ee1e98fd92d617318867e7956ac294289f615c5a053973aad5bb5adabc4b001f",
103
+ "sha256": "9d79580ec55763f2330ae34a0353435e8f0b073256f6b74f1bc8fcf90ce8871c",
104
+ "blake3": "b83ead2e0ac17997464ce778462eae2908ce88e3eeea4164d3bc48341b55221b",
105
+ "sha256-first1m": "e37dbeac7d1e985d390640f36c3758f5bdf215c8f95a268380848403a6762e4f"
106
+ }
107
+ }
108
+ ]
109
+ }
simready_assets/826/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "outdoor_plant_7.usd"
5
+ ]
6
+ }
simready_assets/826/gltf/pbr.mdl ADDED
@@ -0,0 +1,1027 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******************************************************************************
2
+ * Copyright 2024 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * * Redistributions of source code must retain the above copyright
8
+ * notice, this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright
10
+ * notice, this list of conditions and the following disclaimer in the
11
+ * documentation and/or other materials provided with the distribution.
12
+ * * Neither the name of NVIDIA CORPORATION nor the names of its
13
+ * contributors may be used to endorse or promote products derived
14
+ * from this software without specific prior written permission.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ *****************************************************************************/
28
+
29
+ mdl 1.8;
30
+
31
+ import ::anno::*;
32
+ import ::base::*;
33
+ import ::df::*;
34
+ import ::math::*;
35
+ import ::state::*;
36
+ import ::tex::*;
37
+ import ::scene::*;
38
+ import ::limits::*;
39
+
40
+ export enum gltf_alpha_mode {
41
+ opaque,
42
+ mask,
43
+ blend
44
+ };
45
+
46
+ export enum gltf_wrapping_mode {
47
+ clamp_to_edge = 33071,
48
+ mirrored_repeat = 33648,
49
+ repeat = 10497
50
+ };
51
+
52
+ export struct gltf_texture_lookup_value
53
+ {
54
+ bool valid = false;
55
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
56
+ };
57
+
58
+ export struct gltf_normal_texture_lookup_value
59
+ {
60
+ bool valid = false;
61
+ float3 value = float3(0.0);
62
+ };
63
+
64
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
65
+ switch (mode) {
66
+ case mask:
67
+ return alpha < cutoff ? 0.0 : 1.0;
68
+ case blend:
69
+ return alpha;
70
+ case opaque:
71
+ return 1.0;
72
+ }
73
+ }
74
+
75
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
76
+ return sample.valid ? sample.value : default_value;
77
+ }
78
+
79
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
80
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
81
+ }
82
+
83
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
84
+ return sample.valid ? sample.value : state::normal();
85
+ }
86
+
87
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
88
+ float occulusion = sample.valid ? sample.value.x : 1.0;
89
+ return math::lerp(1.0, occulusion, occlusion_strength);
90
+ }
91
+
92
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
93
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
94
+ }
95
+
96
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
97
+ {
98
+ if (mode == clamp_to_edge)
99
+ return ::tex::wrap_clamp;
100
+ if (mode == mirrored_repeat)
101
+ return ::tex::wrap_mirrored_repeat;
102
+
103
+ return ::tex::wrap_repeat;
104
+ }
105
+
106
+ float2 khr_texture_transform_apply(
107
+ float2 coord,
108
+ float2 offset,
109
+ float rotation,
110
+ float2 scale
111
+ )
112
+ {
113
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
114
+ // Assuming the renderer follows the MDL specification in which case the coordinates
115
+ // have been flipped either while loading the glTF geometry or while setting up the state.
116
+
117
+ // Undo the flipping for the transformation to get into the original glTF texture space.
118
+ coord = float2(coord.x, 1.0f - coord.y);
119
+
120
+ // first scale
121
+ coord = coord * scale;
122
+ // then rotate
123
+ float cos_rotation = ::math::cos(rotation);
124
+ float sin_rotation = ::math::sin(rotation);
125
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
126
+ // then translate
127
+ coord = coord + offset;
128
+
129
+ // flip back
130
+ coord = float2(coord.x, 1.0f - coord.y);
131
+ return coord;
132
+ }
133
+
134
+ export gltf_texture_lookup_value gltf_texture_lookup(
135
+ uniform texture_2d texture = texture_2d()
136
+ [[
137
+ anno::in_group("Source"),
138
+ anno::display_name("Texture"),
139
+ anno::description("Texture File")
140
+ ]],
141
+ uniform int tex_coord_index = 0
142
+ [[
143
+ anno::in_group("Source"),
144
+ anno::display_name("Coordinate Set"),
145
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform float2 offset = float2(0.0f, 0.0)
150
+ [[
151
+ anno::in_group("Texture Transform"),
152
+ anno::display_name("Offset"),
153
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform float rotation = 0.0
157
+ [[
158
+ anno::hard_range(0.0, 2.0 * ::math::PI),
159
+ anno::in_group("Texture Transform"),
160
+ anno::display_name("Rotation"),
161
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
162
+ anno::enable_if("::tex::texture_isvalid(texture)")
163
+ ]],
164
+ uniform float2 scale = float2(1.0f, 1.0f)
165
+ [[
166
+ anno::in_group("Texture Transform"),
167
+ anno::display_name("Scale"),
168
+ anno::description("The scale factor applied to the components of the UV coordinates."),
169
+ anno::enable_if("::tex::texture_isvalid(texture)")
170
+ ]],
171
+
172
+ uniform gltf_wrapping_mode wrap_s = repeat
173
+ [[
174
+ anno::in_group("Sampler"),
175
+ anno::display_name("Wrap S"),
176
+ anno::description("S (U) wrapping mode."),
177
+ anno::enable_if("::tex::texture_isvalid(texture)")
178
+ ]],
179
+ uniform gltf_wrapping_mode wrap_t = repeat
180
+ [[
181
+ anno::in_group("Sampler"),
182
+ anno::display_name("Wrap T"),
183
+ anno::description("T (V) wrapping mode."),
184
+ anno::enable_if("::tex::texture_isvalid(texture)")
185
+ ]]
186
+ )
187
+ [[
188
+ anno::author("NVIDIA Corporation"),
189
+ anno::display_name("GLTF Texture Lookup"),
190
+ anno::description("Function to read a color or color with alpha channel texture.")
191
+ ]]
192
+ {
193
+ gltf_texture_lookup_value tex_ret;
194
+ if (!tex::texture_isvalid(texture))
195
+ return tex_ret;
196
+
197
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
198
+ float2 tex_coord = khr_texture_transform_apply(
199
+ coord: float2(tex_coord3.x, tex_coord3.y),
200
+ offset: offset,
201
+ rotation: rotation,
202
+ scale: scale);
203
+
204
+ tex_ret.value = tex::lookup_float4(
205
+ tex: texture,
206
+ coord: tex_coord,
207
+ wrap_u: convert_wrap_mode(wrap_s),
208
+ wrap_v: convert_wrap_mode(wrap_t));
209
+ tex_ret.valid = true;
210
+ return tex_ret;
211
+ }
212
+
213
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
214
+ uniform texture_2d texture = texture_2d()
215
+ [[
216
+ anno::in_group("Source"),
217
+ anno::display_name("Texture"),
218
+ anno::description("Texture File")
219
+ ]],
220
+ uniform float normal_scale_factor = 1.0
221
+ [[
222
+ anno::hard_range(0.0, 1.0),
223
+ anno::in_group("Source"),
224
+ anno::display_name("Normal Scale Factor"),
225
+ anno::description("Strength of the base layer normal mapping."),
226
+ anno::enable_if("::tex::texture_isvalid(texture)")
227
+ ]],
228
+ uniform int tex_coord_index = 0
229
+ [[
230
+ anno::in_group("Source"),
231
+ anno::display_name("Coordinate Set"),
232
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
233
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
234
+ ]],
235
+ uniform int tex_tangent_index = 0
236
+ [[
237
+ anno::hidden(),
238
+ anno::in_group("Source"),
239
+ anno::display_name("Coordinate Set"),
240
+ anno::description("Tangent to be to construct the tangent frame."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform float2 offset = float2(0.0f, 0.0)
245
+ [[
246
+ anno::in_group("Texture Transform"),
247
+ anno::display_name("Offset"),
248
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform float rotation = 0.0
252
+ [[
253
+ anno::hard_range(0.0, 2.0 * ::math::PI),
254
+ anno::in_group("Texture Transform"),
255
+ anno::display_name("Rotation"),
256
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
257
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
258
+ ]],
259
+ uniform float2 scale = float2(1.0f, 1.0f)
260
+ [[
261
+ anno::in_group("Texture Transform"),
262
+ anno::display_name("Scale"),
263
+ anno::description("The scale factor applied to the components of the UV coordinates."),
264
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
265
+ ]],
266
+
267
+ uniform gltf_wrapping_mode wrap_s = repeat
268
+ [[
269
+ anno::in_group("Sampler"),
270
+ anno::display_name("Wrap S"),
271
+ anno::description("S (U) wrapping mode."),
272
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
273
+ ]],
274
+ uniform gltf_wrapping_mode wrap_t = repeat
275
+ [[
276
+ anno::in_group("Sampler"),
277
+ anno::display_name("Wrap T"),
278
+ anno::description("T (V) wrapping mode."),
279
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
280
+ ]]
281
+ )
282
+ [[
283
+ anno::author("NVIDIA Corporation"),
284
+ anno::display_name("GLTF Normal Texture Lookup"),
285
+ anno::description("Function to read a normal texture.")
286
+ ]]
287
+ {
288
+ gltf_normal_texture_lookup_value tex_ret;
289
+ if (!::tex::texture_isvalid(texture))
290
+ return tex_ret;
291
+
292
+ tex_ret.value = base::tangent_space_normal_texture(
293
+ texture: texture,
294
+ factor: normal_scale_factor,
295
+ uvw: base::transform_coordinate(
296
+ transform: base::rotation_translation_scale(
297
+ rotation: float3(0, 0, rotation),
298
+ translation: float3(offset.x, offset.y, 0),
299
+ scaling: float3(scale.x, scale.y, 1)
300
+ ),
301
+ coordinate: base::texture_coordinate_info(
302
+ position: state::texture_coordinate(tex_coord_index),
303
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
304
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
305
+ )
306
+ ),
307
+ wrap_u: convert_wrap_mode(wrap_s),
308
+ wrap_v: convert_wrap_mode(wrap_t));
309
+ tex_ret.valid = true;
310
+ return tex_ret;
311
+ }
312
+
313
+ export material gltf_material(
314
+ // base color
315
+ uniform color base_color_factor = color(1.0)
316
+ [[
317
+ anno::in_group("Metallic Roughness"),
318
+ anno::display_name("Base Color Factor"),
319
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
320
+ ]],
321
+
322
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
323
+ [[
324
+ anno::in_group("Metallic Roughness"),
325
+ anno::display_name("Base Color Texture"),
326
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
327
+ ]],
328
+
329
+ // KHR_materials_specular
330
+ uniform float specular_factor = 1.0
331
+ [[
332
+ anno::hard_range(0.0, 1.0),
333
+ anno::in_group("Specular"),
334
+ anno::display_name("Specular Factor"),
335
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
336
+ ]],
337
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
338
+ [[
339
+ anno::in_group("Specular"),
340
+ anno::display_name("Specular Texture"),
341
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
342
+ ]],
343
+ uniform color specular_color_factor = color(1.0)
344
+ [[
345
+ anno::in_group("Specular"),
346
+ anno::display_name("Specular Color Factor"),
347
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
348
+ ]],
349
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Specular"),
352
+ anno::display_name("Specular Color Texture"),
353
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
354
+ ]],
355
+
356
+ // metallic roughness
357
+ uniform float metallic_factor = 1.0
358
+ [[
359
+ anno::hard_range(0.0, 1.0),
360
+ anno::in_group("Metallic Roughness"),
361
+ anno::display_name("Metallic Factor"),
362
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
363
+ ]],
364
+
365
+ uniform float roughness_factor = 1.0
366
+ [[
367
+ anno::hard_range(0.0, 1.0),
368
+ anno::in_group("Metallic Roughness"),
369
+ anno::display_name("Roughness Factor"),
370
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
371
+ ]],
372
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Metallic Roughness"),
375
+ anno::display_name("Metal/Rough Texture"),
376
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
377
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
378
+ ]],
379
+
380
+ // KHR_materials_anisotropy
381
+ uniform float anisotropy_strength = 0.0
382
+ [[
383
+ anno::hard_range(0.0, 1.0),
384
+ anno::in_group("Anisotropy"),
385
+ anno::display_name("Anisotropy Strength"),
386
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
387
+ ]],
388
+ uniform float anisotropy_rotation = 0.0
389
+ [[
390
+ anno::hard_range(0.0, 2.0 * ::math::PI),
391
+ anno::in_group("Anisotropy"),
392
+ anno::display_name("Anisotropy Rotation"),
393
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
394
+ ]],
395
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
396
+ [[
397
+ anno::in_group("Anisotropy"),
398
+ anno::display_name("Anisotropy Texture"),
399
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
400
+ ]],
401
+
402
+ // KHR_materials_ior
403
+ uniform float ior = 1.5
404
+ [[
405
+ anno::hard_range(1.0, 5.0),
406
+ anno::in_group("Metallic Roughness"),
407
+ anno::display_name("IOR"),
408
+ anno::description("The index of refraction.")
409
+ ]],
410
+
411
+ // normal map
412
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
413
+ [[
414
+ anno::in_group("Normal Mapping"),
415
+ anno::display_name("Normal Texture"),
416
+ anno::description("Base layer normal map.")
417
+ ]],
418
+
419
+ // KHR_materials_transmission
420
+ uniform float transmission_factor = 0.0
421
+ [[
422
+ anno::hard_range(0.0, 1.0),
423
+ anno::in_group("Transmission"),
424
+ anno::display_name("Transmission Factor"),
425
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
426
+ ]],
427
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
428
+ [[
429
+ anno::in_group("Transmission"),
430
+ anno::display_name("Transmission Texture"),
431
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
432
+ anno::enable_if("transmission_factor>0")
433
+ ]],
434
+
435
+ // KHR_materials_sheen
436
+ uniform color sheen_color_factor = color(0.0)
437
+ [[
438
+ anno::in_group("Sheen"),
439
+ anno::display_name("Sheen Color Factor"),
440
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
441
+ ]],
442
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
443
+ [[
444
+ anno::in_group("Sheen"),
445
+ anno::display_name("Sheen Color Texture"),
446
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
447
+ ]],
448
+ uniform float sheen_roughness_factor = 0.0
449
+ [[
450
+ anno::hard_range(0.0, 1.0),
451
+ anno::in_group("Sheen"),
452
+ anno::display_name("Sheen Roughness Factor"),
453
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
454
+ ]],
455
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
456
+ [[
457
+ anno::in_group("Sheen"),
458
+ anno::display_name("Sheen Roughness Texture"),
459
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
460
+ ]],
461
+
462
+ // KHR_materials_clearcoat
463
+ uniform float clearcoat_factor = 0.0
464
+ [[
465
+ anno::hard_range(0.0, 1.0),
466
+ anno::in_group("Clearcoat"),
467
+ anno::display_name("Clearcoat Factor"),
468
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
469
+ ]],
470
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
471
+ [[
472
+ anno::in_group("Clearcoat"),
473
+ anno::display_name("Clearcoat Texture"),
474
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
475
+ anno::enable_if("clearcoat_factor>0")
476
+ ]],
477
+ uniform float clearcoat_roughness_factor = 0.0
478
+ [[
479
+ anno::hard_range(0.0, 1.0),
480
+ anno::in_group("Clearcoat"),
481
+ anno::display_name("Clearcoat Roughness Factor"),
482
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
483
+ anno::enable_if("clearcoat_factor>0.0")
484
+ ]],
485
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Clearcoat"),
488
+ anno::display_name("Clearcoat Roughness Texture"),
489
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
490
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
491
+ ]],
492
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
493
+ [[
494
+ anno::in_group("Clearcoat"),
495
+ anno::display_name("Clearcoat Normal"),
496
+ anno::description("The clearcoat normal map texture."),
497
+ anno::enable_if("clearcoat_factor>0.0")
498
+ ]],
499
+
500
+ // KHR_materials_iridescence
501
+ uniform float iridescence_factor = 0.0
502
+ [[
503
+ anno::hard_range(0.0, 1.0),
504
+ anno::in_group("Iridescence"),
505
+ anno::display_name("Iridescence Factor"),
506
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
507
+ ]],
508
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
509
+ [[
510
+ anno::in_group("Iridescence"),
511
+ anno::display_name("Iridescence Texture"),
512
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
513
+ anno::enable_if("iridescence_factor>0")
514
+ ]],
515
+ uniform float iridescence_ior = 1.3
516
+ [[
517
+ anno::soft_range(1.0, 5.0),
518
+ anno::in_group("Iridescence"),
519
+ anno::display_name("Iridescence IOR"),
520
+ anno::description("The index of refraction of the dielectric thin-film layer.")
521
+ ]],
522
+ uniform float iridescence_thickness_minimum = 100
523
+ [[
524
+ anno::soft_range(0.0, 600.0),
525
+ anno::in_group("Iridescence"),
526
+ anno::display_name("Iridescence Thickness Minimum"),
527
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
528
+ ]],
529
+ uniform float iridescence_thickness_maximum = 400
530
+ [[
531
+ anno::soft_range(0.0, 1000.0),
532
+ anno::in_group("Iridescence"),
533
+ anno::display_name("Iridescence Thickness Maximum"),
534
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
535
+ ]],
536
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
537
+ [[
538
+ anno::in_group("Iridescence"),
539
+ anno::display_name("Iridescence Thickness Texture"),
540
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
541
+ anno::enable_if("iridescence_factor>0")
542
+ ]],
543
+
544
+ // emission
545
+ uniform color emissive_factor = color(0.0)
546
+ [[
547
+ anno::in_group("Emission"),
548
+ anno::display_name("Emissive Factor"),
549
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
550
+ ]],
551
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
552
+ [[
553
+ anno::in_group("Emission"),
554
+ anno::display_name("Emissive Texture"),
555
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
556
+ anno::enable_if("::math::average(emissive_factor)>0.0")
557
+ ]],
558
+ // KHR_materials_emissive_strength
559
+ uniform float emissive_strength = 1.0
560
+ [[
561
+ anno::soft_range(0.0, 10000),
562
+ anno::in_group("Emission"),
563
+ anno::display_name("Emissive Strength"),
564
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
565
+ anno::enable_if("::math::average(emissive_factor)>0.0")
566
+ ]],
567
+
568
+ // KHR_materials_volume
569
+ uniform bool thin_walled = true
570
+ [[
571
+ anno::in_group("Volume"),
572
+ anno::display_name("Thin-walled"),
573
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
574
+ ]],
575
+ uniform float attenuation_distance = 0.0
576
+ [[
577
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
578
+ anno::in_group("Volume"),
579
+ anno::display_name("Attenuation Distance"),
580
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
581
+ ]],
582
+ uniform color attenuation_color = color(1.0)
583
+ [[
584
+ anno::in_group("Volume"),
585
+ anno::display_name("Attenuation Color"),
586
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
587
+ ]],
588
+
589
+ // ambient occlusion
590
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
591
+ [[
592
+ anno::in_group("Occlusion"),
593
+ anno::display_name("Occlusion Texture"),
594
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
595
+ ]],
596
+ uniform float occlusion_strength = 1.0
597
+ [[
598
+ anno::hard_range(0.0, 1.0),
599
+ anno::in_group("Occlusion"),
600
+ anno::display_name("Occlusion Strength"),
601
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
602
+ ]],
603
+
604
+ // alpha
605
+ uniform gltf_alpha_mode alpha_mode = opaque
606
+ [[
607
+ anno::in_group("Opacity"),
608
+ anno::display_name("Alpha Mode"),
609
+ anno::description("Select how to interpret the alpha value.")
610
+ ]],
611
+ uniform float base_alpha = 1.0
612
+ [[
613
+ anno::hard_range(0.0, 1.0),
614
+ anno::in_group("Opacity"),
615
+ anno::display_name("Base Alpha"),
616
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
617
+ anno::enable_if("alpha_mode!=opaque")
618
+ ]],
619
+ // alpha for gltf_alpha_mode::mask
620
+ uniform float alpha_cutoff = 0.5
621
+ [[
622
+ anno::hard_range(0.0, 1.0),
623
+ anno::in_group("Opacity"),
624
+ anno::display_name("Alpha Cutoff"),
625
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
626
+ anno::enable_if("alpha_mode==mask")
627
+ ]],
628
+
629
+ uniform string vertex_color_name = string("displayColor")
630
+ [[
631
+ anno::in_group("Primvar"),
632
+ anno::display_name("Vertex Color Name"),
633
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
634
+ ]],
635
+
636
+ uniform bool use_vertex_color_alpha = false
637
+ [[
638
+ anno::in_group("Primvar"),
639
+ anno::display_name("Use Opacity Channel From Vertex Color"),
640
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
641
+ ]],
642
+
643
+ uniform string vertex_opacity_name = string("displayOpacity")
644
+ [[
645
+ anno::in_group("Primvar"),
646
+ anno::display_name("Vertex Opacity Name"),
647
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
648
+ ]]
649
+
650
+ ) [[
651
+ anno::author("NVIDIA Corporation"),
652
+ anno::display_name("GLTF Material - Metallic-Roughness"),
653
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
654
+ ]] = let {
655
+
656
+ // handling GLTF parameters
657
+ // ------------------------------------------------------------------------
658
+
659
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
660
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
661
+
662
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
663
+
664
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
665
+ float metallic = metallic_factor * metallic_roughness.z;
666
+ float roughness = roughness_factor * metallic_roughness.y;
667
+
668
+ float3 normal = gltf_prepare_normal(normal_texture);
669
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
670
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
671
+
672
+ // KHR_materials_specular
673
+ // ------------------------------------------------------------------------
674
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
675
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
676
+
677
+ // KHR_materials_transmission
678
+ // ------------------------------------------------------------------------
679
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
680
+
681
+ // KHR_materials_sheen
682
+ // ------------------------------------------------------------------------
683
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
684
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
685
+
686
+ // KHR_materials_clearcoat
687
+ // ------------------------------------------------------------------------
688
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
689
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
690
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
691
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
692
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
693
+
694
+ // KHR_materials_iridescence
695
+ // ------------------------------------------------------------------------
696
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
697
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
698
+
699
+ // KHR_materials_anisotropy
700
+ // ------------------------------------------------------------------------
701
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
702
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
703
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
704
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
705
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
706
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
707
+
708
+ // metallic roughness model
709
+ // ------------------------------------------------------------------------
710
+
711
+ // compute final roughness by squaring the "roughness" parameter
712
+ float roughness2 = roughness * roughness;
713
+
714
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
715
+ float anisotropy_roughness_v = roughness2;
716
+
717
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
718
+ // for high roughness due to the layering
719
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
720
+
721
+ // fresnel term based on ior
722
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
723
+
724
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
725
+ // the glossy layer has no color tint
726
+ bsdf dielectric_component = df::color_custom_curve_layer(
727
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
728
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
729
+ grazing_reflectivity: color(grazing_refl * specular),
730
+ layer: df::microfacet_ggx_vcavities_bsdf(
731
+ roughness_u: anisotropy_roughness_u,
732
+ roughness_v: anisotropy_roughness_v,
733
+ tangent_u: anisotropy_tangent_u),
734
+ base: df::weighted_layer(
735
+ weight: transmission,
736
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
737
+ layer: df::microfacet_ggx_vcavities_bsdf(
738
+ roughness_u: roughness2,
739
+ tint: base_color * occlusion,
740
+ mode: df::scatter_transmit)),
741
+ normal: normal
742
+ );
743
+
744
+ // apply iridescence and make the strength adjustable using a weighted layer
745
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
746
+ weight: iridescence_strength,
747
+ base: dielectric_component,
748
+ layer: df::thin_film(
749
+ thickness: iridescence_thickness,
750
+ ior: color(iridescence_ior),
751
+ base: dielectric_component
752
+ )
753
+ );
754
+
755
+ // the metallic component doesn't have a diffuse component,
756
+ // its only glossy base_color is applied to tint it
757
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
758
+ tint: base_color * occlusion,
759
+ roughness_u: anisotropy_roughness_u,
760
+ roughness_v: anisotropy_roughness_v,
761
+ tangent_u: anisotropy_tangent_u);
762
+
763
+ // apply iridescence and make the strength adjustable using a weighted layer
764
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
765
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
766
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
767
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
768
+ weight: iridescence_strength,
769
+ base: metallic_component,
770
+ layer: df::thin_film(
771
+ thickness: iridescence_thickness,
772
+ ior: color(iridescence_ior),
773
+ base: df::fresnel_factor(
774
+ ior: dielectric_ior,
775
+ extinction_coefficient: color(0.0f),
776
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
777
+ )
778
+ );
779
+
780
+ // apply sheen to the dielectric component
781
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
782
+ // otherwise, sheen would be applied and tinted black
783
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
784
+ weight: sheen_color,
785
+ layer: df::sheen_bsdf(
786
+ roughness: sheen_roughness * sheen_roughness,
787
+ tint: color(1.0),
788
+ multiscatter_tint: color(1.0),
789
+ multiscatter: dielectric_component // don't apply thin_film
790
+ ),
791
+ base: dielectric_component_with_thin_film);
792
+
793
+ // final BSDF is a linear blend between dielectric and metallic component
794
+ bsdf dielectric_metal_mix = df::weighted_layer(
795
+ weight: metallic,
796
+ base: dielectric_sheen_component,
797
+ layer: metallic_component_with_thin_film,
798
+ normal: normal);
799
+
800
+ bsdf clearcoated = df::custom_curve_layer(
801
+ weight: clearcoat_blend,
802
+ normal_reflectivity: 0.04,
803
+ grazing_reflectivity: grazing_refl_coat,
804
+ layer: df::microfacet_ggx_vcavities_bsdf(
805
+ mode: df::scatter_reflect,
806
+ roughness_u: clearcoat_roughness2,
807
+ tint: color(1.0)),
808
+ base: df::weighted_layer(
809
+ weight: 1.0,
810
+ layer: dielectric_metal_mix,
811
+ normal: normal),
812
+ normal: clearcoat_normal);
813
+
814
+ } in material(
815
+ thin_walled: thin_walled,
816
+ surface: material_surface(
817
+ scattering: clearcoated,
818
+ emission: material_emission (
819
+ emission: df::diffuse_edf(),
820
+ intensity: emissive_color * ::math::PI
821
+ )
822
+ ),
823
+ volume: material_volume(
824
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
825
+ ),
826
+ ior: color(ior),
827
+ geometry: material_geometry(
828
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
829
+ )
830
+ );
831
+
832
+
833
+ export material gltf_material_khr_specular_glossiness(
834
+ // diffuse color
835
+ uniform color diffuse_factor = color(1.0)
836
+ [[
837
+ anno::in_group("PBR Specular Glossiness"),
838
+ anno::display_name("Diffuse Factor"),
839
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
840
+ ]],
841
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
842
+ [[
843
+ anno::in_group("PBR Specular Glossiness"),
844
+ anno::display_name("Diffuse Texture"),
845
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
846
+ ]],
847
+
848
+ // specular glossiness
849
+ uniform color specular_factor = 1.0
850
+ [[
851
+ anno::in_group("PBR Specular Glossiness"),
852
+ anno::display_name("Specular Factor"),
853
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
854
+ ]],
855
+ uniform float glossiness_factor = 1.0
856
+ [[
857
+ anno::hard_range(0.0, 1.0),
858
+ anno::in_group("PBR Specular Glossiness"),
859
+ anno::display_name("Glossiness Factor"),
860
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
861
+ ]],
862
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
863
+ [[
864
+ anno::in_group("PBR Specular Glossiness"),
865
+ anno::display_name("Specular/Glossy Texture"),
866
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
867
+ ]],
868
+
869
+ // normal map
870
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
871
+ [[
872
+ anno::in_group("Normal Mapping"),
873
+ anno::display_name("Normal Texture"),
874
+ anno::description("Base layer normal map.")
875
+ ]],
876
+
877
+ // emission
878
+ uniform color emissive_factor = color(0.0)
879
+ [[
880
+ anno::in_group("Emission"),
881
+ anno::display_name("Emissive Factor"),
882
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
883
+ ]],
884
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
885
+ [[
886
+ anno::in_group("Emission"),
887
+ anno::display_name("Emissive Texture"),
888
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
889
+ anno::enable_if("::math::average(emissive_factor)>0.0")
890
+ ]],
891
+ // KHR_materials_emissive_strength
892
+ uniform float emissive_strength = 1.0
893
+ [[
894
+ anno::soft_range(0.0, 10000),
895
+ anno::in_group("Emission"),
896
+ anno::display_name("Emissive Strength"),
897
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
898
+ anno::enable_if("::math::average(emissive_factor)>0.0")
899
+ ]],
900
+
901
+ // ambient occlusion
902
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
903
+ [[
904
+ anno::in_group("Occlusion"),
905
+ anno::display_name("Occlusion Texture"),
906
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
907
+ ]],
908
+ uniform float occlusion_strength = 1.0
909
+ [[
910
+ anno::hard_range(0.0, 1.0),
911
+ anno::in_group("Occlusion"),
912
+ anno::display_name("Occlusion Strength"),
913
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
914
+ ]],
915
+
916
+ // alpha
917
+ uniform gltf_alpha_mode alpha_mode = opaque
918
+ [[
919
+ anno::in_group("Opacity"),
920
+ anno::display_name("Alpha Mode"),
921
+ anno::description("Select how to interpret the alpha value.")
922
+ ]],
923
+ uniform float base_alpha = 1.0
924
+ [[
925
+ anno::hard_range(0.0, 1.0),
926
+ anno::in_group("Opacity"),
927
+ anno::display_name("Base Alpha"),
928
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
929
+ anno::enable_if("alpha_mode!=opaque")
930
+ ]],
931
+
932
+ // alpha for gltf_alpha_mode::mask
933
+ uniform float alpha_cutoff = 0.5
934
+ [[
935
+ anno::hard_range(0.0, 1.0),
936
+ anno::in_group("Opacity"),
937
+ anno::display_name("Alpha Cutoff"),
938
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
939
+ anno::enable_if("alpha_mode==mask")
940
+ ]],
941
+
942
+ uniform string vertex_color_name_spec = string("displayColor")
943
+ [[
944
+ anno::in_group("Primvar"),
945
+ anno::display_name("Vertex Color Name"),
946
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
947
+ ]],
948
+
949
+ uniform bool use_vertex_color_alpha_spec = false
950
+ [[
951
+ anno::in_group("Primvar"),
952
+ anno::display_name("Use Opacity Channel From Vertex Color"),
953
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
954
+ ]],
955
+
956
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
957
+ [[
958
+ anno::in_group("Primvar"),
959
+ anno::display_name("Vertex Opacity Name"),
960
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
961
+ ]]
962
+
963
+ ) [[
964
+ anno::author("NVIDIA Corporation"),
965
+ anno::display_name("GLTF Material - Specular-Glossiness"),
966
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
967
+ ]] = let {
968
+
969
+ // handling GLTF parameters
970
+ // ------------------------------------------------------------------------
971
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
972
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
973
+
974
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
975
+ //float alpha = base_alpha;
976
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
977
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
978
+ float glossiness = glossiness_factor * specular_glossiness.w;
979
+
980
+ float3 normal = gltf_prepare_normal(normal_texture);
981
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
982
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
983
+
984
+ // specular glossiness model
985
+ // ------------------------------------------------------------------------
986
+
987
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
988
+ float F_0 = math::max_value(specular);
989
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
990
+
991
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
992
+
993
+ // diffuse BRDF
994
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
995
+ tint: diffuse * occlusion,
996
+ roughness: 0.0);
997
+
998
+ // specular BRDF
999
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
1000
+ tint: color(occlusion),
1001
+ roughness_u: a,
1002
+ roughness_v: a,
1003
+ tangent_u: state::texture_tangent_u(0));
1004
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
1005
+ //- Custom curve for specular/diffuse angular mix
1006
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
1007
+ normal_reflectivity: F_0,
1008
+ grazing_reflectivity: 1.0,
1009
+ exponent: 5.0,
1010
+ weight: 1.0,
1011
+ layer: tinted_specular,
1012
+ base: diffuse_brdf,
1013
+ normal: normal);
1014
+
1015
+ } in material(
1016
+ surface: material_surface(
1017
+ scattering: diffuse_specular_mix,
1018
+ emission: material_emission (
1019
+ emission: df::diffuse_edf(),
1020
+ intensity: emissive_color * ::math::PI
1021
+ )
1022
+ ),
1023
+ geometry: material_geometry(
1024
+ normal: normal,
1025
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1026
+ )
1027
+ );
simready_assets/859/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-11T13:47:35",
6
+ "assets": [
7
+ {
8
+ "asset": "dryer_frontload_7kg.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "aa108370a854c1e838beeb12291c2d33e10c397908ebd3c891ec5980351ba450",
37
+ "blake3": "ce2d3d14164e800b35591cb3ba42df439828249efed2bf0cbbac355b700f64bf"
38
+ }
39
+ }
simready_assets/859/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-11T13:47:35",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/859/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/dryer_frontload_7kg/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/dryer_frontload_7kg.usd.png",
7
+ "size": 16367,
8
+ "hash": {
9
+ "sha256-flat-1mb": "8e8171be6c697f7a994197b4e67903a8464db02e6e3765c3dcef06165dab565b",
10
+ "sha256": "25a354ab218f8356e2e816c191dab34a3c7a964904125b6623fbe6e4166d248f",
11
+ "blake3": "9b54401297c328905059b93ff4b74d42c61ba47ceee4c2f60810664dae79956d"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/dryer_frontload_7kg_display_diffuse.png",
16
+ "size": 1503090,
17
+ "hash": {
18
+ "sha256-flat-1mb": "b7473c702bb022cdd8267e8aa9ac77e56b1c2c8bd63b0976d7ab27880ec0a894",
19
+ "sha256": "56818cf7f5acac6e5e9c6e69eda711f2388ce628e55b0820bc7a25b08a773739",
20
+ "blake3": "6395e90d3bef98141599dc4f6b90c588684fda84ef72c16816eb6e378ad7fcb7",
21
+ "sha256-first1m": "0f02b62ca1b838b09ebefa52995e3f5551789d38bc725b78763ef1b94e1109cc"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "SubUSDs/textures/washing machine_door_glass_support_normal.jpg",
26
+ "size": 1384115,
27
+ "hash": {
28
+ "sha256-flat-1mb": "8f4696c95cb1dfc15270574996a0fb3f46c1aa18ecdb4544510664d7e3ab9384",
29
+ "sha256": "bcb55edff6c7b9d7add3062f7378d7e899f432a2ca6810548b583279ed32082a",
30
+ "blake3": "f14835db69205b4969095b144f0c59bc1b2189f022cf8bb75eef6020d7496b66",
31
+ "sha256-first1m": "f215482cae408bb5a20d767abddffb46e6b45c460d6e2bca72a5d065116cc59e"
32
+ }
33
+ },
34
+ {
35
+ "relative_path": "dryer_frontload_7kg.usd",
36
+ "size": 101317634,
37
+ "hash": {
38
+ "sha256-flat-1mb": "4bc9bbd2d71128d4b44176ec44335472c6e4c6d6cfd4889e1e43ab4f6fdf0621",
39
+ "sha256": "b0a2e5232f1f972e2d7b1bd791319e224a9708cd3e0213e5871691426002df95",
40
+ "blake3": "65b3123b472004ffc980146f5e1eb37a7f9af91e7f152ba9f7364388d9cb0ec8",
41
+ "sha256-first1m": "f2390b8043ff6f2621827e6d9c0f0aced6dc90689cd0acb41c697964e2774ba3"
42
+ }
43
+ },
44
+ {
45
+ "relative_path": "gltf/pbr.mdl",
46
+ "size": 42240,
47
+ "hash": {
48
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
49
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
50
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
51
+ }
52
+ }
53
+ ]
54
+ }
simready_assets/859/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "dryer_frontload_7kg.usd"
5
+ ]
6
+ }
simready_assets/859/dryer_frontload_7kg.usd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0a2e5232f1f972e2d7b1bd791319e224a9708cd3e0213e5871691426002df95
3
+ size 101317634
simready_assets/859/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/860/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-13T22:22:04",
6
+ "assets": [
7
+ {
8
+ "asset": "washing_machine_topload_8kg.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "d20a86ba127aeb5051c36fc470d12ac1d0d770cf4237da45e9315e4f7ec8c249",
37
+ "blake3": "d4ce75e8ff383675fa63dfd2cd2927264244c66ccc96c9935c57475c8aae460e"
38
+ }
39
+ }
simready_assets/860/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-13T22:22:04",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/860/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/washing_machine_topload_8kg/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/washing_machine_topload_8kg.usd.png",
7
+ "size": 11031,
8
+ "hash": {
9
+ "sha256-flat-1mb": "dc3ad23dcff5e3cec79e2db96729f2efb56806dd20361a7fb75974630a866c1d",
10
+ "sha256": "c5b57fbda049ba6922694e69fb96f920ee365e205a7a32430ef25832ad05b10d",
11
+ "blake3": "51442ebecba86be2de5d8fc75c70273ba624a15704190e367f224d8cc172e9e1"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/materials/pbr.mdl",
16
+ "size": 42240,
17
+ "hash": {
18
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
19
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
20
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
21
+ }
22
+ },
23
+ {
24
+ "relative_path": "SubUSDs/textures/washing_machine_1_screen_panel_diffuse.png",
25
+ "size": 601544,
26
+ "hash": {
27
+ "sha256-flat-1mb": "c35476833ee7c33fad43764f71539f43a3edb4070a00baa7b4085d5e0afec3f2",
28
+ "sha256": "92e0b55d79104ecaee5e5f4d360b5a4f9c2deb23bffc455e0b58e77093b0b2e8",
29
+ "blake3": "e3f5254e6b3de803dea7ceac3eaa892738a8e01950f3e7c524440f6831a24d4d"
30
+ }
31
+ },
32
+ {
33
+ "relative_path": "gltf/pbr.mdl",
34
+ "size": 42240,
35
+ "hash": {
36
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
37
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
38
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
39
+ }
40
+ },
41
+ {
42
+ "relative_path": "washing_machine_topload_8kg.usd",
43
+ "size": 47041417,
44
+ "hash": {
45
+ "sha256-flat-1mb": "89c091eb415b95dfac486d3ef4287776a1b01e0f5a6e14a581df3d853d7430cb",
46
+ "sha256": "16e2f27acc228d7b2ab438bf2a7f9993f23bf39223a0ccb2edbea6db2f90679c",
47
+ "blake3": "e96378cdc12aee6d934323a4de97fae9b3c5b31adfcd08f1ebfeac3e99543db3",
48
+ "sha256-first1m": "26ff4e78dd0d5377b95c1ebd828d714775d58017d58d82d4811ac399a2e4c29f"
49
+ }
50
+ }
51
+ ]
52
+ }
simready_assets/860/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "washing_machine_topload_8kg.usd"
5
+ ]
6
+ }
simready_assets/860/SubUSDs/materials/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/860/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/861/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-11T21:13:24",
6
+ "assets": [
7
+ {
8
+ "asset": "detergent_container_1.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "8067252607f8fd802a207d79c5b2d421dc6c6bdbb8d04ccd6148f0fb460d716c",
37
+ "blake3": "14105c0b2d5a1f939c7cabeb268c163bea836adcecb5545ca18af86f5f5baca5"
38
+ }
39
+ }
simready_assets/861/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-11T21:13:24",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/861/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/detergent_container_1/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/detergent_container_1.usd.png",
7
+ "size": 17685,
8
+ "hash": {
9
+ "sha256-flat-1mb": "ed7f368b6168855fa84044dd5dea9514640133848d8e579f204c04b2c4269448",
10
+ "sha256": "9bd76244979d262a20826bedbc57302d610a2acfad0d0121bdd29ea502c7f85f",
11
+ "blake3": "74302bd22ba6643e67e4fb79559548f7eb6a4207c422804816d3b94cc69a8cde"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/detergent_container_1_diffuse.png",
16
+ "size": 1577878,
17
+ "hash": {
18
+ "sha256-flat-1mb": "f6e4f1212459c65f761555cd86929ff09929c7312b1acc46551faccd9362e13b",
19
+ "sha256": "4182beb85538167a02ee9c8425cec1ac78858a9dacff681ba349f0a9ccb0b833",
20
+ "blake3": "dc7b6aa0d16a36f5968d7e70e9d9acb233ea1533ca08003cff29fb4c264ad528",
21
+ "sha256-first1m": "4b0527b1b87a9067e9f1f96b93235f51b85cc6dfd4a3ccb8bb75d87904e39aac"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "detergent_container_1.usd",
26
+ "size": 107189,
27
+ "hash": {
28
+ "sha256-flat-1mb": "db732a36ea7a228cc5dbc93a2ee5f50681d77e4154e81012697e38e53ef7b3c8",
29
+ "sha256": "19ba8db33d2c42a84e9a33b79728911da6b2b3deebedc0142ce1afb8a62d0bdf",
30
+ "blake3": "30c5e86f87ec39293a8bb60c07d57fd9db9b5e12539c4db758a304baba30faef"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "gltf/pbr.mdl",
35
+ "size": 42240,
36
+ "hash": {
37
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
38
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
39
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
40
+ }
41
+ }
42
+ ]
43
+ }
simready_assets/861/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "detergent_container_1.usd"
5
+ ]
6
+ }
simready_assets/861/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/892/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T17:22:50",
6
+ "assets": [
7
+ {
8
+ "asset": "soap_basket.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "41ca04ce942a99e1476b77f569a42579814f323765f61b4e5e453eaca000255d",
37
+ "blake3": "c3414103a335894f8b646b237103f29c130f56c55deeb186e7de6431b5e52128"
38
+ }
39
+ }
simready_assets/892/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T17:22:50",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/892/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///E:/validate/Output/.packages/soap_basket/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/soap_basket.usd.png",
7
+ "size": 39333,
8
+ "hash": {
9
+ "sha256-flat-1mb": "93efe3abb8ea255ec1b8b9db5374473de60a3705a9b2e6cdbbd6ab32a0cfba56",
10
+ "sha256": "3e44e375ceb9a07e14f75e82c3c6f37b58e9301dd1890c69b7c127ac2793ba1f",
11
+ "blake3": "c375c880452c91541fb7d82fd3fdd37999dce9a02cb5b90dc38d9994aa6e6e6c"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/soap_basket_bottle_diffuse.jpg",
16
+ "size": 4170679,
17
+ "hash": {
18
+ "sha256-flat-1mb": "007da732dc88c5d3175ce4dd4a0c5cfe212eb0ecadc296a3472d9e95c3507bed",
19
+ "sha256": "a2e6edeb76395818f2600e139b497f70e2fd5eb66a911ad1e3700ca8a049fe26",
20
+ "blake3": "0a14fa8423cfe8f7a7d421d591be269c4975db4dcef3b8bff9b80c164b1fcf9e",
21
+ "sha256-first1m": "8faef83a5c5b148b869cf96a0799c401851f3bf9cdb1de26d6f561ec6cce5d12"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "SubUSDs/textures/soap_basket_diffuse.jpg",
26
+ "size": 39491,
27
+ "hash": {
28
+ "sha256-flat-1mb": "22e1c94b50905f23f05dc7eaf1757fcc7e76f3e3a2c195faf4bb91d1faa738a7",
29
+ "sha256": "ff0ab29b7109e699a3b2c723726291c057004d753ac59f893b778d379451fb42",
30
+ "blake3": "2b9df70ca2e820c3464cfb2af848aceabe5b2ed0c323a30068be3718c77c4a4a"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "SubUSDs/textures/soap_basket_gallen_diffuse.jpg",
35
+ "size": 3626438,
36
+ "hash": {
37
+ "sha256-flat-1mb": "d3bdde393eae1258308112e33d7917b49affc14574097bcba24c971d8f48d6bd",
38
+ "sha256": "04a40b15923ffcf5faf849e95a4849a2be07d15bfab38f9d3db591bbcb9cc867",
39
+ "blake3": "498fb1fa902afd69065615a8489ce82efb5024d1cf9167f429bd3ca4733f582a",
40
+ "sha256-first1m": "c440a078195510b99d87bc4f89d41549aa617bc45759da2fd645c36b5b46e5d9"
41
+ }
42
+ },
43
+ {
44
+ "relative_path": "gltf/pbr.mdl",
45
+ "size": 43800,
46
+ "hash": {
47
+ "sha256-flat-1mb": "f7013dcb99f4ad5c79b3b53c2b379598d790170e11a0aef8891ceef8c9bfc51c",
48
+ "sha256": "2c7c14d7bbf7cacea990f90e8ecc92700d8a7fe9805e44970096796e2be88b78",
49
+ "blake3": "3f0cb5ffe7e319677743a74dba7fdb0b2b11c3e40cc4b2d69277db595f52cbec"
50
+ }
51
+ },
52
+ {
53
+ "relative_path": "soap_basket.usd",
54
+ "size": 37715822,
55
+ "hash": {
56
+ "sha256-flat-1mb": "e22184a7d19cc56f0285825444ae7b654d31d704d0a2da59f636a2b5cadf8799",
57
+ "sha256": "1d7f23c78872f56a3fde26633f64e7b99bff51788e4a5665bfe91007f747df68",
58
+ "blake3": "72730356f053351d88bf423d42349cbac2a48af95b97e2654b4807faca9e11ef",
59
+ "sha256-first1m": "00be7ad4e6f5c440fd02024a67e970e0b447d611ca2bf630773fcaee52fa220e"
60
+ }
61
+ }
62
+ ]
63
+ }
simready_assets/892/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "soap_basket.usd"
5
+ ]
6
+ }
simready_assets/892/gltf/pbr.mdl ADDED
@@ -0,0 +1,1027 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******************************************************************************
2
+ * Copyright 2024 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * * Redistributions of source code must retain the above copyright
8
+ * notice, this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright
10
+ * notice, this list of conditions and the following disclaimer in the
11
+ * documentation and/or other materials provided with the distribution.
12
+ * * Neither the name of NVIDIA CORPORATION nor the names of its
13
+ * contributors may be used to endorse or promote products derived
14
+ * from this software without specific prior written permission.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ *****************************************************************************/
28
+
29
+ mdl 1.8;
30
+
31
+ import ::anno::*;
32
+ import ::base::*;
33
+ import ::df::*;
34
+ import ::math::*;
35
+ import ::state::*;
36
+ import ::tex::*;
37
+ import ::scene::*;
38
+ import ::limits::*;
39
+
40
+ export enum gltf_alpha_mode {
41
+ opaque,
42
+ mask,
43
+ blend
44
+ };
45
+
46
+ export enum gltf_wrapping_mode {
47
+ clamp_to_edge = 33071,
48
+ mirrored_repeat = 33648,
49
+ repeat = 10497
50
+ };
51
+
52
+ export struct gltf_texture_lookup_value
53
+ {
54
+ bool valid = false;
55
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
56
+ };
57
+
58
+ export struct gltf_normal_texture_lookup_value
59
+ {
60
+ bool valid = false;
61
+ float3 value = float3(0.0);
62
+ };
63
+
64
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
65
+ switch (mode) {
66
+ case mask:
67
+ return alpha < cutoff ? 0.0 : 1.0;
68
+ case blend:
69
+ return alpha;
70
+ case opaque:
71
+ return 1.0;
72
+ }
73
+ }
74
+
75
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
76
+ return sample.valid ? sample.value : default_value;
77
+ }
78
+
79
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
80
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
81
+ }
82
+
83
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
84
+ return sample.valid ? sample.value : state::normal();
85
+ }
86
+
87
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
88
+ float occulusion = sample.valid ? sample.value.x : 1.0;
89
+ return math::lerp(1.0, occulusion, occlusion_strength);
90
+ }
91
+
92
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
93
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
94
+ }
95
+
96
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
97
+ {
98
+ if (mode == clamp_to_edge)
99
+ return ::tex::wrap_clamp;
100
+ if (mode == mirrored_repeat)
101
+ return ::tex::wrap_mirrored_repeat;
102
+
103
+ return ::tex::wrap_repeat;
104
+ }
105
+
106
+ float2 khr_texture_transform_apply(
107
+ float2 coord,
108
+ float2 offset,
109
+ float rotation,
110
+ float2 scale
111
+ )
112
+ {
113
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
114
+ // Assuming the renderer follows the MDL specification in which case the coordinates
115
+ // have been flipped either while loading the glTF geometry or while setting up the state.
116
+
117
+ // Undo the flipping for the transformation to get into the original glTF texture space.
118
+ coord = float2(coord.x, 1.0f - coord.y);
119
+
120
+ // first scale
121
+ coord = coord * scale;
122
+ // then rotate
123
+ float cos_rotation = ::math::cos(rotation);
124
+ float sin_rotation = ::math::sin(rotation);
125
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
126
+ // then translate
127
+ coord = coord + offset;
128
+
129
+ // flip back
130
+ coord = float2(coord.x, 1.0f - coord.y);
131
+ return coord;
132
+ }
133
+
134
+ export gltf_texture_lookup_value gltf_texture_lookup(
135
+ uniform texture_2d texture = texture_2d()
136
+ [[
137
+ anno::in_group("Source"),
138
+ anno::display_name("Texture"),
139
+ anno::description("Texture File")
140
+ ]],
141
+ uniform int tex_coord_index = 0
142
+ [[
143
+ anno::in_group("Source"),
144
+ anno::display_name("Coordinate Set"),
145
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform float2 offset = float2(0.0f, 0.0)
150
+ [[
151
+ anno::in_group("Texture Transform"),
152
+ anno::display_name("Offset"),
153
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform float rotation = 0.0
157
+ [[
158
+ anno::hard_range(0.0, 2.0 * ::math::PI),
159
+ anno::in_group("Texture Transform"),
160
+ anno::display_name("Rotation"),
161
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
162
+ anno::enable_if("::tex::texture_isvalid(texture)")
163
+ ]],
164
+ uniform float2 scale = float2(1.0f, 1.0f)
165
+ [[
166
+ anno::in_group("Texture Transform"),
167
+ anno::display_name("Scale"),
168
+ anno::description("The scale factor applied to the components of the UV coordinates."),
169
+ anno::enable_if("::tex::texture_isvalid(texture)")
170
+ ]],
171
+
172
+ uniform gltf_wrapping_mode wrap_s = repeat
173
+ [[
174
+ anno::in_group("Sampler"),
175
+ anno::display_name("Wrap S"),
176
+ anno::description("S (U) wrapping mode."),
177
+ anno::enable_if("::tex::texture_isvalid(texture)")
178
+ ]],
179
+ uniform gltf_wrapping_mode wrap_t = repeat
180
+ [[
181
+ anno::in_group("Sampler"),
182
+ anno::display_name("Wrap T"),
183
+ anno::description("T (V) wrapping mode."),
184
+ anno::enable_if("::tex::texture_isvalid(texture)")
185
+ ]]
186
+ )
187
+ [[
188
+ anno::author("NVIDIA Corporation"),
189
+ anno::display_name("GLTF Texture Lookup"),
190
+ anno::description("Function to read a color or color with alpha channel texture.")
191
+ ]]
192
+ {
193
+ gltf_texture_lookup_value tex_ret;
194
+ if (!tex::texture_isvalid(texture))
195
+ return tex_ret;
196
+
197
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
198
+ float2 tex_coord = khr_texture_transform_apply(
199
+ coord: float2(tex_coord3.x, tex_coord3.y),
200
+ offset: offset,
201
+ rotation: rotation,
202
+ scale: scale);
203
+
204
+ tex_ret.value = tex::lookup_float4(
205
+ tex: texture,
206
+ coord: tex_coord,
207
+ wrap_u: convert_wrap_mode(wrap_s),
208
+ wrap_v: convert_wrap_mode(wrap_t));
209
+ tex_ret.valid = true;
210
+ return tex_ret;
211
+ }
212
+
213
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
214
+ uniform texture_2d texture = texture_2d()
215
+ [[
216
+ anno::in_group("Source"),
217
+ anno::display_name("Texture"),
218
+ anno::description("Texture File")
219
+ ]],
220
+ uniform float normal_scale_factor = 1.0
221
+ [[
222
+ anno::hard_range(0.0, 1.0),
223
+ anno::in_group("Source"),
224
+ anno::display_name("Normal Scale Factor"),
225
+ anno::description("Strength of the base layer normal mapping."),
226
+ anno::enable_if("::tex::texture_isvalid(texture)")
227
+ ]],
228
+ uniform int tex_coord_index = 0
229
+ [[
230
+ anno::in_group("Source"),
231
+ anno::display_name("Coordinate Set"),
232
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
233
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
234
+ ]],
235
+ uniform int tex_tangent_index = 0
236
+ [[
237
+ anno::hidden(),
238
+ anno::in_group("Source"),
239
+ anno::display_name("Coordinate Set"),
240
+ anno::description("Tangent to be to construct the tangent frame."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform float2 offset = float2(0.0f, 0.0)
245
+ [[
246
+ anno::in_group("Texture Transform"),
247
+ anno::display_name("Offset"),
248
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform float rotation = 0.0
252
+ [[
253
+ anno::hard_range(0.0, 2.0 * ::math::PI),
254
+ anno::in_group("Texture Transform"),
255
+ anno::display_name("Rotation"),
256
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
257
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
258
+ ]],
259
+ uniform float2 scale = float2(1.0f, 1.0f)
260
+ [[
261
+ anno::in_group("Texture Transform"),
262
+ anno::display_name("Scale"),
263
+ anno::description("The scale factor applied to the components of the UV coordinates."),
264
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
265
+ ]],
266
+
267
+ uniform gltf_wrapping_mode wrap_s = repeat
268
+ [[
269
+ anno::in_group("Sampler"),
270
+ anno::display_name("Wrap S"),
271
+ anno::description("S (U) wrapping mode."),
272
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
273
+ ]],
274
+ uniform gltf_wrapping_mode wrap_t = repeat
275
+ [[
276
+ anno::in_group("Sampler"),
277
+ anno::display_name("Wrap T"),
278
+ anno::description("T (V) wrapping mode."),
279
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
280
+ ]]
281
+ )
282
+ [[
283
+ anno::author("NVIDIA Corporation"),
284
+ anno::display_name("GLTF Normal Texture Lookup"),
285
+ anno::description("Function to read a normal texture.")
286
+ ]]
287
+ {
288
+ gltf_normal_texture_lookup_value tex_ret;
289
+ if (!::tex::texture_isvalid(texture))
290
+ return tex_ret;
291
+
292
+ tex_ret.value = base::tangent_space_normal_texture(
293
+ texture: texture,
294
+ factor: normal_scale_factor,
295
+ uvw: base::transform_coordinate(
296
+ transform: base::rotation_translation_scale(
297
+ rotation: float3(0, 0, rotation),
298
+ translation: float3(offset.x, offset.y, 0),
299
+ scaling: float3(scale.x, scale.y, 1)
300
+ ),
301
+ coordinate: base::texture_coordinate_info(
302
+ position: state::texture_coordinate(tex_coord_index),
303
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
304
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
305
+ )
306
+ ),
307
+ wrap_u: convert_wrap_mode(wrap_s),
308
+ wrap_v: convert_wrap_mode(wrap_t));
309
+ tex_ret.valid = true;
310
+ return tex_ret;
311
+ }
312
+
313
+ export material gltf_material(
314
+ // base color
315
+ uniform color base_color_factor = color(1.0)
316
+ [[
317
+ anno::in_group("Metallic Roughness"),
318
+ anno::display_name("Base Color Factor"),
319
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
320
+ ]],
321
+
322
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
323
+ [[
324
+ anno::in_group("Metallic Roughness"),
325
+ anno::display_name("Base Color Texture"),
326
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
327
+ ]],
328
+
329
+ // KHR_materials_specular
330
+ uniform float specular_factor = 1.0
331
+ [[
332
+ anno::hard_range(0.0, 1.0),
333
+ anno::in_group("Specular"),
334
+ anno::display_name("Specular Factor"),
335
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
336
+ ]],
337
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
338
+ [[
339
+ anno::in_group("Specular"),
340
+ anno::display_name("Specular Texture"),
341
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
342
+ ]],
343
+ uniform color specular_color_factor = color(1.0)
344
+ [[
345
+ anno::in_group("Specular"),
346
+ anno::display_name("Specular Color Factor"),
347
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
348
+ ]],
349
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Specular"),
352
+ anno::display_name("Specular Color Texture"),
353
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
354
+ ]],
355
+
356
+ // metallic roughness
357
+ uniform float metallic_factor = 1.0
358
+ [[
359
+ anno::hard_range(0.0, 1.0),
360
+ anno::in_group("Metallic Roughness"),
361
+ anno::display_name("Metallic Factor"),
362
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
363
+ ]],
364
+
365
+ uniform float roughness_factor = 1.0
366
+ [[
367
+ anno::hard_range(0.0, 1.0),
368
+ anno::in_group("Metallic Roughness"),
369
+ anno::display_name("Roughness Factor"),
370
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
371
+ ]],
372
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Metallic Roughness"),
375
+ anno::display_name("Metal/Rough Texture"),
376
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
377
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
378
+ ]],
379
+
380
+ // KHR_materials_anisotropy
381
+ uniform float anisotropy_strength = 0.0
382
+ [[
383
+ anno::hard_range(0.0, 1.0),
384
+ anno::in_group("Anisotropy"),
385
+ anno::display_name("Anisotropy Strength"),
386
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
387
+ ]],
388
+ uniform float anisotropy_rotation = 0.0
389
+ [[
390
+ anno::hard_range(0.0, 2.0 * ::math::PI),
391
+ anno::in_group("Anisotropy"),
392
+ anno::display_name("Anisotropy Rotation"),
393
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
394
+ ]],
395
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
396
+ [[
397
+ anno::in_group("Anisotropy"),
398
+ anno::display_name("Anisotropy Texture"),
399
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
400
+ ]],
401
+
402
+ // KHR_materials_ior
403
+ uniform float ior = 1.5
404
+ [[
405
+ anno::hard_range(1.0, 5.0),
406
+ anno::in_group("Metallic Roughness"),
407
+ anno::display_name("IOR"),
408
+ anno::description("The index of refraction.")
409
+ ]],
410
+
411
+ // normal map
412
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
413
+ [[
414
+ anno::in_group("Normal Mapping"),
415
+ anno::display_name("Normal Texture"),
416
+ anno::description("Base layer normal map.")
417
+ ]],
418
+
419
+ // KHR_materials_transmission
420
+ uniform float transmission_factor = 0.0
421
+ [[
422
+ anno::hard_range(0.0, 1.0),
423
+ anno::in_group("Transmission"),
424
+ anno::display_name("Transmission Factor"),
425
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
426
+ ]],
427
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
428
+ [[
429
+ anno::in_group("Transmission"),
430
+ anno::display_name("Transmission Texture"),
431
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
432
+ anno::enable_if("transmission_factor>0")
433
+ ]],
434
+
435
+ // KHR_materials_sheen
436
+ uniform color sheen_color_factor = color(0.0)
437
+ [[
438
+ anno::in_group("Sheen"),
439
+ anno::display_name("Sheen Color Factor"),
440
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
441
+ ]],
442
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
443
+ [[
444
+ anno::in_group("Sheen"),
445
+ anno::display_name("Sheen Color Texture"),
446
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
447
+ ]],
448
+ uniform float sheen_roughness_factor = 0.0
449
+ [[
450
+ anno::hard_range(0.0, 1.0),
451
+ anno::in_group("Sheen"),
452
+ anno::display_name("Sheen Roughness Factor"),
453
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
454
+ ]],
455
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
456
+ [[
457
+ anno::in_group("Sheen"),
458
+ anno::display_name("Sheen Roughness Texture"),
459
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
460
+ ]],
461
+
462
+ // KHR_materials_clearcoat
463
+ uniform float clearcoat_factor = 0.0
464
+ [[
465
+ anno::hard_range(0.0, 1.0),
466
+ anno::in_group("Clearcoat"),
467
+ anno::display_name("Clearcoat Factor"),
468
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
469
+ ]],
470
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
471
+ [[
472
+ anno::in_group("Clearcoat"),
473
+ anno::display_name("Clearcoat Texture"),
474
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
475
+ anno::enable_if("clearcoat_factor>0")
476
+ ]],
477
+ uniform float clearcoat_roughness_factor = 0.0
478
+ [[
479
+ anno::hard_range(0.0, 1.0),
480
+ anno::in_group("Clearcoat"),
481
+ anno::display_name("Clearcoat Roughness Factor"),
482
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
483
+ anno::enable_if("clearcoat_factor>0.0")
484
+ ]],
485
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Clearcoat"),
488
+ anno::display_name("Clearcoat Roughness Texture"),
489
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
490
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
491
+ ]],
492
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
493
+ [[
494
+ anno::in_group("Clearcoat"),
495
+ anno::display_name("Clearcoat Normal"),
496
+ anno::description("The clearcoat normal map texture."),
497
+ anno::enable_if("clearcoat_factor>0.0")
498
+ ]],
499
+
500
+ // KHR_materials_iridescence
501
+ uniform float iridescence_factor = 0.0
502
+ [[
503
+ anno::hard_range(0.0, 1.0),
504
+ anno::in_group("Iridescence"),
505
+ anno::display_name("Iridescence Factor"),
506
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
507
+ ]],
508
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
509
+ [[
510
+ anno::in_group("Iridescence"),
511
+ anno::display_name("Iridescence Texture"),
512
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
513
+ anno::enable_if("iridescence_factor>0")
514
+ ]],
515
+ uniform float iridescence_ior = 1.3
516
+ [[
517
+ anno::soft_range(1.0, 5.0),
518
+ anno::in_group("Iridescence"),
519
+ anno::display_name("Iridescence IOR"),
520
+ anno::description("The index of refraction of the dielectric thin-film layer.")
521
+ ]],
522
+ uniform float iridescence_thickness_minimum = 100
523
+ [[
524
+ anno::soft_range(0.0, 600.0),
525
+ anno::in_group("Iridescence"),
526
+ anno::display_name("Iridescence Thickness Minimum"),
527
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
528
+ ]],
529
+ uniform float iridescence_thickness_maximum = 400
530
+ [[
531
+ anno::soft_range(0.0, 1000.0),
532
+ anno::in_group("Iridescence"),
533
+ anno::display_name("Iridescence Thickness Maximum"),
534
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
535
+ ]],
536
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
537
+ [[
538
+ anno::in_group("Iridescence"),
539
+ anno::display_name("Iridescence Thickness Texture"),
540
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
541
+ anno::enable_if("iridescence_factor>0")
542
+ ]],
543
+
544
+ // emission
545
+ uniform color emissive_factor = color(0.0)
546
+ [[
547
+ anno::in_group("Emission"),
548
+ anno::display_name("Emissive Factor"),
549
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
550
+ ]],
551
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
552
+ [[
553
+ anno::in_group("Emission"),
554
+ anno::display_name("Emissive Texture"),
555
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
556
+ anno::enable_if("::math::average(emissive_factor)>0.0")
557
+ ]],
558
+ // KHR_materials_emissive_strength
559
+ uniform float emissive_strength = 1.0
560
+ [[
561
+ anno::soft_range(0.0, 10000),
562
+ anno::in_group("Emission"),
563
+ anno::display_name("Emissive Strength"),
564
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
565
+ anno::enable_if("::math::average(emissive_factor)>0.0")
566
+ ]],
567
+
568
+ // KHR_materials_volume
569
+ uniform bool thin_walled = true
570
+ [[
571
+ anno::in_group("Volume"),
572
+ anno::display_name("Thin-walled"),
573
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
574
+ ]],
575
+ uniform float attenuation_distance = 0.0
576
+ [[
577
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
578
+ anno::in_group("Volume"),
579
+ anno::display_name("Attenuation Distance"),
580
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
581
+ ]],
582
+ uniform color attenuation_color = color(1.0)
583
+ [[
584
+ anno::in_group("Volume"),
585
+ anno::display_name("Attenuation Color"),
586
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
587
+ ]],
588
+
589
+ // ambient occlusion
590
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
591
+ [[
592
+ anno::in_group("Occlusion"),
593
+ anno::display_name("Occlusion Texture"),
594
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
595
+ ]],
596
+ uniform float occlusion_strength = 1.0
597
+ [[
598
+ anno::hard_range(0.0, 1.0),
599
+ anno::in_group("Occlusion"),
600
+ anno::display_name("Occlusion Strength"),
601
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
602
+ ]],
603
+
604
+ // alpha
605
+ uniform gltf_alpha_mode alpha_mode = opaque
606
+ [[
607
+ anno::in_group("Opacity"),
608
+ anno::display_name("Alpha Mode"),
609
+ anno::description("Select how to interpret the alpha value.")
610
+ ]],
611
+ uniform float base_alpha = 1.0
612
+ [[
613
+ anno::hard_range(0.0, 1.0),
614
+ anno::in_group("Opacity"),
615
+ anno::display_name("Base Alpha"),
616
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
617
+ anno::enable_if("alpha_mode!=opaque")
618
+ ]],
619
+ // alpha for gltf_alpha_mode::mask
620
+ uniform float alpha_cutoff = 0.5
621
+ [[
622
+ anno::hard_range(0.0, 1.0),
623
+ anno::in_group("Opacity"),
624
+ anno::display_name("Alpha Cutoff"),
625
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
626
+ anno::enable_if("alpha_mode==mask")
627
+ ]],
628
+
629
+ uniform string vertex_color_name = string("displayColor")
630
+ [[
631
+ anno::in_group("Primvar"),
632
+ anno::display_name("Vertex Color Name"),
633
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
634
+ ]],
635
+
636
+ uniform bool use_vertex_color_alpha = false
637
+ [[
638
+ anno::in_group("Primvar"),
639
+ anno::display_name("Use Opacity Channel From Vertex Color"),
640
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
641
+ ]],
642
+
643
+ uniform string vertex_opacity_name = string("displayOpacity")
644
+ [[
645
+ anno::in_group("Primvar"),
646
+ anno::display_name("Vertex Opacity Name"),
647
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
648
+ ]]
649
+
650
+ ) [[
651
+ anno::author("NVIDIA Corporation"),
652
+ anno::display_name("GLTF Material - Metallic-Roughness"),
653
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
654
+ ]] = let {
655
+
656
+ // handling GLTF parameters
657
+ // ------------------------------------------------------------------------
658
+
659
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
660
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
661
+
662
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
663
+
664
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
665
+ float metallic = metallic_factor * metallic_roughness.z;
666
+ float roughness = roughness_factor * metallic_roughness.y;
667
+
668
+ float3 normal = gltf_prepare_normal(normal_texture);
669
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
670
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
671
+
672
+ // KHR_materials_specular
673
+ // ------------------------------------------------------------------------
674
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
675
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
676
+
677
+ // KHR_materials_transmission
678
+ // ------------------------------------------------------------------------
679
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
680
+
681
+ // KHR_materials_sheen
682
+ // ------------------------------------------------------------------------
683
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
684
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
685
+
686
+ // KHR_materials_clearcoat
687
+ // ------------------------------------------------------------------------
688
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
689
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
690
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
691
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
692
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
693
+
694
+ // KHR_materials_iridescence
695
+ // ------------------------------------------------------------------------
696
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
697
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
698
+
699
+ // KHR_materials_anisotropy
700
+ // ------------------------------------------------------------------------
701
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
702
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
703
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
704
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
705
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
706
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
707
+
708
+ // metallic roughness model
709
+ // ------------------------------------------------------------------------
710
+
711
+ // compute final roughness by squaring the "roughness" parameter
712
+ float roughness2 = roughness * roughness;
713
+
714
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
715
+ float anisotropy_roughness_v = roughness2;
716
+
717
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
718
+ // for high roughness due to the layering
719
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
720
+
721
+ // fresnel term based on ior
722
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
723
+
724
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
725
+ // the glossy layer has no color tint
726
+ bsdf dielectric_component = df::color_custom_curve_layer(
727
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
728
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
729
+ grazing_reflectivity: color(grazing_refl * specular),
730
+ layer: df::microfacet_ggx_vcavities_bsdf(
731
+ roughness_u: anisotropy_roughness_u,
732
+ roughness_v: anisotropy_roughness_v,
733
+ tangent_u: anisotropy_tangent_u),
734
+ base: df::weighted_layer(
735
+ weight: transmission,
736
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
737
+ layer: df::microfacet_ggx_vcavities_bsdf(
738
+ roughness_u: roughness2,
739
+ tint: base_color * occlusion,
740
+ mode: df::scatter_transmit)),
741
+ normal: normal
742
+ );
743
+
744
+ // apply iridescence and make the strength adjustable using a weighted layer
745
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
746
+ weight: iridescence_strength,
747
+ base: dielectric_component,
748
+ layer: df::thin_film(
749
+ thickness: iridescence_thickness,
750
+ ior: color(iridescence_ior),
751
+ base: dielectric_component
752
+ )
753
+ );
754
+
755
+ // the metallic component doesn't have a diffuse component,
756
+ // its only glossy base_color is applied to tint it
757
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
758
+ tint: base_color * occlusion,
759
+ roughness_u: anisotropy_roughness_u,
760
+ roughness_v: anisotropy_roughness_v,
761
+ tangent_u: anisotropy_tangent_u);
762
+
763
+ // apply iridescence and make the strength adjustable using a weighted layer
764
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
765
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
766
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
767
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
768
+ weight: iridescence_strength,
769
+ base: metallic_component,
770
+ layer: df::thin_film(
771
+ thickness: iridescence_thickness,
772
+ ior: color(iridescence_ior),
773
+ base: df::fresnel_factor(
774
+ ior: dielectric_ior,
775
+ extinction_coefficient: color(0.0f),
776
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
777
+ )
778
+ );
779
+
780
+ // apply sheen to the dielectric component
781
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
782
+ // otherwise, sheen would be applied and tinted black
783
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
784
+ weight: sheen_color,
785
+ layer: df::sheen_bsdf(
786
+ roughness: sheen_roughness * sheen_roughness,
787
+ tint: color(1.0),
788
+ multiscatter_tint: color(1.0),
789
+ multiscatter: dielectric_component // don't apply thin_film
790
+ ),
791
+ base: dielectric_component_with_thin_film);
792
+
793
+ // final BSDF is a linear blend between dielectric and metallic component
794
+ bsdf dielectric_metal_mix = df::weighted_layer(
795
+ weight: metallic,
796
+ base: dielectric_sheen_component,
797
+ layer: metallic_component_with_thin_film,
798
+ normal: normal);
799
+
800
+ bsdf clearcoated = df::custom_curve_layer(
801
+ weight: clearcoat_blend,
802
+ normal_reflectivity: 0.04,
803
+ grazing_reflectivity: grazing_refl_coat,
804
+ layer: df::microfacet_ggx_vcavities_bsdf(
805
+ mode: df::scatter_reflect,
806
+ roughness_u: clearcoat_roughness2,
807
+ tint: color(1.0)),
808
+ base: df::weighted_layer(
809
+ weight: 1.0,
810
+ layer: dielectric_metal_mix,
811
+ normal: normal),
812
+ normal: clearcoat_normal);
813
+
814
+ } in material(
815
+ thin_walled: thin_walled,
816
+ surface: material_surface(
817
+ scattering: clearcoated,
818
+ emission: material_emission (
819
+ emission: df::diffuse_edf(),
820
+ intensity: emissive_color * ::math::PI
821
+ )
822
+ ),
823
+ volume: material_volume(
824
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
825
+ ),
826
+ ior: color(ior),
827
+ geometry: material_geometry(
828
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
829
+ )
830
+ );
831
+
832
+
833
+ export material gltf_material_khr_specular_glossiness(
834
+ // diffuse color
835
+ uniform color diffuse_factor = color(1.0)
836
+ [[
837
+ anno::in_group("PBR Specular Glossiness"),
838
+ anno::display_name("Diffuse Factor"),
839
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
840
+ ]],
841
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
842
+ [[
843
+ anno::in_group("PBR Specular Glossiness"),
844
+ anno::display_name("Diffuse Texture"),
845
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
846
+ ]],
847
+
848
+ // specular glossiness
849
+ uniform color specular_factor = 1.0
850
+ [[
851
+ anno::in_group("PBR Specular Glossiness"),
852
+ anno::display_name("Specular Factor"),
853
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
854
+ ]],
855
+ uniform float glossiness_factor = 1.0
856
+ [[
857
+ anno::hard_range(0.0, 1.0),
858
+ anno::in_group("PBR Specular Glossiness"),
859
+ anno::display_name("Glossiness Factor"),
860
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
861
+ ]],
862
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
863
+ [[
864
+ anno::in_group("PBR Specular Glossiness"),
865
+ anno::display_name("Specular/Glossy Texture"),
866
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
867
+ ]],
868
+
869
+ // normal map
870
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
871
+ [[
872
+ anno::in_group("Normal Mapping"),
873
+ anno::display_name("Normal Texture"),
874
+ anno::description("Base layer normal map.")
875
+ ]],
876
+
877
+ // emission
878
+ uniform color emissive_factor = color(0.0)
879
+ [[
880
+ anno::in_group("Emission"),
881
+ anno::display_name("Emissive Factor"),
882
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
883
+ ]],
884
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
885
+ [[
886
+ anno::in_group("Emission"),
887
+ anno::display_name("Emissive Texture"),
888
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
889
+ anno::enable_if("::math::average(emissive_factor)>0.0")
890
+ ]],
891
+ // KHR_materials_emissive_strength
892
+ uniform float emissive_strength = 1.0
893
+ [[
894
+ anno::soft_range(0.0, 10000),
895
+ anno::in_group("Emission"),
896
+ anno::display_name("Emissive Strength"),
897
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
898
+ anno::enable_if("::math::average(emissive_factor)>0.0")
899
+ ]],
900
+
901
+ // ambient occlusion
902
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
903
+ [[
904
+ anno::in_group("Occlusion"),
905
+ anno::display_name("Occlusion Texture"),
906
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
907
+ ]],
908
+ uniform float occlusion_strength = 1.0
909
+ [[
910
+ anno::hard_range(0.0, 1.0),
911
+ anno::in_group("Occlusion"),
912
+ anno::display_name("Occlusion Strength"),
913
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
914
+ ]],
915
+
916
+ // alpha
917
+ uniform gltf_alpha_mode alpha_mode = opaque
918
+ [[
919
+ anno::in_group("Opacity"),
920
+ anno::display_name("Alpha Mode"),
921
+ anno::description("Select how to interpret the alpha value.")
922
+ ]],
923
+ uniform float base_alpha = 1.0
924
+ [[
925
+ anno::hard_range(0.0, 1.0),
926
+ anno::in_group("Opacity"),
927
+ anno::display_name("Base Alpha"),
928
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
929
+ anno::enable_if("alpha_mode!=opaque")
930
+ ]],
931
+
932
+ // alpha for gltf_alpha_mode::mask
933
+ uniform float alpha_cutoff = 0.5
934
+ [[
935
+ anno::hard_range(0.0, 1.0),
936
+ anno::in_group("Opacity"),
937
+ anno::display_name("Alpha Cutoff"),
938
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
939
+ anno::enable_if("alpha_mode==mask")
940
+ ]],
941
+
942
+ uniform string vertex_color_name_spec = string("displayColor")
943
+ [[
944
+ anno::in_group("Primvar"),
945
+ anno::display_name("Vertex Color Name"),
946
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
947
+ ]],
948
+
949
+ uniform bool use_vertex_color_alpha_spec = false
950
+ [[
951
+ anno::in_group("Primvar"),
952
+ anno::display_name("Use Opacity Channel From Vertex Color"),
953
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
954
+ ]],
955
+
956
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
957
+ [[
958
+ anno::in_group("Primvar"),
959
+ anno::display_name("Vertex Opacity Name"),
960
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
961
+ ]]
962
+
963
+ ) [[
964
+ anno::author("NVIDIA Corporation"),
965
+ anno::display_name("GLTF Material - Specular-Glossiness"),
966
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
967
+ ]] = let {
968
+
969
+ // handling GLTF parameters
970
+ // ------------------------------------------------------------------------
971
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
972
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
973
+
974
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
975
+ //float alpha = base_alpha;
976
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
977
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
978
+ float glossiness = glossiness_factor * specular_glossiness.w;
979
+
980
+ float3 normal = gltf_prepare_normal(normal_texture);
981
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
982
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
983
+
984
+ // specular glossiness model
985
+ // ------------------------------------------------------------------------
986
+
987
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
988
+ float F_0 = math::max_value(specular);
989
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
990
+
991
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
992
+
993
+ // diffuse BRDF
994
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
995
+ tint: diffuse * occlusion,
996
+ roughness: 0.0);
997
+
998
+ // specular BRDF
999
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
1000
+ tint: color(occlusion),
1001
+ roughness_u: a,
1002
+ roughness_v: a,
1003
+ tangent_u: state::texture_tangent_u(0));
1004
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
1005
+ //- Custom curve for specular/diffuse angular mix
1006
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
1007
+ normal_reflectivity: F_0,
1008
+ grazing_reflectivity: 1.0,
1009
+ exponent: 5.0,
1010
+ weight: 1.0,
1011
+ layer: tinted_specular,
1012
+ base: diffuse_brdf,
1013
+ normal: normal);
1014
+
1015
+ } in material(
1016
+ surface: material_surface(
1017
+ scattering: diffuse_specular_mix,
1018
+ emission: material_emission (
1019
+ emission: df::diffuse_edf(),
1020
+ intensity: emissive_color * ::math::PI
1021
+ )
1022
+ ),
1023
+ geometry: material_geometry(
1024
+ normal: normal,
1025
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1026
+ )
1027
+ );
simready_assets/893/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T14:19:21",
6
+ "assets": [
7
+ {
8
+ "asset": "fabric_softener_box.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "b6bfa3f6ccba188c37e97ff5adf72c8ed8910da0986c4b43faa6b3f99bdca3d8",
37
+ "blake3": "95e4e01625e02b50b29d4c6c1d4a0f7f57e9a4211786b5b9bef66c6150b871e3"
38
+ }
39
+ }
simready_assets/893/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T14:19:22",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/893/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/fabric_softener_box/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/fabric_softener_box.usd.png",
7
+ "size": 36041,
8
+ "hash": {
9
+ "sha256-flat-1mb": "79bef8ec5cc9b0e159337546d6f7ec1895b6b9395d08d18c232ae8a6ab7de6ed",
10
+ "sha256": "0b7fc97b31e508f8c3166baf241afa3398a0cc0aa2cc5515706ca0f8aa1e8320",
11
+ "blake3": "2b469e2ac83a6de0007189be6aef8d189db96e579a2b5ffef04950d8d97f1147"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/fabric_softener_box_1_diffuse.png",
16
+ "size": 2230051,
17
+ "hash": {
18
+ "sha256-flat-1mb": "a0513865177f0914410ef5c08d89a5fa262db2696ff6b3ba4f74ecbbf0f20d62",
19
+ "sha256": "9857e7f306cc11b143ae56d4093020917594a41dda8740a6b7370b130adb4e02",
20
+ "blake3": "bad90fa3ea9828c4282c8a9bc5958cd3747f66e5ad8e5028a913d6d6a347c3dd",
21
+ "sha256-first1m": "2955cf0eb13da0b901ecc49b0d25d18389f8de1f9b6b78127910fbdfe45ba4f1"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "fabric_softener_box.usd",
26
+ "size": 12146,
27
+ "hash": {
28
+ "sha256-flat-1mb": "6346a22e11b8c956b10ca8e93d0aee399d510f7f8e721da0a0ab697ad203c360",
29
+ "sha256": "a8bf4c02c9bf2cf9070f68fe48098b9447dc625c47e8a1e88299500b99e019a7",
30
+ "blake3": "00659378b9a3f9bd7a4e598010a98f8a83317c1a7874e1a10d45f5380d722e2b"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "gltf/pbr.mdl",
35
+ "size": 42240,
36
+ "hash": {
37
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
38
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
39
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
40
+ }
41
+ }
42
+ ]
43
+ }
simready_assets/893/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "fabric_softener_box.usd"
5
+ ]
6
+ }
simready_assets/893/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/894/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T15:24:25",
6
+ "assets": [
7
+ {
8
+ "asset": "stain_remover_box.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "0b31724f99836c204573432248ac03b7ffed1ad6391dd1ae43c0ff1fde6d55f2",
37
+ "blake3": "1ad931d0c8c9230729768a2002eaf06053d0837657cb02921530898a3cfefd49"
38
+ }
39
+ }
simready_assets/894/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T15:24:25",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/894/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/stain_remover_box/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/stain_remover_box.usd.png",
7
+ "size": 33781,
8
+ "hash": {
9
+ "sha256-flat-1mb": "a8d4bbb06c1e0a1f3196f70362f134eb2bafa41af3dda12301b71219052bd6f6",
10
+ "sha256": "455f446b9cfcc45ea8f402402774909592b1d26ba21c7334a65d69d02f11f079",
11
+ "blake3": "4b0ec4399e54816545745dab8253bba0c7afbad2b18c6cd15cb317c89b63c066"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/stain_remover_box_1_diffuse.png",
16
+ "size": 2833083,
17
+ "hash": {
18
+ "sha256-flat-1mb": "7887812be1bb080067c0686d61cb9a8f2bde42a74331e38b3e9ac1d632cc4f0f",
19
+ "sha256": "bd0376edc42ee8324f209e486e3b2aa5ba926e60414d7c79e89671a6af780019",
20
+ "blake3": "9ba7eecac56ef1c19f2270e055c99ee0f6c90ec656a9fc2c434c3e1acd3a7489",
21
+ "sha256-first1m": "ac9661dc185ee1eebb4116f6aae7be89fd253a98ddba1cc1d7dba4c5354c700a"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "gltf/pbr.mdl",
26
+ "size": 42240,
27
+ "hash": {
28
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
29
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
30
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "stain_remover_box.usd",
35
+ "size": 19026,
36
+ "hash": {
37
+ "sha256-flat-1mb": "c2c53a6c4de97d69072e58bdbad8da384675e23e082e79560edbb66d9fb66763",
38
+ "sha256": "f0dd9d8d63199e690b9ed64e7cd9346d4cfbbe5752de746d7f82f4590d323740",
39
+ "blake3": "bab9d092b3464dbae9525359b1b72c240e5057fe8e06bf4c484b85b24353831d"
40
+ }
41
+ }
42
+ ]
43
+ }
simready_assets/894/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "stain_remover_box.usd"
5
+ ]
6
+ }
simready_assets/894/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/895/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T16:25:54",
6
+ "assets": [
7
+ {
8
+ "asset": "laundry_pod_box.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "54dd24d33145aa724734cb83395ff77452efd37bf64465170717d9c4755207a6",
37
+ "blake3": "14a94e0045ad61c222cd9b95234c12933d34ccf8c97d243b5611d232a3e5ddba"
38
+ }
39
+ }
simready_assets/895/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-12T16:25:54",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/895/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///D:/Validation/output/.packages/laundry_pod_box/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/laundry_pod_box.usd.png",
7
+ "size": 42806,
8
+ "hash": {
9
+ "sha256-flat-1mb": "5333d4afb358aba87addfe8db8920fbba549fa3098cb6ae5011f4f772430c044",
10
+ "sha256": "15ee1bf7c6c5598373f033e2e4e1eed89160721a142fe793ddcfb9dd3163105d",
11
+ "blake3": "4908eddf1272e7e5c72a4a04f6ff2181bdfd7ad21ab86e655474c42e0aeb7488"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/laundry_pod_box_1_diffuse.png",
16
+ "size": 2698189,
17
+ "hash": {
18
+ "sha256-flat-1mb": "3a5a1144f89f0c36be6c500aa8238b1932e01a4325e2636d39346618666ca361",
19
+ "sha256": "b91596b565c27da9fa999da956a16fc3d914281a6fa1e17c231c65cb60a7d4c5",
20
+ "blake3": "a3452eb92c9da39934a813613f82fe782bedd97359625b3acb88f3b6ce320561",
21
+ "sha256-first1m": "e2222123f4ecd788edf2eeb12b4a3f062689de465e591111fb9e3f8a7943f76b"
22
+ }
23
+ },
24
+ {
25
+ "relative_path": "gltf/pbr.mdl",
26
+ "size": 42240,
27
+ "hash": {
28
+ "sha256-flat-1mb": "0ea567c192a18e6835ba556207f797ebe90850414ac832952c61c571cff22a0d",
29
+ "sha256": "eeed10b53c18d789f94a24a3a6b996c49668ae2d5b6a909bae3420f2beb16fc8",
30
+ "blake3": "9e577cb4dd7efe74b8418e38467a9e1c7056625fc127599c85a36596c6b62a59"
31
+ }
32
+ },
33
+ {
34
+ "relative_path": "laundry_pod_box.usd",
35
+ "size": 36637,
36
+ "hash": {
37
+ "sha256-flat-1mb": "b241d40b42952c3ab29fb249e3114864047efb02d743da5c1e6ece6a9740be48",
38
+ "sha256": "56bc27222c7b4f8ca66ca07f758ebdd34bc7ac1a8a8769621d3ff9be5efa0367",
39
+ "blake3": "db5b3f23b1f01749c660497aed20a22ea36de2b899fcd733e00a07e675c9720f"
40
+ }
41
+ }
42
+ ]
43
+ }
simready_assets/895/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "laundry_pod_box.usd"
5
+ ]
6
+ }
simready_assets/895/gltf/pbr.mdl ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+
6
+ mdl 1.8;
7
+
8
+ import ::anno::*;
9
+ import ::base::*;
10
+ import ::df::*;
11
+ import ::math::*;
12
+ import ::state::*;
13
+ import ::tex::*;
14
+ import ::scene::*;
15
+ import ::limits::*;
16
+
17
+ export enum gltf_alpha_mode {
18
+ opaque,
19
+ mask,
20
+ blend
21
+ };
22
+
23
+ export enum gltf_wrapping_mode {
24
+ clamp_to_edge = 33071,
25
+ mirrored_repeat = 33648,
26
+ repeat = 10497
27
+ };
28
+
29
+ export struct gltf_texture_lookup_value
30
+ {
31
+ bool valid = false;
32
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
33
+ };
34
+
35
+ export struct gltf_normal_texture_lookup_value
36
+ {
37
+ bool valid = false;
38
+ float3 value = float3(0.0);
39
+ };
40
+
41
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
42
+ switch (mode) {
43
+ case mask:
44
+ return alpha < cutoff ? 0.0 : 1.0;
45
+ case blend:
46
+ return alpha;
47
+ case opaque:
48
+ return 1.0;
49
+ }
50
+ }
51
+
52
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
53
+ return sample.valid ? sample.value : default_value;
54
+ }
55
+
56
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
57
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
58
+ }
59
+
60
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
61
+ return sample.valid ? sample.value : state::normal();
62
+ }
63
+
64
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
65
+ float occulusion = sample.valid ? sample.value.x : 1.0;
66
+ return math::lerp(1.0, occulusion, occlusion_strength);
67
+ }
68
+
69
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
70
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
71
+ }
72
+
73
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
74
+ {
75
+ if (mode == clamp_to_edge)
76
+ return ::tex::wrap_clamp;
77
+ if (mode == mirrored_repeat)
78
+ return ::tex::wrap_mirrored_repeat;
79
+
80
+ return ::tex::wrap_repeat;
81
+ }
82
+
83
+ float2 khr_texture_transform_apply(
84
+ float2 coord,
85
+ float2 offset,
86
+ float rotation,
87
+ float2 scale
88
+ )
89
+ {
90
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
91
+ // Assuming the renderer follows the MDL specification in which case the coordinates
92
+ // have been flipped either while loading the glTF geometry or while setting up the state.
93
+
94
+ // Undo the flipping for the transformation to get into the original glTF texture space.
95
+ coord = float2(coord.x, 1.0f - coord.y);
96
+
97
+ // first scale
98
+ coord = coord * scale;
99
+ // then rotate
100
+ float cos_rotation = ::math::cos(rotation);
101
+ float sin_rotation = ::math::sin(rotation);
102
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
103
+ // then translate
104
+ coord = coord + offset;
105
+
106
+ // flip back
107
+ coord = float2(coord.x, 1.0f - coord.y);
108
+ return coord;
109
+ }
110
+
111
+ export gltf_texture_lookup_value gltf_texture_lookup(
112
+ uniform texture_2d texture = texture_2d()
113
+ [[
114
+ anno::in_group("Source"),
115
+ anno::display_name("Texture"),
116
+ anno::description("Texture File")
117
+ ]],
118
+ uniform int tex_coord_index = 0
119
+ [[
120
+ anno::in_group("Source"),
121
+ anno::display_name("Coordinate Set"),
122
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
123
+ anno::enable_if("::tex::texture_isvalid(texture)")
124
+ ]],
125
+
126
+ uniform float2 offset = float2(0.0f, 0.0)
127
+ [[
128
+ anno::in_group("Texture Transform"),
129
+ anno::display_name("Offset"),
130
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
131
+ anno::enable_if("::tex::texture_isvalid(texture)")
132
+ ]],
133
+ uniform float rotation = 0.0
134
+ [[
135
+ anno::hard_range(0.0, 2.0 * ::math::PI),
136
+ anno::in_group("Texture Transform"),
137
+ anno::display_name("Rotation"),
138
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
139
+ anno::enable_if("::tex::texture_isvalid(texture)")
140
+ ]],
141
+ uniform float2 scale = float2(1.0f, 1.0f)
142
+ [[
143
+ anno::in_group("Texture Transform"),
144
+ anno::display_name("Scale"),
145
+ anno::description("The scale factor applied to the components of the UV coordinates."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform gltf_wrapping_mode wrap_s = repeat
150
+ [[
151
+ anno::in_group("Sampler"),
152
+ anno::display_name("Wrap S"),
153
+ anno::description("S (U) wrapping mode."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform gltf_wrapping_mode wrap_t = repeat
157
+ [[
158
+ anno::in_group("Sampler"),
159
+ anno::display_name("Wrap T"),
160
+ anno::description("T (V) wrapping mode."),
161
+ anno::enable_if("::tex::texture_isvalid(texture)")
162
+ ]]
163
+ )
164
+ [[
165
+ anno::author("NVIDIA Corporation"),
166
+ anno::display_name("GLTF Texture Lookup"),
167
+ anno::description("Function to read a color or color with alpha channel texture.")
168
+ ]]
169
+ {
170
+ gltf_texture_lookup_value tex_ret;
171
+ if (!tex::texture_isvalid(texture))
172
+ return tex_ret;
173
+
174
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
175
+ float2 tex_coord = khr_texture_transform_apply(
176
+ coord: float2(tex_coord3.x, tex_coord3.y),
177
+ offset: offset,
178
+ rotation: rotation,
179
+ scale: scale);
180
+
181
+ tex_ret.value = tex::lookup_float4(
182
+ tex: texture,
183
+ coord: tex_coord,
184
+ wrap_u: convert_wrap_mode(wrap_s),
185
+ wrap_v: convert_wrap_mode(wrap_t));
186
+ tex_ret.valid = true;
187
+ return tex_ret;
188
+ }
189
+
190
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
191
+ uniform texture_2d texture = texture_2d()
192
+ [[
193
+ anno::in_group("Source"),
194
+ anno::display_name("Texture"),
195
+ anno::description("Texture File")
196
+ ]],
197
+ uniform float normal_scale_factor = 1.0
198
+ [[
199
+ anno::hard_range(0.0, 1.0),
200
+ anno::in_group("Source"),
201
+ anno::display_name("Normal Scale Factor"),
202
+ anno::description("Strength of the base layer normal mapping."),
203
+ anno::enable_if("::tex::texture_isvalid(texture)")
204
+ ]],
205
+ uniform int tex_coord_index = 0
206
+ [[
207
+ anno::in_group("Source"),
208
+ anno::display_name("Coordinate Set"),
209
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
210
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
211
+ ]],
212
+ uniform int tex_tangent_index = 0
213
+ [[
214
+ anno::hidden(),
215
+ anno::in_group("Source"),
216
+ anno::display_name("Coordinate Set"),
217
+ anno::description("Tangent to be to construct the tangent frame."),
218
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
219
+ ]],
220
+
221
+ uniform float2 offset = float2(0.0f, 0.0)
222
+ [[
223
+ anno::in_group("Texture Transform"),
224
+ anno::display_name("Offset"),
225
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
226
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
227
+ ]],
228
+ uniform float rotation = 0.0
229
+ [[
230
+ anno::hard_range(0.0, 2.0 * ::math::PI),
231
+ anno::in_group("Texture Transform"),
232
+ anno::display_name("Rotation"),
233
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
234
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
235
+ ]],
236
+ uniform float2 scale = float2(1.0f, 1.0f)
237
+ [[
238
+ anno::in_group("Texture Transform"),
239
+ anno::display_name("Scale"),
240
+ anno::description("The scale factor applied to the components of the UV coordinates."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform gltf_wrapping_mode wrap_s = repeat
245
+ [[
246
+ anno::in_group("Sampler"),
247
+ anno::display_name("Wrap S"),
248
+ anno::description("S (U) wrapping mode."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform gltf_wrapping_mode wrap_t = repeat
252
+ [[
253
+ anno::in_group("Sampler"),
254
+ anno::display_name("Wrap T"),
255
+ anno::description("T (V) wrapping mode."),
256
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
257
+ ]]
258
+ )
259
+ [[
260
+ anno::author("NVIDIA Corporation"),
261
+ anno::display_name("GLTF Normal Texture Lookup"),
262
+ anno::description("Function to read a normal texture.")
263
+ ]]
264
+ {
265
+ gltf_normal_texture_lookup_value tex_ret;
266
+ if (!::tex::texture_isvalid(texture))
267
+ return tex_ret;
268
+
269
+ tex_ret.value = base::tangent_space_normal_texture(
270
+ texture: texture,
271
+ factor: normal_scale_factor,
272
+ uvw: base::transform_coordinate(
273
+ transform: base::rotation_translation_scale(
274
+ rotation: float3(0, 0, rotation),
275
+ translation: float3(offset.x, offset.y, 0),
276
+ scaling: float3(scale.x, scale.y, 1)
277
+ ),
278
+ coordinate: base::texture_coordinate_info(
279
+ position: state::texture_coordinate(tex_coord_index),
280
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
281
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
282
+ )
283
+ ),
284
+ wrap_u: convert_wrap_mode(wrap_s),
285
+ wrap_v: convert_wrap_mode(wrap_t));
286
+ tex_ret.valid = true;
287
+ return tex_ret;
288
+ }
289
+
290
+ export material gltf_material(
291
+ // base color
292
+ uniform color base_color_factor = color(1.0)
293
+ [[
294
+ anno::in_group("Metallic Roughness"),
295
+ anno::display_name("Base Color Factor"),
296
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
297
+ ]],
298
+
299
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
300
+ [[
301
+ anno::in_group("Metallic Roughness"),
302
+ anno::display_name("Base Color Texture"),
303
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
304
+ ]],
305
+
306
+ // KHR_materials_specular
307
+ uniform float specular_factor = 1.0
308
+ [[
309
+ anno::hard_range(0.0, 1.0),
310
+ anno::in_group("Specular"),
311
+ anno::display_name("Specular Factor"),
312
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
313
+ ]],
314
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
315
+ [[
316
+ anno::in_group("Specular"),
317
+ anno::display_name("Specular Texture"),
318
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
319
+ ]],
320
+ uniform color specular_color_factor = color(1.0)
321
+ [[
322
+ anno::in_group("Specular"),
323
+ anno::display_name("Specular Color Factor"),
324
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
325
+ ]],
326
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
327
+ [[
328
+ anno::in_group("Specular"),
329
+ anno::display_name("Specular Color Texture"),
330
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
331
+ ]],
332
+
333
+ // metallic roughness
334
+ uniform float metallic_factor = 1.0
335
+ [[
336
+ anno::hard_range(0.0, 1.0),
337
+ anno::in_group("Metallic Roughness"),
338
+ anno::display_name("Metallic Factor"),
339
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
340
+ ]],
341
+
342
+ uniform float roughness_factor = 1.0
343
+ [[
344
+ anno::hard_range(0.0, 1.0),
345
+ anno::in_group("Metallic Roughness"),
346
+ anno::display_name("Roughness Factor"),
347
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
348
+ ]],
349
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Metallic Roughness"),
352
+ anno::display_name("Metal/Rough Texture"),
353
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
354
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
355
+ ]],
356
+
357
+ // KHR_materials_anisotropy
358
+ uniform float anisotropy_strength = 0.0
359
+ [[
360
+ anno::hard_range(0.0, 1.0),
361
+ anno::in_group("Anisotropy"),
362
+ anno::display_name("Anisotropy Strength"),
363
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
364
+ ]],
365
+ uniform float anisotropy_rotation = 0.0
366
+ [[
367
+ anno::hard_range(0.0, 2.0 * ::math::PI),
368
+ anno::in_group("Anisotropy"),
369
+ anno::display_name("Anisotropy Rotation"),
370
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
371
+ ]],
372
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Anisotropy"),
375
+ anno::display_name("Anisotropy Texture"),
376
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
377
+ ]],
378
+
379
+ // KHR_materials_ior
380
+ uniform float ior = 1.5
381
+ [[
382
+ anno::hard_range(1.0, 5.0),
383
+ anno::in_group("Metallic Roughness"),
384
+ anno::display_name("IOR"),
385
+ anno::description("The index of refraction.")
386
+ ]],
387
+
388
+ // normal map
389
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
390
+ [[
391
+ anno::in_group("Normal Mapping"),
392
+ anno::display_name("Normal Texture"),
393
+ anno::description("Base layer normal map.")
394
+ ]],
395
+
396
+ // KHR_materials_transmission
397
+ uniform float transmission_factor = 0.0
398
+ [[
399
+ anno::hard_range(0.0, 1.0),
400
+ anno::in_group("Transmission"),
401
+ anno::display_name("Transmission Factor"),
402
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
403
+ ]],
404
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
405
+ [[
406
+ anno::in_group("Transmission"),
407
+ anno::display_name("Transmission Texture"),
408
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
409
+ anno::enable_if("transmission_factor>0")
410
+ ]],
411
+
412
+ // KHR_materials_sheen
413
+ uniform color sheen_color_factor = color(0.0)
414
+ [[
415
+ anno::in_group("Sheen"),
416
+ anno::display_name("Sheen Color Factor"),
417
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
418
+ ]],
419
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
420
+ [[
421
+ anno::in_group("Sheen"),
422
+ anno::display_name("Sheen Color Texture"),
423
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
424
+ ]],
425
+ uniform float sheen_roughness_factor = 0.0
426
+ [[
427
+ anno::hard_range(0.0, 1.0),
428
+ anno::in_group("Sheen"),
429
+ anno::display_name("Sheen Roughness Factor"),
430
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
431
+ ]],
432
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
433
+ [[
434
+ anno::in_group("Sheen"),
435
+ anno::display_name("Sheen Roughness Texture"),
436
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
437
+ ]],
438
+
439
+ // KHR_materials_clearcoat
440
+ uniform float clearcoat_factor = 0.0
441
+ [[
442
+ anno::hard_range(0.0, 1.0),
443
+ anno::in_group("Clearcoat"),
444
+ anno::display_name("Clearcoat Factor"),
445
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
446
+ ]],
447
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
448
+ [[
449
+ anno::in_group("Clearcoat"),
450
+ anno::display_name("Clearcoat Texture"),
451
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
452
+ anno::enable_if("clearcoat_factor>0")
453
+ ]],
454
+ uniform float clearcoat_roughness_factor = 0.0
455
+ [[
456
+ anno::hard_range(0.0, 1.0),
457
+ anno::in_group("Clearcoat"),
458
+ anno::display_name("Clearcoat Roughness Factor"),
459
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
460
+ anno::enable_if("clearcoat_factor>0.0")
461
+ ]],
462
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
463
+ [[
464
+ anno::in_group("Clearcoat"),
465
+ anno::display_name("Clearcoat Roughness Texture"),
466
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
467
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
468
+ ]],
469
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
470
+ [[
471
+ anno::in_group("Clearcoat"),
472
+ anno::display_name("Clearcoat Normal"),
473
+ anno::description("The clearcoat normal map texture."),
474
+ anno::enable_if("clearcoat_factor>0.0")
475
+ ]],
476
+
477
+ // KHR_materials_iridescence
478
+ uniform float iridescence_factor = 0.0
479
+ [[
480
+ anno::hard_range(0.0, 1.0),
481
+ anno::in_group("Iridescence"),
482
+ anno::display_name("Iridescence Factor"),
483
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484
+ ]],
485
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Iridescence"),
488
+ anno::display_name("Iridescence Texture"),
489
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490
+ anno::enable_if("iridescence_factor>0")
491
+ ]],
492
+ uniform float iridescence_ior = 1.3
493
+ [[
494
+ anno::soft_range(1.0, 5.0),
495
+ anno::in_group("Iridescence"),
496
+ anno::display_name("Iridescence IOR"),
497
+ anno::description("The index of refraction of the dielectric thin-film layer.")
498
+ ]],
499
+ uniform float iridescence_thickness_minimum = 100
500
+ [[
501
+ anno::soft_range(0.0, 600.0),
502
+ anno::in_group("Iridescence"),
503
+ anno::display_name("Iridescence Thickness Minimum"),
504
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505
+ ]],
506
+ uniform float iridescence_thickness_maximum = 400
507
+ [[
508
+ anno::soft_range(0.0, 1000.0),
509
+ anno::in_group("Iridescence"),
510
+ anno::display_name("Iridescence Thickness Maximum"),
511
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512
+ ]],
513
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514
+ [[
515
+ anno::in_group("Iridescence"),
516
+ anno::display_name("Iridescence Thickness Texture"),
517
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518
+ anno::enable_if("iridescence_factor>0")
519
+ ]],
520
+
521
+ // emission
522
+ uniform color emissive_factor = color(0.0)
523
+ [[
524
+ anno::in_group("Emission"),
525
+ anno::display_name("Emissive Factor"),
526
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
527
+ ]],
528
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
529
+ [[
530
+ anno::in_group("Emission"),
531
+ anno::display_name("Emissive Texture"),
532
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
533
+ anno::enable_if("::math::average(emissive_factor)>0.0")
534
+ ]],
535
+ // KHR_materials_emissive_strength
536
+ uniform float emissive_strength = 1.0
537
+ [[
538
+ anno::soft_range(0.0, 10000),
539
+ anno::in_group("Emission"),
540
+ anno::display_name("Emissive Strength"),
541
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
542
+ anno::enable_if("::math::average(emissive_factor)>0.0")
543
+ ]],
544
+
545
+ // KHR_materials_volume
546
+ uniform bool thin_walled = true
547
+ [[
548
+ anno::in_group("Volume"),
549
+ anno::display_name("Thin-walled"),
550
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
551
+ ]],
552
+ uniform float attenuation_distance = 0.0
553
+ [[
554
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
555
+ anno::in_group("Volume"),
556
+ anno::display_name("Attenuation Distance"),
557
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
558
+ ]],
559
+ uniform color attenuation_color = color(1.0)
560
+ [[
561
+ anno::in_group("Volume"),
562
+ anno::display_name("Attenuation Color"),
563
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
564
+ ]],
565
+
566
+ // ambient occlusion
567
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
568
+ [[
569
+ anno::in_group("Occlusion"),
570
+ anno::display_name("Occlusion Texture"),
571
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
572
+ ]],
573
+ uniform float occlusion_strength = 1.0
574
+ [[
575
+ anno::hard_range(0.0, 1.0),
576
+ anno::in_group("Occlusion"),
577
+ anno::display_name("Occlusion Strength"),
578
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
579
+ ]],
580
+
581
+ // alpha
582
+ uniform gltf_alpha_mode alpha_mode = opaque
583
+ [[
584
+ anno::in_group("Opacity"),
585
+ anno::display_name("Alpha Mode"),
586
+ anno::description("Select how to interpret the alpha value.")
587
+ ]],
588
+ uniform float base_alpha = 1.0
589
+ [[
590
+ anno::hard_range(0.0, 1.0),
591
+ anno::in_group("Opacity"),
592
+ anno::display_name("Base Alpha"),
593
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
594
+ anno::enable_if("alpha_mode!=opaque")
595
+ ]],
596
+ // alpha for gltf_alpha_mode::mask
597
+ uniform float alpha_cutoff = 0.5
598
+ [[
599
+ anno::hard_range(0.0, 1.0),
600
+ anno::in_group("Opacity"),
601
+ anno::display_name("Alpha Cutoff"),
602
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
603
+ anno::enable_if("alpha_mode==mask")
604
+ ]],
605
+
606
+ uniform string vertex_color_name = string("displayColor")
607
+ [[
608
+ anno::in_group("Primvar"),
609
+ anno::display_name("Vertex Color Name"),
610
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
611
+ ]],
612
+
613
+ uniform bool use_vertex_color_alpha = false
614
+ [[
615
+ anno::in_group("Primvar"),
616
+ anno::display_name("Use Opacity Channel From Vertex Color"),
617
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
618
+ ]],
619
+
620
+ uniform string vertex_opacity_name = string("displayOpacity")
621
+ [[
622
+ anno::in_group("Primvar"),
623
+ anno::display_name("Vertex Opacity Name"),
624
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
625
+ ]]
626
+
627
+ ) [[
628
+ anno::author("NVIDIA Corporation"),
629
+ anno::display_name("GLTF Material - Metallic-Roughness"),
630
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
631
+ ]] = let {
632
+
633
+ // handling GLTF parameters
634
+ // ------------------------------------------------------------------------
635
+
636
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
637
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
638
+
639
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
640
+
641
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
642
+ float metallic = metallic_factor * metallic_roughness.z;
643
+ float roughness = roughness_factor * metallic_roughness.y;
644
+
645
+ float3 normal = gltf_prepare_normal(normal_texture);
646
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
647
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
648
+
649
+ // KHR_materials_specular
650
+ // ------------------------------------------------------------------------
651
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
652
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
653
+
654
+ // KHR_materials_transmission
655
+ // ------------------------------------------------------------------------
656
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
657
+
658
+ // KHR_materials_sheen
659
+ // ------------------------------------------------------------------------
660
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
661
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
662
+
663
+ // KHR_materials_clearcoat
664
+ // ------------------------------------------------------------------------
665
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
666
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
667
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
668
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
669
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
670
+
671
+ // KHR_materials_iridescence
672
+ // ------------------------------------------------------------------------
673
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
674
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
675
+
676
+ // KHR_materials_anisotropy
677
+ // ------------------------------------------------------------------------
678
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
679
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
680
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
681
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
682
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
683
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
684
+
685
+ // metallic roughness model
686
+ // ------------------------------------------------------------------------
687
+
688
+ // compute final roughness by squaring the "roughness" parameter
689
+ float roughness2 = roughness * roughness;
690
+
691
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
692
+ float anisotropy_roughness_v = roughness2;
693
+
694
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
695
+ // for high roughness due to the layering
696
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
697
+
698
+ // fresnel term based on ior
699
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
700
+
701
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
702
+ // the glossy layer has no color tint
703
+ bsdf dielectric_component = df::color_custom_curve_layer(
704
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
705
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
706
+ grazing_reflectivity: color(grazing_refl * specular),
707
+ layer: df::microfacet_ggx_vcavities_bsdf(
708
+ roughness_u: anisotropy_roughness_u,
709
+ roughness_v: anisotropy_roughness_v,
710
+ tangent_u: anisotropy_tangent_u),
711
+ base: df::weighted_layer(
712
+ weight: transmission,
713
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
714
+ layer: df::microfacet_ggx_vcavities_bsdf(
715
+ roughness_u: roughness2,
716
+ tint: base_color * occlusion,
717
+ mode: df::scatter_transmit)),
718
+ normal: normal
719
+ );
720
+
721
+ // apply iridescence and make the strength adjustable using a weighted layer
722
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
723
+ weight: iridescence_strength,
724
+ base: dielectric_component,
725
+ layer: df::thin_film(
726
+ thickness: iridescence_thickness,
727
+ ior: color(iridescence_ior),
728
+ base: dielectric_component
729
+ )
730
+ );
731
+
732
+ // the metallic component doesn't have a diffuse component,
733
+ // its only glossy base_color is applied to tint it
734
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
735
+ tint: base_color * occlusion,
736
+ roughness_u: anisotropy_roughness_u,
737
+ roughness_v: anisotropy_roughness_v,
738
+ tangent_u: anisotropy_tangent_u);
739
+
740
+ // apply iridescence and make the strength adjustable using a weighted layer
741
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
742
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
743
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
744
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
745
+ weight: iridescence_strength,
746
+ base: metallic_component,
747
+ layer: df::thin_film(
748
+ thickness: iridescence_thickness,
749
+ ior: color(iridescence_ior),
750
+ base: df::fresnel_factor(
751
+ ior: dielectric_ior,
752
+ extinction_coefficient: color(0.0f),
753
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
754
+ )
755
+ );
756
+
757
+ // apply sheen to the dielectric component
758
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
759
+ // otherwise, sheen would be applied and tinted black
760
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
761
+ weight: sheen_color,
762
+ layer: df::sheen_bsdf(
763
+ roughness: sheen_roughness * sheen_roughness,
764
+ tint: color(1.0),
765
+ multiscatter_tint: color(1.0),
766
+ multiscatter: dielectric_component // don't apply thin_film
767
+ ),
768
+ base: dielectric_component_with_thin_film);
769
+
770
+ // final BSDF is a linear blend between dielectric and metallic component
771
+ bsdf dielectric_metal_mix = df::weighted_layer(
772
+ weight: metallic,
773
+ base: dielectric_sheen_component,
774
+ layer: metallic_component_with_thin_film,
775
+ normal: normal);
776
+
777
+ bsdf clearcoated = df::custom_curve_layer(
778
+ weight: clearcoat_blend,
779
+ normal_reflectivity: 0.04,
780
+ grazing_reflectivity: grazing_refl_coat,
781
+ layer: df::microfacet_ggx_vcavities_bsdf(
782
+ mode: df::scatter_reflect,
783
+ roughness_u: clearcoat_roughness2,
784
+ tint: color(1.0)),
785
+ base: df::weighted_layer(
786
+ weight: 1.0,
787
+ layer: dielectric_metal_mix,
788
+ normal: normal),
789
+ normal: clearcoat_normal);
790
+
791
+ } in material(
792
+ thin_walled: thin_walled,
793
+ surface: material_surface(
794
+ scattering: clearcoated,
795
+ emission: material_emission (
796
+ emission: df::diffuse_edf(),
797
+ intensity: emissive_color * ::math::PI
798
+ )
799
+ ),
800
+ volume: material_volume(
801
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
802
+ ),
803
+ ior: color(ior),
804
+ geometry: material_geometry(
805
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
806
+ )
807
+ );
808
+
809
+
810
+ export material gltf_material_khr_specular_glossiness(
811
+ // diffuse color
812
+ uniform color diffuse_factor = color(1.0)
813
+ [[
814
+ anno::in_group("PBR Specular Glossiness"),
815
+ anno::display_name("Diffuse Factor"),
816
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
817
+ ]],
818
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
819
+ [[
820
+ anno::in_group("PBR Specular Glossiness"),
821
+ anno::display_name("Diffuse Texture"),
822
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
823
+ ]],
824
+
825
+ // specular glossiness
826
+ uniform color specular_factor = 1.0
827
+ [[
828
+ anno::in_group("PBR Specular Glossiness"),
829
+ anno::display_name("Specular Factor"),
830
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
831
+ ]],
832
+ uniform float glossiness_factor = 1.0
833
+ [[
834
+ anno::hard_range(0.0, 1.0),
835
+ anno::in_group("PBR Specular Glossiness"),
836
+ anno::display_name("Glossiness Factor"),
837
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
838
+ ]],
839
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
840
+ [[
841
+ anno::in_group("PBR Specular Glossiness"),
842
+ anno::display_name("Specular/Glossy Texture"),
843
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
844
+ ]],
845
+
846
+ // normal map
847
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
848
+ [[
849
+ anno::in_group("Normal Mapping"),
850
+ anno::display_name("Normal Texture"),
851
+ anno::description("Base layer normal map.")
852
+ ]],
853
+
854
+ // emission
855
+ uniform color emissive_factor = color(0.0)
856
+ [[
857
+ anno::in_group("Emission"),
858
+ anno::display_name("Emissive Factor"),
859
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
860
+ ]],
861
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
862
+ [[
863
+ anno::in_group("Emission"),
864
+ anno::display_name("Emissive Texture"),
865
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
866
+ anno::enable_if("::math::average(emissive_factor)>0.0")
867
+ ]],
868
+ // KHR_materials_emissive_strength
869
+ uniform float emissive_strength = 1.0
870
+ [[
871
+ anno::soft_range(0.0, 10000),
872
+ anno::in_group("Emission"),
873
+ anno::display_name("Emissive Strength"),
874
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
875
+ anno::enable_if("::math::average(emissive_factor)>0.0")
876
+ ]],
877
+
878
+ // ambient occlusion
879
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
880
+ [[
881
+ anno::in_group("Occlusion"),
882
+ anno::display_name("Occlusion Texture"),
883
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
884
+ ]],
885
+ uniform float occlusion_strength = 1.0
886
+ [[
887
+ anno::hard_range(0.0, 1.0),
888
+ anno::in_group("Occlusion"),
889
+ anno::display_name("Occlusion Strength"),
890
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
891
+ ]],
892
+
893
+ // alpha
894
+ uniform gltf_alpha_mode alpha_mode = opaque
895
+ [[
896
+ anno::in_group("Opacity"),
897
+ anno::display_name("Alpha Mode"),
898
+ anno::description("Select how to interpret the alpha value.")
899
+ ]],
900
+ uniform float base_alpha = 1.0
901
+ [[
902
+ anno::hard_range(0.0, 1.0),
903
+ anno::in_group("Opacity"),
904
+ anno::display_name("Base Alpha"),
905
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
906
+ anno::enable_if("alpha_mode!=opaque")
907
+ ]],
908
+
909
+ // alpha for gltf_alpha_mode::mask
910
+ uniform float alpha_cutoff = 0.5
911
+ [[
912
+ anno::hard_range(0.0, 1.0),
913
+ anno::in_group("Opacity"),
914
+ anno::display_name("Alpha Cutoff"),
915
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
916
+ anno::enable_if("alpha_mode==mask")
917
+ ]],
918
+
919
+ uniform string vertex_color_name_spec = string("displayColor")
920
+ [[
921
+ anno::in_group("Primvar"),
922
+ anno::display_name("Vertex Color Name"),
923
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
924
+ ]],
925
+
926
+ uniform bool use_vertex_color_alpha_spec = false
927
+ [[
928
+ anno::in_group("Primvar"),
929
+ anno::display_name("Use Opacity Channel From Vertex Color"),
930
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
931
+ ]],
932
+
933
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
934
+ [[
935
+ anno::in_group("Primvar"),
936
+ anno::display_name("Vertex Opacity Name"),
937
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
938
+ ]]
939
+
940
+ ) [[
941
+ anno::author("NVIDIA Corporation"),
942
+ anno::display_name("GLTF Material - Specular-Glossiness"),
943
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
944
+ ]] = let {
945
+
946
+ // handling GLTF parameters
947
+ // ------------------------------------------------------------------------
948
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
949
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
950
+
951
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
952
+ //float alpha = base_alpha;
953
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
954
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
955
+ float glossiness = glossiness_factor * specular_glossiness.w;
956
+
957
+ float3 normal = gltf_prepare_normal(normal_texture);
958
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
959
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
960
+
961
+ // specular glossiness model
962
+ // ------------------------------------------------------------------------
963
+
964
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
965
+ float F_0 = math::max_value(specular);
966
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
967
+
968
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
969
+
970
+ // diffuse BRDF
971
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
972
+ tint: diffuse * occlusion,
973
+ roughness: 0.0);
974
+
975
+ // specular BRDF
976
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
977
+ tint: color(occlusion),
978
+ roughness_u: a,
979
+ roughness_v: a,
980
+ tangent_u: state::texture_tangent_u(0));
981
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
982
+ //- Custom curve for specular/diffuse angular mix
983
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
984
+ normal_reflectivity: F_0,
985
+ grazing_reflectivity: 1.0,
986
+ exponent: 5.0,
987
+ weight: 1.0,
988
+ layer: tinted_specular,
989
+ base: diffuse_brdf,
990
+ normal: normal);
991
+
992
+ } in material(
993
+ surface: material_surface(
994
+ scattering: diffuse_specular_mix,
995
+ emission: material_emission (
996
+ emission: df::diffuse_edf(),
997
+ intensity: emissive_color * ::math::PI
998
+ )
999
+ ),
1000
+ geometry: material_geometry(
1001
+ normal: normal,
1002
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1003
+ )
1004
+ );
simready_assets/896/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-14T16:22:15",
6
+ "assets": [
7
+ {
8
+ "asset": "wet_floor_sign_board.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "a687c4f53467ddfea9255581e3c1755cb9615812ad6b9c7814684d18959985b3",
37
+ "blake3": "9af0d78fc666371f1a9718d7d7edda810cc4c30cca00ce1a7783ebeb99157bfd"
38
+ }
39
+ }
simready_assets/896/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-14T16:22:15",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }
simready_assets/896/.metadata/com.nvidia.simready.packaging.bom.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "content_root": "file:///E:/validate/Output/.packages/wet_floor_sign_board/1.0.0",
4
+ "items": [
5
+ {
6
+ "relative_path": ".thumbs/256x256/wet_floor_sign_board.usd.png",
7
+ "size": 15595,
8
+ "hash": {
9
+ "sha256-flat-1mb": "2d6bde7eb23377919793f1b78ead193c9307282c9ce63687c059803131d81c1d",
10
+ "sha256": "557a5ae406bb80408112ff35e1b1f99c6f75a6bdcdeb910821544f2488e11e10",
11
+ "blake3": "9c50193b834bcb99bee21595bb5282676ae442e1b76e528cc333f4f9e0cf339f"
12
+ }
13
+ },
14
+ {
15
+ "relative_path": "SubUSDs/textures/wet_floor_sign_board_diffuse.jpg",
16
+ "size": 399185,
17
+ "hash": {
18
+ "sha256-flat-1mb": "038edfcddbd0d161e8f4656020f2ae96a6d4d510dc29b721374ae5f0f274ab99",
19
+ "sha256": "6a7cec2c407fafaf3b508eb534777b75d97608404a89fa4290455e4f10d71613",
20
+ "blake3": "f1ea13dcc2766d6159eadddffab9bf1c079d70904f1c0f79fe2177da9e89af1a"
21
+ }
22
+ },
23
+ {
24
+ "relative_path": "gltf/pbr.mdl",
25
+ "size": 43800,
26
+ "hash": {
27
+ "sha256-flat-1mb": "f7013dcb99f4ad5c79b3b53c2b379598d790170e11a0aef8891ceef8c9bfc51c",
28
+ "sha256": "2c7c14d7bbf7cacea990f90e8ecc92700d8a7fe9805e44970096796e2be88b78",
29
+ "blake3": "3f0cb5ffe7e319677743a74dba7fdb0b2b11c3e40cc4b2d69277db595f52cbec"
30
+ }
31
+ },
32
+ {
33
+ "relative_path": "wet_floor_sign_board.usd",
34
+ "size": 1691653,
35
+ "hash": {
36
+ "sha256-flat-1mb": "0d102812dc368c3bfb9f756b8daf4a53a83fd0ac0c70bfa84225c15619f30105",
37
+ "sha256": "469737bb4b40aa4646968f8dd1177821e4b675ba117579f276dd98368ec5874d",
38
+ "blake3": "9ab5e4b633a697165b4f894930859cb42168af2a24c58fa9a89ace09df4e0103",
39
+ "sha256-first1m": "0e971ddda3ba157e99d8a00361e89314b815ab4bb18b240a9a89f1e9399bc17c"
40
+ }
41
+ }
42
+ ]
43
+ }
simready_assets/896/.metadata/com.nvidia.simready.root_usds.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "entries": [
4
+ "wet_floor_sign_board.usd"
5
+ ]
6
+ }
simready_assets/896/gltf/pbr.mdl ADDED
@@ -0,0 +1,1027 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******************************************************************************
2
+ * Copyright 2024 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * * Redistributions of source code must retain the above copyright
8
+ * notice, this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright
10
+ * notice, this list of conditions and the following disclaimer in the
11
+ * documentation and/or other materials provided with the distribution.
12
+ * * Neither the name of NVIDIA CORPORATION nor the names of its
13
+ * contributors may be used to endorse or promote products derived
14
+ * from this software without specific prior written permission.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ *****************************************************************************/
28
+
29
+ mdl 1.8;
30
+
31
+ import ::anno::*;
32
+ import ::base::*;
33
+ import ::df::*;
34
+ import ::math::*;
35
+ import ::state::*;
36
+ import ::tex::*;
37
+ import ::scene::*;
38
+ import ::limits::*;
39
+
40
+ export enum gltf_alpha_mode {
41
+ opaque,
42
+ mask,
43
+ blend
44
+ };
45
+
46
+ export enum gltf_wrapping_mode {
47
+ clamp_to_edge = 33071,
48
+ mirrored_repeat = 33648,
49
+ repeat = 10497
50
+ };
51
+
52
+ export struct gltf_texture_lookup_value
53
+ {
54
+ bool valid = false;
55
+ float4 value = float4(0.0, 0.0, 0.0, 1.0);
56
+ };
57
+
58
+ export struct gltf_normal_texture_lookup_value
59
+ {
60
+ bool valid = false;
61
+ float3 value = float3(0.0);
62
+ };
63
+
64
+ float compute_opacity(gltf_alpha_mode mode, float alpha, float cutoff) {
65
+ switch (mode) {
66
+ case mask:
67
+ return alpha < cutoff ? 0.0 : 1.0;
68
+ case blend:
69
+ return alpha;
70
+ case opaque:
71
+ return 1.0;
72
+ }
73
+ }
74
+
75
+ float4 gltf_prepare_tex_float4(gltf_texture_lookup_value sample, float4 default_value = float4(1.0)) {
76
+ return sample.valid ? sample.value : default_value;
77
+ }
78
+
79
+ float3 gltf_prepare_tex_float3(gltf_texture_lookup_value sample, float3 default_value = float3(1.0)) {
80
+ return sample.valid ? float3(sample.value.x, sample.value.y, sample.value.z) : default_value;
81
+ }
82
+
83
+ float3 gltf_prepare_normal(gltf_normal_texture_lookup_value sample) {
84
+ return sample.valid ? sample.value : state::normal();
85
+ }
86
+
87
+ float gltf_prepare_occlusion(gltf_texture_lookup_value sample, float occlusion_strength) {
88
+ float occulusion = sample.valid ? sample.value.x : 1.0;
89
+ return math::lerp(1.0, occulusion, occlusion_strength);
90
+ }
91
+
92
+ color gltf_perpare_emission(gltf_texture_lookup_value sample, color emissive_factor) {
93
+ return emissive_factor * color(gltf_prepare_tex_float3(sample));
94
+ }
95
+
96
+ ::tex::wrap_mode convert_wrap_mode(gltf_wrapping_mode mode)
97
+ {
98
+ if (mode == clamp_to_edge)
99
+ return ::tex::wrap_clamp;
100
+ if (mode == mirrored_repeat)
101
+ return ::tex::wrap_mirrored_repeat;
102
+
103
+ return ::tex::wrap_repeat;
104
+ }
105
+
106
+ float2 khr_texture_transform_apply(
107
+ float2 coord,
108
+ float2 offset,
109
+ float rotation,
110
+ float2 scale
111
+ )
112
+ {
113
+ // MDL expects the texture coordinate origin at the bottom left (gltf at top left)
114
+ // Assuming the renderer follows the MDL specification in which case the coordinates
115
+ // have been flipped either while loading the glTF geometry or while setting up the state.
116
+
117
+ // Undo the flipping for the transformation to get into the original glTF texture space.
118
+ coord = float2(coord.x, 1.0f - coord.y);
119
+
120
+ // first scale
121
+ coord = coord * scale;
122
+ // then rotate
123
+ float cos_rotation = ::math::cos(rotation);
124
+ float sin_rotation = ::math::sin(rotation);
125
+ coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
126
+ // then translate
127
+ coord = coord + offset;
128
+
129
+ // flip back
130
+ coord = float2(coord.x, 1.0f - coord.y);
131
+ return coord;
132
+ }
133
+
134
+ export gltf_texture_lookup_value gltf_texture_lookup(
135
+ uniform texture_2d texture = texture_2d()
136
+ [[
137
+ anno::in_group("Source"),
138
+ anno::display_name("Texture"),
139
+ anno::description("Texture File")
140
+ ]],
141
+ uniform int tex_coord_index = 0
142
+ [[
143
+ anno::in_group("Source"),
144
+ anno::display_name("Coordinate Set"),
145
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
146
+ anno::enable_if("::tex::texture_isvalid(texture)")
147
+ ]],
148
+
149
+ uniform float2 offset = float2(0.0f, 0.0)
150
+ [[
151
+ anno::in_group("Texture Transform"),
152
+ anno::display_name("Offset"),
153
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
154
+ anno::enable_if("::tex::texture_isvalid(texture)")
155
+ ]],
156
+ uniform float rotation = 0.0
157
+ [[
158
+ anno::hard_range(0.0, 2.0 * ::math::PI),
159
+ anno::in_group("Texture Transform"),
160
+ anno::display_name("Rotation"),
161
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
162
+ anno::enable_if("::tex::texture_isvalid(texture)")
163
+ ]],
164
+ uniform float2 scale = float2(1.0f, 1.0f)
165
+ [[
166
+ anno::in_group("Texture Transform"),
167
+ anno::display_name("Scale"),
168
+ anno::description("The scale factor applied to the components of the UV coordinates."),
169
+ anno::enable_if("::tex::texture_isvalid(texture)")
170
+ ]],
171
+
172
+ uniform gltf_wrapping_mode wrap_s = repeat
173
+ [[
174
+ anno::in_group("Sampler"),
175
+ anno::display_name("Wrap S"),
176
+ anno::description("S (U) wrapping mode."),
177
+ anno::enable_if("::tex::texture_isvalid(texture)")
178
+ ]],
179
+ uniform gltf_wrapping_mode wrap_t = repeat
180
+ [[
181
+ anno::in_group("Sampler"),
182
+ anno::display_name("Wrap T"),
183
+ anno::description("T (V) wrapping mode."),
184
+ anno::enable_if("::tex::texture_isvalid(texture)")
185
+ ]]
186
+ )
187
+ [[
188
+ anno::author("NVIDIA Corporation"),
189
+ anno::display_name("GLTF Texture Lookup"),
190
+ anno::description("Function to read a color or color with alpha channel texture.")
191
+ ]]
192
+ {
193
+ gltf_texture_lookup_value tex_ret;
194
+ if (!tex::texture_isvalid(texture))
195
+ return tex_ret;
196
+
197
+ float3 tex_coord3 = state::texture_coordinate(tex_coord_index);
198
+ float2 tex_coord = khr_texture_transform_apply(
199
+ coord: float2(tex_coord3.x, tex_coord3.y),
200
+ offset: offset,
201
+ rotation: rotation,
202
+ scale: scale);
203
+
204
+ tex_ret.value = tex::lookup_float4(
205
+ tex: texture,
206
+ coord: tex_coord,
207
+ wrap_u: convert_wrap_mode(wrap_s),
208
+ wrap_v: convert_wrap_mode(wrap_t));
209
+ tex_ret.valid = true;
210
+ return tex_ret;
211
+ }
212
+
213
+ export gltf_normal_texture_lookup_value gltf_normal_texture_lookup(
214
+ uniform texture_2d texture = texture_2d()
215
+ [[
216
+ anno::in_group("Source"),
217
+ anno::display_name("Texture"),
218
+ anno::description("Texture File")
219
+ ]],
220
+ uniform float normal_scale_factor = 1.0
221
+ [[
222
+ anno::hard_range(0.0, 1.0),
223
+ anno::in_group("Source"),
224
+ anno::display_name("Normal Scale Factor"),
225
+ anno::description("Strength of the base layer normal mapping."),
226
+ anno::enable_if("::tex::texture_isvalid(texture)")
227
+ ]],
228
+ uniform int tex_coord_index = 0
229
+ [[
230
+ anno::in_group("Source"),
231
+ anno::display_name("Coordinate Set"),
232
+ anno::description("Texture coordinate set (UV-Set). KHR_texture_transform overrides the textureInfo texCoord value if supplied."),
233
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
234
+ ]],
235
+ uniform int tex_tangent_index = 0
236
+ [[
237
+ anno::hidden(),
238
+ anno::in_group("Source"),
239
+ anno::display_name("Coordinate Set"),
240
+ anno::description("Tangent to be to construct the tangent frame."),
241
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
242
+ ]],
243
+
244
+ uniform float2 offset = float2(0.0f, 0.0)
245
+ [[
246
+ anno::in_group("Texture Transform"),
247
+ anno::display_name("Offset"),
248
+ anno::description("The offset of the UV coordinate origin as a factor of the texture dimensions."),
249
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
250
+ ]],
251
+ uniform float rotation = 0.0
252
+ [[
253
+ anno::hard_range(0.0, 2.0 * ::math::PI),
254
+ anno::in_group("Texture Transform"),
255
+ anno::display_name("Rotation"),
256
+ anno::description("Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent to a similar rotation of the image clockwise."),
257
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
258
+ ]],
259
+ uniform float2 scale = float2(1.0f, 1.0f)
260
+ [[
261
+ anno::in_group("Texture Transform"),
262
+ anno::display_name("Scale"),
263
+ anno::description("The scale factor applied to the components of the UV coordinates."),
264
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
265
+ ]],
266
+
267
+ uniform gltf_wrapping_mode wrap_s = repeat
268
+ [[
269
+ anno::in_group("Sampler"),
270
+ anno::display_name("Wrap S"),
271
+ anno::description("S (U) wrapping mode."),
272
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
273
+ ]],
274
+ uniform gltf_wrapping_mode wrap_t = repeat
275
+ [[
276
+ anno::in_group("Sampler"),
277
+ anno::display_name("Wrap T"),
278
+ anno::description("T (V) wrapping mode."),
279
+ anno::enable_if("::tex::texture_isvalid(texture) && normal_scale_factor>0.0")
280
+ ]]
281
+ )
282
+ [[
283
+ anno::author("NVIDIA Corporation"),
284
+ anno::display_name("GLTF Normal Texture Lookup"),
285
+ anno::description("Function to read a normal texture.")
286
+ ]]
287
+ {
288
+ gltf_normal_texture_lookup_value tex_ret;
289
+ if (!::tex::texture_isvalid(texture))
290
+ return tex_ret;
291
+
292
+ tex_ret.value = base::tangent_space_normal_texture(
293
+ texture: texture,
294
+ factor: normal_scale_factor,
295
+ uvw: base::transform_coordinate(
296
+ transform: base::rotation_translation_scale(
297
+ rotation: float3(0, 0, rotation),
298
+ translation: float3(offset.x, offset.y, 0),
299
+ scaling: float3(scale.x, scale.y, 1)
300
+ ),
301
+ coordinate: base::texture_coordinate_info(
302
+ position: state::texture_coordinate(tex_coord_index),
303
+ tangent_u: state::texture_tangent_u(tex_tangent_index),
304
+ tangent_v: state::texture_tangent_v(tex_tangent_index)
305
+ )
306
+ ),
307
+ wrap_u: convert_wrap_mode(wrap_s),
308
+ wrap_v: convert_wrap_mode(wrap_t));
309
+ tex_ret.valid = true;
310
+ return tex_ret;
311
+ }
312
+
313
+ export material gltf_material(
314
+ // base color
315
+ uniform color base_color_factor = color(1.0)
316
+ [[
317
+ anno::in_group("Metallic Roughness"),
318
+ anno::display_name("Base Color Factor"),
319
+ anno::description("The base color of the material. Multiplied to the 'Base Color Texture' if available.")
320
+ ]],
321
+
322
+ gltf_texture_lookup_value base_color_texture = gltf_texture_lookup()
323
+ [[
324
+ anno::in_group("Metallic Roughness"),
325
+ anno::display_name("Base Color Texture"),
326
+ anno::description("The base color of the material. Influenced by the 'Base Color Factor'.")
327
+ ]],
328
+
329
+ // KHR_materials_specular
330
+ uniform float specular_factor = 1.0
331
+ [[
332
+ anno::hard_range(0.0, 1.0),
333
+ anno::in_group("Specular"),
334
+ anno::display_name("Specular Factor"),
335
+ anno::description("The strength of the specular reflection. Multiplied to the 'Specular Texture' if available.")
336
+ ]],
337
+ gltf_texture_lookup_value specular_texture = gltf_texture_lookup()
338
+ [[
339
+ anno::in_group("Specular"),
340
+ anno::display_name("Specular Texture"),
341
+ anno::description("A texture that defines the strength of the specular reflection, stored in the alpha (A) channel. This will be multiplied by the 'Specular Factor'.")
342
+ ]],
343
+ uniform color specular_color_factor = color(1.0)
344
+ [[
345
+ anno::in_group("Specular"),
346
+ anno::display_name("Specular Color Factor"),
347
+ anno::description("The F0 color of the specular reflection (linear RGB). Multiplied to the 'Specular Color Texture' if available.")
348
+ ]],
349
+ gltf_texture_lookup_value specular_color_texture = gltf_texture_lookup()
350
+ [[
351
+ anno::in_group("Specular"),
352
+ anno::display_name("Specular Color Texture"),
353
+ anno::description("A texture that defines the F0 color of the specular reflection, stored in the RGB channels and encoded in sRGB. This texture will be multiplied by 'Specular Color Factor'.")
354
+ ]],
355
+
356
+ // metallic roughness
357
+ uniform float metallic_factor = 1.0
358
+ [[
359
+ anno::hard_range(0.0, 1.0),
360
+ anno::in_group("Metallic Roughness"),
361
+ anno::display_name("Metallic Factor"),
362
+ anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
363
+ ]],
364
+
365
+ uniform float roughness_factor = 1.0
366
+ [[
367
+ anno::hard_range(0.0, 1.0),
368
+ anno::in_group("Metallic Roughness"),
369
+ anno::display_name("Roughness Factor"),
370
+ anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0). Multiplied to the 'Metal/Rough Texture' value if available.")
371
+ ]],
372
+ gltf_texture_lookup_value metallic_roughness_texture = gltf_texture_lookup()
373
+ [[
374
+ anno::in_group("Metallic Roughness"),
375
+ anno::display_name("Metal/Rough Texture"),
376
+ anno::description("Metallic in the red or blue component and roughness in the green component. Influenced by the 'Metallic Factor' and 'Roughness Factor'."),
377
+ anno::enable_if("metallic_factor>0.0 || roughness_factor>0.0")
378
+ ]],
379
+
380
+ // KHR_materials_anisotropy
381
+ uniform float anisotropy_strength = 0.0
382
+ [[
383
+ anno::hard_range(0.0, 1.0),
384
+ anno::in_group("Anisotropy"),
385
+ anno::display_name("Anisotropy Strength"),
386
+ anno::description("The anisotropy strength. When the anisotropy texture is present, this value is multiplied by the texture's blue channel.")
387
+ ]],
388
+ uniform float anisotropy_rotation = 0.0
389
+ [[
390
+ anno::hard_range(0.0, 2.0 * ::math::PI),
391
+ anno::in_group("Anisotropy"),
392
+ anno::display_name("Anisotropy Rotation"),
393
+ anno::description("The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When the anisotropy texture is present, this value provides additional rotation to the vectors in the texture.")
394
+ ]],
395
+ gltf_texture_lookup_value anisotropy_texture = gltf_texture_lookup()
396
+ [[
397
+ anno::in_group("Anisotropy"),
398
+ anno::display_name("Anisotropy Texture"),
399
+ anno::description("The anisotropy texture. Red and green channels represent the anisotropy direction in [− 1, 1] tangent, bitangent space to be rotated by the anisotropy rotation. The blue channel contains strength as [0, 1] to be multiplied by the anisotropy strength.")
400
+ ]],
401
+
402
+ // KHR_materials_ior
403
+ uniform float ior = 1.5
404
+ [[
405
+ anno::hard_range(1.0, 5.0),
406
+ anno::in_group("Metallic Roughness"),
407
+ anno::display_name("IOR"),
408
+ anno::description("The index of refraction.")
409
+ ]],
410
+
411
+ // normal map
412
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
413
+ [[
414
+ anno::in_group("Normal Mapping"),
415
+ anno::display_name("Normal Texture"),
416
+ anno::description("Base layer normal map.")
417
+ ]],
418
+
419
+ // KHR_materials_transmission
420
+ uniform float transmission_factor = 0.0
421
+ [[
422
+ anno::hard_range(0.0, 1.0),
423
+ anno::in_group("Transmission"),
424
+ anno::display_name("Transmission Factor"),
425
+ anno::description("The base percentage of light that is transmitted through the surface. Multiplied to the 'Transmission Texture' if available.")
426
+ ]],
427
+ gltf_texture_lookup_value transmission_texture = gltf_texture_lookup()
428
+ [[
429
+ anno::in_group("Transmission"),
430
+ anno::display_name("Transmission Texture"),
431
+ anno::description("A texture that defines the transmission percentage of the surface, stored in the R channel. Influenced by the 'Transmission Factor'."),
432
+ anno::enable_if("transmission_factor>0")
433
+ ]],
434
+
435
+ // KHR_materials_sheen
436
+ uniform color sheen_color_factor = color(0.0)
437
+ [[
438
+ anno::in_group("Sheen"),
439
+ anno::display_name("Sheen Color Factor"),
440
+ anno::description("The sheen color in linear space. Multiplied to the 'Sheen Color Texture' if available.")
441
+ ]],
442
+ gltf_texture_lookup_value sheen_color_texture = gltf_texture_lookup()
443
+ [[
444
+ anno::in_group("Sheen"),
445
+ anno::display_name("Sheen Color Texture"),
446
+ anno::description("The sheen color (RGB). The sheen color is in sRGB transfer function. Influenced by the 'Sheen Color Factor'.")
447
+ ]],
448
+ uniform float sheen_roughness_factor = 0.0
449
+ [[
450
+ anno::hard_range(0.0, 1.0),
451
+ anno::in_group("Sheen"),
452
+ anno::display_name("Sheen Roughness Factor"),
453
+ anno::description("The sheen roughness. Multiplied to the 'Sheen Roughness Texture' if available.")
454
+ ]],
455
+ gltf_texture_lookup_value sheen_roughness_texture = gltf_texture_lookup()
456
+ [[
457
+ anno::in_group("Sheen"),
458
+ anno::display_name("Sheen Roughness Texture"),
459
+ anno::description("The sheen roughness (Alpha) texture. Influenced by the 'Sheen Roughness Factor'.")
460
+ ]],
461
+
462
+ // KHR_materials_clearcoat
463
+ uniform float clearcoat_factor = 0.0
464
+ [[
465
+ anno::hard_range(0.0, 1.0),
466
+ anno::in_group("Clearcoat"),
467
+ anno::display_name("Clearcoat Factor"),
468
+ anno::description("Strength of the clearcoat. Multiplied to the 'Clearcoat Texture' if available.")
469
+ ]],
470
+ gltf_texture_lookup_value clearcoat_texture = gltf_texture_lookup()
471
+ [[
472
+ anno::in_group("Clearcoat"),
473
+ anno::display_name("Clearcoat Texture"),
474
+ anno::description("Strength of the clearcoat. Influenced by the 'Clearcoat Factor'."),
475
+ anno::enable_if("clearcoat_factor>0")
476
+ ]],
477
+ uniform float clearcoat_roughness_factor = 0.0
478
+ [[
479
+ anno::hard_range(0.0, 1.0),
480
+ anno::in_group("Clearcoat"),
481
+ anno::display_name("Clearcoat Roughness Factor"),
482
+ anno::description("The clearcoat layer roughness. Multiplied to the 'Clearcoat Roughness Texture' if available."),
483
+ anno::enable_if("clearcoat_factor>0.0")
484
+ ]],
485
+ gltf_texture_lookup_value clearcoat_roughness_texture = gltf_texture_lookup()
486
+ [[
487
+ anno::in_group("Clearcoat"),
488
+ anno::display_name("Clearcoat Roughness Texture"),
489
+ anno::description("The clearcoat layer roughness texture. Influenced by the 'Clearcoat Roughness Texture'."),
490
+ anno::enable_if("clearcoat_factor>0.0 && clearcoat_roughness_factor>0.0")
491
+ ]],
492
+ gltf_normal_texture_lookup_value clearcoat_normal_texture = gltf_normal_texture_lookup()
493
+ [[
494
+ anno::in_group("Clearcoat"),
495
+ anno::display_name("Clearcoat Normal"),
496
+ anno::description("The clearcoat normal map texture."),
497
+ anno::enable_if("clearcoat_factor>0.0")
498
+ ]],
499
+
500
+ // KHR_materials_iridescence
501
+ uniform float iridescence_factor = 0.0
502
+ [[
503
+ anno::hard_range(0.0, 1.0),
504
+ anno::in_group("Iridescence"),
505
+ anno::display_name("Iridescence Factor"),
506
+ anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
507
+ ]],
508
+ gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
509
+ [[
510
+ anno::in_group("Iridescence"),
511
+ anno::display_name("Iridescence Texture"),
512
+ anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
513
+ anno::enable_if("iridescence_factor>0")
514
+ ]],
515
+ uniform float iridescence_ior = 1.3
516
+ [[
517
+ anno::soft_range(1.0, 5.0),
518
+ anno::in_group("Iridescence"),
519
+ anno::display_name("Iridescence IOR"),
520
+ anno::description("The index of refraction of the dielectric thin-film layer.")
521
+ ]],
522
+ uniform float iridescence_thickness_minimum = 100
523
+ [[
524
+ anno::soft_range(0.0, 600.0),
525
+ anno::in_group("Iridescence"),
526
+ anno::display_name("Iridescence Thickness Minimum"),
527
+ anno::description("The minimum thickness of the thin-film layer given in nanometers.")
528
+ ]],
529
+ uniform float iridescence_thickness_maximum = 400
530
+ [[
531
+ anno::soft_range(0.0, 1000.0),
532
+ anno::in_group("Iridescence"),
533
+ anno::display_name("Iridescence Thickness Maximum"),
534
+ anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
535
+ ]],
536
+ gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
537
+ [[
538
+ anno::in_group("Iridescence"),
539
+ anno::display_name("Iridescence Thickness Texture"),
540
+ anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
541
+ anno::enable_if("iridescence_factor>0")
542
+ ]],
543
+
544
+ // emission
545
+ uniform color emissive_factor = color(0.0)
546
+ [[
547
+ anno::in_group("Emission"),
548
+ anno::display_name("Emissive Factor"),
549
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
550
+ ]],
551
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
552
+ [[
553
+ anno::in_group("Emission"),
554
+ anno::display_name("Emissive Texture"),
555
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
556
+ anno::enable_if("::math::average(emissive_factor)>0.0")
557
+ ]],
558
+ // KHR_materials_emissive_strength
559
+ uniform float emissive_strength = 1.0
560
+ [[
561
+ anno::soft_range(0.0, 10000),
562
+ anno::in_group("Emission"),
563
+ anno::display_name("Emissive Strength"),
564
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
565
+ anno::enable_if("::math::average(emissive_factor)>0.0")
566
+ ]],
567
+
568
+ // KHR_materials_volume
569
+ uniform bool thin_walled = true
570
+ [[
571
+ anno::in_group("Volume"),
572
+ anno::display_name("Thin-walled"),
573
+ anno::description("If true the material is thin-walled. Otherwise the material is a volume boundary. The doubleSided property has no effect on volume boundaries. Note, the thickness parameters are ignored since ray-tracing is used to compute the traveled distance within the volume.")
574
+ ]],
575
+ uniform float attenuation_distance = 0.0
576
+ [[
577
+ anno::soft_range(0.0, ::limits::FLOAT_MAX),
578
+ anno::in_group("Volume"),
579
+ anno::display_name("Attenuation Distance"),
580
+ anno::description("Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space. A value 0.0 disables it")
581
+ ]],
582
+ uniform color attenuation_color = color(1.0)
583
+ [[
584
+ anno::in_group("Volume"),
585
+ anno::display_name("Attenuation Color"),
586
+ anno::description("The color that white light turns into due to absorption when reaching the attenuation distance.")
587
+ ]],
588
+
589
+ // ambient occlusion
590
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
591
+ [[
592
+ anno::in_group("Occlusion"),
593
+ anno::display_name("Occlusion Texture"),
594
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
595
+ ]],
596
+ uniform float occlusion_strength = 1.0
597
+ [[
598
+ anno::hard_range(0.0, 1.0),
599
+ anno::in_group("Occlusion"),
600
+ anno::display_name("Occlusion Strength"),
601
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
602
+ ]],
603
+
604
+ // alpha
605
+ uniform gltf_alpha_mode alpha_mode = opaque
606
+ [[
607
+ anno::in_group("Opacity"),
608
+ anno::display_name("Alpha Mode"),
609
+ anno::description("Select how to interpret the alpha value.")
610
+ ]],
611
+ uniform float base_alpha = 1.0
612
+ [[
613
+ anno::hard_range(0.0, 1.0),
614
+ anno::in_group("Opacity"),
615
+ anno::display_name("Base Alpha"),
616
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
617
+ anno::enable_if("alpha_mode!=opaque")
618
+ ]],
619
+ // alpha for gltf_alpha_mode::mask
620
+ uniform float alpha_cutoff = 0.5
621
+ [[
622
+ anno::hard_range(0.0, 1.0),
623
+ anno::in_group("Opacity"),
624
+ anno::display_name("Alpha Cutoff"),
625
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
626
+ anno::enable_if("alpha_mode==mask")
627
+ ]],
628
+
629
+ uniform string vertex_color_name = string("displayColor")
630
+ [[
631
+ anno::in_group("Primvar"),
632
+ anno::display_name("Vertex Color Name"),
633
+ anno::description("Name of the vertex color primvar usually COLOR_0(gltf), or displayColor(usd)")
634
+ ]],
635
+
636
+ uniform bool use_vertex_color_alpha = false
637
+ [[
638
+ anno::in_group("Primvar"),
639
+ anno::display_name("Use Opacity Channel From Vertex Color"),
640
+ anno::description("Multipy the Alpha or .w channel from the vertex color with the base alpha value.")
641
+ ]],
642
+
643
+ uniform string vertex_opacity_name = string("displayOpacity")
644
+ [[
645
+ anno::in_group("Primvar"),
646
+ anno::display_name("Vertex Opacity Name"),
647
+ anno::description("Name of the vertex opacity primvar usually the fourth component of COLOR_0(gltf), or displayOpacity(usd)")
648
+ ]]
649
+
650
+ ) [[
651
+ anno::author("NVIDIA Corporation"),
652
+ anno::display_name("GLTF Material - Metallic-Roughness"),
653
+ anno::description("Metallic-Roughness Material that takes the GLTF PBR model and KHR extension parameters as input.")
654
+ ]] = let {
655
+
656
+ // handling GLTF parameters
657
+ // ------------------------------------------------------------------------
658
+
659
+ float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * ::scene::data_lookup_float4(vertex_color_name, float4(1.0)); // apply vertex color
660
+ color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
661
+
662
+ float alpha = base_alpha * (use_vertex_color_alpha == 1 ? base_float4.w : 1.0) * ((vertex_color_name != vertex_opacity_name) ? ::scene::data_lookup_float(vertex_opacity_name, float(1.0)) : 1.0);
663
+
664
+ float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
665
+ float metallic = metallic_factor * metallic_roughness.z;
666
+ float roughness = roughness_factor * metallic_roughness.y;
667
+
668
+ float3 normal = gltf_prepare_normal(normal_texture);
669
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
670
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
671
+
672
+ // KHR_materials_specular
673
+ // ------------------------------------------------------------------------
674
+ color specular_color = color(gltf_prepare_tex_float3(specular_color_texture)) * specular_color_factor;
675
+ float specular = gltf_prepare_tex_float4(specular_texture).w * specular_factor;
676
+
677
+ // KHR_materials_transmission
678
+ // ------------------------------------------------------------------------
679
+ float transmission = gltf_prepare_tex_float4(transmission_texture).x * transmission_factor;
680
+
681
+ // KHR_materials_sheen
682
+ // ------------------------------------------------------------------------
683
+ color sheen_color = color(gltf_prepare_tex_float3(sheen_color_texture)) * sheen_color_factor;
684
+ float sheen_roughness = gltf_prepare_tex_float4(sheen_roughness_texture).w * sheen_roughness_factor;
685
+
686
+ // KHR_materials_clearcoat
687
+ // ------------------------------------------------------------------------
688
+ float clearcoat_blend = gltf_prepare_tex_float3(clearcoat_texture).x * clearcoat_factor;
689
+ float clearcoat_roughness = gltf_prepare_tex_float3(clearcoat_roughness_texture).y * clearcoat_roughness_factor;
690
+ float clearcoat_roughness2 = clearcoat_roughness * clearcoat_roughness;
691
+ float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
692
+ float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
693
+
694
+ // KHR_materials_iridescence
695
+ // ------------------------------------------------------------------------
696
+ float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
697
+ float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
698
+
699
+ // KHR_materials_anisotropy
700
+ // ------------------------------------------------------------------------
701
+ float3 anisotropy_tex = gltf_prepare_tex_float3(anisotropy_texture, float3(1.0, 0.5, 1.0));
702
+ float2 anisotropy_tex_dir = float2(anisotropy_tex.x * 2.0 - 1.0, anisotropy_tex.y * 2.0 - 1.0);
703
+ float2 anisotropy_rot = float2(math::cos(anisotropy_rotation), math::sin(anisotropy_rotation));
704
+ float2 anisotropy_dir = float2x2(anisotropy_rot.x, anisotropy_rot.y, -anisotropy_rot.y, anisotropy_rot.x) * math::normalize(anisotropy_tex_dir);
705
+ float3 anisotropy_tangent_u = state::texture_tangent_u(0) * anisotropy_dir.x + state::texture_tangent_v(0) * anisotropy_dir.y;
706
+ float anisotropy = anisotropy_strength * anisotropy_tex.z;
707
+
708
+ // metallic roughness model
709
+ // ------------------------------------------------------------------------
710
+
711
+ // compute final roughness by squaring the "roughness" parameter
712
+ float roughness2 = roughness * roughness;
713
+
714
+ float anisotropy_roughness_u = math::lerp(roughness2, 1.0, anisotropy * anisotropy);
715
+ float anisotropy_roughness_v = roughness2;
716
+
717
+ // reduce the reflectivity at grazing angles to avoid "dark edges"
718
+ // for high roughness due to the layering
719
+ float grazing_refl = math::max((1.0 - roughness), 0.0);
720
+
721
+ // fresnel term based on ior
722
+ float f0 = math::pow((ior - 1.0)/(ior + 1.0), 2.0);
723
+
724
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
725
+ // the glossy layer has no color tint
726
+ bsdf dielectric_component = df::color_custom_curve_layer(
727
+ weight: color(1.0), // roughness is used to weight between diffuse and glossy
728
+ normal_reflectivity: math::min(f0 * specular_color, color(1.0)) * specular,
729
+ grazing_reflectivity: color(grazing_refl * specular),
730
+ layer: df::microfacet_ggx_vcavities_bsdf(
731
+ roughness_u: anisotropy_roughness_u,
732
+ roughness_v: anisotropy_roughness_v,
733
+ tangent_u: anisotropy_tangent_u),
734
+ base: df::weighted_layer(
735
+ weight: transmission,
736
+ base: df::diffuse_reflection_bsdf(tint: base_color * occlusion),
737
+ layer: df::microfacet_ggx_vcavities_bsdf(
738
+ roughness_u: roughness2,
739
+ tint: base_color * occlusion,
740
+ mode: df::scatter_transmit)),
741
+ normal: normal
742
+ );
743
+
744
+ // apply iridescence and make the strength adjustable using a weighted layer
745
+ bsdf dielectric_component_with_thin_film = df::weighted_layer(
746
+ weight: iridescence_strength,
747
+ base: dielectric_component,
748
+ layer: df::thin_film(
749
+ thickness: iridescence_thickness,
750
+ ior: color(iridescence_ior),
751
+ base: dielectric_component
752
+ )
753
+ );
754
+
755
+ // the metallic component doesn't have a diffuse component,
756
+ // its only glossy base_color is applied to tint it
757
+ bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
758
+ tint: base_color * occlusion,
759
+ roughness_u: anisotropy_roughness_u,
760
+ roughness_v: anisotropy_roughness_v,
761
+ tangent_u: anisotropy_tangent_u);
762
+
763
+ // apply iridescence and make the strength adjustable using a weighted layer
764
+ // according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
765
+ color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
766
+ color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
767
+ bsdf metallic_component_with_thin_film = df::weighted_layer(
768
+ weight: iridescence_strength,
769
+ base: metallic_component,
770
+ layer: df::thin_film(
771
+ thickness: iridescence_thickness,
772
+ ior: color(iridescence_ior),
773
+ base: df::fresnel_factor(
774
+ ior: dielectric_ior,
775
+ extinction_coefficient: color(0.0f),
776
+ base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
777
+ )
778
+ );
779
+
780
+ // apply sheen to the dielectric component
781
+ // add the sheen_color as weight in an outer layer to be able to blend and disable on default
782
+ // otherwise, sheen would be applied and tinted black
783
+ bsdf dielectric_sheen_component = df::color_weighted_layer(
784
+ weight: sheen_color,
785
+ layer: df::sheen_bsdf(
786
+ roughness: sheen_roughness * sheen_roughness,
787
+ tint: color(1.0),
788
+ multiscatter_tint: color(1.0),
789
+ multiscatter: dielectric_component // don't apply thin_film
790
+ ),
791
+ base: dielectric_component_with_thin_film);
792
+
793
+ // final BSDF is a linear blend between dielectric and metallic component
794
+ bsdf dielectric_metal_mix = df::weighted_layer(
795
+ weight: metallic,
796
+ base: dielectric_sheen_component,
797
+ layer: metallic_component_with_thin_film,
798
+ normal: normal);
799
+
800
+ bsdf clearcoated = df::custom_curve_layer(
801
+ weight: clearcoat_blend,
802
+ normal_reflectivity: 0.04,
803
+ grazing_reflectivity: grazing_refl_coat,
804
+ layer: df::microfacet_ggx_vcavities_bsdf(
805
+ mode: df::scatter_reflect,
806
+ roughness_u: clearcoat_roughness2,
807
+ tint: color(1.0)),
808
+ base: df::weighted_layer(
809
+ weight: 1.0,
810
+ layer: dielectric_metal_mix,
811
+ normal: normal),
812
+ normal: clearcoat_normal);
813
+
814
+ } in material(
815
+ thin_walled: thin_walled,
816
+ surface: material_surface(
817
+ scattering: clearcoated,
818
+ emission: material_emission (
819
+ emission: df::diffuse_edf(),
820
+ intensity: emissive_color * ::math::PI
821
+ )
822
+ ),
823
+ volume: material_volume(
824
+ absorption_coefficient: thin_walled ? color(0.0) : (attenuation_distance == 0) ? color(0.0) : -math::log(attenuation_color) / attenuation_distance
825
+ ),
826
+ ior: color(ior),
827
+ geometry: material_geometry(
828
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
829
+ )
830
+ );
831
+
832
+
833
+ export material gltf_material_khr_specular_glossiness(
834
+ // diffuse color
835
+ uniform color diffuse_factor = color(1.0)
836
+ [[
837
+ anno::in_group("PBR Specular Glossiness"),
838
+ anno::display_name("Diffuse Factor"),
839
+ anno::description("The diffuse color of the material. Multiplied to the 'Diffuse Texture' if available.")
840
+ ]],
841
+ gltf_texture_lookup_value diffuse_texture = gltf_texture_lookup()
842
+ [[
843
+ anno::in_group("PBR Specular Glossiness"),
844
+ anno::display_name("Diffuse Texture"),
845
+ anno::description("The diffuse color of the material. Influenced by the 'Diffuse Factor'.")
846
+ ]],
847
+
848
+ // specular glossiness
849
+ uniform color specular_factor = 1.0
850
+ [[
851
+ anno::in_group("PBR Specular Glossiness"),
852
+ anno::display_name("Specular Factor"),
853
+ anno::description("The specular color of the material. Multiplied to the rgb values of the 'Specular/Glossy Texture' if available.")
854
+ ]],
855
+ uniform float glossiness_factor = 1.0
856
+ [[
857
+ anno::hard_range(0.0, 1.0),
858
+ anno::in_group("PBR Specular Glossiness"),
859
+ anno::display_name("Glossiness Factor"),
860
+ anno::description("The glossiness of the material. Select between diffuse (0.0) and nearly specular (1.0). Multiplied to the alpha value of the 'Specular/Glossy Texture' if available.")
861
+ ]],
862
+ gltf_texture_lookup_value specular_glossiness_texture = gltf_texture_lookup()
863
+ [[
864
+ anno::in_group("PBR Specular Glossiness"),
865
+ anno::display_name("Specular/Glossy Texture"),
866
+ anno::description("The specular-glossiness texture. Influenced by the 'Specular Factor' and 'Glossiness Factor'.")
867
+ ]],
868
+
869
+ // normal map
870
+ gltf_normal_texture_lookup_value normal_texture = gltf_normal_texture_lookup()
871
+ [[
872
+ anno::in_group("Normal Mapping"),
873
+ anno::display_name("Normal Texture"),
874
+ anno::description("Base layer normal map.")
875
+ ]],
876
+
877
+ // emission
878
+ uniform color emissive_factor = color(0.0)
879
+ [[
880
+ anno::in_group("Emission"),
881
+ anno::display_name("Emissive Factor"),
882
+ anno::description("The emissive color of the material. Multiplied to the 'Emissive Texture' if available.")
883
+ ]],
884
+ gltf_texture_lookup_value emissive_texture = gltf_texture_lookup()
885
+ [[
886
+ anno::in_group("Emission"),
887
+ anno::display_name("Emissive Texture"),
888
+ anno::description("The emissive map texture. Influenced by the 'Emissive Factor'."),
889
+ anno::enable_if("::math::average(emissive_factor)>0.0")
890
+ ]],
891
+ // KHR_materials_emissive_strength
892
+ uniform float emissive_strength = 1.0
893
+ [[
894
+ anno::soft_range(0.0, 10000),
895
+ anno::in_group("Emission"),
896
+ anno::display_name("Emissive Strength"),
897
+ anno::description("The maximum strength of the emissive texture. Multiplied to the 'Emissive Factor'."),
898
+ anno::enable_if("::math::average(emissive_factor)>0.0")
899
+ ]],
900
+
901
+ // ambient occlusion
902
+ gltf_texture_lookup_value occlusion_texture = gltf_texture_lookup()
903
+ [[
904
+ anno::in_group("Occlusion"),
905
+ anno::display_name("Occlusion Texture"),
906
+ anno::description("The occlusion map texture. Influenced by the 'Occlusion Strength'.")
907
+ ]],
908
+ uniform float occlusion_strength = 1.0
909
+ [[
910
+ anno::hard_range(0.0, 1.0),
911
+ anno::in_group("Occlusion"),
912
+ anno::display_name("Occlusion Strength"),
913
+ anno::description("A scalar multiplier controlling the amount of occlusion applied. Multiplied to the 'Occlusion Texture'.")
914
+ ]],
915
+
916
+ // alpha
917
+ uniform gltf_alpha_mode alpha_mode = opaque
918
+ [[
919
+ anno::in_group("Opacity"),
920
+ anno::display_name("Alpha Mode"),
921
+ anno::description("Select how to interpret the alpha value.")
922
+ ]],
923
+ uniform float base_alpha = 1.0
924
+ [[
925
+ anno::hard_range(0.0, 1.0),
926
+ anno::in_group("Opacity"),
927
+ anno::display_name("Base Alpha"),
928
+ anno::description("Select between transparent (0.0) and opaque (1.0). Multiplied to the base color texture alpha channel if available."),
929
+ anno::enable_if("alpha_mode!=opaque")
930
+ ]],
931
+
932
+ // alpha for gltf_alpha_mode::mask
933
+ uniform float alpha_cutoff = 0.5
934
+ [[
935
+ anno::hard_range(0.0, 1.0),
936
+ anno::in_group("Opacity"),
937
+ anno::display_name("Alpha Cutoff"),
938
+ anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
939
+ anno::enable_if("alpha_mode==mask")
940
+ ]],
941
+
942
+ uniform string vertex_color_name_spec = string("displayColor")
943
+ [[
944
+ anno::in_group("Primvar"),
945
+ anno::display_name("Vertex Color Name"),
946
+ anno::description("Name of the vertex color primvar usually COLOR_0 'gltf', or displayColor 'usd'.")
947
+ ]],
948
+
949
+ uniform bool use_vertex_color_alpha_spec = false
950
+ [[
951
+ anno::in_group("Primvar"),
952
+ anno::display_name("Use Opacity Channel From Vertex Color"),
953
+ anno::description("Multiply the Alpha or .w channel from the vertex color with the base alpha value.")
954
+ ]],
955
+
956
+ uniform string vertex_opacity_name_spec = string("displayOpacity")
957
+ [[
958
+ anno::in_group("Primvar"),
959
+ anno::display_name("Vertex Opacity Name"),
960
+ anno::description("Name of the vertex color primvar usually the .w component of COLOR_0 'gltf', or displayOpacity 'usd'.")
961
+ ]]
962
+
963
+ ) [[
964
+ anno::author("NVIDIA Corporation"),
965
+ anno::display_name("GLTF Material - Specular-Glossiness"),
966
+ anno::description("Specular-Glossiness Material that takes the GLTF KHR extension parameters as input.")
967
+ ]] = let {
968
+
969
+ // handling GLTF parameters
970
+ // ------------------------------------------------------------------------
971
+ float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * ::scene::data_lookup_float4(vertex_color_name_spec, float4(1.0)); // apply vertex color
972
+ color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
973
+
974
+ float alpha = base_alpha * (use_vertex_color_alpha_spec == 1 ? diffuse_float4.w : 1.0) * ((vertex_color_name_spec != vertex_opacity_name_spec) ? ::scene::data_lookup_float(vertex_opacity_name_spec, float(1.0)) : 1.0);
975
+ //float alpha = base_alpha;
976
+ float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
977
+ color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
978
+ float glossiness = glossiness_factor * specular_glossiness.w;
979
+
980
+ float3 normal = gltf_prepare_normal(normal_texture);
981
+ float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);
982
+ color emissive_color = gltf_perpare_emission(emissive_texture, emissive_factor * math::max(0.0f, emissive_strength));
983
+
984
+ // specular glossiness model
985
+ // ------------------------------------------------------------------------
986
+
987
+ //color c_diff = diffuse * (1.0 - math::maxvalue(specular));
988
+ float F_0 = math::max_value(specular);
989
+ color F_0_tint = F_0==0.0? color(0.0) : (specular/F_0);
990
+
991
+ float a = (1.0 - glossiness) * (1.0 - glossiness);
992
+
993
+ // diffuse BRDF
994
+ bsdf diffuse_brdf = df::diffuse_reflection_bsdf(
995
+ tint: diffuse * occlusion,
996
+ roughness: 0.0);
997
+
998
+ // specular BRDF
999
+ bsdf specular_brdf = df::microfacet_ggx_smith_bsdf(
1000
+ tint: color(occlusion),
1001
+ roughness_u: a,
1002
+ roughness_v: a,
1003
+ tangent_u: state::texture_tangent_u(0));
1004
+ bsdf tinted_specular = df::directional_factor(normal_tint: F_0_tint, grazing_tint: color(1.0), exponent: 5.0, base: specular_brdf);
1005
+ //- Custom curve for specular/diffuse angular mix
1006
+ bsdf diffuse_specular_mix = df::custom_curve_layer(
1007
+ normal_reflectivity: F_0,
1008
+ grazing_reflectivity: 1.0,
1009
+ exponent: 5.0,
1010
+ weight: 1.0,
1011
+ layer: tinted_specular,
1012
+ base: diffuse_brdf,
1013
+ normal: normal);
1014
+
1015
+ } in material(
1016
+ surface: material_surface(
1017
+ scattering: diffuse_specular_mix,
1018
+ emission: material_emission (
1019
+ emission: df::diffuse_edf(),
1020
+ intensity: emissive_color * ::math::PI
1021
+ )
1022
+ ),
1023
+ geometry: material_geometry(
1024
+ normal: normal,
1025
+ cutout_opacity: compute_opacity(alpha_mode, alpha, alpha_cutoff)
1026
+ )
1027
+ );
simready_assets/897/.metadata/com.nvidia.simready.conformance.Package-Candidate@1.0.0.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package-Candidate",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-14T20:10:29",
6
+ "assets": [
7
+ {
8
+ "asset": "traffic_cone.usd",
9
+ "features": [
10
+ {
11
+ "FET031_PACKAGE_SELF_CONTAINED": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET033_SIMREADY_PACKAGING": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET031_PACKAGE_SELF_CONTAINED": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "content_hash": {
36
+ "sha256": "2f035115efd1ff228d9bb0a8e7fdefd4fd41b85764a070a407bd8e73b55892b8",
37
+ "blake3": "ea85159b73e901ce040db3726ab6f909ee7cd38c499ea1514cbd0c74b2fc3215"
38
+ }
39
+ }
simready_assets/897/.metadata/com.nvidia.simready.conformance.Package@1.0.0.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": "1.0",
3
+ "profile": "Package",
4
+ "profile_version": "1.0.0",
5
+ "timestamp": "2026-08-14T20:10:29",
6
+ "assets": [
7
+ {
8
+ "asset": "com.nvidia.simready.packaging.json",
9
+ "features": [
10
+ {
11
+ "FET030_PACKAGING_CORE": {
12
+ "version": "0.1.0",
13
+ "passed": true,
14
+ "failing_requirements": [],
15
+ "dependencies": []
16
+ }
17
+ },
18
+ {
19
+ "FET032_PACKAGING_INTROSPECTION": {
20
+ "version": "0.1.0",
21
+ "passed": true,
22
+ "failing_requirements": [],
23
+ "dependencies": [
24
+ {
25
+ "FET030_PACKAGING_CORE": {
26
+ "version": "0.1.0"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ }