Datasets:

License:
RongWei-at commited on
Commit
b58f4d9
·
verified ·
1 Parent(s): 53a844f

Upload folder using huggingface_hub

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 +166 -59
  2. kujiale_0003/.thumbs/256x256/kujiale_0003.usda.png +3 -0
  3. kujiale_0003/Materials/BasicShapeMaterial.mdl +56 -0
  4. kujiale_0003/Materials/MI_52d35ae0e4b01eb42b093f5f.mdl +290 -0
  5. kujiale_0003/Materials/MI_5a263f65ef62e00c6235eff5.mdl +290 -0
  6. kujiale_0003/Materials/MI_60c028e05b896900017ee29b.mdl +313 -0
  7. kujiale_0003/Materials/M_BaseMaterial.mdl +290 -0
  8. kujiale_0003/Materials/M_BaseMaterial_twosided.mdl +290 -0
  9. kujiale_0003/Materials/M_BaseMaterial_v2.mdl +914 -0
  10. kujiale_0003/Materials/M_BaseMaterial_v2_twosided.mdl +914 -0
  11. kujiale_0003/Materials/M_TranslucentMaterial.mdl +313 -0
  12. kujiale_0003/Materials/M_TranslucentMaterial_v2.mdl +1073 -0
  13. kujiale_0003/Materials/OmniUe4Base.mdl +224 -0
  14. kujiale_0003/Materials/OmniUe4Function.mdl +1413 -0
  15. kujiale_0003/Materials/OmniUe4Translucent.mdl +233 -0
  16. kujiale_0003/Materials/Textures/BlackPlaceholder.png +3 -0
  17. kujiale_0003/Materials/Textures/DefaultDiffuse.png +3 -0
  18. kujiale_0003/Materials/Textures/DefaultNormal.png +3 -0
  19. kujiale_0003/Materials/Textures/DefaultTexture.png +3 -0
  20. kujiale_0003/Materials/Textures/Fabric_00.png +3 -0
  21. kujiale_0003/Materials/Textures/Fabric_000.jpeg +3 -0
  22. kujiale_0003/Materials/Textures/Glass_Normal01.jpeg +3 -0
  23. kujiale_0003/Materials/Textures/Placeholder_Normal.png +3 -0
  24. kujiale_0003/Materials/Textures/T_52ae9f19e4b0b61ad72e5426_color.png +3 -0
  25. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12be_color.png +3 -0
  26. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12be_metallic.png +3 -0
  27. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12bf_color.png +3 -0
  28. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12bf_metallic.png +3 -0
  29. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c0_color.png +3 -0
  30. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c0_metallic.png +3 -0
  31. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c1_color.png +3 -0
  32. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c1_metallic.png +3 -0
  33. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c2_color.png +3 -0
  34. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c2_metallic.png +3 -0
  35. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c3_color.png +3 -0
  36. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c3_metallic.png +3 -0
  37. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c4_color.png +3 -0
  38. kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c4_metallic.png +3 -0
  39. kujiale_0003/Materials/Textures/T_530d982ae4b074e6429be7a2_color.png +3 -0
  40. kujiale_0003/Materials/Textures/T_531d6b93ec95ea1a4e99d820_color.png +3 -0
  41. kujiale_0003/Materials/Textures/T_531d6b93ec95ea1a4e99d820_metallic.png +3 -0
  42. kujiale_0003/Materials/Textures/T_5497cf8de4b0c4fb5caca231_emission.png +3 -0
  43. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82dde_color.png +3 -0
  44. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82dde_metallic.png +3 -0
  45. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82ddf_color.png +3 -0
  46. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82ddf_metallic.png +3 -0
  47. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de0_color.png +3 -0
  48. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de0_metallic.png +3 -0
  49. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de7_color.png +3 -0
  50. kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de7_metallic.png +3 -0
.gitattributes CHANGED
@@ -1,59 +1,166 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.lz4 filter=lfs diff=lfs merge=lfs -text
12
- *.mds filter=lfs diff=lfs merge=lfs -text
13
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
- *.model filter=lfs diff=lfs merge=lfs -text
15
- *.msgpack filter=lfs diff=lfs merge=lfs -text
16
- *.npy filter=lfs diff=lfs merge=lfs -text
17
- *.npz filter=lfs diff=lfs merge=lfs -text
18
- *.onnx filter=lfs diff=lfs merge=lfs -text
19
- *.ot filter=lfs diff=lfs merge=lfs -text
20
- *.parquet filter=lfs diff=lfs merge=lfs -text
21
- *.pb filter=lfs diff=lfs merge=lfs -text
22
- *.pickle filter=lfs diff=lfs merge=lfs -text
23
- *.pkl filter=lfs diff=lfs merge=lfs -text
24
- *.pt filter=lfs diff=lfs merge=lfs -text
25
- *.pth filter=lfs diff=lfs merge=lfs -text
26
- *.rar filter=lfs diff=lfs merge=lfs -text
27
- *.safetensors filter=lfs diff=lfs merge=lfs -text
28
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
- *.tar.* filter=lfs diff=lfs merge=lfs -text
30
- *.tar filter=lfs diff=lfs merge=lfs -text
31
- *.tflite filter=lfs diff=lfs merge=lfs -text
32
- *.tgz filter=lfs diff=lfs merge=lfs -text
33
- *.wasm filter=lfs diff=lfs merge=lfs -text
34
- *.xz filter=lfs diff=lfs merge=lfs -text
35
- *.zip filter=lfs diff=lfs merge=lfs -text
36
- *.zst filter=lfs diff=lfs merge=lfs -text
37
- *tfevents* filter=lfs diff=lfs merge=lfs -text
38
- # Audio files - uncompressed
39
- *.pcm filter=lfs diff=lfs merge=lfs -text
40
- *.sam filter=lfs diff=lfs merge=lfs -text
41
- *.raw filter=lfs diff=lfs merge=lfs -text
42
- # Audio files - compressed
43
- *.aac filter=lfs diff=lfs merge=lfs -text
44
- *.flac filter=lfs diff=lfs merge=lfs -text
45
- *.mp3 filter=lfs diff=lfs merge=lfs -text
46
- *.ogg filter=lfs diff=lfs merge=lfs -text
47
- *.wav filter=lfs diff=lfs merge=lfs -text
48
- # Image files - uncompressed
49
- *.bmp filter=lfs diff=lfs merge=lfs -text
50
- *.gif filter=lfs diff=lfs merge=lfs -text
51
- *.png filter=lfs diff=lfs merge=lfs -text
52
- *.tiff filter=lfs diff=lfs merge=lfs -text
53
- # Image files - compressed
54
- *.jpg filter=lfs diff=lfs merge=lfs -text
55
- *.jpeg filter=lfs diff=lfs merge=lfs -text
56
- *.webp filter=lfs diff=lfs merge=lfs -text
57
- # Video files - compressed
58
- *.mp4 filter=lfs diff=lfs merge=lfs -text
59
- *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
60
+ *.usda filter=lfs diff=lfs merge=lfs -text
61
+ *.mdl filter=lfs diff=lfs merge=lfs -text
62
+ *.usd filter=lfs diff=lfs merge=lfs -text
63
+ kujiale_0003/buikslotermeerplein_4k.hdr filter=lfs diff=lfs merge=lfs -text
64
+ kujiale_0004/buikslotermeerplein_4k.hdr filter=lfs diff=lfs merge=lfs -text
65
+ kujiale_0008/bloem_hill_01_4k.hdr filter=lfs diff=lfs merge=lfs -text
66
+ kujiale_0009/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
67
+ kujiale_0020/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
68
+ kujiale_0021/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
69
+ kujiale_0022/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
70
+ kujiale_0024/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
71
+ kujiale_0024/Materials/Textures/T_Lemon_th5jddwva_2K_DpR.exr filter=lfs diff=lfs merge=lfs -text
72
+ kujiale_0024/Materials/Textures/T_Lemon_th5jddwva_2K_N.exr filter=lfs diff=lfs merge=lfs -text
73
+ kujiale_0025/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
74
+ kujiale_0026/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
75
+ kujiale_0030/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
76
+ kujiale_0031/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
77
+ kujiale_0032/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
78
+ kujiale_0033/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
79
+ kujiale_0033/Materials/Textures/T_Crema_Marfi_Marble_wjmkfbnl_2K_D.exr filter=lfs diff=lfs merge=lfs -text
80
+ kujiale_0033/Materials/Textures/T_CremaMarfiMarble_wjmkfbnl_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
81
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
82
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
83
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvcbtc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
84
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvcbtc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
85
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvdgbc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
86
+ kujiale_0033/Materials/Textures/T_Furniture_Fabric_sjfvdgbc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
87
+ kujiale_0033/Materials/Textures/T_FurnitureFabric_sjfvbjpc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
88
+ kujiale_0033/Materials/Textures/T_FurnitureFabric_sjfvcbtc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
89
+ kujiale_0033/Materials/Textures/T_FurnitureFabric_sjfvdgbc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
90
+ kujiale_0033/Materials/Textures/T_Plywood_vdcjecc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
91
+ kujiale_0033/Materials/Textures/T_Plywood_vdcjecc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
92
+ kujiale_0033/Materials/Textures/T_Plywood_vdcjecc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
93
+ kujiale_0033/Materials/Textures/T_Stripbond_Walnut_Parquet_thspbeac_2K_D.exr filter=lfs diff=lfs merge=lfs -text
94
+ kujiale_0033/Materials/Textures/T_Stripbond_Walnut_Parquet_thspbeac_2K_N.exr filter=lfs diff=lfs merge=lfs -text
95
+ kujiale_0033/Materials/Textures/T_StripbondWalnutParquet_thspbeac_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
96
+ kujiale_0034/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
97
+ kujiale_0034/Materials/Textures/T_Crema_Marfi_Marble_wjmkfbnl_2K_D.exr filter=lfs diff=lfs merge=lfs -text
98
+ kujiale_0034/Materials/Textures/T_CremaMarfiMarble_wjmkfbnl_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
99
+ kujiale_0034/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
100
+ kujiale_0034/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
101
+ kujiale_0034/Materials/Textures/T_FurnitureFabric_sjfvbjpc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
102
+ kujiale_0034/Materials/Textures/T_Plywood_vdcjecc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
103
+ kujiale_0034/Materials/Textures/T_Plywood_vdcjecc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
104
+ kujiale_0034/Materials/Textures/T_Plywood_vdcjecc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
105
+ kujiale_0035/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
106
+ kujiale_0035/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_D.exr filter=lfs diff=lfs merge=lfs -text
107
+ kujiale_0035/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_N.exr filter=lfs diff=lfs merge=lfs -text
108
+ kujiale_0035/Materials/Textures/T_BiancaCarraraMarbleTiles_uh1kajrv_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
109
+ kujiale_0035/Materials/Textures/T_Crema_Marfi_Marble_wjmkfbnl_2K_D.exr filter=lfs diff=lfs merge=lfs -text
110
+ kujiale_0035/Materials/Textures/T_CremaMarfiMarble_wjmkfbnl_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
111
+ kujiale_0035/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
112
+ kujiale_0035/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
113
+ kujiale_0035/Materials/Textures/T_FurnitureFabric_sjfvbjpc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
114
+ kujiale_0035/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_D.exr filter=lfs diff=lfs merge=lfs -text
115
+ kujiale_0035/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_N.exr filter=lfs diff=lfs merge=lfs -text
116
+ kujiale_0035/Materials/Textures/T_LinenCanvas_rbess3s0_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
117
+ kujiale_0035/Materials/Textures/T_Plastic_Garage_Door_tj1hfhwi_2K_D.exr filter=lfs diff=lfs merge=lfs -text
118
+ kujiale_0035/Materials/Textures/T_Plastic_Garage_Door_tj1hfhwi_2K_N.exr filter=lfs diff=lfs merge=lfs -text
119
+ kujiale_0035/Materials/Textures/T_PlasticGarageDoor_tj1hfhwi_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
120
+ kujiale_0036/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
121
+ kujiale_0036/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_D.exr filter=lfs diff=lfs merge=lfs -text
122
+ kujiale_0036/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_N.exr filter=lfs diff=lfs merge=lfs -text
123
+ kujiale_0036/Materials/Textures/T_BiancaCarraraMarbleTiles_uh1kajrv_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
124
+ kujiale_0036/Materials/Textures/T_Chevron_Walnut_Parquet_th4hfcfl_2K_D.exr filter=lfs diff=lfs merge=lfs -text
125
+ kujiale_0036/Materials/Textures/T_Chevron_Walnut_Parquet_th4hfcfl_2K_N.exr filter=lfs diff=lfs merge=lfs -text
126
+ kujiale_0036/Materials/Textures/T_ChevronWalnutParquet_th4hfcfl_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
127
+ kujiale_0036/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
128
+ kujiale_0036/Materials/Textures/T_Furniture_Fabric_sjfvbjpc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
129
+ kujiale_0036/Materials/Textures/T_FurnitureFabric_sjfvbjpc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
130
+ kujiale_0036/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_D.exr filter=lfs diff=lfs merge=lfs -text
131
+ kujiale_0036/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_N.exr filter=lfs diff=lfs merge=lfs -text
132
+ kujiale_0036/Materials/Textures/T_LinenCanvas_rbess3s0_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
133
+ kujiale_0036/Materials/Textures/T_Scratched_Polyvinyl_Carbonate_Plastic_sccnbdnp_2K_D.exr filter=lfs diff=lfs merge=lfs -text
134
+ kujiale_0036/Materials/Textures/T_Scratched_Polyvinyl_Carbonate_Plastic_sccnbdnp_2K_N.exr filter=lfs diff=lfs merge=lfs -text
135
+ kujiale_0036/Materials/Textures/T_Scratched_Polyvinylpyrrolidone_Plastic_schcbgfp_2K_D.exr filter=lfs diff=lfs merge=lfs -text
136
+ kujiale_0036/Materials/Textures/T_Scratched_Polyvinylpyrrolidone_Plastic_schcbgfp_2K_N.exr filter=lfs diff=lfs merge=lfs -text
137
+ kujiale_0036/Materials/Textures/T_ScratchedPolyvinylCarbonatePlastic_sccnbdnp_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
138
+ kujiale_0036/Materials/Textures/T_ScratchedPolyvinylpyrrolidonePlastic_schcbgfp_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
139
+ kujiale_0036/Materials/Textures/T_Stucco_Facade_wfnhfaq_2K_D.exr filter=lfs diff=lfs merge=lfs -text
140
+ kujiale_0036/Materials/Textures/T_Stucco_Facade_wfnhfaq_2K_N.exr filter=lfs diff=lfs merge=lfs -text
141
+ kujiale_0036/Materials/Textures/T_StuccoFacade_wfnhfaq_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
142
+ kujiale_0036/Materials/Textures/T_White_Cloth_sbklx0p0_2K_D.exr filter=lfs diff=lfs merge=lfs -text
143
+ kujiale_0036/Materials/Textures/T_White_Cloth_sbklx0p0_2K_N.exr filter=lfs diff=lfs merge=lfs -text
144
+ kujiale_0036/Materials/Textures/T_WhiteCloth_sbklx0p0_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
145
+ kujiale_0037/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
146
+ kujiale_0038/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
147
+ kujiale_0040/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
148
+ kujiale_0040/Materials/Textures/T_Cedar_Veneer_te3ecdyc_2K_D.exr filter=lfs diff=lfs merge=lfs -text
149
+ kujiale_0040/Materials/Textures/T_Cedar_Veneer_te3ecdyc_2K_N.exr filter=lfs diff=lfs merge=lfs -text
150
+ kujiale_0040/Materials/Textures/T_CedarVeneer_te3ecdyc_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
151
+ kujiale_0042/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
152
+ kujiale_0043/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
153
+ kujiale_0043/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_D.exr filter=lfs diff=lfs merge=lfs -text
154
+ kujiale_0043/Materials/Textures/T_Bianca_Carrara_Marble_Tiles_uh1kajrv_2K_N.exr filter=lfs diff=lfs merge=lfs -text
155
+ kujiale_0043/Materials/Textures/T_BiancaCarraraMarbleTiles_uh1kajrv_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
156
+ kujiale_0043/Materials/Textures/T_Crema_Marfi_Marble_wjmkfbnl_2K_D.exr filter=lfs diff=lfs merge=lfs -text
157
+ kujiale_0043/Materials/Textures/T_CremaMarfiMarble_wjmkfbnl_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
158
+ kujiale_0043/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_D.exr filter=lfs diff=lfs merge=lfs -text
159
+ kujiale_0043/Materials/Textures/T_Linen_Canvas_rbess3s0_2K_N.exr filter=lfs diff=lfs merge=lfs -text
160
+ kujiale_0043/Materials/Textures/T_LinenCanvas_rbess3s0_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
161
+ kujiale_0043/Materials/Textures/T_Patterned_Marble_Tiles_vf5leawv_2K_D.exr filter=lfs diff=lfs merge=lfs -text
162
+ kujiale_0043/Materials/Textures/T_Patterned_Marble_Tiles_vf5leawv_2K_N.exr filter=lfs diff=lfs merge=lfs -text
163
+ kujiale_0043/Materials/Textures/T_PatternedMarbleTiles_vf5leawv_2K_ORDp.exr filter=lfs diff=lfs merge=lfs -text
164
+ kujiale_0065/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
165
+ kujiale_0066/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
166
+ kujiale_0067/limpopo_golf_course_4k.hdr filter=lfs diff=lfs merge=lfs -text
kujiale_0003/.thumbs/256x256/kujiale_0003.usda.png ADDED

Git LFS Details

  • SHA256: 60845a9c1ce8baa04d98c1e9ee85ca1d67687f886ace025684b5e45ed81a6fb6
  • Pointer size: 130 Bytes
  • Size of remote file: 90.1 kB
kujiale_0003/Materials/BasicShapeMaterial.mdl ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material BasicShapeMaterial(
21
+ float4 Color = float4(0.9,0.9,0.9,1.0)
22
+ [[
23
+ anno::display_name("Color"),
24
+ anno::ui_order(32)
25
+ ]],
26
+ float Roughness = 0.6407
27
+ [[
28
+ anno::display_name("Roughness"),
29
+ anno::ui_order(32)
30
+ ]])
31
+ =
32
+ let {
33
+ float3 WorldPositionOffset_mdl = float3(0.0,0.0,0.0);
34
+
35
+
36
+ float3 Normal_mdl = float3(0.0,0.0,1.0);
37
+
38
+ float3 EmissiveColor_mdl = float3(0.0,0.0,0.0);
39
+ float OpacityMask_mdl = 1.0;
40
+ float3 BaseColor_mdl = float3(Color.x,Color.y,Color.z);
41
+ float Metallic_mdl = 0.0;
42
+ float Specular_mdl = 0.5;
43
+ float Roughness_mdl = Roughness;
44
+ float SurfaceThickness_mdl = 0.01;
45
+
46
+ } in
47
+ ::OmniUe4Base(
48
+ base_color: BaseColor_mdl,
49
+ metallic: Metallic_mdl,
50
+ roughness: Roughness_mdl,
51
+ specular: Specular_mdl,
52
+ normal: Normal_mdl,
53
+ opacity: OpacityMask_mdl,
54
+ emissive_color: EmissiveColor_mdl,
55
+ displacement: WorldPositionOffset_mdl,
56
+ two_sided: false);
kujiale_0003/Materials/MI_52d35ae0e4b01eb42b093f5f.mdl ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material MI_52d35ae0e4b01eb42b093f5f(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float PolygonOffset = 0.0
167
+ [[
168
+ anno::display_name("PolygonOffset"),
169
+ anno::ui_order(32),
170
+ anno::in_group("WorldPosition")
171
+ ]],
172
+ int MaxTexCoordIndex = 3
173
+ [[
174
+ anno::hidden()
175
+ ]])
176
+ =
177
+ let {
178
+ float3 Local82 = ::camera_position();
179
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
180
+ float3 Local84 = math::normalize(Local83);
181
+ float3 Local85 = (Local84 * PolygonOffset);
182
+
183
+ float3 WorldPositionOffset_mdl = Local85;
184
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
185
+
186
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
187
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
188
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
189
+ float2 Local3 = (Local0 + float2(Local1,Local2));
190
+ float Local4 = (3.141592 * -2.0);
191
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
192
+ float Local6 = (Local5 * 6.283185);
193
+ float Local7 = math::cos(Local6);
194
+ float Local8 = math::sin(Local6);
195
+ float Local9 = (Local8 * -1.0);
196
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
197
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
198
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
199
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
200
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
201
+
202
+ float3 Normal_mdl = Local14;
203
+
204
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
205
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
206
+ float2 Local17 = (Local0 + float2(Local15,Local16));
207
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
208
+ float Local19 = (Local18 * 6.283185);
209
+ float Local20 = math::cos(Local19);
210
+ float Local21 = math::sin(Local19);
211
+ float Local22 = (Local21 * -1.0);
212
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
213
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
214
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
215
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
216
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
217
+ float3 Local28 = (EmissiveIntensity * Local27);
218
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
219
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
220
+ float2 Local31 = (Local0 + float2(Local29,Local30));
221
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
222
+ float Local33 = (Local32 * 6.283185);
223
+ float Local34 = math::cos(Local33);
224
+ float Local35 = math::sin(Local33);
225
+ float Local36 = (Local35 * -1.0);
226
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
227
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
228
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
229
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
230
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
231
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
232
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
233
+ float2 Local44 = (Local0 + float2(Local42,Local43));
234
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
235
+ float Local46 = (Local45 * 6.283185);
236
+ float Local47 = math::cos(Local46);
237
+ float Local48 = math::sin(Local46);
238
+ float Local49 = (Local48 * -1.0);
239
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
240
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
241
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
242
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
243
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
244
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
245
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
246
+ float2 Local57 = (Local0 + float2(Local55,Local56));
247
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
248
+ float Local59 = (Local58 * 6.283185);
249
+ float Local60 = math::cos(Local59);
250
+ float Local61 = math::sin(Local59);
251
+ float Local62 = (Local61 * -1.0);
252
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
253
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
254
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
255
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
256
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
257
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
258
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
259
+ float2 Local70 = (Local0 + float2(Local68,Local69));
260
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
261
+ float Local72 = (Local71 * 6.283185);
262
+ float Local73 = math::cos(Local72);
263
+ float Local74 = math::sin(Local72);
264
+ float Local75 = (Local74 * -1.0);
265
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
266
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
267
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
268
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
269
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
270
+ float3 Local81 = (1.0 - Local80);
271
+
272
+ float3 EmissiveColor_mdl = Local28;
273
+ float OpacityMask_mdl = 1.0;
274
+ float3 BaseColor_mdl = Local41;
275
+ float Metallic_mdl = Local54.x;
276
+ float Specular_mdl = Local67.x;
277
+ float Roughness_mdl = Local81.x;
278
+ float SurfaceThickness_mdl = 0.01;
279
+
280
+ } in
281
+ ::OmniUe4Base(
282
+ base_color: BaseColor_mdl,
283
+ metallic: Metallic_mdl,
284
+ roughness: Roughness_mdl,
285
+ specular: Specular_mdl,
286
+ normal: Normal_mdl,
287
+ opacity: OpacityMask_mdl,
288
+ emissive_color: EmissiveColor_mdl,
289
+ displacement: WorldPositionOffset_mdl,
290
+ two_sided: true);
kujiale_0003/Materials/MI_5a263f65ef62e00c6235eff5.mdl ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material MI_5a263f65ef62e00c6235eff5(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float PolygonOffset = 0.0
167
+ [[
168
+ anno::display_name("PolygonOffset"),
169
+ anno::ui_order(32),
170
+ anno::in_group("WorldPosition")
171
+ ]],
172
+ int MaxTexCoordIndex = 3
173
+ [[
174
+ anno::hidden()
175
+ ]])
176
+ =
177
+ let {
178
+ float3 Local82 = ::camera_position();
179
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
180
+ float3 Local84 = math::normalize(Local83);
181
+ float3 Local85 = (Local84 * PolygonOffset);
182
+
183
+ float3 WorldPositionOffset_mdl = Local85;
184
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
185
+
186
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
187
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
188
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
189
+ float2 Local3 = (Local0 + float2(Local1,Local2));
190
+ float Local4 = (3.141592 * -2.0);
191
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
192
+ float Local6 = (Local5 * 6.283185);
193
+ float Local7 = math::cos(Local6);
194
+ float Local8 = math::sin(Local6);
195
+ float Local9 = (Local8 * -1.0);
196
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
197
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
198
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
199
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
200
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
201
+
202
+ float3 Normal_mdl = Local14;
203
+
204
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
205
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
206
+ float2 Local17 = (Local0 + float2(Local15,Local16));
207
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
208
+ float Local19 = (Local18 * 6.283185);
209
+ float Local20 = math::cos(Local19);
210
+ float Local21 = math::sin(Local19);
211
+ float Local22 = (Local21 * -1.0);
212
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
213
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
214
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
215
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
216
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
217
+ float3 Local28 = (EmissiveIntensity * Local27);
218
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
219
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
220
+ float2 Local31 = (Local0 + float2(Local29,Local30));
221
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
222
+ float Local33 = (Local32 * 6.283185);
223
+ float Local34 = math::cos(Local33);
224
+ float Local35 = math::sin(Local33);
225
+ float Local36 = (Local35 * -1.0);
226
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
227
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
228
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
229
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
230
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
231
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
232
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
233
+ float2 Local44 = (Local0 + float2(Local42,Local43));
234
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
235
+ float Local46 = (Local45 * 6.283185);
236
+ float Local47 = math::cos(Local46);
237
+ float Local48 = math::sin(Local46);
238
+ float Local49 = (Local48 * -1.0);
239
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
240
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
241
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
242
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
243
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
244
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
245
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
246
+ float2 Local57 = (Local0 + float2(Local55,Local56));
247
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
248
+ float Local59 = (Local58 * 6.283185);
249
+ float Local60 = math::cos(Local59);
250
+ float Local61 = math::sin(Local59);
251
+ float Local62 = (Local61 * -1.0);
252
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
253
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
254
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
255
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
256
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
257
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
258
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
259
+ float2 Local70 = (Local0 + float2(Local68,Local69));
260
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
261
+ float Local72 = (Local71 * 6.283185);
262
+ float Local73 = math::cos(Local72);
263
+ float Local74 = math::sin(Local72);
264
+ float Local75 = (Local74 * -1.0);
265
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
266
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
267
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
268
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
269
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
270
+ float3 Local81 = (1.0 - Local80);
271
+
272
+ float3 EmissiveColor_mdl = Local28;
273
+ float OpacityMask_mdl = 1.0;
274
+ float3 BaseColor_mdl = Local41;
275
+ float Metallic_mdl = Local54.x;
276
+ float Specular_mdl = Local67.x;
277
+ float Roughness_mdl = Local81.x;
278
+ float SurfaceThickness_mdl = 0.01;
279
+
280
+ } in
281
+ ::OmniUe4Base(
282
+ base_color: BaseColor_mdl,
283
+ metallic: Metallic_mdl,
284
+ roughness: Roughness_mdl,
285
+ specular: Specular_mdl,
286
+ normal: Normal_mdl,
287
+ opacity: OpacityMask_mdl,
288
+ emissive_color: EmissiveColor_mdl,
289
+ displacement: WorldPositionOffset_mdl,
290
+ two_sided: false);
kujiale_0003/Materials/MI_60c028e05b896900017ee29b.mdl ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Translucent import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material MI_60c028e05b896900017ee29b(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float Opacity = 0.5
167
+ [[
168
+ anno::display_name("Opacity"),
169
+ anno::ui_order(32),
170
+ anno::in_group("Translucent")
171
+ ]],
172
+ float PolygonOffset = 0.0
173
+ [[
174
+ anno::display_name("PolygonOffset"),
175
+ anno::ui_order(32),
176
+ anno::in_group("WorldPosition")
177
+ ]],
178
+ uniform float SwitchRefraction = 0.0
179
+ [[
180
+ anno::display_name("SwitchRefraction"),
181
+ anno::ui_order(32),
182
+ anno::in_group("Refraction")
183
+ ]],
184
+ uniform float FresnelB = 1.517
185
+ [[
186
+ anno::display_name("FresnelB"),
187
+ anno::ui_order(32),
188
+ anno::in_group("Refraction")
189
+ ]],
190
+ int MaxTexCoordIndex = 3
191
+ [[
192
+ anno::hidden()
193
+ ]])
194
+ =
195
+ let {
196
+ float3 Local82 = ::camera_position();
197
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
198
+ float3 Local84 = math::normalize(Local83);
199
+ float3 Local85 = (Local84 * PolygonOffset);
200
+
201
+ float3 WorldPositionOffset_mdl = Local85;
202
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
203
+
204
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
205
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
206
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
207
+ float2 Local3 = (Local0 + float2(Local1,Local2));
208
+ float Local4 = (3.141592 * -2.0);
209
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
210
+ float Local6 = (Local5 * 6.283185);
211
+ float Local7 = math::cos(Local6);
212
+ float Local8 = math::sin(Local6);
213
+ float Local9 = (Local8 * -1.0);
214
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
215
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
216
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
217
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
218
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
219
+
220
+ float3 Normal_mdl = Local14;
221
+
222
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
223
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
224
+ float2 Local17 = (Local0 + float2(Local15,Local16));
225
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
226
+ float Local19 = (Local18 * 6.283185);
227
+ float Local20 = math::cos(Local19);
228
+ float Local21 = math::sin(Local19);
229
+ float Local22 = (Local21 * -1.0);
230
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
231
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
232
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
233
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
234
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
235
+ float3 Local28 = (EmissiveIntensity * Local27);
236
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
237
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
238
+ float2 Local31 = (Local0 + float2(Local29,Local30));
239
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
240
+ float Local33 = (Local32 * 6.283185);
241
+ float Local34 = math::cos(Local33);
242
+ float Local35 = math::sin(Local33);
243
+ float Local36 = (Local35 * -1.0);
244
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
245
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
246
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
247
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
248
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
249
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
250
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
251
+ float2 Local44 = (Local0 + float2(Local42,Local43));
252
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
253
+ float Local46 = (Local45 * 6.283185);
254
+ float Local47 = math::cos(Local46);
255
+ float Local48 = math::sin(Local46);
256
+ float Local49 = (Local48 * -1.0);
257
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
258
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
259
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
260
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
261
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
262
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
263
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
264
+ float2 Local57 = (Local0 + float2(Local55,Local56));
265
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
266
+ float Local59 = (Local58 * 6.283185);
267
+ float Local60 = math::cos(Local59);
268
+ float Local61 = math::sin(Local59);
269
+ float Local62 = (Local61 * -1.0);
270
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
271
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
272
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
273
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
274
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
275
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
276
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
277
+ float2 Local70 = (Local0 + float2(Local68,Local69));
278
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
279
+ float Local72 = (Local71 * 6.283185);
280
+ float Local73 = math::cos(Local72);
281
+ float Local74 = math::sin(Local72);
282
+ float Local75 = (Local74 * -1.0);
283
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
284
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
285
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
286
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
287
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
288
+ float3 Local81 = (1.0 - Local80);
289
+ float Local87 = ((math::abs(SwitchRefraction - 1.0) > 0.01) ? (1.0) : FresnelB);
290
+
291
+ float3 EmissiveColor_mdl = Local28;
292
+ float Opacity_mdl = Opacity;
293
+ float OpacityMask_mdl = (math::saturate(Opacity) - 1.0f / 255.0f) < 0.0f ? 0.0f : 1.0f;
294
+ float3 BaseColor_mdl = Local41;
295
+ float Metallic_mdl = Local54.x;
296
+ float Specular_mdl = Local67.x;
297
+ float Roughness_mdl = Local81.x;
298
+ float3 Refraction_mdl = math::max(float3(Local87,Local87,Local87), 1.0f);
299
+ float SurfaceThickness_mdl = 0.01;
300
+
301
+ } in
302
+ ::OmniUe4Translucent(
303
+ base_color: BaseColor_mdl,
304
+ metallic: Metallic_mdl,
305
+ roughness: Roughness_mdl,
306
+ specular: Specular_mdl,
307
+ normal: Normal_mdl,
308
+ opacity: Opacity_mdl,
309
+ opacity_mask: OpacityMask_mdl,
310
+ emissive_color: EmissiveColor_mdl,
311
+ displacement: WorldPositionOffset_mdl,
312
+ refraction: Refraction_mdl.x,
313
+ two_sided: false);
kujiale_0003/Materials/M_BaseMaterial.mdl ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_BaseMaterial(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float PolygonOffset = 0.0
167
+ [[
168
+ anno::display_name("PolygonOffset"),
169
+ anno::ui_order(32),
170
+ anno::in_group("WorldPosition")
171
+ ]],
172
+ int MaxTexCoordIndex = 3
173
+ [[
174
+ anno::hidden()
175
+ ]])
176
+ =
177
+ let {
178
+ float3 Local82 = ::camera_position();
179
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
180
+ float3 Local84 = math::normalize(Local83);
181
+ float3 Local85 = (Local84 * PolygonOffset);
182
+
183
+ float3 WorldPositionOffset_mdl = Local85;
184
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
185
+
186
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
187
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
188
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
189
+ float2 Local3 = (Local0 + float2(Local1,Local2));
190
+ float Local4 = (3.141592 * -2.0);
191
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
192
+ float Local6 = (Local5 * 6.283185);
193
+ float Local7 = math::cos(Local6);
194
+ float Local8 = math::sin(Local6);
195
+ float Local9 = (Local8 * -1.0);
196
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
197
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
198
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
199
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
200
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
201
+
202
+ float3 Normal_mdl = Local14;
203
+
204
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
205
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
206
+ float2 Local17 = (Local0 + float2(Local15,Local16));
207
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
208
+ float Local19 = (Local18 * 6.283185);
209
+ float Local20 = math::cos(Local19);
210
+ float Local21 = math::sin(Local19);
211
+ float Local22 = (Local21 * -1.0);
212
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
213
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
214
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
215
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
216
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
217
+ float3 Local28 = (EmissiveIntensity * Local27);
218
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
219
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
220
+ float2 Local31 = (Local0 + float2(Local29,Local30));
221
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
222
+ float Local33 = (Local32 * 6.283185);
223
+ float Local34 = math::cos(Local33);
224
+ float Local35 = math::sin(Local33);
225
+ float Local36 = (Local35 * -1.0);
226
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
227
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
228
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
229
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
230
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
231
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
232
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
233
+ float2 Local44 = (Local0 + float2(Local42,Local43));
234
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
235
+ float Local46 = (Local45 * 6.283185);
236
+ float Local47 = math::cos(Local46);
237
+ float Local48 = math::sin(Local46);
238
+ float Local49 = (Local48 * -1.0);
239
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
240
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
241
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
242
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
243
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
244
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
245
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
246
+ float2 Local57 = (Local0 + float2(Local55,Local56));
247
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
248
+ float Local59 = (Local58 * 6.283185);
249
+ float Local60 = math::cos(Local59);
250
+ float Local61 = math::sin(Local59);
251
+ float Local62 = (Local61 * -1.0);
252
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
253
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
254
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
255
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
256
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
257
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
258
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
259
+ float2 Local70 = (Local0 + float2(Local68,Local69));
260
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
261
+ float Local72 = (Local71 * 6.283185);
262
+ float Local73 = math::cos(Local72);
263
+ float Local74 = math::sin(Local72);
264
+ float Local75 = (Local74 * -1.0);
265
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
266
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
267
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
268
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
269
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
270
+ float3 Local81 = (1.0 - Local80);
271
+
272
+ float3 EmissiveColor_mdl = Local28;
273
+ float OpacityMask_mdl = 1.0;
274
+ float3 BaseColor_mdl = Local41;
275
+ float Metallic_mdl = Local54.x;
276
+ float Specular_mdl = Local67.x;
277
+ float Roughness_mdl = Local81.x;
278
+ float SurfaceThickness_mdl = 0.01;
279
+
280
+ } in
281
+ ::OmniUe4Base(
282
+ base_color: BaseColor_mdl,
283
+ metallic: Metallic_mdl,
284
+ roughness: Roughness_mdl,
285
+ specular: Specular_mdl,
286
+ normal: Normal_mdl,
287
+ opacity: OpacityMask_mdl,
288
+ emissive_color: EmissiveColor_mdl,
289
+ displacement: WorldPositionOffset_mdl,
290
+ two_sided: false);
kujiale_0003/Materials/M_BaseMaterial_twosided.mdl ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_BaseMaterial_twosided(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float PolygonOffset = 0.0
167
+ [[
168
+ anno::display_name("PolygonOffset"),
169
+ anno::ui_order(32),
170
+ anno::in_group("WorldPosition")
171
+ ]],
172
+ int MaxTexCoordIndex = 3
173
+ [[
174
+ anno::hidden()
175
+ ]])
176
+ =
177
+ let {
178
+ float3 Local82 = ::camera_position();
179
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
180
+ float3 Local84 = math::normalize(Local83);
181
+ float3 Local85 = (Local84 * PolygonOffset);
182
+
183
+ float3 WorldPositionOffset_mdl = Local85;
184
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
185
+
186
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
187
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
188
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
189
+ float2 Local3 = (Local0 + float2(Local1,Local2));
190
+ float Local4 = (3.141592 * -2.0);
191
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
192
+ float Local6 = (Local5 * 6.283185);
193
+ float Local7 = math::cos(Local6);
194
+ float Local8 = math::sin(Local6);
195
+ float Local9 = (Local8 * -1.0);
196
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
197
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
198
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
199
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
200
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
201
+
202
+ float3 Normal_mdl = Local14;
203
+
204
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
205
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
206
+ float2 Local17 = (Local0 + float2(Local15,Local16));
207
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
208
+ float Local19 = (Local18 * 6.283185);
209
+ float Local20 = math::cos(Local19);
210
+ float Local21 = math::sin(Local19);
211
+ float Local22 = (Local21 * -1.0);
212
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
213
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
214
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
215
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
216
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
217
+ float3 Local28 = (EmissiveIntensity * Local27);
218
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
219
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
220
+ float2 Local31 = (Local0 + float2(Local29,Local30));
221
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
222
+ float Local33 = (Local32 * 6.283185);
223
+ float Local34 = math::cos(Local33);
224
+ float Local35 = math::sin(Local33);
225
+ float Local36 = (Local35 * -1.0);
226
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
227
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
228
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
229
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
230
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
231
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
232
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
233
+ float2 Local44 = (Local0 + float2(Local42,Local43));
234
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
235
+ float Local46 = (Local45 * 6.283185);
236
+ float Local47 = math::cos(Local46);
237
+ float Local48 = math::sin(Local46);
238
+ float Local49 = (Local48 * -1.0);
239
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
240
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
241
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
242
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
243
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
244
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
245
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
246
+ float2 Local57 = (Local0 + float2(Local55,Local56));
247
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
248
+ float Local59 = (Local58 * 6.283185);
249
+ float Local60 = math::cos(Local59);
250
+ float Local61 = math::sin(Local59);
251
+ float Local62 = (Local61 * -1.0);
252
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
253
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
254
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
255
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
256
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
257
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
258
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
259
+ float2 Local70 = (Local0 + float2(Local68,Local69));
260
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
261
+ float Local72 = (Local71 * 6.283185);
262
+ float Local73 = math::cos(Local72);
263
+ float Local74 = math::sin(Local72);
264
+ float Local75 = (Local74 * -1.0);
265
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
266
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
267
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
268
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
269
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
270
+ float3 Local81 = (1.0 - Local80);
271
+
272
+ float3 EmissiveColor_mdl = Local28;
273
+ float OpacityMask_mdl = 1.0;
274
+ float3 BaseColor_mdl = Local41;
275
+ float Metallic_mdl = Local54.x;
276
+ float Specular_mdl = Local67.x;
277
+ float Roughness_mdl = Local81.x;
278
+ float SurfaceThickness_mdl = 0.01;
279
+
280
+ } in
281
+ ::OmniUe4Base(
282
+ base_color: BaseColor_mdl,
283
+ metallic: Metallic_mdl,
284
+ roughness: Roughness_mdl,
285
+ specular: Specular_mdl,
286
+ normal: Normal_mdl,
287
+ opacity: OpacityMask_mdl,
288
+ emissive_color: EmissiveColor_mdl,
289
+ displacement: WorldPositionOffset_mdl,
290
+ two_sided: true);
kujiale_0003/Materials/M_BaseMaterial_v2.mdl ADDED
@@ -0,0 +1,914 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_BaseMaterial_v2(
21
+ float IsNormal = 0.0
22
+ [[
23
+ anno::display_name("IsNormal"),
24
+ anno::ui_order(32)
25
+ ]],
26
+ float IsFlip = 0.0
27
+ [[
28
+ anno::display_name("IsFlip"),
29
+ anno::ui_order(32),
30
+ anno::in_group("Normal")
31
+ ]],
32
+ uniform texture_2d NormalTex = texture_2d("./Textures/DefaultNormal.png",::tex::gamma_linear)
33
+ [[
34
+ anno::display_name("NormalTex"),
35
+ anno::ui_order(32),
36
+ anno::in_group("Normal"),
37
+ sampler_normal()
38
+ ]],
39
+ float4 NormalUVW = float4(1.0,1.0,0.0,1.0)
40
+ [[
41
+ anno::display_name("NormalUVW"),
42
+ anno::ui_order(4),
43
+ anno::in_group("Normal")
44
+ ]],
45
+ float4 NormalOffset = float4(0.0,0.0,0.0,1.0)
46
+ [[
47
+ anno::display_name("NormalOffset"),
48
+ anno::ui_order(5),
49
+ anno::in_group("Normal")
50
+ ]],
51
+ float NormalIntensity = 0.0
52
+ [[
53
+ anno::display_name("NormalIntensity"),
54
+ anno::ui_order(32),
55
+ anno::in_group("Normal")
56
+ ]],
57
+ float EmissionIsTexType = 0.0
58
+ [[
59
+ anno::display_name("EmissionIsTexType"),
60
+ anno::description("0 is color, 1 is tex, 2 is falloff
61
+ "),
62
+ anno::ui_order(1),
63
+ anno::in_group("Emission")
64
+ ]],
65
+ float EmissionFalloffValue1Type = 0.0
66
+ [[
67
+ anno::display_name("EmissionFalloffValue1Type"),
68
+ anno::ui_order(7),
69
+ anno::in_group("Emission")
70
+ ]],
71
+ float EmissionFalloffFloat = 0.0
72
+ [[
73
+ anno::display_name("EmissionFalloffFloat"),
74
+ anno::ui_order(8),
75
+ anno::in_group("Emission")
76
+ ]],
77
+ float4 EmissionColor = float4(0.0,0.0,0.0,1.0)
78
+ [[
79
+ anno::display_name("EmissionColor"),
80
+ anno::ui_order(2),
81
+ anno::in_group("Emission")
82
+ ]],
83
+ uniform texture_2d EmissionTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
84
+ [[
85
+ anno::display_name("EmissionTex"),
86
+ anno::ui_order(3),
87
+ anno::in_group("Emission"),
88
+ sampler_color()
89
+ ]],
90
+ float4 EmissionUVW = float4(1.0,1.0,0.0,1.0)
91
+ [[
92
+ anno::display_name("EmissionUVW"),
93
+ anno::ui_order(4),
94
+ anno::in_group("Emission")
95
+ ]],
96
+ float4 EmissionOffset = float4(0.0,0.0,0.0,1.0)
97
+ [[
98
+ anno::display_name("EmissionOffset"),
99
+ anno::ui_order(5),
100
+ anno::in_group("Emission")
101
+ ]],
102
+ float EmissionFalloffValue2Type = 0.0
103
+ [[
104
+ anno::display_name("EmissionFalloffValue2Type"),
105
+ anno::ui_order(9),
106
+ anno::in_group("Emission")
107
+ ]],
108
+ float EmissionFalloffFloat_2 = 0.0
109
+ [[
110
+ anno::display_name("EmissionFalloffFloat_2"),
111
+ anno::ui_order(10),
112
+ anno::in_group("Emission")
113
+ ]],
114
+ float4 EmissionColor_2 = float4(1.0,1.0,1.0,1.0)
115
+ [[
116
+ anno::display_name("EmissionColor_2"),
117
+ anno::ui_order(11),
118
+ anno::in_group("Emission")
119
+ ]],
120
+ uniform texture_2d EmissionTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
121
+ [[
122
+ anno::display_name("EmissionTex_2"),
123
+ anno::ui_order(12),
124
+ anno::in_group("Emission"),
125
+ sampler_color()
126
+ ]],
127
+ float4 EmissionUVW_2 = float4(1.0,1.0,0.0,1.0)
128
+ [[
129
+ anno::display_name("EmissionUVW_2"),
130
+ anno::ui_order(13),
131
+ anno::in_group("Emission")
132
+ ]],
133
+ float4 EmissionOffset_2 = float4(0.0,0.0,0.0,1.0)
134
+ [[
135
+ anno::display_name("EmissionOffset_2"),
136
+ anno::ui_order(14),
137
+ anno::in_group("Emission")
138
+ ]],
139
+ float EmissionFalloffFreshnelIor = 1.6
140
+ [[
141
+ anno::display_name("EmissionFalloffFreshnelIor"),
142
+ anno::ui_order(6),
143
+ anno::in_group("Emission")
144
+ ]],
145
+ float ColorIsTexType = 0.0
146
+ [[
147
+ anno::display_name("ColorIsTexType"),
148
+ anno::description("0 is color, 1 is tex, 2 is falloff
149
+ "),
150
+ anno::ui_order(1),
151
+ anno::in_group("Color")
152
+ ]],
153
+ float ColorFalloffValue1Type = 0.0
154
+ [[
155
+ anno::display_name("ColorFalloffValue1Type"),
156
+ anno::ui_order(7),
157
+ anno::in_group("Color")
158
+ ]],
159
+ float ColorFalloffFloat = 0.0
160
+ [[
161
+ anno::display_name("ColorFalloffFloat"),
162
+ anno::ui_order(10),
163
+ anno::in_group("Color")
164
+ ]],
165
+ float4 ColorColor = float4(1.0,1.0,1.0,1.0)
166
+ [[
167
+ anno::display_name("ColorColor"),
168
+ anno::ui_order(2),
169
+ anno::in_group("Color")
170
+ ]],
171
+ uniform texture_2d ColorTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
172
+ [[
173
+ anno::display_name("ColorTex"),
174
+ anno::ui_order(3),
175
+ anno::in_group("Color"),
176
+ sampler_color()
177
+ ]],
178
+ float4 ColorUVW = float4(1.0,1.0,0.0,1.0)
179
+ [[
180
+ anno::display_name("ColorUVW"),
181
+ anno::ui_order(4),
182
+ anno::in_group("Color")
183
+ ]],
184
+ float4 ColorOffset = float4(0.0,0.0,0.0,1.0)
185
+ [[
186
+ anno::display_name("ColorOffset"),
187
+ anno::ui_order(5),
188
+ anno::in_group("Color")
189
+ ]],
190
+ float ColorFalloffValue2Type = 0.0
191
+ [[
192
+ anno::display_name("ColorFalloffValue2Type"),
193
+ anno::ui_order(9),
194
+ anno::in_group("Color")
195
+ ]],
196
+ float ColorFalloffFloat_2 = 0.0
197
+ [[
198
+ anno::display_name("ColorFalloffFloat_2"),
199
+ anno::ui_order(10),
200
+ anno::in_group("Color")
201
+ ]],
202
+ float4 ColorColor_2 = float4(1.0,1.0,1.0,1.0)
203
+ [[
204
+ anno::display_name("ColorColor_2"),
205
+ anno::ui_order(11),
206
+ anno::in_group("Color")
207
+ ]],
208
+ uniform texture_2d ColorTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
209
+ [[
210
+ anno::display_name("ColorTex_2"),
211
+ anno::ui_order(12),
212
+ anno::in_group("Color"),
213
+ sampler_color()
214
+ ]],
215
+ float4 ColorUVW_2 = float4(1.0,1.0,0.0,1.0)
216
+ [[
217
+ anno::display_name("ColorUVW_2"),
218
+ anno::ui_order(13),
219
+ anno::in_group("Color")
220
+ ]],
221
+ float4 ColorOffset_2 = float4(0.0,0.0,0.0,1.0)
222
+ [[
223
+ anno::display_name("ColorOffset_2"),
224
+ anno::ui_order(14),
225
+ anno::in_group("Color")
226
+ ]],
227
+ float ColorFalloffFreshnelIor = 1.6
228
+ [[
229
+ anno::display_name("ColorFalloffFreshnelIor"),
230
+ anno::ui_order(6),
231
+ anno::in_group("Color")
232
+ ]],
233
+ float MetallicIsTexType = 0.0
234
+ [[
235
+ anno::display_name("MetallicIsTexType"),
236
+ anno::description("0 is color, 1 is tex, 2 is falloff
237
+ "),
238
+ anno::ui_order(1),
239
+ anno::in_group("Metallic")
240
+ ]],
241
+ float MetallicFalloffValue1Type = 0.0
242
+ [[
243
+ anno::display_name("MetallicFalloffValue1Type"),
244
+ anno::ui_order(7),
245
+ anno::in_group("Metallic")
246
+ ]],
247
+ float MetallicFalloffFloat = 0.0
248
+ [[
249
+ anno::display_name("MetallicFalloffFloat"),
250
+ anno::ui_order(8),
251
+ anno::in_group("Metallic")
252
+ ]],
253
+ float MetallicFloat = 0.0
254
+ [[
255
+ anno::display_name("MetallicFloat"),
256
+ anno::ui_order(2),
257
+ anno::in_group("Metallic")
258
+ ]],
259
+ uniform texture_2d MetallicTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
260
+ [[
261
+ anno::display_name("MetallicTex"),
262
+ anno::ui_order(3),
263
+ anno::in_group("Metallic"),
264
+ sampler_color()
265
+ ]],
266
+ float4 MetallicUVW = float4(1.0,1.0,0.0,1.0)
267
+ [[
268
+ anno::display_name("MetallicUVW"),
269
+ anno::ui_order(4),
270
+ anno::in_group("Metallic")
271
+ ]],
272
+ float4 MetallicOffset = float4(0.0,0.0,0.0,1.0)
273
+ [[
274
+ anno::display_name("MetallicOffset"),
275
+ anno::ui_order(5),
276
+ anno::in_group("Metallic")
277
+ ]],
278
+ float MetallicFalloffValue2Type = 0.0
279
+ [[
280
+ anno::display_name("MetallicFalloffValue2Type"),
281
+ anno::ui_order(9),
282
+ anno::in_group("Metallic")
283
+ ]],
284
+ float MetallicFalloffFloat_2 = 0.0
285
+ [[
286
+ anno::display_name("MetallicFalloffFloat_2"),
287
+ anno::ui_order(10),
288
+ anno::in_group("Metallic")
289
+ ]],
290
+ float4 MetallicColor_2 = float4(1.0,1.0,1.0,1.0)
291
+ [[
292
+ anno::display_name("MetallicColor_2"),
293
+ anno::ui_order(11),
294
+ anno::in_group("Metallic")
295
+ ]],
296
+ uniform texture_2d MetallicTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
297
+ [[
298
+ anno::display_name("MetallicTex_2"),
299
+ anno::ui_order(12),
300
+ anno::in_group("Metallic"),
301
+ sampler_color()
302
+ ]],
303
+ float4 MetallicUVW_2 = float4(1.0,1.0,0.0,1.0)
304
+ [[
305
+ anno::display_name("MetallicUVW_2"),
306
+ anno::ui_order(13),
307
+ anno::in_group("Metallic")
308
+ ]],
309
+ float4 MetallicOffset_2 = float4(0.0,0.0,0.0,1.0)
310
+ [[
311
+ anno::display_name("MetallicOffset_2"),
312
+ anno::ui_order(14),
313
+ anno::in_group("Metallic")
314
+ ]],
315
+ float MetallicFalloffFreshnelIor = 1.6
316
+ [[
317
+ anno::display_name("MetallicFalloffFreshnelIor"),
318
+ anno::ui_order(6),
319
+ anno::in_group("Metallic")
320
+ ]],
321
+ float SpecularIsTexType = 0.0
322
+ [[
323
+ anno::display_name("SpecularIsTexType"),
324
+ anno::description("0 is color, 1 is tex, 2 is falloff
325
+ "),
326
+ anno::ui_order(1),
327
+ anno::in_group("Specular")
328
+ ]],
329
+ float SpecularFalloffValue1Type = 0.0
330
+ [[
331
+ anno::display_name("SpecularFalloffValue1Type"),
332
+ anno::ui_order(7),
333
+ anno::in_group("Specular")
334
+ ]],
335
+ float SpecularFalloffFloat = 0.0
336
+ [[
337
+ anno::display_name("SpecularFalloffFloat"),
338
+ anno::ui_order(8),
339
+ anno::in_group("Specular")
340
+ ]],
341
+ float SpecularFloat = 0.0
342
+ [[
343
+ anno::display_name("SpecularFloat"),
344
+ anno::ui_order(2),
345
+ anno::in_group("Specular")
346
+ ]],
347
+ uniform texture_2d SpecularTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
348
+ [[
349
+ anno::display_name("SpecularTex"),
350
+ anno::ui_order(3),
351
+ anno::in_group("Specular"),
352
+ sampler_color()
353
+ ]],
354
+ float4 SpecularUVW = float4(1.0,1.0,0.0,1.0)
355
+ [[
356
+ anno::display_name("SpecularUVW"),
357
+ anno::ui_order(4),
358
+ anno::in_group("Specular")
359
+ ]],
360
+ float4 SpecularOffset = float4(0.0,0.0,0.0,1.0)
361
+ [[
362
+ anno::display_name("SpecularOffset"),
363
+ anno::ui_order(5),
364
+ anno::in_group("Specular")
365
+ ]],
366
+ float SpecularFalloffValue2Type = 0.0
367
+ [[
368
+ anno::display_name("SpecularFalloffValue2Type"),
369
+ anno::ui_order(9),
370
+ anno::in_group("Specular")
371
+ ]],
372
+ float SpecularFalloffFloat_2 = 0.0
373
+ [[
374
+ anno::display_name("SpecularFalloffFloat_2"),
375
+ anno::ui_order(10),
376
+ anno::in_group("Specular")
377
+ ]],
378
+ float4 SpecularColor_2 = float4(1.0,1.0,1.0,1.0)
379
+ [[
380
+ anno::display_name("SpecularColor_2"),
381
+ anno::ui_order(11),
382
+ anno::in_group("Specular")
383
+ ]],
384
+ uniform texture_2d SpecularTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
385
+ [[
386
+ anno::display_name("SpecularTex_2"),
387
+ anno::ui_order(12),
388
+ anno::in_group("Specular"),
389
+ sampler_color()
390
+ ]],
391
+ float4 SpecularUVW_2 = float4(1.0,1.0,0.0,1.0)
392
+ [[
393
+ anno::display_name("SpecularUVW_2"),
394
+ anno::ui_order(13),
395
+ anno::in_group("Specular")
396
+ ]],
397
+ float4 SpecularOffset_2 = float4(0.0,0.0,0.0,1.0)
398
+ [[
399
+ anno::display_name("SpecularOffset_2"),
400
+ anno::ui_order(14),
401
+ anno::in_group("Specular")
402
+ ]],
403
+ float SpecularFalloffFreshnelIor = 1.6
404
+ [[
405
+ anno::display_name("SpecularFalloffFreshnelIor"),
406
+ anno::ui_order(6),
407
+ anno::in_group("Specular")
408
+ ]],
409
+ float RoughnessIsTexType = 0.0
410
+ [[
411
+ anno::display_name("RoughnessIsTexType"),
412
+ anno::description("0 is color, 1 is tex, 2 is falloff
413
+ "),
414
+ anno::ui_order(1),
415
+ anno::in_group("Roughness")
416
+ ]],
417
+ float RoughnessFalloffValue1Type = 0.0
418
+ [[
419
+ anno::display_name("RoughnessFalloffValue1Type"),
420
+ anno::ui_order(7),
421
+ anno::in_group("Roughness")
422
+ ]],
423
+ float RoughnessFalloffFloat = 0.0
424
+ [[
425
+ anno::display_name("RoughnessFalloffFloat"),
426
+ anno::ui_order(8),
427
+ anno::in_group("Roughness")
428
+ ]],
429
+ float RoughnessFloat = 0.0
430
+ [[
431
+ anno::display_name("RoughnessFloat"),
432
+ anno::ui_order(2),
433
+ anno::in_group("Roughness")
434
+ ]],
435
+ uniform texture_2d RoughnessTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
436
+ [[
437
+ anno::display_name("RoughnessTex"),
438
+ anno::ui_order(3),
439
+ anno::in_group("Roughness"),
440
+ sampler_color()
441
+ ]],
442
+ float4 RoughnessUVW = float4(1.0,1.0,0.0,1.0)
443
+ [[
444
+ anno::display_name("RoughnessUVW"),
445
+ anno::ui_order(4),
446
+ anno::in_group("Roughness")
447
+ ]],
448
+ float4 RoughnessOffset = float4(0.0,0.0,0.0,1.0)
449
+ [[
450
+ anno::display_name("RoughnessOffset"),
451
+ anno::ui_order(5),
452
+ anno::in_group("Roughness")
453
+ ]],
454
+ float RoughnessFalloffValue2Type = 0.0
455
+ [[
456
+ anno::display_name("RoughnessFalloffValue2Type"),
457
+ anno::ui_order(9),
458
+ anno::in_group("Roughness")
459
+ ]],
460
+ float RoughnessFalloffFloat_2 = 0.0
461
+ [[
462
+ anno::display_name("RoughnessFalloffFloat_2"),
463
+ anno::ui_order(10),
464
+ anno::in_group("Roughness")
465
+ ]],
466
+ float4 RoughnessColor_2 = float4(1.0,1.0,1.0,1.0)
467
+ [[
468
+ anno::display_name("RoughnessColor_2"),
469
+ anno::ui_order(11),
470
+ anno::in_group("Roughness")
471
+ ]],
472
+ uniform texture_2d RoughnessTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
473
+ [[
474
+ anno::display_name("RoughnessTex_2"),
475
+ anno::ui_order(12),
476
+ anno::in_group("Roughness"),
477
+ sampler_color()
478
+ ]],
479
+ float4 RoughnessUVW_2 = float4(1.0,1.0,0.0,1.0)
480
+ [[
481
+ anno::display_name("RoughnessUVW_2"),
482
+ anno::ui_order(13),
483
+ anno::in_group("Roughness")
484
+ ]],
485
+ float4 RoughnessOffset_2 = float4(0.0,0.0,0.0,1.0)
486
+ [[
487
+ anno::display_name("RoughnessOffset_2"),
488
+ anno::ui_order(14),
489
+ anno::in_group("Roughness")
490
+ ]],
491
+ float RoughnessFalloffFreshnelIor = 1.6
492
+ [[
493
+ anno::display_name("RoughnessFalloffFreshnelIor"),
494
+ anno::ui_order(6),
495
+ anno::in_group("Roughness")
496
+ ]],
497
+ float PolygonOffset = 0.0
498
+ [[
499
+ anno::display_name("PolygonOffset"),
500
+ anno::ui_order(32)
501
+ ]],
502
+ int MaxTexCoordIndex = 3
503
+ [[
504
+ anno::hidden()
505
+ ]])
506
+ =
507
+ let {
508
+ float3 Local370 = ::camera_position();
509
+ float3 Local371 = (Local370 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
510
+ float3 Local372 = math::normalize(Local371);
511
+ float3 Local373 = (Local372 * PolygonOffset);
512
+
513
+ float3 WorldPositionOffset_mdl = Local373;
514
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
515
+ float2 CustomizedUV1_mdl = float2(state::texture_coordinate(math::min(1,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(1,MaxTexCoordIndex)).y);
516
+ float2 CustomizedUV2_mdl = float2(state::texture_coordinate(math::min(2,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(2,MaxTexCoordIndex)).y);
517
+ float2 CustomizedUV3_mdl = float2(state::texture_coordinate(math::min(3,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(3,MaxTexCoordIndex)).y);
518
+ float2 CustomizedUV4_mdl = float2(state::texture_coordinate(math::min(4,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(4,MaxTexCoordIndex)).y);
519
+ float2 CustomizedUV5_mdl = float2(state::texture_coordinate(math::min(5,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(5,MaxTexCoordIndex)).y);
520
+ float2 CustomizedUV6_mdl = float2(state::texture_coordinate(math::min(6,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(6,MaxTexCoordIndex)).y);
521
+
522
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
523
+ float Local1 = math::min(math::max(0.0,0.0),6.0);
524
+ float2 Local2 = ((math::abs(Local1 - 1.0) > 0.00001) ? (Local1 >= 1.0 ? CustomizedUV2_mdl : CustomizedUV0_mdl) : CustomizedUV1_mdl);
525
+ float2 Local3 = ((math::abs(Local1 - 3.0) > 0.00001) ? (Local1 >= 3.0 ? CustomizedUV4_mdl : Local2) : CustomizedUV3_mdl);
526
+ float2 Local4 = ((math::abs(Local1 - 5.0) > 0.00001) ? (Local1 >= 5.0 ? CustomizedUV6_mdl : Local3) : CustomizedUV5_mdl);
527
+ float Local5 = (Local4.x * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).x);
528
+ float Local6 = (Local4.y * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
529
+ float Local7 = (1.0 - float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
530
+ float Local8 = (Local6 + Local7);
531
+ float Local9 = (float2(Local5,Local8).x + float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).x);
532
+ float Local10 = (float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).y * -1.0);
533
+ float Local11 = (float2(Local5,Local8).y + Local10);
534
+ float2 Local12 = (Local0 + float2(Local9,Local11));
535
+ float Local13 = (float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).z * 6.283185);
536
+ float Local14 = math::cos(Local13);
537
+ float Local15 = math::sin(Local13);
538
+ float Local16 = (Local15 * -1.0);
539
+ float Local17 = math::dot(Local12, float2(Local14,Local16));
540
+ float Local18 = math::dot(Local12, float2(Local15,Local14));
541
+ float2 Local19 = (float2(0.5,0.5) + float2(Local17,Local18));
542
+ float4 Local20 = ::unpack_normal_map(tex::lookup_float4(NormalTex,float2(Local19.x,1.0-Local19.y),tex::wrap_repeat,tex::wrap_repeat));
543
+ float2 Local21 = (float2(float3(Local20.x,Local20.y,Local20.z).x,float3(Local20.x,Local20.y,Local20.z).y) * NormalIntensity);
544
+ float3 Local22 = math::normalize(float3(Local21.x,Local21.y,float3(Local20.x,Local20.y,Local20.z).z));
545
+ float3 Local23 = ((math::abs(IsFlip - 1.0) > 0.00001) ? (Local22) : Local22);
546
+ float Local24 = (Local23.z + 1.0);
547
+ float2 Local25 = (float2(float3(0.0,0.0,1.0).x,float3(0.0,0.0,1.0).y) * -1.0);
548
+ float Local26 = math::dot(float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24), float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
549
+ float3 Local27 = (float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24) * Local26);
550
+ float3 Local28 = (Local24 * float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
551
+ float3 Local29 = (Local27 - Local28);
552
+ float3 Local30 = math::normalize(Local29);
553
+ float3 Local31 = ((math::abs(IsNormal - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : Local30);
554
+
555
+ float3 Normal_mdl = Local31;
556
+
557
+ float Local32 = (Local4.x * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).x);
558
+ float Local33 = (Local4.y * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
559
+ float Local34 = (1.0 - float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
560
+ float Local35 = (Local33 + Local34);
561
+ float Local36 = (float2(Local32,Local35).x + float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).x);
562
+ float Local37 = (float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).y * -1.0);
563
+ float Local38 = (float2(Local32,Local35).y + Local37);
564
+ float2 Local39 = (Local0 + float2(Local36,Local38));
565
+ float Local40 = (float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).z * 6.283185);
566
+ float Local41 = math::cos(Local40);
567
+ float Local42 = math::sin(Local40);
568
+ float Local43 = (Local42 * -1.0);
569
+ float Local44 = math::dot(Local39, float2(Local41,Local43));
570
+ float Local45 = math::dot(Local39, float2(Local42,Local41));
571
+ float2 Local46 = (float2(0.5,0.5) + float2(Local44,Local45));
572
+ float4 Local47 = tex::lookup_float4(EmissionTex,float2(Local46.x,1.0-Local46.y),tex::wrap_repeat,tex::wrap_repeat);
573
+ float3 Local48 = ((math::abs(EmissionFalloffValue1Type - 1.0) > 0.00001) ? (EmissionFalloffValue1Type >= 1.0 ? float3(float2(EmissionFalloffFloat,EmissionFalloffFloat).x,float2(EmissionFalloffFloat,EmissionFalloffFloat).y,EmissionFalloffFloat) : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
574
+ float Local49 = (Local4.x * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).x);
575
+ float Local50 = (Local4.y * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
576
+ float Local51 = (1.0 - float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
577
+ float Local52 = (Local50 + Local51);
578
+ float Local53 = (float2(Local49,Local52).x + float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).x);
579
+ float Local54 = (float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).y * -1.0);
580
+ float Local55 = (float2(Local49,Local52).y + Local54);
581
+ float2 Local56 = (Local0 + float2(Local53,Local55));
582
+ float Local57 = (float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).z * 6.283185);
583
+ float Local58 = math::cos(Local57);
584
+ float Local59 = math::sin(Local57);
585
+ float Local60 = (Local59 * -1.0);
586
+ float Local61 = math::dot(Local56, float2(Local58,Local60));
587
+ float Local62 = math::dot(Local56, float2(Local59,Local58));
588
+ float2 Local63 = (float2(0.5,0.5) + float2(Local61,Local62));
589
+ float4 Local64 = tex::lookup_float4(EmissionTex_2,float2(Local63.x,1.0-Local63.y),tex::wrap_repeat,tex::wrap_repeat);
590
+ float3 Local65 = ((math::abs(EmissionFalloffValue2Type - 1.0) > 0.00001) ? (EmissionFalloffValue2Type >= 1.0 ? float3(float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).x,float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).y,EmissionFalloffFloat_2) : float3(EmissionColor_2.x,EmissionColor_2.y,EmissionColor_2.z)) : float3(Local64.x,Local64.y,Local64.z));
591
+ float Local66 = math::min(math::max(EmissionFalloffFreshnelIor,0.0),100.0);
592
+ float Local67 = (1.0 / Local66);
593
+ float Local68 = math::max(Local66,Local67);
594
+ float Local69 = (Local68 - 1.0);
595
+ float Local70 = (Local68 * Local68);
596
+ float Local71 = math::dot(::pixel_normal_world_space(true), ::camera_vector(true));
597
+ float Local72 = (Local71 * Local71);
598
+ float Local73 = (Local70 + Local72);
599
+ float Local74 = (Local73 - 1.0);
600
+ float Local75 = math::sqrt(Local74);
601
+ float Local76 = (Local75 / Local68);
602
+ float Local77 = ((math::abs(Local76 - 0.99999) > 0.000001) ? (Local76 >= 0.99999 ? 1.0 : 0.0) : 0.0);
603
+ float Local78 = ((math::abs(Local71 - 0.99999) > 0.000001) ? (Local71 >= 0.99999 ? 1.0 : 0.0) : 0.0);
604
+ float Local79 = math::max(Local77,Local78);
605
+ float Local80 = (Local71 / Local76);
606
+ float Local81 = (Local68 * Local80);
607
+ float Local82 = (Local81 - 1.0);
608
+ float Local83 = (Local81 + 1.0);
609
+ float Local84 = (Local82 / Local83);
610
+ float Local85 = math::pow(math::max(Local84,float(0.000001)),2.0);
611
+ float Local86 = (Local76 / Local71);
612
+ float Local87 = (Local68 * Local86);
613
+ float Local88 = (Local87 - 1.0);
614
+ float Local89 = (Local87 + 1.0);
615
+ float Local90 = (Local88 / Local89);
616
+ float Local91 = math::pow(math::max(Local90,float(0.000001)),2.0);
617
+ float Local92 = (Local85 + Local91);
618
+ float Local93 = (Local92 * 0.5);
619
+ float Local94 = (Local68 + 1.0);
620
+ float Local95 = (Local69 / Local94);
621
+ float Local96 = math::pow(math::max(Local95,float(0.000001)),2.0);
622
+ float Local97 = ((math::abs(Local79 - 1.0) > 0.1) ? (Local93) : Local96);
623
+ float Local98 = ((math::abs(Local69 - 0.0) > 0.000001) ? (Local97) : 0.0);
624
+ float Local99 = math::saturate(Local98);
625
+ float3 Local100 = math::lerp(Local48,Local65,Local99);
626
+ float3 Local101 = ((math::abs(EmissionIsTexType - 1.0) > 0.00001) ? (EmissionIsTexType >= 1.0 ? Local100 : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
627
+ float Local102 = (Local4.x * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).x);
628
+ float Local103 = (Local4.y * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
629
+ float Local104 = (1.0 - float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
630
+ float Local105 = (Local103 + Local104);
631
+ float Local106 = (float2(Local102,Local105).x + float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).x);
632
+ float Local107 = (float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).y * -1.0);
633
+ float Local108 = (float2(Local102,Local105).y + Local107);
634
+ float2 Local109 = (Local0 + float2(Local106,Local108));
635
+ float Local110 = (float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).z * 6.283185);
636
+ float Local111 = math::cos(Local110);
637
+ float Local112 = math::sin(Local110);
638
+ float Local113 = (Local112 * -1.0);
639
+ float Local114 = math::dot(Local109, float2(Local111,Local113));
640
+ float Local115 = math::dot(Local109, float2(Local112,Local111));
641
+ float2 Local116 = (float2(0.5,0.5) + float2(Local114,Local115));
642
+ float4 Local117 = tex::lookup_float4(ColorTex,float2(Local116.x,1.0-Local116.y),tex::wrap_repeat,tex::wrap_repeat);
643
+ float3 Local118 = ((math::abs(ColorFalloffValue1Type - 1.0) > 0.00001) ? (ColorFalloffValue1Type >= 1.0 ? float3(float2(ColorFalloffFloat,ColorFalloffFloat).x,float2(ColorFalloffFloat,ColorFalloffFloat).y,ColorFalloffFloat) : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
644
+ float Local119 = (Local4.x * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).x);
645
+ float Local120 = (Local4.y * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
646
+ float Local121 = (1.0 - float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
647
+ float Local122 = (Local120 + Local121);
648
+ float Local123 = (float2(Local119,Local122).x + float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).x);
649
+ float Local124 = (float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).y * -1.0);
650
+ float Local125 = (float2(Local119,Local122).y + Local124);
651
+ float2 Local126 = (Local0 + float2(Local123,Local125));
652
+ float Local127 = (float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).z * 6.283185);
653
+ float Local128 = math::cos(Local127);
654
+ float Local129 = math::sin(Local127);
655
+ float Local130 = (Local129 * -1.0);
656
+ float Local131 = math::dot(Local126, float2(Local128,Local130));
657
+ float Local132 = math::dot(Local126, float2(Local129,Local128));
658
+ float2 Local133 = (float2(0.5,0.5) + float2(Local131,Local132));
659
+ float4 Local134 = tex::lookup_float4(ColorTex_2,float2(Local133.x,1.0-Local133.y),tex::wrap_repeat,tex::wrap_repeat);
660
+ float3 Local135 = ((math::abs(ColorFalloffValue2Type - 1.0) > 0.00001) ? (ColorFalloffValue2Type >= 1.0 ? float3(float2(ColorFalloffFloat_2,ColorFalloffFloat_2).x,float2(ColorFalloffFloat_2,ColorFalloffFloat_2).y,ColorFalloffFloat_2) : float3(ColorColor_2.x,ColorColor_2.y,ColorColor_2.z)) : float3(Local134.x,Local134.y,Local134.z));
661
+ float Local136 = math::min(math::max(ColorFalloffFreshnelIor,0.0),100.0);
662
+ float Local137 = (1.0 / Local136);
663
+ float Local138 = math::max(Local136,Local137);
664
+ float Local139 = (Local138 - 1.0);
665
+ float Local140 = (Local138 * Local138);
666
+ float Local141 = (Local140 + Local72);
667
+ float Local142 = (Local141 - 1.0);
668
+ float Local143 = math::sqrt(Local142);
669
+ float Local144 = (Local143 / Local138);
670
+ float Local145 = ((math::abs(Local144 - 0.99999) > 0.000001) ? (Local144 >= 0.99999 ? 1.0 : 0.0) : 0.0);
671
+ float Local146 = math::max(Local145,Local78);
672
+ float Local147 = (Local71 / Local144);
673
+ float Local148 = (Local138 * Local147);
674
+ float Local149 = (Local148 - 1.0);
675
+ float Local150 = (Local148 + 1.0);
676
+ float Local151 = (Local149 / Local150);
677
+ float Local152 = math::pow(math::max(Local151,float(0.000001)),2.0);
678
+ float Local153 = (Local144 / Local71);
679
+ float Local154 = (Local138 * Local153);
680
+ float Local155 = (Local154 - 1.0);
681
+ float Local156 = (Local154 + 1.0);
682
+ float Local157 = (Local155 / Local156);
683
+ float Local158 = math::pow(math::max(Local157,float(0.000001)),2.0);
684
+ float Local159 = (Local152 + Local158);
685
+ float Local160 = (Local159 * 0.5);
686
+ float Local161 = (Local138 + 1.0);
687
+ float Local162 = (Local139 / Local161);
688
+ float Local163 = math::pow(math::max(Local162,float(0.000001)),2.0);
689
+ float Local164 = ((math::abs(Local146 - 1.0) > 0.1) ? (Local160) : Local163);
690
+ float Local165 = ((math::abs(Local139 - 0.0) > 0.000001) ? (Local164) : 0.0);
691
+ float Local166 = math::saturate(Local165);
692
+ float3 Local167 = math::lerp(Local118,Local135,Local166);
693
+ float3 Local168 = ((math::abs(ColorIsTexType - 1.0) > 0.00001) ? (ColorIsTexType >= 1.0 ? Local167 : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
694
+ float Local169 = (Local4.x * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).x);
695
+ float Local170 = (Local4.y * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
696
+ float Local171 = (1.0 - float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
697
+ float Local172 = (Local170 + Local171);
698
+ float Local173 = (float2(Local169,Local172).x + float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).x);
699
+ float Local174 = (float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).y * -1.0);
700
+ float Local175 = (float2(Local169,Local172).y + Local174);
701
+ float2 Local176 = (Local0 + float2(Local173,Local175));
702
+ float Local177 = (float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).z * 6.283185);
703
+ float Local178 = math::cos(Local177);
704
+ float Local179 = math::sin(Local177);
705
+ float Local180 = (Local179 * -1.0);
706
+ float Local181 = math::dot(Local176, float2(Local178,Local180));
707
+ float Local182 = math::dot(Local176, float2(Local179,Local178));
708
+ float2 Local183 = (float2(0.5,0.5) + float2(Local181,Local182));
709
+ float4 Local184 = tex::lookup_float4(MetallicTex,float2(Local183.x,1.0-Local183.y),tex::wrap_repeat,tex::wrap_repeat);
710
+ float3 Local185 = ((math::abs(MetallicFalloffValue1Type - 1.0) > 0.00001) ? (MetallicFalloffValue1Type >= 1.0 ? float3(float2(MetallicFalloffFloat,MetallicFalloffFloat).x,float2(MetallicFalloffFloat,MetallicFalloffFloat).y,MetallicFalloffFloat) : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
711
+ float Local186 = (Local4.x * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).x);
712
+ float Local187 = (Local4.y * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
713
+ float Local188 = (1.0 - float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
714
+ float Local189 = (Local187 + Local188);
715
+ float Local190 = (float2(Local186,Local189).x + float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).x);
716
+ float Local191 = (float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).y * -1.0);
717
+ float Local192 = (float2(Local186,Local189).y + Local191);
718
+ float2 Local193 = (Local0 + float2(Local190,Local192));
719
+ float Local194 = (float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).z * 6.283185);
720
+ float Local195 = math::cos(Local194);
721
+ float Local196 = math::sin(Local194);
722
+ float Local197 = (Local196 * -1.0);
723
+ float Local198 = math::dot(Local193, float2(Local195,Local197));
724
+ float Local199 = math::dot(Local193, float2(Local196,Local195));
725
+ float2 Local200 = (float2(0.5,0.5) + float2(Local198,Local199));
726
+ float4 Local201 = tex::lookup_float4(MetallicTex_2,float2(Local200.x,1.0-Local200.y),tex::wrap_repeat,tex::wrap_repeat);
727
+ float3 Local202 = ((math::abs(MetallicFalloffValue2Type - 1.0) > 0.00001) ? (MetallicFalloffValue2Type >= 1.0 ? float3(float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).x,float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).y,MetallicFalloffFloat_2) : float3(MetallicColor_2.x,MetallicColor_2.y,MetallicColor_2.z)) : float3(Local201.x,Local201.y,Local201.z));
728
+ float Local203 = math::min(math::max(MetallicFalloffFreshnelIor,0.0),100.0);
729
+ float Local204 = (1.0 / Local203);
730
+ float Local205 = math::max(Local203,Local204);
731
+ float Local206 = (Local205 - 1.0);
732
+ float Local207 = (Local205 * Local205);
733
+ float Local208 = (Local207 + Local72);
734
+ float Local209 = (Local208 - 1.0);
735
+ float Local210 = math::sqrt(Local209);
736
+ float Local211 = (Local210 / Local205);
737
+ float Local212 = ((math::abs(Local211 - 0.99999) > 0.000001) ? (Local211 >= 0.99999 ? 1.0 : 0.0) : 0.0);
738
+ float Local213 = math::max(Local212,Local78);
739
+ float Local214 = (Local71 / Local211);
740
+ float Local215 = (Local205 * Local214);
741
+ float Local216 = (Local215 - 1.0);
742
+ float Local217 = (Local215 + 1.0);
743
+ float Local218 = (Local216 / Local217);
744
+ float Local219 = math::pow(math::max(Local218,float(0.000001)),2.0);
745
+ float Local220 = (Local211 / Local71);
746
+ float Local221 = (Local205 * Local220);
747
+ float Local222 = (Local221 - 1.0);
748
+ float Local223 = (Local221 + 1.0);
749
+ float Local224 = (Local222 / Local223);
750
+ float Local225 = math::pow(math::max(Local224,float(0.000001)),2.0);
751
+ float Local226 = (Local219 + Local225);
752
+ float Local227 = (Local226 * 0.5);
753
+ float Local228 = (Local205 + 1.0);
754
+ float Local229 = (Local206 / Local228);
755
+ float Local230 = math::pow(math::max(Local229,float(0.000001)),2.0);
756
+ float Local231 = ((math::abs(Local213 - 1.0) > 0.1) ? (Local227) : Local230);
757
+ float Local232 = ((math::abs(Local206 - 0.0) > 0.000001) ? (Local231) : 0.0);
758
+ float Local233 = math::saturate(Local232);
759
+ float3 Local234 = math::lerp(Local185,Local202,Local233);
760
+ float3 Local235 = ((math::abs(MetallicIsTexType - 1.0) > 0.00001) ? (MetallicIsTexType >= 1.0 ? Local234 : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
761
+ float Local236 = (Local4.x * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).x);
762
+ float Local237 = (Local4.y * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
763
+ float Local238 = (1.0 - float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
764
+ float Local239 = (Local237 + Local238);
765
+ float Local240 = (float2(Local236,Local239).x + float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).x);
766
+ float Local241 = (float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).y * -1.0);
767
+ float Local242 = (float2(Local236,Local239).y + Local241);
768
+ float2 Local243 = (Local0 + float2(Local240,Local242));
769
+ float Local244 = (float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).z * 6.283185);
770
+ float Local245 = math::cos(Local244);
771
+ float Local246 = math::sin(Local244);
772
+ float Local247 = (Local246 * -1.0);
773
+ float Local248 = math::dot(Local243, float2(Local245,Local247));
774
+ float Local249 = math::dot(Local243, float2(Local246,Local245));
775
+ float2 Local250 = (float2(0.5,0.5) + float2(Local248,Local249));
776
+ float4 Local251 = tex::lookup_float4(SpecularTex,float2(Local250.x,1.0-Local250.y),tex::wrap_repeat,tex::wrap_repeat);
777
+ float3 Local252 = ((math::abs(SpecularFalloffValue1Type - 1.0) > 0.00001) ? (SpecularFalloffValue1Type >= 1.0 ? float3(float2(SpecularFalloffFloat,SpecularFalloffFloat).x,float2(SpecularFalloffFloat,SpecularFalloffFloat).y,SpecularFalloffFloat) : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
778
+ float Local253 = (Local4.x * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).x);
779
+ float Local254 = (Local4.y * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
780
+ float Local255 = (1.0 - float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
781
+ float Local256 = (Local254 + Local255);
782
+ float Local257 = (float2(Local253,Local256).x + float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).x);
783
+ float Local258 = (float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).y * -1.0);
784
+ float Local259 = (float2(Local253,Local256).y + Local258);
785
+ float2 Local260 = (Local0 + float2(Local257,Local259));
786
+ float Local261 = (float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).z * 6.283185);
787
+ float Local262 = math::cos(Local261);
788
+ float Local263 = math::sin(Local261);
789
+ float Local264 = (Local263 * -1.0);
790
+ float Local265 = math::dot(Local260, float2(Local262,Local264));
791
+ float Local266 = math::dot(Local260, float2(Local263,Local262));
792
+ float2 Local267 = (float2(0.5,0.5) + float2(Local265,Local266));
793
+ float4 Local268 = tex::lookup_float4(SpecularTex_2,float2(Local267.x,1.0-Local267.y),tex::wrap_repeat,tex::wrap_repeat);
794
+ float3 Local269 = ((math::abs(SpecularFalloffValue2Type - 1.0) > 0.00001) ? (SpecularFalloffValue2Type >= 1.0 ? float3(float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).x,float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).y,SpecularFalloffFloat_2) : float3(SpecularColor_2.x,SpecularColor_2.y,SpecularColor_2.z)) : float3(Local268.x,Local268.y,Local268.z));
795
+ float Local270 = math::min(math::max(SpecularFalloffFreshnelIor,0.0),100.0);
796
+ float Local271 = (1.0 / Local270);
797
+ float Local272 = math::max(Local270,Local271);
798
+ float Local273 = (Local272 - 1.0);
799
+ float Local274 = (Local272 * Local272);
800
+ float Local275 = (Local274 + Local72);
801
+ float Local276 = (Local275 - 1.0);
802
+ float Local277 = math::sqrt(Local276);
803
+ float Local278 = (Local277 / Local272);
804
+ float Local279 = ((math::abs(Local278 - 0.99999) > 0.000001) ? (Local278 >= 0.99999 ? 1.0 : 0.0) : 0.0);
805
+ float Local280 = math::max(Local279,Local78);
806
+ float Local281 = (Local71 / Local278);
807
+ float Local282 = (Local272 * Local281);
808
+ float Local283 = (Local282 - 1.0);
809
+ float Local284 = (Local282 + 1.0);
810
+ float Local285 = (Local283 / Local284);
811
+ float Local286 = math::pow(math::max(Local285,float(0.000001)),2.0);
812
+ float Local287 = (Local278 / Local71);
813
+ float Local288 = (Local272 * Local287);
814
+ float Local289 = (Local288 - 1.0);
815
+ float Local290 = (Local288 + 1.0);
816
+ float Local291 = (Local289 / Local290);
817
+ float Local292 = math::pow(math::max(Local291,float(0.000001)),2.0);
818
+ float Local293 = (Local286 + Local292);
819
+ float Local294 = (Local293 * 0.5);
820
+ float Local295 = (Local272 + 1.0);
821
+ float Local296 = (Local273 / Local295);
822
+ float Local297 = math::pow(math::max(Local296,float(0.000001)),2.0);
823
+ float Local298 = ((math::abs(Local280 - 1.0) > 0.1) ? (Local294) : Local297);
824
+ float Local299 = ((math::abs(Local273 - 0.0) > 0.000001) ? (Local298) : 0.0);
825
+ float Local300 = math::saturate(Local299);
826
+ float3 Local301 = math::lerp(Local252,Local269,Local300);
827
+ float3 Local302 = ((math::abs(SpecularIsTexType - 1.0) > 0.00001) ? (SpecularIsTexType >= 1.0 ? Local301 : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
828
+ float Local303 = (Local4.x * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).x);
829
+ float Local304 = (Local4.y * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
830
+ float Local305 = (1.0 - float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
831
+ float Local306 = (Local304 + Local305);
832
+ float Local307 = (float2(Local303,Local306).x + float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).x);
833
+ float Local308 = (float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).y * -1.0);
834
+ float Local309 = (float2(Local303,Local306).y + Local308);
835
+ float2 Local310 = (Local0 + float2(Local307,Local309));
836
+ float Local311 = (float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).z * 6.283185);
837
+ float Local312 = math::cos(Local311);
838
+ float Local313 = math::sin(Local311);
839
+ float Local314 = (Local313 * -1.0);
840
+ float Local315 = math::dot(Local310, float2(Local312,Local314));
841
+ float Local316 = math::dot(Local310, float2(Local313,Local312));
842
+ float2 Local317 = (float2(0.5,0.5) + float2(Local315,Local316));
843
+ float4 Local318 = tex::lookup_float4(RoughnessTex,float2(Local317.x,1.0-Local317.y),tex::wrap_repeat,tex::wrap_repeat);
844
+ float3 Local319 = ((math::abs(RoughnessFalloffValue1Type - 1.0) > 0.00001) ? (RoughnessFalloffValue1Type >= 1.0 ? float3(float2(RoughnessFalloffFloat,RoughnessFalloffFloat).x,float2(RoughnessFalloffFloat,RoughnessFalloffFloat).y,RoughnessFalloffFloat) : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
845
+ float Local320 = (Local4.x * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).x);
846
+ float Local321 = (Local4.y * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
847
+ float Local322 = (1.0 - float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
848
+ float Local323 = (Local321 + Local322);
849
+ float Local324 = (float2(Local320,Local323).x + float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).x);
850
+ float Local325 = (float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).y * -1.0);
851
+ float Local326 = (float2(Local320,Local323).y + Local325);
852
+ float2 Local327 = (Local0 + float2(Local324,Local326));
853
+ float Local328 = (float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).z * 6.283185);
854
+ float Local329 = math::cos(Local328);
855
+ float Local330 = math::sin(Local328);
856
+ float Local331 = (Local330 * -1.0);
857
+ float Local332 = math::dot(Local327, float2(Local329,Local331));
858
+ float Local333 = math::dot(Local327, float2(Local330,Local329));
859
+ float2 Local334 = (float2(0.5,0.5) + float2(Local332,Local333));
860
+ float4 Local335 = tex::lookup_float4(RoughnessTex_2,float2(Local334.x,1.0-Local334.y),tex::wrap_repeat,tex::wrap_repeat);
861
+ float3 Local336 = ((math::abs(RoughnessFalloffValue2Type - 1.0) > 0.00001) ? (RoughnessFalloffValue2Type >= 1.0 ? float3(float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).x,float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).y,RoughnessFalloffFloat_2) : float3(RoughnessColor_2.x,RoughnessColor_2.y,RoughnessColor_2.z)) : float3(Local335.x,Local335.y,Local335.z));
862
+ float Local337 = math::min(math::max(RoughnessFalloffFreshnelIor,0.0),100.0);
863
+ float Local338 = (1.0 / Local337);
864
+ float Local339 = math::max(Local337,Local338);
865
+ float Local340 = (Local339 - 1.0);
866
+ float Local341 = (Local339 * Local339);
867
+ float Local342 = (Local341 + Local72);
868
+ float Local343 = (Local342 - 1.0);
869
+ float Local344 = math::sqrt(Local343);
870
+ float Local345 = (Local344 / Local339);
871
+ float Local346 = ((math::abs(Local345 - 0.99999) > 0.000001) ? (Local345 >= 0.99999 ? 1.0 : 0.0) : 0.0);
872
+ float Local347 = math::max(Local346,Local78);
873
+ float Local348 = (Local71 / Local345);
874
+ float Local349 = (Local339 * Local348);
875
+ float Local350 = (Local349 - 1.0);
876
+ float Local351 = (Local349 + 1.0);
877
+ float Local352 = (Local350 / Local351);
878
+ float Local353 = math::pow(math::max(Local352,float(0.000001)),2.0);
879
+ float Local354 = (Local345 / Local71);
880
+ float Local355 = (Local339 * Local354);
881
+ float Local356 = (Local355 - 1.0);
882
+ float Local357 = (Local355 + 1.0);
883
+ float Local358 = (Local356 / Local357);
884
+ float Local359 = math::pow(math::max(Local358,float(0.000001)),2.0);
885
+ float Local360 = (Local353 + Local359);
886
+ float Local361 = (Local360 * 0.5);
887
+ float Local362 = (Local339 + 1.0);
888
+ float Local363 = (Local340 / Local362);
889
+ float Local364 = math::pow(math::max(Local363,float(0.000001)),2.0);
890
+ float Local365 = ((math::abs(Local347 - 1.0) > 0.1) ? (Local361) : Local364);
891
+ float Local366 = ((math::abs(Local340 - 0.0) > 0.000001) ? (Local365) : 0.0);
892
+ float Local367 = math::saturate(Local366);
893
+ float3 Local368 = math::lerp(Local319,Local336,Local367);
894
+ float3 Local369 = ((math::abs(RoughnessIsTexType - 1.0) > 0.00001) ? (RoughnessIsTexType >= 1.0 ? Local368 : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
895
+
896
+ float3 EmissiveColor_mdl = Local101;
897
+ float OpacityMask_mdl = 1.0;
898
+ float3 BaseColor_mdl = Local168;
899
+ float Metallic_mdl = Local235.x;
900
+ float Specular_mdl = Local302.x;
901
+ float Roughness_mdl = Local369.x;
902
+ float SurfaceThickness_mdl = 0.01;
903
+
904
+ } in
905
+ ::OmniUe4Base(
906
+ base_color: BaseColor_mdl,
907
+ metallic: Metallic_mdl,
908
+ roughness: Roughness_mdl,
909
+ specular: Specular_mdl,
910
+ normal: Normal_mdl,
911
+ opacity: OpacityMask_mdl,
912
+ emissive_color: EmissiveColor_mdl,
913
+ displacement: WorldPositionOffset_mdl,
914
+ two_sided: false);
kujiale_0003/Materials/M_BaseMaterial_v2_twosided.mdl ADDED
@@ -0,0 +1,914 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Base import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_BaseMaterial_v2_twosided(
21
+ float IsNormal = 0.0
22
+ [[
23
+ anno::display_name("IsNormal"),
24
+ anno::ui_order(32)
25
+ ]],
26
+ float IsFlip = 0.0
27
+ [[
28
+ anno::display_name("IsFlip"),
29
+ anno::ui_order(32),
30
+ anno::in_group("Normal")
31
+ ]],
32
+ uniform texture_2d NormalTex = texture_2d("./Textures/DefaultNormal.png",::tex::gamma_linear)
33
+ [[
34
+ anno::display_name("NormalTex"),
35
+ anno::ui_order(32),
36
+ anno::in_group("Normal"),
37
+ sampler_normal()
38
+ ]],
39
+ float4 NormalUVW = float4(1.0,1.0,0.0,1.0)
40
+ [[
41
+ anno::display_name("NormalUVW"),
42
+ anno::ui_order(4),
43
+ anno::in_group("Normal")
44
+ ]],
45
+ float4 NormalOffset = float4(0.0,0.0,0.0,1.0)
46
+ [[
47
+ anno::display_name("NormalOffset"),
48
+ anno::ui_order(5),
49
+ anno::in_group("Normal")
50
+ ]],
51
+ float NormalIntensity = 0.0
52
+ [[
53
+ anno::display_name("NormalIntensity"),
54
+ anno::ui_order(32),
55
+ anno::in_group("Normal")
56
+ ]],
57
+ float EmissionIsTexType = 0.0
58
+ [[
59
+ anno::display_name("EmissionIsTexType"),
60
+ anno::description("0 is color, 1 is tex, 2 is falloff
61
+ "),
62
+ anno::ui_order(1),
63
+ anno::in_group("Emission")
64
+ ]],
65
+ float EmissionFalloffValue1Type = 0.0
66
+ [[
67
+ anno::display_name("EmissionFalloffValue1Type"),
68
+ anno::ui_order(7),
69
+ anno::in_group("Emission")
70
+ ]],
71
+ float EmissionFalloffFloat = 0.0
72
+ [[
73
+ anno::display_name("EmissionFalloffFloat"),
74
+ anno::ui_order(8),
75
+ anno::in_group("Emission")
76
+ ]],
77
+ float4 EmissionColor = float4(0.0,0.0,0.0,1.0)
78
+ [[
79
+ anno::display_name("EmissionColor"),
80
+ anno::ui_order(2),
81
+ anno::in_group("Emission")
82
+ ]],
83
+ uniform texture_2d EmissionTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
84
+ [[
85
+ anno::display_name("EmissionTex"),
86
+ anno::ui_order(3),
87
+ anno::in_group("Emission"),
88
+ sampler_color()
89
+ ]],
90
+ float4 EmissionUVW = float4(1.0,1.0,0.0,1.0)
91
+ [[
92
+ anno::display_name("EmissionUVW"),
93
+ anno::ui_order(4),
94
+ anno::in_group("Emission")
95
+ ]],
96
+ float4 EmissionOffset = float4(0.0,0.0,0.0,1.0)
97
+ [[
98
+ anno::display_name("EmissionOffset"),
99
+ anno::ui_order(5),
100
+ anno::in_group("Emission")
101
+ ]],
102
+ float EmissionFalloffValue2Type = 0.0
103
+ [[
104
+ anno::display_name("EmissionFalloffValue2Type"),
105
+ anno::ui_order(9),
106
+ anno::in_group("Emission")
107
+ ]],
108
+ float EmissionFalloffFloat_2 = 0.0
109
+ [[
110
+ anno::display_name("EmissionFalloffFloat_2"),
111
+ anno::ui_order(10),
112
+ anno::in_group("Emission")
113
+ ]],
114
+ float4 EmissionColor_2 = float4(1.0,1.0,1.0,1.0)
115
+ [[
116
+ anno::display_name("EmissionColor_2"),
117
+ anno::ui_order(11),
118
+ anno::in_group("Emission")
119
+ ]],
120
+ uniform texture_2d EmissionTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
121
+ [[
122
+ anno::display_name("EmissionTex_2"),
123
+ anno::ui_order(12),
124
+ anno::in_group("Emission"),
125
+ sampler_color()
126
+ ]],
127
+ float4 EmissionUVW_2 = float4(1.0,1.0,0.0,1.0)
128
+ [[
129
+ anno::display_name("EmissionUVW_2"),
130
+ anno::ui_order(13),
131
+ anno::in_group("Emission")
132
+ ]],
133
+ float4 EmissionOffset_2 = float4(0.0,0.0,0.0,1.0)
134
+ [[
135
+ anno::display_name("EmissionOffset_2"),
136
+ anno::ui_order(14),
137
+ anno::in_group("Emission")
138
+ ]],
139
+ float EmissionFalloffFreshnelIor = 1.6
140
+ [[
141
+ anno::display_name("EmissionFalloffFreshnelIor"),
142
+ anno::ui_order(6),
143
+ anno::in_group("Emission")
144
+ ]],
145
+ float ColorIsTexType = 0.0
146
+ [[
147
+ anno::display_name("ColorIsTexType"),
148
+ anno::description("0 is color, 1 is tex, 2 is falloff
149
+ "),
150
+ anno::ui_order(1),
151
+ anno::in_group("Color")
152
+ ]],
153
+ float ColorFalloffValue1Type = 0.0
154
+ [[
155
+ anno::display_name("ColorFalloffValue1Type"),
156
+ anno::ui_order(7),
157
+ anno::in_group("Color")
158
+ ]],
159
+ float ColorFalloffFloat = 0.0
160
+ [[
161
+ anno::display_name("ColorFalloffFloat"),
162
+ anno::ui_order(10),
163
+ anno::in_group("Color")
164
+ ]],
165
+ float4 ColorColor = float4(1.0,1.0,1.0,1.0)
166
+ [[
167
+ anno::display_name("ColorColor"),
168
+ anno::ui_order(2),
169
+ anno::in_group("Color")
170
+ ]],
171
+ uniform texture_2d ColorTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
172
+ [[
173
+ anno::display_name("ColorTex"),
174
+ anno::ui_order(3),
175
+ anno::in_group("Color"),
176
+ sampler_color()
177
+ ]],
178
+ float4 ColorUVW = float4(1.0,1.0,0.0,1.0)
179
+ [[
180
+ anno::display_name("ColorUVW"),
181
+ anno::ui_order(4),
182
+ anno::in_group("Color")
183
+ ]],
184
+ float4 ColorOffset = float4(0.0,0.0,0.0,1.0)
185
+ [[
186
+ anno::display_name("ColorOffset"),
187
+ anno::ui_order(5),
188
+ anno::in_group("Color")
189
+ ]],
190
+ float ColorFalloffValue2Type = 0.0
191
+ [[
192
+ anno::display_name("ColorFalloffValue2Type"),
193
+ anno::ui_order(9),
194
+ anno::in_group("Color")
195
+ ]],
196
+ float ColorFalloffFloat_2 = 0.0
197
+ [[
198
+ anno::display_name("ColorFalloffFloat_2"),
199
+ anno::ui_order(10),
200
+ anno::in_group("Color")
201
+ ]],
202
+ float4 ColorColor_2 = float4(1.0,1.0,1.0,1.0)
203
+ [[
204
+ anno::display_name("ColorColor_2"),
205
+ anno::ui_order(11),
206
+ anno::in_group("Color")
207
+ ]],
208
+ uniform texture_2d ColorTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
209
+ [[
210
+ anno::display_name("ColorTex_2"),
211
+ anno::ui_order(12),
212
+ anno::in_group("Color"),
213
+ sampler_color()
214
+ ]],
215
+ float4 ColorUVW_2 = float4(1.0,1.0,0.0,1.0)
216
+ [[
217
+ anno::display_name("ColorUVW_2"),
218
+ anno::ui_order(13),
219
+ anno::in_group("Color")
220
+ ]],
221
+ float4 ColorOffset_2 = float4(0.0,0.0,0.0,1.0)
222
+ [[
223
+ anno::display_name("ColorOffset_2"),
224
+ anno::ui_order(14),
225
+ anno::in_group("Color")
226
+ ]],
227
+ float ColorFalloffFreshnelIor = 1.6
228
+ [[
229
+ anno::display_name("ColorFalloffFreshnelIor"),
230
+ anno::ui_order(6),
231
+ anno::in_group("Color")
232
+ ]],
233
+ float MetallicIsTexType = 0.0
234
+ [[
235
+ anno::display_name("MetallicIsTexType"),
236
+ anno::description("0 is color, 1 is tex, 2 is falloff
237
+ "),
238
+ anno::ui_order(1),
239
+ anno::in_group("Metallic")
240
+ ]],
241
+ float MetallicFalloffValue1Type = 0.0
242
+ [[
243
+ anno::display_name("MetallicFalloffValue1Type"),
244
+ anno::ui_order(7),
245
+ anno::in_group("Metallic")
246
+ ]],
247
+ float MetallicFalloffFloat = 0.0
248
+ [[
249
+ anno::display_name("MetallicFalloffFloat"),
250
+ anno::ui_order(8),
251
+ anno::in_group("Metallic")
252
+ ]],
253
+ float MetallicFloat = 0.0
254
+ [[
255
+ anno::display_name("MetallicFloat"),
256
+ anno::ui_order(2),
257
+ anno::in_group("Metallic")
258
+ ]],
259
+ uniform texture_2d MetallicTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
260
+ [[
261
+ anno::display_name("MetallicTex"),
262
+ anno::ui_order(3),
263
+ anno::in_group("Metallic"),
264
+ sampler_color()
265
+ ]],
266
+ float4 MetallicUVW = float4(1.0,1.0,0.0,1.0)
267
+ [[
268
+ anno::display_name("MetallicUVW"),
269
+ anno::ui_order(4),
270
+ anno::in_group("Metallic")
271
+ ]],
272
+ float4 MetallicOffset = float4(0.0,0.0,0.0,1.0)
273
+ [[
274
+ anno::display_name("MetallicOffset"),
275
+ anno::ui_order(5),
276
+ anno::in_group("Metallic")
277
+ ]],
278
+ float MetallicFalloffValue2Type = 0.0
279
+ [[
280
+ anno::display_name("MetallicFalloffValue2Type"),
281
+ anno::ui_order(9),
282
+ anno::in_group("Metallic")
283
+ ]],
284
+ float MetallicFalloffFloat_2 = 0.0
285
+ [[
286
+ anno::display_name("MetallicFalloffFloat_2"),
287
+ anno::ui_order(10),
288
+ anno::in_group("Metallic")
289
+ ]],
290
+ float4 MetallicColor_2 = float4(1.0,1.0,1.0,1.0)
291
+ [[
292
+ anno::display_name("MetallicColor_2"),
293
+ anno::ui_order(11),
294
+ anno::in_group("Metallic")
295
+ ]],
296
+ uniform texture_2d MetallicTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
297
+ [[
298
+ anno::display_name("MetallicTex_2"),
299
+ anno::ui_order(12),
300
+ anno::in_group("Metallic"),
301
+ sampler_color()
302
+ ]],
303
+ float4 MetallicUVW_2 = float4(1.0,1.0,0.0,1.0)
304
+ [[
305
+ anno::display_name("MetallicUVW_2"),
306
+ anno::ui_order(13),
307
+ anno::in_group("Metallic")
308
+ ]],
309
+ float4 MetallicOffset_2 = float4(0.0,0.0,0.0,1.0)
310
+ [[
311
+ anno::display_name("MetallicOffset_2"),
312
+ anno::ui_order(14),
313
+ anno::in_group("Metallic")
314
+ ]],
315
+ float MetallicFalloffFreshnelIor = 1.6
316
+ [[
317
+ anno::display_name("MetallicFalloffFreshnelIor"),
318
+ anno::ui_order(6),
319
+ anno::in_group("Metallic")
320
+ ]],
321
+ float SpecularIsTexType = 0.0
322
+ [[
323
+ anno::display_name("SpecularIsTexType"),
324
+ anno::description("0 is color, 1 is tex, 2 is falloff
325
+ "),
326
+ anno::ui_order(1),
327
+ anno::in_group("Specular")
328
+ ]],
329
+ float SpecularFalloffValue1Type = 0.0
330
+ [[
331
+ anno::display_name("SpecularFalloffValue1Type"),
332
+ anno::ui_order(7),
333
+ anno::in_group("Specular")
334
+ ]],
335
+ float SpecularFalloffFloat = 0.0
336
+ [[
337
+ anno::display_name("SpecularFalloffFloat"),
338
+ anno::ui_order(8),
339
+ anno::in_group("Specular")
340
+ ]],
341
+ float SpecularFloat = 0.0
342
+ [[
343
+ anno::display_name("SpecularFloat"),
344
+ anno::ui_order(2),
345
+ anno::in_group("Specular")
346
+ ]],
347
+ uniform texture_2d SpecularTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
348
+ [[
349
+ anno::display_name("SpecularTex"),
350
+ anno::ui_order(3),
351
+ anno::in_group("Specular"),
352
+ sampler_color()
353
+ ]],
354
+ float4 SpecularUVW = float4(1.0,1.0,0.0,1.0)
355
+ [[
356
+ anno::display_name("SpecularUVW"),
357
+ anno::ui_order(4),
358
+ anno::in_group("Specular")
359
+ ]],
360
+ float4 SpecularOffset = float4(0.0,0.0,0.0,1.0)
361
+ [[
362
+ anno::display_name("SpecularOffset"),
363
+ anno::ui_order(5),
364
+ anno::in_group("Specular")
365
+ ]],
366
+ float SpecularFalloffValue2Type = 0.0
367
+ [[
368
+ anno::display_name("SpecularFalloffValue2Type"),
369
+ anno::ui_order(9),
370
+ anno::in_group("Specular")
371
+ ]],
372
+ float SpecularFalloffFloat_2 = 0.0
373
+ [[
374
+ anno::display_name("SpecularFalloffFloat_2"),
375
+ anno::ui_order(10),
376
+ anno::in_group("Specular")
377
+ ]],
378
+ float4 SpecularColor_2 = float4(1.0,1.0,1.0,1.0)
379
+ [[
380
+ anno::display_name("SpecularColor_2"),
381
+ anno::ui_order(11),
382
+ anno::in_group("Specular")
383
+ ]],
384
+ uniform texture_2d SpecularTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
385
+ [[
386
+ anno::display_name("SpecularTex_2"),
387
+ anno::ui_order(12),
388
+ anno::in_group("Specular"),
389
+ sampler_color()
390
+ ]],
391
+ float4 SpecularUVW_2 = float4(1.0,1.0,0.0,1.0)
392
+ [[
393
+ anno::display_name("SpecularUVW_2"),
394
+ anno::ui_order(13),
395
+ anno::in_group("Specular")
396
+ ]],
397
+ float4 SpecularOffset_2 = float4(0.0,0.0,0.0,1.0)
398
+ [[
399
+ anno::display_name("SpecularOffset_2"),
400
+ anno::ui_order(14),
401
+ anno::in_group("Specular")
402
+ ]],
403
+ float SpecularFalloffFreshnelIor = 1.6
404
+ [[
405
+ anno::display_name("SpecularFalloffFreshnelIor"),
406
+ anno::ui_order(6),
407
+ anno::in_group("Specular")
408
+ ]],
409
+ float RoughnessIsTexType = 0.0
410
+ [[
411
+ anno::display_name("RoughnessIsTexType"),
412
+ anno::description("0 is color, 1 is tex, 2 is falloff
413
+ "),
414
+ anno::ui_order(1),
415
+ anno::in_group("Roughness")
416
+ ]],
417
+ float RoughnessFalloffValue1Type = 0.0
418
+ [[
419
+ anno::display_name("RoughnessFalloffValue1Type"),
420
+ anno::ui_order(7),
421
+ anno::in_group("Roughness")
422
+ ]],
423
+ float RoughnessFalloffFloat = 0.0
424
+ [[
425
+ anno::display_name("RoughnessFalloffFloat"),
426
+ anno::ui_order(8),
427
+ anno::in_group("Roughness")
428
+ ]],
429
+ float RoughnessFloat = 0.0
430
+ [[
431
+ anno::display_name("RoughnessFloat"),
432
+ anno::ui_order(2),
433
+ anno::in_group("Roughness")
434
+ ]],
435
+ uniform texture_2d RoughnessTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
436
+ [[
437
+ anno::display_name("RoughnessTex"),
438
+ anno::ui_order(3),
439
+ anno::in_group("Roughness"),
440
+ sampler_color()
441
+ ]],
442
+ float4 RoughnessUVW = float4(1.0,1.0,0.0,1.0)
443
+ [[
444
+ anno::display_name("RoughnessUVW"),
445
+ anno::ui_order(4),
446
+ anno::in_group("Roughness")
447
+ ]],
448
+ float4 RoughnessOffset = float4(0.0,0.0,0.0,1.0)
449
+ [[
450
+ anno::display_name("RoughnessOffset"),
451
+ anno::ui_order(5),
452
+ anno::in_group("Roughness")
453
+ ]],
454
+ float RoughnessFalloffValue2Type = 0.0
455
+ [[
456
+ anno::display_name("RoughnessFalloffValue2Type"),
457
+ anno::ui_order(9),
458
+ anno::in_group("Roughness")
459
+ ]],
460
+ float RoughnessFalloffFloat_2 = 0.0
461
+ [[
462
+ anno::display_name("RoughnessFalloffFloat_2"),
463
+ anno::ui_order(10),
464
+ anno::in_group("Roughness")
465
+ ]],
466
+ float4 RoughnessColor_2 = float4(1.0,1.0,1.0,1.0)
467
+ [[
468
+ anno::display_name("RoughnessColor_2"),
469
+ anno::ui_order(11),
470
+ anno::in_group("Roughness")
471
+ ]],
472
+ uniform texture_2d RoughnessTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
473
+ [[
474
+ anno::display_name("RoughnessTex_2"),
475
+ anno::ui_order(12),
476
+ anno::in_group("Roughness"),
477
+ sampler_color()
478
+ ]],
479
+ float4 RoughnessUVW_2 = float4(1.0,1.0,0.0,1.0)
480
+ [[
481
+ anno::display_name("RoughnessUVW_2"),
482
+ anno::ui_order(13),
483
+ anno::in_group("Roughness")
484
+ ]],
485
+ float4 RoughnessOffset_2 = float4(0.0,0.0,0.0,1.0)
486
+ [[
487
+ anno::display_name("RoughnessOffset_2"),
488
+ anno::ui_order(14),
489
+ anno::in_group("Roughness")
490
+ ]],
491
+ float RoughnessFalloffFreshnelIor = 1.6
492
+ [[
493
+ anno::display_name("RoughnessFalloffFreshnelIor"),
494
+ anno::ui_order(6),
495
+ anno::in_group("Roughness")
496
+ ]],
497
+ float PolygonOffset = 0.0
498
+ [[
499
+ anno::display_name("PolygonOffset"),
500
+ anno::ui_order(32)
501
+ ]],
502
+ int MaxTexCoordIndex = 3
503
+ [[
504
+ anno::hidden()
505
+ ]])
506
+ =
507
+ let {
508
+ float3 Local370 = ::camera_position();
509
+ float3 Local371 = (Local370 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
510
+ float3 Local372 = math::normalize(Local371);
511
+ float3 Local373 = (Local372 * PolygonOffset);
512
+
513
+ float3 WorldPositionOffset_mdl = Local373;
514
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
515
+ float2 CustomizedUV1_mdl = float2(state::texture_coordinate(math::min(1,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(1,MaxTexCoordIndex)).y);
516
+ float2 CustomizedUV2_mdl = float2(state::texture_coordinate(math::min(2,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(2,MaxTexCoordIndex)).y);
517
+ float2 CustomizedUV3_mdl = float2(state::texture_coordinate(math::min(3,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(3,MaxTexCoordIndex)).y);
518
+ float2 CustomizedUV4_mdl = float2(state::texture_coordinate(math::min(4,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(4,MaxTexCoordIndex)).y);
519
+ float2 CustomizedUV5_mdl = float2(state::texture_coordinate(math::min(5,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(5,MaxTexCoordIndex)).y);
520
+ float2 CustomizedUV6_mdl = float2(state::texture_coordinate(math::min(6,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(6,MaxTexCoordIndex)).y);
521
+
522
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
523
+ float Local1 = math::min(math::max(0.0,0.0),6.0);
524
+ float2 Local2 = ((math::abs(Local1 - 1.0) > 0.00001) ? (Local1 >= 1.0 ? CustomizedUV2_mdl : CustomizedUV0_mdl) : CustomizedUV1_mdl);
525
+ float2 Local3 = ((math::abs(Local1 - 3.0) > 0.00001) ? (Local1 >= 3.0 ? CustomizedUV4_mdl : Local2) : CustomizedUV3_mdl);
526
+ float2 Local4 = ((math::abs(Local1 - 5.0) > 0.00001) ? (Local1 >= 5.0 ? CustomizedUV6_mdl : Local3) : CustomizedUV5_mdl);
527
+ float Local5 = (Local4.x * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).x);
528
+ float Local6 = (Local4.y * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
529
+ float Local7 = (1.0 - float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
530
+ float Local8 = (Local6 + Local7);
531
+ float Local9 = (float2(Local5,Local8).x + float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).x);
532
+ float Local10 = (float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).y * -1.0);
533
+ float Local11 = (float2(Local5,Local8).y + Local10);
534
+ float2 Local12 = (Local0 + float2(Local9,Local11));
535
+ float Local13 = (float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).z * 6.283185);
536
+ float Local14 = math::cos(Local13);
537
+ float Local15 = math::sin(Local13);
538
+ float Local16 = (Local15 * -1.0);
539
+ float Local17 = math::dot(Local12, float2(Local14,Local16));
540
+ float Local18 = math::dot(Local12, float2(Local15,Local14));
541
+ float2 Local19 = (float2(0.5,0.5) + float2(Local17,Local18));
542
+ float4 Local20 = ::unpack_normal_map(tex::lookup_float4(NormalTex,float2(Local19.x,1.0-Local19.y),tex::wrap_repeat,tex::wrap_repeat));
543
+ float2 Local21 = (float2(float3(Local20.x,Local20.y,Local20.z).x,float3(Local20.x,Local20.y,Local20.z).y) * NormalIntensity);
544
+ float3 Local22 = math::normalize(float3(Local21.x,Local21.y,float3(Local20.x,Local20.y,Local20.z).z));
545
+ float3 Local23 = ((math::abs(IsFlip - 1.0) > 0.00001) ? (Local22) : Local22);
546
+ float Local24 = (Local23.z + 1.0);
547
+ float2 Local25 = (float2(float3(0.0,0.0,1.0).x,float3(0.0,0.0,1.0).y) * -1.0);
548
+ float Local26 = math::dot(float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24), float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
549
+ float3 Local27 = (float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24) * Local26);
550
+ float3 Local28 = (Local24 * float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
551
+ float3 Local29 = (Local27 - Local28);
552
+ float3 Local30 = math::normalize(Local29);
553
+ float3 Local31 = ((math::abs(IsNormal - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : Local30);
554
+
555
+ float3 Normal_mdl = Local31;
556
+
557
+ float Local32 = (Local4.x * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).x);
558
+ float Local33 = (Local4.y * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
559
+ float Local34 = (1.0 - float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
560
+ float Local35 = (Local33 + Local34);
561
+ float Local36 = (float2(Local32,Local35).x + float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).x);
562
+ float Local37 = (float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).y * -1.0);
563
+ float Local38 = (float2(Local32,Local35).y + Local37);
564
+ float2 Local39 = (Local0 + float2(Local36,Local38));
565
+ float Local40 = (float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).z * 6.283185);
566
+ float Local41 = math::cos(Local40);
567
+ float Local42 = math::sin(Local40);
568
+ float Local43 = (Local42 * -1.0);
569
+ float Local44 = math::dot(Local39, float2(Local41,Local43));
570
+ float Local45 = math::dot(Local39, float2(Local42,Local41));
571
+ float2 Local46 = (float2(0.5,0.5) + float2(Local44,Local45));
572
+ float4 Local47 = tex::lookup_float4(EmissionTex,float2(Local46.x,1.0-Local46.y),tex::wrap_repeat,tex::wrap_repeat);
573
+ float3 Local48 = ((math::abs(EmissionFalloffValue1Type - 1.0) > 0.00001) ? (EmissionFalloffValue1Type >= 1.0 ? float3(float2(EmissionFalloffFloat,EmissionFalloffFloat).x,float2(EmissionFalloffFloat,EmissionFalloffFloat).y,EmissionFalloffFloat) : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
574
+ float Local49 = (Local4.x * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).x);
575
+ float Local50 = (Local4.y * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
576
+ float Local51 = (1.0 - float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
577
+ float Local52 = (Local50 + Local51);
578
+ float Local53 = (float2(Local49,Local52).x + float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).x);
579
+ float Local54 = (float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).y * -1.0);
580
+ float Local55 = (float2(Local49,Local52).y + Local54);
581
+ float2 Local56 = (Local0 + float2(Local53,Local55));
582
+ float Local57 = (float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).z * 6.283185);
583
+ float Local58 = math::cos(Local57);
584
+ float Local59 = math::sin(Local57);
585
+ float Local60 = (Local59 * -1.0);
586
+ float Local61 = math::dot(Local56, float2(Local58,Local60));
587
+ float Local62 = math::dot(Local56, float2(Local59,Local58));
588
+ float2 Local63 = (float2(0.5,0.5) + float2(Local61,Local62));
589
+ float4 Local64 = tex::lookup_float4(EmissionTex_2,float2(Local63.x,1.0-Local63.y),tex::wrap_repeat,tex::wrap_repeat);
590
+ float3 Local65 = ((math::abs(EmissionFalloffValue2Type - 1.0) > 0.00001) ? (EmissionFalloffValue2Type >= 1.0 ? float3(float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).x,float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).y,EmissionFalloffFloat_2) : float3(EmissionColor_2.x,EmissionColor_2.y,EmissionColor_2.z)) : float3(Local64.x,Local64.y,Local64.z));
591
+ float Local66 = math::min(math::max(EmissionFalloffFreshnelIor,0.0),100.0);
592
+ float Local67 = (1.0 / Local66);
593
+ float Local68 = math::max(Local66,Local67);
594
+ float Local69 = (Local68 - 1.0);
595
+ float Local70 = (Local68 * Local68);
596
+ float Local71 = math::dot(::pixel_normal_world_space(true), ::camera_vector(true));
597
+ float Local72 = (Local71 * Local71);
598
+ float Local73 = (Local70 + Local72);
599
+ float Local74 = (Local73 - 1.0);
600
+ float Local75 = math::sqrt(Local74);
601
+ float Local76 = (Local75 / Local68);
602
+ float Local77 = ((math::abs(Local76 - 0.99999) > 0.000001) ? (Local76 >= 0.99999 ? 1.0 : 0.0) : 0.0);
603
+ float Local78 = ((math::abs(Local71 - 0.99999) > 0.000001) ? (Local71 >= 0.99999 ? 1.0 : 0.0) : 0.0);
604
+ float Local79 = math::max(Local77,Local78);
605
+ float Local80 = (Local71 / Local76);
606
+ float Local81 = (Local68 * Local80);
607
+ float Local82 = (Local81 - 1.0);
608
+ float Local83 = (Local81 + 1.0);
609
+ float Local84 = (Local82 / Local83);
610
+ float Local85 = math::pow(math::max(Local84,float(0.000001)),2.0);
611
+ float Local86 = (Local76 / Local71);
612
+ float Local87 = (Local68 * Local86);
613
+ float Local88 = (Local87 - 1.0);
614
+ float Local89 = (Local87 + 1.0);
615
+ float Local90 = (Local88 / Local89);
616
+ float Local91 = math::pow(math::max(Local90,float(0.000001)),2.0);
617
+ float Local92 = (Local85 + Local91);
618
+ float Local93 = (Local92 * 0.5);
619
+ float Local94 = (Local68 + 1.0);
620
+ float Local95 = (Local69 / Local94);
621
+ float Local96 = math::pow(math::max(Local95,float(0.000001)),2.0);
622
+ float Local97 = ((math::abs(Local79 - 1.0) > 0.1) ? (Local93) : Local96);
623
+ float Local98 = ((math::abs(Local69 - 0.0) > 0.000001) ? (Local97) : 0.0);
624
+ float Local99 = math::saturate(Local98);
625
+ float3 Local100 = math::lerp(Local48,Local65,Local99);
626
+ float3 Local101 = ((math::abs(EmissionIsTexType - 1.0) > 0.00001) ? (EmissionIsTexType >= 1.0 ? Local100 : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
627
+ float Local102 = (Local4.x * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).x);
628
+ float Local103 = (Local4.y * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
629
+ float Local104 = (1.0 - float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
630
+ float Local105 = (Local103 + Local104);
631
+ float Local106 = (float2(Local102,Local105).x + float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).x);
632
+ float Local107 = (float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).y * -1.0);
633
+ float Local108 = (float2(Local102,Local105).y + Local107);
634
+ float2 Local109 = (Local0 + float2(Local106,Local108));
635
+ float Local110 = (float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).z * 6.283185);
636
+ float Local111 = math::cos(Local110);
637
+ float Local112 = math::sin(Local110);
638
+ float Local113 = (Local112 * -1.0);
639
+ float Local114 = math::dot(Local109, float2(Local111,Local113));
640
+ float Local115 = math::dot(Local109, float2(Local112,Local111));
641
+ float2 Local116 = (float2(0.5,0.5) + float2(Local114,Local115));
642
+ float4 Local117 = tex::lookup_float4(ColorTex,float2(Local116.x,1.0-Local116.y),tex::wrap_repeat,tex::wrap_repeat);
643
+ float3 Local118 = ((math::abs(ColorFalloffValue1Type - 1.0) > 0.00001) ? (ColorFalloffValue1Type >= 1.0 ? float3(float2(ColorFalloffFloat,ColorFalloffFloat).x,float2(ColorFalloffFloat,ColorFalloffFloat).y,ColorFalloffFloat) : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
644
+ float Local119 = (Local4.x * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).x);
645
+ float Local120 = (Local4.y * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
646
+ float Local121 = (1.0 - float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
647
+ float Local122 = (Local120 + Local121);
648
+ float Local123 = (float2(Local119,Local122).x + float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).x);
649
+ float Local124 = (float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).y * -1.0);
650
+ float Local125 = (float2(Local119,Local122).y + Local124);
651
+ float2 Local126 = (Local0 + float2(Local123,Local125));
652
+ float Local127 = (float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).z * 6.283185);
653
+ float Local128 = math::cos(Local127);
654
+ float Local129 = math::sin(Local127);
655
+ float Local130 = (Local129 * -1.0);
656
+ float Local131 = math::dot(Local126, float2(Local128,Local130));
657
+ float Local132 = math::dot(Local126, float2(Local129,Local128));
658
+ float2 Local133 = (float2(0.5,0.5) + float2(Local131,Local132));
659
+ float4 Local134 = tex::lookup_float4(ColorTex_2,float2(Local133.x,1.0-Local133.y),tex::wrap_repeat,tex::wrap_repeat);
660
+ float3 Local135 = ((math::abs(ColorFalloffValue2Type - 1.0) > 0.00001) ? (ColorFalloffValue2Type >= 1.0 ? float3(float2(ColorFalloffFloat_2,ColorFalloffFloat_2).x,float2(ColorFalloffFloat_2,ColorFalloffFloat_2).y,ColorFalloffFloat_2) : float3(ColorColor_2.x,ColorColor_2.y,ColorColor_2.z)) : float3(Local134.x,Local134.y,Local134.z));
661
+ float Local136 = math::min(math::max(ColorFalloffFreshnelIor,0.0),100.0);
662
+ float Local137 = (1.0 / Local136);
663
+ float Local138 = math::max(Local136,Local137);
664
+ float Local139 = (Local138 - 1.0);
665
+ float Local140 = (Local138 * Local138);
666
+ float Local141 = (Local140 + Local72);
667
+ float Local142 = (Local141 - 1.0);
668
+ float Local143 = math::sqrt(Local142);
669
+ float Local144 = (Local143 / Local138);
670
+ float Local145 = ((math::abs(Local144 - 0.99999) > 0.000001) ? (Local144 >= 0.99999 ? 1.0 : 0.0) : 0.0);
671
+ float Local146 = math::max(Local145,Local78);
672
+ float Local147 = (Local71 / Local144);
673
+ float Local148 = (Local138 * Local147);
674
+ float Local149 = (Local148 - 1.0);
675
+ float Local150 = (Local148 + 1.0);
676
+ float Local151 = (Local149 / Local150);
677
+ float Local152 = math::pow(math::max(Local151,float(0.000001)),2.0);
678
+ float Local153 = (Local144 / Local71);
679
+ float Local154 = (Local138 * Local153);
680
+ float Local155 = (Local154 - 1.0);
681
+ float Local156 = (Local154 + 1.0);
682
+ float Local157 = (Local155 / Local156);
683
+ float Local158 = math::pow(math::max(Local157,float(0.000001)),2.0);
684
+ float Local159 = (Local152 + Local158);
685
+ float Local160 = (Local159 * 0.5);
686
+ float Local161 = (Local138 + 1.0);
687
+ float Local162 = (Local139 / Local161);
688
+ float Local163 = math::pow(math::max(Local162,float(0.000001)),2.0);
689
+ float Local164 = ((math::abs(Local146 - 1.0) > 0.1) ? (Local160) : Local163);
690
+ float Local165 = ((math::abs(Local139 - 0.0) > 0.000001) ? (Local164) : 0.0);
691
+ float Local166 = math::saturate(Local165);
692
+ float3 Local167 = math::lerp(Local118,Local135,Local166);
693
+ float3 Local168 = ((math::abs(ColorIsTexType - 1.0) > 0.00001) ? (ColorIsTexType >= 1.0 ? Local167 : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
694
+ float Local169 = (Local4.x * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).x);
695
+ float Local170 = (Local4.y * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
696
+ float Local171 = (1.0 - float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
697
+ float Local172 = (Local170 + Local171);
698
+ float Local173 = (float2(Local169,Local172).x + float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).x);
699
+ float Local174 = (float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).y * -1.0);
700
+ float Local175 = (float2(Local169,Local172).y + Local174);
701
+ float2 Local176 = (Local0 + float2(Local173,Local175));
702
+ float Local177 = (float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).z * 6.283185);
703
+ float Local178 = math::cos(Local177);
704
+ float Local179 = math::sin(Local177);
705
+ float Local180 = (Local179 * -1.0);
706
+ float Local181 = math::dot(Local176, float2(Local178,Local180));
707
+ float Local182 = math::dot(Local176, float2(Local179,Local178));
708
+ float2 Local183 = (float2(0.5,0.5) + float2(Local181,Local182));
709
+ float4 Local184 = tex::lookup_float4(MetallicTex,float2(Local183.x,1.0-Local183.y),tex::wrap_repeat,tex::wrap_repeat);
710
+ float3 Local185 = ((math::abs(MetallicFalloffValue1Type - 1.0) > 0.00001) ? (MetallicFalloffValue1Type >= 1.0 ? float3(float2(MetallicFalloffFloat,MetallicFalloffFloat).x,float2(MetallicFalloffFloat,MetallicFalloffFloat).y,MetallicFalloffFloat) : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
711
+ float Local186 = (Local4.x * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).x);
712
+ float Local187 = (Local4.y * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
713
+ float Local188 = (1.0 - float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
714
+ float Local189 = (Local187 + Local188);
715
+ float Local190 = (float2(Local186,Local189).x + float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).x);
716
+ float Local191 = (float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).y * -1.0);
717
+ float Local192 = (float2(Local186,Local189).y + Local191);
718
+ float2 Local193 = (Local0 + float2(Local190,Local192));
719
+ float Local194 = (float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).z * 6.283185);
720
+ float Local195 = math::cos(Local194);
721
+ float Local196 = math::sin(Local194);
722
+ float Local197 = (Local196 * -1.0);
723
+ float Local198 = math::dot(Local193, float2(Local195,Local197));
724
+ float Local199 = math::dot(Local193, float2(Local196,Local195));
725
+ float2 Local200 = (float2(0.5,0.5) + float2(Local198,Local199));
726
+ float4 Local201 = tex::lookup_float4(MetallicTex_2,float2(Local200.x,1.0-Local200.y),tex::wrap_repeat,tex::wrap_repeat);
727
+ float3 Local202 = ((math::abs(MetallicFalloffValue2Type - 1.0) > 0.00001) ? (MetallicFalloffValue2Type >= 1.0 ? float3(float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).x,float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).y,MetallicFalloffFloat_2) : float3(MetallicColor_2.x,MetallicColor_2.y,MetallicColor_2.z)) : float3(Local201.x,Local201.y,Local201.z));
728
+ float Local203 = math::min(math::max(MetallicFalloffFreshnelIor,0.0),100.0);
729
+ float Local204 = (1.0 / Local203);
730
+ float Local205 = math::max(Local203,Local204);
731
+ float Local206 = (Local205 - 1.0);
732
+ float Local207 = (Local205 * Local205);
733
+ float Local208 = (Local207 + Local72);
734
+ float Local209 = (Local208 - 1.0);
735
+ float Local210 = math::sqrt(Local209);
736
+ float Local211 = (Local210 / Local205);
737
+ float Local212 = ((math::abs(Local211 - 0.99999) > 0.000001) ? (Local211 >= 0.99999 ? 1.0 : 0.0) : 0.0);
738
+ float Local213 = math::max(Local212,Local78);
739
+ float Local214 = (Local71 / Local211);
740
+ float Local215 = (Local205 * Local214);
741
+ float Local216 = (Local215 - 1.0);
742
+ float Local217 = (Local215 + 1.0);
743
+ float Local218 = (Local216 / Local217);
744
+ float Local219 = math::pow(math::max(Local218,float(0.000001)),2.0);
745
+ float Local220 = (Local211 / Local71);
746
+ float Local221 = (Local205 * Local220);
747
+ float Local222 = (Local221 - 1.0);
748
+ float Local223 = (Local221 + 1.0);
749
+ float Local224 = (Local222 / Local223);
750
+ float Local225 = math::pow(math::max(Local224,float(0.000001)),2.0);
751
+ float Local226 = (Local219 + Local225);
752
+ float Local227 = (Local226 * 0.5);
753
+ float Local228 = (Local205 + 1.0);
754
+ float Local229 = (Local206 / Local228);
755
+ float Local230 = math::pow(math::max(Local229,float(0.000001)),2.0);
756
+ float Local231 = ((math::abs(Local213 - 1.0) > 0.1) ? (Local227) : Local230);
757
+ float Local232 = ((math::abs(Local206 - 0.0) > 0.000001) ? (Local231) : 0.0);
758
+ float Local233 = math::saturate(Local232);
759
+ float3 Local234 = math::lerp(Local185,Local202,Local233);
760
+ float3 Local235 = ((math::abs(MetallicIsTexType - 1.0) > 0.00001) ? (MetallicIsTexType >= 1.0 ? Local234 : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
761
+ float Local236 = (Local4.x * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).x);
762
+ float Local237 = (Local4.y * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
763
+ float Local238 = (1.0 - float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
764
+ float Local239 = (Local237 + Local238);
765
+ float Local240 = (float2(Local236,Local239).x + float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).x);
766
+ float Local241 = (float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).y * -1.0);
767
+ float Local242 = (float2(Local236,Local239).y + Local241);
768
+ float2 Local243 = (Local0 + float2(Local240,Local242));
769
+ float Local244 = (float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).z * 6.283185);
770
+ float Local245 = math::cos(Local244);
771
+ float Local246 = math::sin(Local244);
772
+ float Local247 = (Local246 * -1.0);
773
+ float Local248 = math::dot(Local243, float2(Local245,Local247));
774
+ float Local249 = math::dot(Local243, float2(Local246,Local245));
775
+ float2 Local250 = (float2(0.5,0.5) + float2(Local248,Local249));
776
+ float4 Local251 = tex::lookup_float4(SpecularTex,float2(Local250.x,1.0-Local250.y),tex::wrap_repeat,tex::wrap_repeat);
777
+ float3 Local252 = ((math::abs(SpecularFalloffValue1Type - 1.0) > 0.00001) ? (SpecularFalloffValue1Type >= 1.0 ? float3(float2(SpecularFalloffFloat,SpecularFalloffFloat).x,float2(SpecularFalloffFloat,SpecularFalloffFloat).y,SpecularFalloffFloat) : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
778
+ float Local253 = (Local4.x * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).x);
779
+ float Local254 = (Local4.y * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
780
+ float Local255 = (1.0 - float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
781
+ float Local256 = (Local254 + Local255);
782
+ float Local257 = (float2(Local253,Local256).x + float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).x);
783
+ float Local258 = (float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).y * -1.0);
784
+ float Local259 = (float2(Local253,Local256).y + Local258);
785
+ float2 Local260 = (Local0 + float2(Local257,Local259));
786
+ float Local261 = (float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).z * 6.283185);
787
+ float Local262 = math::cos(Local261);
788
+ float Local263 = math::sin(Local261);
789
+ float Local264 = (Local263 * -1.0);
790
+ float Local265 = math::dot(Local260, float2(Local262,Local264));
791
+ float Local266 = math::dot(Local260, float2(Local263,Local262));
792
+ float2 Local267 = (float2(0.5,0.5) + float2(Local265,Local266));
793
+ float4 Local268 = tex::lookup_float4(SpecularTex_2,float2(Local267.x,1.0-Local267.y),tex::wrap_repeat,tex::wrap_repeat);
794
+ float3 Local269 = ((math::abs(SpecularFalloffValue2Type - 1.0) > 0.00001) ? (SpecularFalloffValue2Type >= 1.0 ? float3(float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).x,float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).y,SpecularFalloffFloat_2) : float3(SpecularColor_2.x,SpecularColor_2.y,SpecularColor_2.z)) : float3(Local268.x,Local268.y,Local268.z));
795
+ float Local270 = math::min(math::max(SpecularFalloffFreshnelIor,0.0),100.0);
796
+ float Local271 = (1.0 / Local270);
797
+ float Local272 = math::max(Local270,Local271);
798
+ float Local273 = (Local272 - 1.0);
799
+ float Local274 = (Local272 * Local272);
800
+ float Local275 = (Local274 + Local72);
801
+ float Local276 = (Local275 - 1.0);
802
+ float Local277 = math::sqrt(Local276);
803
+ float Local278 = (Local277 / Local272);
804
+ float Local279 = ((math::abs(Local278 - 0.99999) > 0.000001) ? (Local278 >= 0.99999 ? 1.0 : 0.0) : 0.0);
805
+ float Local280 = math::max(Local279,Local78);
806
+ float Local281 = (Local71 / Local278);
807
+ float Local282 = (Local272 * Local281);
808
+ float Local283 = (Local282 - 1.0);
809
+ float Local284 = (Local282 + 1.0);
810
+ float Local285 = (Local283 / Local284);
811
+ float Local286 = math::pow(math::max(Local285,float(0.000001)),2.0);
812
+ float Local287 = (Local278 / Local71);
813
+ float Local288 = (Local272 * Local287);
814
+ float Local289 = (Local288 - 1.0);
815
+ float Local290 = (Local288 + 1.0);
816
+ float Local291 = (Local289 / Local290);
817
+ float Local292 = math::pow(math::max(Local291,float(0.000001)),2.0);
818
+ float Local293 = (Local286 + Local292);
819
+ float Local294 = (Local293 * 0.5);
820
+ float Local295 = (Local272 + 1.0);
821
+ float Local296 = (Local273 / Local295);
822
+ float Local297 = math::pow(math::max(Local296,float(0.000001)),2.0);
823
+ float Local298 = ((math::abs(Local280 - 1.0) > 0.1) ? (Local294) : Local297);
824
+ float Local299 = ((math::abs(Local273 - 0.0) > 0.000001) ? (Local298) : 0.0);
825
+ float Local300 = math::saturate(Local299);
826
+ float3 Local301 = math::lerp(Local252,Local269,Local300);
827
+ float3 Local302 = ((math::abs(SpecularIsTexType - 1.0) > 0.00001) ? (SpecularIsTexType >= 1.0 ? Local301 : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
828
+ float Local303 = (Local4.x * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).x);
829
+ float Local304 = (Local4.y * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
830
+ float Local305 = (1.0 - float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
831
+ float Local306 = (Local304 + Local305);
832
+ float Local307 = (float2(Local303,Local306).x + float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).x);
833
+ float Local308 = (float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).y * -1.0);
834
+ float Local309 = (float2(Local303,Local306).y + Local308);
835
+ float2 Local310 = (Local0 + float2(Local307,Local309));
836
+ float Local311 = (float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).z * 6.283185);
837
+ float Local312 = math::cos(Local311);
838
+ float Local313 = math::sin(Local311);
839
+ float Local314 = (Local313 * -1.0);
840
+ float Local315 = math::dot(Local310, float2(Local312,Local314));
841
+ float Local316 = math::dot(Local310, float2(Local313,Local312));
842
+ float2 Local317 = (float2(0.5,0.5) + float2(Local315,Local316));
843
+ float4 Local318 = tex::lookup_float4(RoughnessTex,float2(Local317.x,1.0-Local317.y),tex::wrap_repeat,tex::wrap_repeat);
844
+ float3 Local319 = ((math::abs(RoughnessFalloffValue1Type - 1.0) > 0.00001) ? (RoughnessFalloffValue1Type >= 1.0 ? float3(float2(RoughnessFalloffFloat,RoughnessFalloffFloat).x,float2(RoughnessFalloffFloat,RoughnessFalloffFloat).y,RoughnessFalloffFloat) : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
845
+ float Local320 = (Local4.x * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).x);
846
+ float Local321 = (Local4.y * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
847
+ float Local322 = (1.0 - float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
848
+ float Local323 = (Local321 + Local322);
849
+ float Local324 = (float2(Local320,Local323).x + float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).x);
850
+ float Local325 = (float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).y * -1.0);
851
+ float Local326 = (float2(Local320,Local323).y + Local325);
852
+ float2 Local327 = (Local0 + float2(Local324,Local326));
853
+ float Local328 = (float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).z * 6.283185);
854
+ float Local329 = math::cos(Local328);
855
+ float Local330 = math::sin(Local328);
856
+ float Local331 = (Local330 * -1.0);
857
+ float Local332 = math::dot(Local327, float2(Local329,Local331));
858
+ float Local333 = math::dot(Local327, float2(Local330,Local329));
859
+ float2 Local334 = (float2(0.5,0.5) + float2(Local332,Local333));
860
+ float4 Local335 = tex::lookup_float4(RoughnessTex_2,float2(Local334.x,1.0-Local334.y),tex::wrap_repeat,tex::wrap_repeat);
861
+ float3 Local336 = ((math::abs(RoughnessFalloffValue2Type - 1.0) > 0.00001) ? (RoughnessFalloffValue2Type >= 1.0 ? float3(float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).x,float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).y,RoughnessFalloffFloat_2) : float3(RoughnessColor_2.x,RoughnessColor_2.y,RoughnessColor_2.z)) : float3(Local335.x,Local335.y,Local335.z));
862
+ float Local337 = math::min(math::max(RoughnessFalloffFreshnelIor,0.0),100.0);
863
+ float Local338 = (1.0 / Local337);
864
+ float Local339 = math::max(Local337,Local338);
865
+ float Local340 = (Local339 - 1.0);
866
+ float Local341 = (Local339 * Local339);
867
+ float Local342 = (Local341 + Local72);
868
+ float Local343 = (Local342 - 1.0);
869
+ float Local344 = math::sqrt(Local343);
870
+ float Local345 = (Local344 / Local339);
871
+ float Local346 = ((math::abs(Local345 - 0.99999) > 0.000001) ? (Local345 >= 0.99999 ? 1.0 : 0.0) : 0.0);
872
+ float Local347 = math::max(Local346,Local78);
873
+ float Local348 = (Local71 / Local345);
874
+ float Local349 = (Local339 * Local348);
875
+ float Local350 = (Local349 - 1.0);
876
+ float Local351 = (Local349 + 1.0);
877
+ float Local352 = (Local350 / Local351);
878
+ float Local353 = math::pow(math::max(Local352,float(0.000001)),2.0);
879
+ float Local354 = (Local345 / Local71);
880
+ float Local355 = (Local339 * Local354);
881
+ float Local356 = (Local355 - 1.0);
882
+ float Local357 = (Local355 + 1.0);
883
+ float Local358 = (Local356 / Local357);
884
+ float Local359 = math::pow(math::max(Local358,float(0.000001)),2.0);
885
+ float Local360 = (Local353 + Local359);
886
+ float Local361 = (Local360 * 0.5);
887
+ float Local362 = (Local339 + 1.0);
888
+ float Local363 = (Local340 / Local362);
889
+ float Local364 = math::pow(math::max(Local363,float(0.000001)),2.0);
890
+ float Local365 = ((math::abs(Local347 - 1.0) > 0.1) ? (Local361) : Local364);
891
+ float Local366 = ((math::abs(Local340 - 0.0) > 0.000001) ? (Local365) : 0.0);
892
+ float Local367 = math::saturate(Local366);
893
+ float3 Local368 = math::lerp(Local319,Local336,Local367);
894
+ float3 Local369 = ((math::abs(RoughnessIsTexType - 1.0) > 0.00001) ? (RoughnessIsTexType >= 1.0 ? Local368 : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
895
+
896
+ float3 EmissiveColor_mdl = Local101;
897
+ float OpacityMask_mdl = 1.0;
898
+ float3 BaseColor_mdl = Local168;
899
+ float Metallic_mdl = Local235.x;
900
+ float Specular_mdl = Local302.x;
901
+ float Roughness_mdl = Local369.x;
902
+ float SurfaceThickness_mdl = 0.01;
903
+
904
+ } in
905
+ ::OmniUe4Base(
906
+ base_color: BaseColor_mdl,
907
+ metallic: Metallic_mdl,
908
+ roughness: Roughness_mdl,
909
+ specular: Specular_mdl,
910
+ normal: Normal_mdl,
911
+ opacity: OpacityMask_mdl,
912
+ emissive_color: EmissiveColor_mdl,
913
+ displacement: WorldPositionOffset_mdl,
914
+ two_sided: true);
kujiale_0003/Materials/M_TranslucentMaterial.mdl ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Translucent import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_TranslucentMaterial(
21
+ float IsNormalTex = 0.0
22
+ [[
23
+ anno::display_name("IsNormalTex"),
24
+ anno::ui_order(32),
25
+ anno::in_group("Normal")
26
+ ]],
27
+ uniform texture_2d Normal_Tex = texture_2d("./Textures/T_Normal.png",::tex::gamma_linear)
28
+ [[
29
+ anno::display_name("Normal_Tex"),
30
+ anno::ui_order(32),
31
+ anno::in_group("Normal"),
32
+ sampler_normal()
33
+ ]],
34
+ float4 Normal_UVA = float4(1.0,1.0,0.0,0.0)
35
+ [[
36
+ anno::display_name("Normal_UVA"),
37
+ anno::ui_order(32),
38
+ anno::in_group("Normal")
39
+ ]],
40
+ float EmissiveIntensity = 0.0
41
+ [[
42
+ anno::display_name("EmissiveIntensity"),
43
+ anno::ui_order(32),
44
+ anno::in_group("EmissiveColor")
45
+ ]],
46
+ float IsEmissiveTex = 0.0
47
+ [[
48
+ anno::display_name("IsEmissiveTex"),
49
+ anno::in_group("EmissiveColor")
50
+ ]],
51
+ float4 Emissive_Color = float4(1.0,1.0,1.0,1.0)
52
+ [[
53
+ anno::display_name("Emissive_Color"),
54
+ anno::ui_order(32),
55
+ anno::in_group("EmissiveColor")
56
+ ]],
57
+ uniform texture_2d Emissive_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
58
+ [[
59
+ anno::display_name("Emissive_Tex"),
60
+ anno::ui_order(32),
61
+ anno::in_group("EmissiveColor"),
62
+ sampler_color()
63
+ ]],
64
+ float4 Emissive_UVA = float4(1.0,1.0,0.0,0.0)
65
+ [[
66
+ anno::display_name("Emissive_UVA"),
67
+ anno::ui_order(32),
68
+ anno::in_group("EmissiveColor")
69
+ ]],
70
+ float IsBaseColorTex = 0.0
71
+ [[
72
+ anno::display_name("IsBaseColorTex"),
73
+ anno::in_group("BaseColor")
74
+ ]],
75
+ float4 BaseColor_Color = float4(1.0,1.0,1.0,1.0)
76
+ [[
77
+ anno::display_name("BaseColor_Color"),
78
+ anno::ui_order(32),
79
+ anno::in_group("BaseColor")
80
+ ]],
81
+ uniform texture_2d BaseColor_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
82
+ [[
83
+ anno::display_name("BaseColor_Tex"),
84
+ anno::ui_order(32),
85
+ anno::in_group("BaseColor"),
86
+ sampler_color()
87
+ ]],
88
+ float4 BaseColor_UVA = float4(1.0,1.0,0.0,0.0)
89
+ [[
90
+ anno::display_name("BaseColor_UVA"),
91
+ anno::ui_order(32),
92
+ anno::in_group("BaseColor")
93
+ ]],
94
+ float IsMetallicTex = 0.0
95
+ [[
96
+ anno::display_name("IsMetallicTex"),
97
+ anno::in_group("Metallic")
98
+ ]],
99
+ float4 Metallic_Color = float4(0.0,0.0,0.0,1.0)
100
+ [[
101
+ anno::display_name("Metallic_Color"),
102
+ anno::ui_order(32),
103
+ anno::in_group("Metallic")
104
+ ]],
105
+ uniform texture_2d Metallic_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
106
+ [[
107
+ anno::display_name("Metallic_Tex"),
108
+ anno::ui_order(32),
109
+ anno::in_group("Metallic"),
110
+ sampler_color()
111
+ ]],
112
+ float4 Metallic_UVA = float4(1.0,1.0,0.0,0.0)
113
+ [[
114
+ anno::display_name("Metallic_UVA"),
115
+ anno::ui_order(32),
116
+ anno::in_group("Metallic")
117
+ ]],
118
+ float IsSpecularTex = 0.0
119
+ [[
120
+ anno::display_name("IsSpecularTex"),
121
+ anno::in_group("Specular")
122
+ ]],
123
+ float4 Specular_Color = float4(1.0,1.0,1.0,1.0)
124
+ [[
125
+ anno::display_name("Specular_Color"),
126
+ anno::ui_order(32),
127
+ anno::in_group("Specular")
128
+ ]],
129
+ uniform texture_2d Specular_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
130
+ [[
131
+ anno::display_name("Specular_Tex"),
132
+ anno::ui_order(32),
133
+ anno::in_group("Specular"),
134
+ sampler_color()
135
+ ]],
136
+ float4 Specular_UVA = float4(1.0,1.0,0.0,0.0)
137
+ [[
138
+ anno::display_name("Specular_UVA"),
139
+ anno::ui_order(32),
140
+ anno::in_group("Specular")
141
+ ]],
142
+ float IsGlossTex = 0.0
143
+ [[
144
+ anno::display_name("IsGlossTex"),
145
+ anno::in_group("Roughness")
146
+ ]],
147
+ float4 Gloss_Color = float4(0.1,0.1,0.1,1.0)
148
+ [[
149
+ anno::display_name("Gloss_Color"),
150
+ anno::ui_order(32),
151
+ anno::in_group("Roughness")
152
+ ]],
153
+ uniform texture_2d Gloss_Tex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
154
+ [[
155
+ anno::display_name("Gloss_Tex"),
156
+ anno::ui_order(32),
157
+ anno::in_group("Roughness"),
158
+ sampler_color()
159
+ ]],
160
+ float4 Gloss_UVA = float4(1.0,1.0,0.0,0.0)
161
+ [[
162
+ anno::display_name("Gloss_UVA"),
163
+ anno::ui_order(32),
164
+ anno::in_group("Roughness")
165
+ ]],
166
+ float Opacity = 0.5
167
+ [[
168
+ anno::display_name("Opacity"),
169
+ anno::ui_order(32),
170
+ anno::in_group("Translucent")
171
+ ]],
172
+ float PolygonOffset = 0.0
173
+ [[
174
+ anno::display_name("PolygonOffset"),
175
+ anno::ui_order(32),
176
+ anno::in_group("WorldPosition")
177
+ ]],
178
+ uniform float SwitchRefraction = 0.0
179
+ [[
180
+ anno::display_name("SwitchRefraction"),
181
+ anno::ui_order(32),
182
+ anno::in_group("Refraction")
183
+ ]],
184
+ uniform float FresnelB = 1.517
185
+ [[
186
+ anno::display_name("FresnelB"),
187
+ anno::ui_order(32),
188
+ anno::in_group("Refraction")
189
+ ]],
190
+ int MaxTexCoordIndex = 3
191
+ [[
192
+ anno::hidden()
193
+ ]])
194
+ =
195
+ let {
196
+ float3 Local82 = ::camera_position();
197
+ float3 Local83 = (Local82 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
198
+ float3 Local84 = math::normalize(Local83);
199
+ float3 Local85 = (Local84 * PolygonOffset);
200
+
201
+ float3 WorldPositionOffset_mdl = Local85;
202
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
203
+
204
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
205
+ float Local1 = (CustomizedUV0_mdl.x * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).x);
206
+ float Local2 = (CustomizedUV0_mdl.y * float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).y);
207
+ float2 Local3 = (Local0 + float2(Local1,Local2));
208
+ float Local4 = (3.141592 * -2.0);
209
+ float Local5 = (float3(Normal_UVA.x,Normal_UVA.y,Normal_UVA.z).z / Local4);
210
+ float Local6 = (Local5 * 6.283185);
211
+ float Local7 = math::cos(Local6);
212
+ float Local8 = math::sin(Local6);
213
+ float Local9 = (Local8 * -1.0);
214
+ float Local10 = math::dot(Local3, float2(Local7,Local9));
215
+ float Local11 = math::dot(Local3, float2(Local8,Local7));
216
+ float2 Local12 = (float2(0.5,0.5) + float2(Local10,Local11));
217
+ float4 Local13 = ::unpack_normal_map(tex::lookup_float4(Normal_Tex,float2(Local12.x,1.0-Local12.y),tex::wrap_repeat,tex::wrap_repeat));
218
+ float3 Local14 = ((math::abs(IsNormalTex - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : float3(Local13.x,Local13.y,Local13.z));
219
+
220
+ float3 Normal_mdl = Local14;
221
+
222
+ float Local15 = (CustomizedUV0_mdl.x * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).x);
223
+ float Local16 = (CustomizedUV0_mdl.y * float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).y);
224
+ float2 Local17 = (Local0 + float2(Local15,Local16));
225
+ float Local18 = (float3(Emissive_UVA.x,Emissive_UVA.y,Emissive_UVA.z).z / Local4);
226
+ float Local19 = (Local18 * 6.283185);
227
+ float Local20 = math::cos(Local19);
228
+ float Local21 = math::sin(Local19);
229
+ float Local22 = (Local21 * -1.0);
230
+ float Local23 = math::dot(Local17, float2(Local20,Local22));
231
+ float Local24 = math::dot(Local17, float2(Local21,Local20));
232
+ float2 Local25 = (float2(0.5,0.5) + float2(Local23,Local24));
233
+ float4 Local26 = tex::lookup_float4(Emissive_Tex,float2(Local25.x,1.0-Local25.y),tex::wrap_repeat,tex::wrap_repeat);
234
+ float3 Local27 = ((math::abs(IsEmissiveTex - 1.0) > 0.00001) ? (float3(Emissive_Color.x,Emissive_Color.y,Emissive_Color.z)) : float3(Local26.x,Local26.y,Local26.z));
235
+ float3 Local28 = (EmissiveIntensity * Local27);
236
+ float Local29 = (CustomizedUV0_mdl.x * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).x);
237
+ float Local30 = (CustomizedUV0_mdl.y * float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).y);
238
+ float2 Local31 = (Local0 + float2(Local29,Local30));
239
+ float Local32 = (float3(BaseColor_UVA.x,BaseColor_UVA.y,BaseColor_UVA.z).z / Local4);
240
+ float Local33 = (Local32 * 6.283185);
241
+ float Local34 = math::cos(Local33);
242
+ float Local35 = math::sin(Local33);
243
+ float Local36 = (Local35 * -1.0);
244
+ float Local37 = math::dot(Local31, float2(Local34,Local36));
245
+ float Local38 = math::dot(Local31, float2(Local35,Local34));
246
+ float2 Local39 = (float2(0.5,0.5) + float2(Local37,Local38));
247
+ float4 Local40 = tex::lookup_float4(BaseColor_Tex,float2(Local39.x,1.0-Local39.y),tex::wrap_repeat,tex::wrap_repeat);
248
+ float3 Local41 = ((math::abs(IsBaseColorTex - 1.0) > 0.00001) ? (float3(BaseColor_Color.x,BaseColor_Color.y,BaseColor_Color.z)) : float3(Local40.x,Local40.y,Local40.z));
249
+ float Local42 = (CustomizedUV0_mdl.x * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).x);
250
+ float Local43 = (CustomizedUV0_mdl.y * float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).y);
251
+ float2 Local44 = (Local0 + float2(Local42,Local43));
252
+ float Local45 = (float3(Metallic_UVA.x,Metallic_UVA.y,Metallic_UVA.z).z / Local4);
253
+ float Local46 = (Local45 * 6.283185);
254
+ float Local47 = math::cos(Local46);
255
+ float Local48 = math::sin(Local46);
256
+ float Local49 = (Local48 * -1.0);
257
+ float Local50 = math::dot(Local44, float2(Local47,Local49));
258
+ float Local51 = math::dot(Local44, float2(Local48,Local47));
259
+ float2 Local52 = (float2(0.5,0.5) + float2(Local50,Local51));
260
+ float4 Local53 = tex::lookup_float4(Metallic_Tex,float2(Local52.x,1.0-Local52.y),tex::wrap_repeat,tex::wrap_repeat);
261
+ float3 Local54 = ((math::abs(IsMetallicTex - 1.0) > 0.00001) ? (float3(Metallic_Color.x,Metallic_Color.y,Metallic_Color.z)) : float3(Local53.x,Local53.y,Local53.z));
262
+ float Local55 = (CustomizedUV0_mdl.x * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).x);
263
+ float Local56 = (CustomizedUV0_mdl.y * float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).y);
264
+ float2 Local57 = (Local0 + float2(Local55,Local56));
265
+ float Local58 = (float3(Specular_UVA.x,Specular_UVA.y,Specular_UVA.z).z / Local4);
266
+ float Local59 = (Local58 * 6.283185);
267
+ float Local60 = math::cos(Local59);
268
+ float Local61 = math::sin(Local59);
269
+ float Local62 = (Local61 * -1.0);
270
+ float Local63 = math::dot(Local57, float2(Local60,Local62));
271
+ float Local64 = math::dot(Local57, float2(Local61,Local60));
272
+ float2 Local65 = (float2(0.5,0.5) + float2(Local63,Local64));
273
+ float4 Local66 = tex::lookup_float4(Specular_Tex,float2(Local65.x,1.0-Local65.y),tex::wrap_repeat,tex::wrap_repeat);
274
+ float3 Local67 = ((math::abs(IsSpecularTex - 1.0) > 0.00001) ? (float3(Specular_Color.x,Specular_Color.y,Specular_Color.z)) : float3(Local66.x,Local66.y,Local66.z));
275
+ float Local68 = (CustomizedUV0_mdl.x * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).x);
276
+ float Local69 = (CustomizedUV0_mdl.y * float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).y);
277
+ float2 Local70 = (Local0 + float2(Local68,Local69));
278
+ float Local71 = (float3(Gloss_UVA.x,Gloss_UVA.y,Gloss_UVA.z).z / Local4);
279
+ float Local72 = (Local71 * 6.283185);
280
+ float Local73 = math::cos(Local72);
281
+ float Local74 = math::sin(Local72);
282
+ float Local75 = (Local74 * -1.0);
283
+ float Local76 = math::dot(Local70, float2(Local73,Local75));
284
+ float Local77 = math::dot(Local70, float2(Local74,Local73));
285
+ float2 Local78 = (float2(0.5,0.5) + float2(Local76,Local77));
286
+ float4 Local79 = tex::lookup_float4(Gloss_Tex,float2(Local78.x,1.0-Local78.y),tex::wrap_repeat,tex::wrap_repeat);
287
+ float3 Local80 = ((math::abs(IsGlossTex - 1.0) > 0.00001) ? (float3(Gloss_Color.x,Gloss_Color.y,Gloss_Color.z)) : float3(Local79.x,Local79.y,Local79.z));
288
+ float3 Local81 = (1.0 - Local80);
289
+ float Local87 = ((math::abs(SwitchRefraction - 1.0) > 0.01) ? (1.0) : FresnelB);
290
+
291
+ float3 EmissiveColor_mdl = Local28;
292
+ float Opacity_mdl = Opacity;
293
+ float OpacityMask_mdl = (math::saturate(Opacity) - 1.0f / 255.0f) < 0.0f ? 0.0f : 1.0f;
294
+ float3 BaseColor_mdl = Local41;
295
+ float Metallic_mdl = Local54.x;
296
+ float Specular_mdl = Local67.x;
297
+ float Roughness_mdl = Local81.x;
298
+ float3 Refraction_mdl = math::max(float3(Local87,Local87,Local87), 1.0f);
299
+ float SurfaceThickness_mdl = 0.01;
300
+
301
+ } in
302
+ ::OmniUe4Translucent(
303
+ base_color: BaseColor_mdl,
304
+ metallic: Metallic_mdl,
305
+ roughness: Roughness_mdl,
306
+ specular: Specular_mdl,
307
+ normal: Normal_mdl,
308
+ opacity: Opacity_mdl,
309
+ opacity_mask: OpacityMask_mdl,
310
+ emissive_color: EmissiveColor_mdl,
311
+ displacement: WorldPositionOffset_mdl,
312
+ refraction: Refraction_mdl.x,
313
+ two_sided: false);
kujiale_0003/Materials/M_TranslucentMaterial_v2.mdl ADDED
@@ -0,0 +1,1073 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mdl 1.6;
2
+
3
+ import ::math::*;
4
+ import ::state::*;
5
+ import ::tex::*;
6
+ import ::anno::*;
7
+ import ::scene::*;
8
+ using .::OmniUe4Function import *;
9
+ using .::OmniUe4Translucent import *;
10
+
11
+ export annotation sampler_color();
12
+ export annotation sampler_normal();
13
+ export annotation sampler_grayscale();
14
+ export annotation sampler_alpha();
15
+ export annotation sampler_masks();
16
+ export annotation sampler_distancefield();
17
+ export annotation dither_masked_off();
18
+ export annotation world_space_normal();
19
+
20
+ export material M_TranslucentMaterial_v2(
21
+ float IsNormal = 0.0
22
+ [[
23
+ anno::display_name("IsNormal"),
24
+ anno::ui_order(32)
25
+ ]],
26
+ float IsFlip = 0.0
27
+ [[
28
+ anno::display_name("IsFlip"),
29
+ anno::ui_order(32),
30
+ anno::in_group("Normal")
31
+ ]],
32
+ uniform texture_2d NormalTex = texture_2d("./Textures/DefaultNormal.png",::tex::gamma_linear)
33
+ [[
34
+ anno::display_name("NormalTex"),
35
+ anno::ui_order(32),
36
+ anno::in_group("Normal"),
37
+ sampler_normal()
38
+ ]],
39
+ float4 NormalUVW = float4(1.0,1.0,0.0,1.0)
40
+ [[
41
+ anno::display_name("NormalUVW"),
42
+ anno::ui_order(4),
43
+ anno::in_group("Normal")
44
+ ]],
45
+ float4 NormalOffset = float4(0.0,0.0,0.0,1.0)
46
+ [[
47
+ anno::display_name("NormalOffset"),
48
+ anno::ui_order(5),
49
+ anno::in_group("Normal")
50
+ ]],
51
+ float NormalIntensity = 0.0
52
+ [[
53
+ anno::display_name("NormalIntensity"),
54
+ anno::ui_order(32),
55
+ anno::in_group("Normal")
56
+ ]],
57
+ float EmissionIsTexType = 0.0
58
+ [[
59
+ anno::display_name("EmissionIsTexType"),
60
+ anno::description("0 is color, 1 is tex, 2 is falloff
61
+ "),
62
+ anno::ui_order(1),
63
+ anno::in_group("Emission")
64
+ ]],
65
+ float EmissionFalloffValue1Type = 0.0
66
+ [[
67
+ anno::display_name("EmissionFalloffValue1Type"),
68
+ anno::ui_order(7),
69
+ anno::in_group("Emission")
70
+ ]],
71
+ float EmissionFalloffFloat = 0.0
72
+ [[
73
+ anno::display_name("EmissionFalloffFloat"),
74
+ anno::ui_order(8),
75
+ anno::in_group("Emission")
76
+ ]],
77
+ float4 EmissionColor = float4(0.0,0.0,0.0,1.0)
78
+ [[
79
+ anno::display_name("EmissionColor"),
80
+ anno::ui_order(2),
81
+ anno::in_group("Emission")
82
+ ]],
83
+ uniform texture_2d EmissionTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
84
+ [[
85
+ anno::display_name("EmissionTex"),
86
+ anno::ui_order(3),
87
+ anno::in_group("Emission"),
88
+ sampler_color()
89
+ ]],
90
+ float4 EmissionUVW = float4(1.0,1.0,0.0,1.0)
91
+ [[
92
+ anno::display_name("EmissionUVW"),
93
+ anno::ui_order(4),
94
+ anno::in_group("Emission")
95
+ ]],
96
+ float4 EmissionOffset = float4(0.0,0.0,0.0,1.0)
97
+ [[
98
+ anno::display_name("EmissionOffset"),
99
+ anno::ui_order(5),
100
+ anno::in_group("Emission")
101
+ ]],
102
+ float EmissionFalloffValue2Type = 0.0
103
+ [[
104
+ anno::display_name("EmissionFalloffValue2Type"),
105
+ anno::ui_order(9),
106
+ anno::in_group("Emission")
107
+ ]],
108
+ float EmissionFalloffFloat_2 = 0.0
109
+ [[
110
+ anno::display_name("EmissionFalloffFloat_2"),
111
+ anno::ui_order(10),
112
+ anno::in_group("Emission")
113
+ ]],
114
+ float4 EmissionColor_2 = float4(1.0,1.0,1.0,1.0)
115
+ [[
116
+ anno::display_name("EmissionColor_2"),
117
+ anno::ui_order(11),
118
+ anno::in_group("Emission")
119
+ ]],
120
+ uniform texture_2d EmissionTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
121
+ [[
122
+ anno::display_name("EmissionTex_2"),
123
+ anno::ui_order(12),
124
+ anno::in_group("Emission"),
125
+ sampler_color()
126
+ ]],
127
+ float4 EmissionUVW_2 = float4(1.0,1.0,0.0,1.0)
128
+ [[
129
+ anno::display_name("EmissionUVW_2"),
130
+ anno::ui_order(13),
131
+ anno::in_group("Emission")
132
+ ]],
133
+ float4 EmissionOffset_2 = float4(0.0,0.0,0.0,1.0)
134
+ [[
135
+ anno::display_name("EmissionOffset_2"),
136
+ anno::ui_order(14),
137
+ anno::in_group("Emission")
138
+ ]],
139
+ float EmissionFalloffFreshnelIor = 1.6
140
+ [[
141
+ anno::display_name("EmissionFalloffFreshnelIor"),
142
+ anno::ui_order(6),
143
+ anno::in_group("Emission")
144
+ ]],
145
+ float ColorIsTexType = 0.0
146
+ [[
147
+ anno::display_name("ColorIsTexType"),
148
+ anno::description("0 is color, 1 is tex, 2 is falloff
149
+ "),
150
+ anno::ui_order(1),
151
+ anno::in_group("Color")
152
+ ]],
153
+ float ColorFalloffValue1Type = 0.0
154
+ [[
155
+ anno::display_name("ColorFalloffValue1Type"),
156
+ anno::ui_order(7),
157
+ anno::in_group("Color")
158
+ ]],
159
+ float ColorFalloffFloat = 0.0
160
+ [[
161
+ anno::display_name("ColorFalloffFloat"),
162
+ anno::ui_order(10),
163
+ anno::in_group("Color")
164
+ ]],
165
+ float4 ColorColor = float4(1.0,1.0,1.0,1.0)
166
+ [[
167
+ anno::display_name("ColorColor"),
168
+ anno::ui_order(2),
169
+ anno::in_group("Color")
170
+ ]],
171
+ uniform texture_2d ColorTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
172
+ [[
173
+ anno::display_name("ColorTex"),
174
+ anno::ui_order(3),
175
+ anno::in_group("Color"),
176
+ sampler_color()
177
+ ]],
178
+ float4 ColorUVW = float4(1.0,1.0,0.0,1.0)
179
+ [[
180
+ anno::display_name("ColorUVW"),
181
+ anno::ui_order(4),
182
+ anno::in_group("Color")
183
+ ]],
184
+ float4 ColorOffset = float4(0.0,0.0,0.0,1.0)
185
+ [[
186
+ anno::display_name("ColorOffset"),
187
+ anno::ui_order(5),
188
+ anno::in_group("Color")
189
+ ]],
190
+ float ColorFalloffValue2Type = 0.0
191
+ [[
192
+ anno::display_name("ColorFalloffValue2Type"),
193
+ anno::ui_order(9),
194
+ anno::in_group("Color")
195
+ ]],
196
+ float ColorFalloffFloat_2 = 0.0
197
+ [[
198
+ anno::display_name("ColorFalloffFloat_2"),
199
+ anno::ui_order(10),
200
+ anno::in_group("Color")
201
+ ]],
202
+ float4 ColorColor_2 = float4(1.0,1.0,1.0,1.0)
203
+ [[
204
+ anno::display_name("ColorColor_2"),
205
+ anno::ui_order(11),
206
+ anno::in_group("Color")
207
+ ]],
208
+ uniform texture_2d ColorTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
209
+ [[
210
+ anno::display_name("ColorTex_2"),
211
+ anno::ui_order(12),
212
+ anno::in_group("Color"),
213
+ sampler_color()
214
+ ]],
215
+ float4 ColorUVW_2 = float4(1.0,1.0,0.0,1.0)
216
+ [[
217
+ anno::display_name("ColorUVW_2"),
218
+ anno::ui_order(13),
219
+ anno::in_group("Color")
220
+ ]],
221
+ float4 ColorOffset_2 = float4(0.0,0.0,0.0,1.0)
222
+ [[
223
+ anno::display_name("ColorOffset_2"),
224
+ anno::ui_order(14),
225
+ anno::in_group("Color")
226
+ ]],
227
+ float ColorFalloffFreshnelIor = 1.6
228
+ [[
229
+ anno::display_name("ColorFalloffFreshnelIor"),
230
+ anno::ui_order(6),
231
+ anno::in_group("Color")
232
+ ]],
233
+ float MetallicIsTexType = 0.0
234
+ [[
235
+ anno::display_name("MetallicIsTexType"),
236
+ anno::description("0 is color, 1 is tex, 2 is falloff
237
+ "),
238
+ anno::ui_order(1),
239
+ anno::in_group("Metallic")
240
+ ]],
241
+ float MetallicFalloffValue1Type = 0.0
242
+ [[
243
+ anno::display_name("MetallicFalloffValue1Type"),
244
+ anno::ui_order(7),
245
+ anno::in_group("Metallic")
246
+ ]],
247
+ float MetallicFalloffFloat = 0.0
248
+ [[
249
+ anno::display_name("MetallicFalloffFloat"),
250
+ anno::ui_order(8),
251
+ anno::in_group("Metallic")
252
+ ]],
253
+ float MetallicFloat = 0.0
254
+ [[
255
+ anno::display_name("MetallicFloat"),
256
+ anno::ui_order(2),
257
+ anno::in_group("Metallic")
258
+ ]],
259
+ uniform texture_2d MetallicTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
260
+ [[
261
+ anno::display_name("MetallicTex"),
262
+ anno::ui_order(3),
263
+ anno::in_group("Metallic"),
264
+ sampler_color()
265
+ ]],
266
+ float4 MetallicUVW = float4(1.0,1.0,0.0,1.0)
267
+ [[
268
+ anno::display_name("MetallicUVW"),
269
+ anno::ui_order(4),
270
+ anno::in_group("Metallic")
271
+ ]],
272
+ float4 MetallicOffset = float4(0.0,0.0,0.0,1.0)
273
+ [[
274
+ anno::display_name("MetallicOffset"),
275
+ anno::ui_order(5),
276
+ anno::in_group("Metallic")
277
+ ]],
278
+ float MetallicFalloffValue2Type = 0.0
279
+ [[
280
+ anno::display_name("MetallicFalloffValue2Type"),
281
+ anno::ui_order(9),
282
+ anno::in_group("Metallic")
283
+ ]],
284
+ float MetallicFalloffFloat_2 = 0.0
285
+ [[
286
+ anno::display_name("MetallicFalloffFloat_2"),
287
+ anno::ui_order(10),
288
+ anno::in_group("Metallic")
289
+ ]],
290
+ float4 MetallicColor_2 = float4(1.0,1.0,1.0,1.0)
291
+ [[
292
+ anno::display_name("MetallicColor_2"),
293
+ anno::ui_order(11),
294
+ anno::in_group("Metallic")
295
+ ]],
296
+ uniform texture_2d MetallicTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
297
+ [[
298
+ anno::display_name("MetallicTex_2"),
299
+ anno::ui_order(12),
300
+ anno::in_group("Metallic"),
301
+ sampler_color()
302
+ ]],
303
+ float4 MetallicUVW_2 = float4(1.0,1.0,0.0,1.0)
304
+ [[
305
+ anno::display_name("MetallicUVW_2"),
306
+ anno::ui_order(13),
307
+ anno::in_group("Metallic")
308
+ ]],
309
+ float4 MetallicOffset_2 = float4(0.0,0.0,0.0,1.0)
310
+ [[
311
+ anno::display_name("MetallicOffset_2"),
312
+ anno::ui_order(14),
313
+ anno::in_group("Metallic")
314
+ ]],
315
+ float MetallicFalloffFreshnelIor = 1.6
316
+ [[
317
+ anno::display_name("MetallicFalloffFreshnelIor"),
318
+ anno::ui_order(6),
319
+ anno::in_group("Metallic")
320
+ ]],
321
+ float SpecularIsTexType = 0.0
322
+ [[
323
+ anno::display_name("SpecularIsTexType"),
324
+ anno::description("0 is color, 1 is tex, 2 is falloff
325
+ "),
326
+ anno::ui_order(1),
327
+ anno::in_group("Specular")
328
+ ]],
329
+ float SpecularFalloffValue1Type = 0.0
330
+ [[
331
+ anno::display_name("SpecularFalloffValue1Type"),
332
+ anno::ui_order(7),
333
+ anno::in_group("Specular")
334
+ ]],
335
+ float SpecularFalloffFloat = 0.0
336
+ [[
337
+ anno::display_name("SpecularFalloffFloat"),
338
+ anno::ui_order(8),
339
+ anno::in_group("Specular")
340
+ ]],
341
+ float SpecularFloat = 0.0
342
+ [[
343
+ anno::display_name("SpecularFloat"),
344
+ anno::ui_order(2),
345
+ anno::in_group("Specular")
346
+ ]],
347
+ uniform texture_2d SpecularTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
348
+ [[
349
+ anno::display_name("SpecularTex"),
350
+ anno::ui_order(3),
351
+ anno::in_group("Specular"),
352
+ sampler_color()
353
+ ]],
354
+ float4 SpecularUVW = float4(1.0,1.0,0.0,1.0)
355
+ [[
356
+ anno::display_name("SpecularUVW"),
357
+ anno::ui_order(4),
358
+ anno::in_group("Specular")
359
+ ]],
360
+ float4 SpecularOffset = float4(0.0,0.0,0.0,1.0)
361
+ [[
362
+ anno::display_name("SpecularOffset"),
363
+ anno::ui_order(5),
364
+ anno::in_group("Specular")
365
+ ]],
366
+ float SpecularFalloffValue2Type = 0.0
367
+ [[
368
+ anno::display_name("SpecularFalloffValue2Type"),
369
+ anno::ui_order(9),
370
+ anno::in_group("Specular")
371
+ ]],
372
+ float SpecularFalloffFloat_2 = 0.0
373
+ [[
374
+ anno::display_name("SpecularFalloffFloat_2"),
375
+ anno::ui_order(10),
376
+ anno::in_group("Specular")
377
+ ]],
378
+ float4 SpecularColor_2 = float4(1.0,1.0,1.0,1.0)
379
+ [[
380
+ anno::display_name("SpecularColor_2"),
381
+ anno::ui_order(11),
382
+ anno::in_group("Specular")
383
+ ]],
384
+ uniform texture_2d SpecularTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
385
+ [[
386
+ anno::display_name("SpecularTex_2"),
387
+ anno::ui_order(12),
388
+ anno::in_group("Specular"),
389
+ sampler_color()
390
+ ]],
391
+ float4 SpecularUVW_2 = float4(1.0,1.0,0.0,1.0)
392
+ [[
393
+ anno::display_name("SpecularUVW_2"),
394
+ anno::ui_order(13),
395
+ anno::in_group("Specular")
396
+ ]],
397
+ float4 SpecularOffset_2 = float4(0.0,0.0,0.0,1.0)
398
+ [[
399
+ anno::display_name("SpecularOffset_2"),
400
+ anno::ui_order(14),
401
+ anno::in_group("Specular")
402
+ ]],
403
+ float SpecularFalloffFreshnelIor = 1.6
404
+ [[
405
+ anno::display_name("SpecularFalloffFreshnelIor"),
406
+ anno::ui_order(6),
407
+ anno::in_group("Specular")
408
+ ]],
409
+ float RoughnessIsTexType = 0.0
410
+ [[
411
+ anno::display_name("RoughnessIsTexType"),
412
+ anno::description("0 is color, 1 is tex, 2 is falloff
413
+ "),
414
+ anno::ui_order(1),
415
+ anno::in_group("Roughness")
416
+ ]],
417
+ float RoughnessFalloffValue1Type = 0.0
418
+ [[
419
+ anno::display_name("RoughnessFalloffValue1Type"),
420
+ anno::ui_order(7),
421
+ anno::in_group("Roughness")
422
+ ]],
423
+ float RoughnessFalloffFloat = 0.0
424
+ [[
425
+ anno::display_name("RoughnessFalloffFloat"),
426
+ anno::ui_order(8),
427
+ anno::in_group("Roughness")
428
+ ]],
429
+ float RoughnessFloat = 0.0
430
+ [[
431
+ anno::display_name("RoughnessFloat"),
432
+ anno::ui_order(2),
433
+ anno::in_group("Roughness")
434
+ ]],
435
+ uniform texture_2d RoughnessTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
436
+ [[
437
+ anno::display_name("RoughnessTex"),
438
+ anno::ui_order(3),
439
+ anno::in_group("Roughness"),
440
+ sampler_color()
441
+ ]],
442
+ float4 RoughnessUVW = float4(1.0,1.0,0.0,1.0)
443
+ [[
444
+ anno::display_name("RoughnessUVW"),
445
+ anno::ui_order(4),
446
+ anno::in_group("Roughness")
447
+ ]],
448
+ float4 RoughnessOffset = float4(0.0,0.0,0.0,1.0)
449
+ [[
450
+ anno::display_name("RoughnessOffset"),
451
+ anno::ui_order(5),
452
+ anno::in_group("Roughness")
453
+ ]],
454
+ float RoughnessFalloffValue2Type = 0.0
455
+ [[
456
+ anno::display_name("RoughnessFalloffValue2Type"),
457
+ anno::ui_order(9),
458
+ anno::in_group("Roughness")
459
+ ]],
460
+ float RoughnessFalloffFloat_2 = 0.0
461
+ [[
462
+ anno::display_name("RoughnessFalloffFloat_2"),
463
+ anno::ui_order(10),
464
+ anno::in_group("Roughness")
465
+ ]],
466
+ float4 RoughnessColor_2 = float4(1.0,1.0,1.0,1.0)
467
+ [[
468
+ anno::display_name("RoughnessColor_2"),
469
+ anno::ui_order(11),
470
+ anno::in_group("Roughness")
471
+ ]],
472
+ uniform texture_2d RoughnessTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
473
+ [[
474
+ anno::display_name("RoughnessTex_2"),
475
+ anno::ui_order(12),
476
+ anno::in_group("Roughness"),
477
+ sampler_color()
478
+ ]],
479
+ float4 RoughnessUVW_2 = float4(1.0,1.0,0.0,1.0)
480
+ [[
481
+ anno::display_name("RoughnessUVW_2"),
482
+ anno::ui_order(13),
483
+ anno::in_group("Roughness")
484
+ ]],
485
+ float4 RoughnessOffset_2 = float4(0.0,0.0,0.0,1.0)
486
+ [[
487
+ anno::display_name("RoughnessOffset_2"),
488
+ anno::ui_order(14),
489
+ anno::in_group("Roughness")
490
+ ]],
491
+ float RoughnessFalloffFreshnelIor = 1.6
492
+ [[
493
+ anno::display_name("RoughnessFalloffFreshnelIor"),
494
+ anno::ui_order(6),
495
+ anno::in_group("Roughness")
496
+ ]],
497
+ float OpacityIsTexType = 0.0
498
+ [[
499
+ anno::display_name("OpacityIsTexType"),
500
+ anno::description("0 is float, 1 is tex, 2 is falloff
501
+ "),
502
+ anno::ui_order(1),
503
+ anno::in_group("Opacity")
504
+ ]],
505
+ float OpacityFalloffValue1Type = 0.0
506
+ [[
507
+ anno::display_name("OpacityFalloffValue1Type"),
508
+ anno::ui_order(7),
509
+ anno::in_group("Opacity")
510
+ ]],
511
+ float OpacityFalloffFloat = 0.0
512
+ [[
513
+ anno::display_name("OpacityFalloffFloat"),
514
+ anno::ui_order(8),
515
+ anno::in_group("Opacity")
516
+ ]],
517
+ float OpacityFloat = 0.0
518
+ [[
519
+ anno::display_name("OpacityFloat"),
520
+ anno::ui_order(2),
521
+ anno::in_group("Opacity")
522
+ ]],
523
+ uniform texture_2d OpacityTex = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
524
+ [[
525
+ anno::display_name("OpacityTex"),
526
+ anno::ui_order(3),
527
+ anno::in_group("Opacity"),
528
+ sampler_color()
529
+ ]],
530
+ float4 OpacityUVW = float4(1.0,1.0,0.0,1.0)
531
+ [[
532
+ anno::display_name("OpacityUVW"),
533
+ anno::ui_order(4),
534
+ anno::in_group("Opacity")
535
+ ]],
536
+ float4 OpacityOffset = float4(0.0,0.0,0.0,1.0)
537
+ [[
538
+ anno::display_name("OpacityOffset"),
539
+ anno::ui_order(5),
540
+ anno::in_group("Opacity")
541
+ ]],
542
+ float OpacityFalloffValue2Type = 0.0
543
+ [[
544
+ anno::display_name("OpacityFalloffValue2Type"),
545
+ anno::ui_order(9),
546
+ anno::in_group("Opacity")
547
+ ]],
548
+ float OpacityFalloffFloat_2 = 0.0
549
+ [[
550
+ anno::display_name("OpacityFalloffFloat_2"),
551
+ anno::ui_order(10),
552
+ anno::in_group("Opacity")
553
+ ]],
554
+ float4 OpacityColor_2 = float4(1.0,1.0,1.0,1.0)
555
+ [[
556
+ anno::display_name("OpacityColor_2"),
557
+ anno::ui_order(11),
558
+ anno::in_group("Opacity")
559
+ ]],
560
+ uniform texture_2d OpacityTex_2 = texture_2d("./Textures/DefaultTexture.png",::tex::gamma_srgb)
561
+ [[
562
+ anno::display_name("OpacityTex_2"),
563
+ anno::ui_order(12),
564
+ anno::in_group("Opacity"),
565
+ sampler_color()
566
+ ]],
567
+ float4 OpacityUVW_2 = float4(1.0,1.0,0.0,1.0)
568
+ [[
569
+ anno::display_name("OpacityUVW_2"),
570
+ anno::ui_order(13),
571
+ anno::in_group("Opacity")
572
+ ]],
573
+ float4 OpacityOffset_2 = float4(0.0,0.0,0.0,1.0)
574
+ [[
575
+ anno::display_name("OpacityOffset_2"),
576
+ anno::ui_order(14),
577
+ anno::in_group("Opacity")
578
+ ]],
579
+ float OpacityFalloffFreshnelIor = 1.6
580
+ [[
581
+ anno::display_name("OpacityFalloffFreshnelIor"),
582
+ anno::ui_order(6),
583
+ anno::in_group("Opacity")
584
+ ]],
585
+ float PolygonOffset = 0.0
586
+ [[
587
+ anno::display_name("PolygonOffset"),
588
+ anno::ui_order(32)
589
+ ]],
590
+ int MaxTexCoordIndex = 3
591
+ [[
592
+ anno::hidden()
593
+ ]])
594
+ =
595
+ let {
596
+ float3 Local437 = ::camera_position();
597
+ float3 Local438 = (Local437 - (::convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), true)*state::meters_per_scene_unit()*100.0));
598
+ float3 Local439 = math::normalize(Local438);
599
+ float3 Local440 = (Local439 * PolygonOffset);
600
+
601
+ float3 WorldPositionOffset_mdl = Local440;
602
+ float2 CustomizedUV0_mdl = float2(state::texture_coordinate(math::min(0,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(0,MaxTexCoordIndex)).y);
603
+ float2 CustomizedUV1_mdl = float2(state::texture_coordinate(math::min(1,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(1,MaxTexCoordIndex)).y);
604
+ float2 CustomizedUV2_mdl = float2(state::texture_coordinate(math::min(2,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(2,MaxTexCoordIndex)).y);
605
+ float2 CustomizedUV3_mdl = float2(state::texture_coordinate(math::min(3,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(3,MaxTexCoordIndex)).y);
606
+ float2 CustomizedUV4_mdl = float2(state::texture_coordinate(math::min(4,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(4,MaxTexCoordIndex)).y);
607
+ float2 CustomizedUV5_mdl = float2(state::texture_coordinate(math::min(5,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(5,MaxTexCoordIndex)).y);
608
+ float2 CustomizedUV6_mdl = float2(state::texture_coordinate(math::min(6,MaxTexCoordIndex)).x,1.0-state::texture_coordinate(math::min(6,MaxTexCoordIndex)).y);
609
+
610
+ float2 Local0 = (float2(0.5,0.5) * -1.0);
611
+ float Local1 = math::min(math::max(0.0,0.0),6.0);
612
+ float2 Local2 = ((math::abs(Local1 - 1.0) > 0.00001) ? (Local1 >= 1.0 ? CustomizedUV2_mdl : CustomizedUV0_mdl) : CustomizedUV1_mdl);
613
+ float2 Local3 = ((math::abs(Local1 - 3.0) > 0.00001) ? (Local1 >= 3.0 ? CustomizedUV4_mdl : Local2) : CustomizedUV3_mdl);
614
+ float2 Local4 = ((math::abs(Local1 - 5.0) > 0.00001) ? (Local1 >= 5.0 ? CustomizedUV6_mdl : Local3) : CustomizedUV5_mdl);
615
+ float Local5 = (Local4.x * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).x);
616
+ float Local6 = (Local4.y * float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
617
+ float Local7 = (1.0 - float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).y);
618
+ float Local8 = (Local6 + Local7);
619
+ float Local9 = (float2(Local5,Local8).x + float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).x);
620
+ float Local10 = (float3(NormalOffset.x,NormalOffset.y,NormalOffset.z).y * -1.0);
621
+ float Local11 = (float2(Local5,Local8).y + Local10);
622
+ float2 Local12 = (Local0 + float2(Local9,Local11));
623
+ float Local13 = (float3(NormalUVW.x,NormalUVW.y,NormalUVW.z).z * 6.283185);
624
+ float Local14 = math::cos(Local13);
625
+ float Local15 = math::sin(Local13);
626
+ float Local16 = (Local15 * -1.0);
627
+ float Local17 = math::dot(Local12, float2(Local14,Local16));
628
+ float Local18 = math::dot(Local12, float2(Local15,Local14));
629
+ float2 Local19 = (float2(0.5,0.5) + float2(Local17,Local18));
630
+ float4 Local20 = ::unpack_normal_map(tex::lookup_float4(NormalTex,float2(Local19.x,1.0-Local19.y),tex::wrap_repeat,tex::wrap_repeat));
631
+ float2 Local21 = (float2(float3(Local20.x,Local20.y,Local20.z).x,float3(Local20.x,Local20.y,Local20.z).y) * NormalIntensity);
632
+ float3 Local22 = math::normalize(float3(Local21.x,Local21.y,float3(Local20.x,Local20.y,Local20.z).z));
633
+ float3 Local23 = ((math::abs(IsFlip - 1.0) > 0.00001) ? (Local22) : Local22);
634
+ float Local24 = (Local23.z + 1.0);
635
+ float2 Local25 = (float2(float3(0.0,0.0,1.0).x,float3(0.0,0.0,1.0).y) * -1.0);
636
+ float Local26 = math::dot(float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24), float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
637
+ float3 Local27 = (float3(float2(Local23.x,Local23.y).x,float2(Local23.x,Local23.y).y,Local24) * Local26);
638
+ float3 Local28 = (Local24 * float3(Local25.x,Local25.y,float3(0.0,0.0,1.0).z));
639
+ float3 Local29 = (Local27 - Local28);
640
+ float3 Local30 = math::normalize(Local29);
641
+ float3 Local31 = ((math::abs(IsNormal - 1.0) > 0.00001) ? (float3(0.0,0.0,1.0)) : Local30);
642
+
643
+ float3 Normal_mdl = Local31;
644
+
645
+ float Local32 = (Local4.x * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).x);
646
+ float Local33 = (Local4.y * float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
647
+ float Local34 = (1.0 - float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).y);
648
+ float Local35 = (Local33 + Local34);
649
+ float Local36 = (float2(Local32,Local35).x + float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).x);
650
+ float Local37 = (float3(EmissionOffset.x,EmissionOffset.y,EmissionOffset.z).y * -1.0);
651
+ float Local38 = (float2(Local32,Local35).y + Local37);
652
+ float2 Local39 = (Local0 + float2(Local36,Local38));
653
+ float Local40 = (float3(EmissionUVW.x,EmissionUVW.y,EmissionUVW.z).z * 6.283185);
654
+ float Local41 = math::cos(Local40);
655
+ float Local42 = math::sin(Local40);
656
+ float Local43 = (Local42 * -1.0);
657
+ float Local44 = math::dot(Local39, float2(Local41,Local43));
658
+ float Local45 = math::dot(Local39, float2(Local42,Local41));
659
+ float2 Local46 = (float2(0.5,0.5) + float2(Local44,Local45));
660
+ float4 Local47 = tex::lookup_float4(EmissionTex,float2(Local46.x,1.0-Local46.y),tex::wrap_repeat,tex::wrap_repeat);
661
+ float3 Local48 = ((math::abs(EmissionFalloffValue1Type - 1.0) > 0.00001) ? (EmissionFalloffValue1Type >= 1.0 ? float3(float2(EmissionFalloffFloat,EmissionFalloffFloat).x,float2(EmissionFalloffFloat,EmissionFalloffFloat).y,EmissionFalloffFloat) : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
662
+ float Local49 = (Local4.x * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).x);
663
+ float Local50 = (Local4.y * float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
664
+ float Local51 = (1.0 - float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).y);
665
+ float Local52 = (Local50 + Local51);
666
+ float Local53 = (float2(Local49,Local52).x + float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).x);
667
+ float Local54 = (float3(EmissionOffset_2.x,EmissionOffset_2.y,EmissionOffset_2.z).y * -1.0);
668
+ float Local55 = (float2(Local49,Local52).y + Local54);
669
+ float2 Local56 = (Local0 + float2(Local53,Local55));
670
+ float Local57 = (float3(EmissionUVW_2.x,EmissionUVW_2.y,EmissionUVW_2.z).z * 6.283185);
671
+ float Local58 = math::cos(Local57);
672
+ float Local59 = math::sin(Local57);
673
+ float Local60 = (Local59 * -1.0);
674
+ float Local61 = math::dot(Local56, float2(Local58,Local60));
675
+ float Local62 = math::dot(Local56, float2(Local59,Local58));
676
+ float2 Local63 = (float2(0.5,0.5) + float2(Local61,Local62));
677
+ float4 Local64 = tex::lookup_float4(EmissionTex_2,float2(Local63.x,1.0-Local63.y),tex::wrap_repeat,tex::wrap_repeat);
678
+ float3 Local65 = ((math::abs(EmissionFalloffValue2Type - 1.0) > 0.00001) ? (EmissionFalloffValue2Type >= 1.0 ? float3(float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).x,float2(EmissionFalloffFloat_2,EmissionFalloffFloat_2).y,EmissionFalloffFloat_2) : float3(EmissionColor_2.x,EmissionColor_2.y,EmissionColor_2.z)) : float3(Local64.x,Local64.y,Local64.z));
679
+ float Local66 = math::min(math::max(EmissionFalloffFreshnelIor,0.0),100.0);
680
+ float Local67 = (1.0 / Local66);
681
+ float Local68 = math::max(Local66,Local67);
682
+ float Local69 = (Local68 - 1.0);
683
+ float Local70 = (Local68 * Local68);
684
+ float Local71 = math::dot(::pixel_normal_world_space(true), ::camera_vector(true));
685
+ float Local72 = (Local71 * Local71);
686
+ float Local73 = (Local70 + Local72);
687
+ float Local74 = (Local73 - 1.0);
688
+ float Local75 = math::sqrt(Local74);
689
+ float Local76 = (Local75 / Local68);
690
+ float Local77 = ((math::abs(Local76 - 0.99999) > 0.000001) ? (Local76 >= 0.99999 ? 1.0 : 0.0) : 0.0);
691
+ float Local78 = ((math::abs(Local71 - 0.99999) > 0.000001) ? (Local71 >= 0.99999 ? 1.0 : 0.0) : 0.0);
692
+ float Local79 = math::max(Local77,Local78);
693
+ float Local80 = (Local71 / Local76);
694
+ float Local81 = (Local68 * Local80);
695
+ float Local82 = (Local81 - 1.0);
696
+ float Local83 = (Local81 + 1.0);
697
+ float Local84 = (Local82 / Local83);
698
+ float Local85 = math::pow(math::max(Local84,float(0.000001)),2.0);
699
+ float Local86 = (Local76 / Local71);
700
+ float Local87 = (Local68 * Local86);
701
+ float Local88 = (Local87 - 1.0);
702
+ float Local89 = (Local87 + 1.0);
703
+ float Local90 = (Local88 / Local89);
704
+ float Local91 = math::pow(math::max(Local90,float(0.000001)),2.0);
705
+ float Local92 = (Local85 + Local91);
706
+ float Local93 = (Local92 * 0.5);
707
+ float Local94 = (Local68 + 1.0);
708
+ float Local95 = (Local69 / Local94);
709
+ float Local96 = math::pow(math::max(Local95,float(0.000001)),2.0);
710
+ float Local97 = ((math::abs(Local79 - 1.0) > 0.1) ? (Local93) : Local96);
711
+ float Local98 = ((math::abs(Local69 - 0.0) > 0.000001) ? (Local97) : 0.0);
712
+ float Local99 = math::saturate(Local98);
713
+ float3 Local100 = math::lerp(Local48,Local65,Local99);
714
+ float3 Local101 = ((math::abs(EmissionIsTexType - 1.0) > 0.00001) ? (EmissionIsTexType >= 1.0 ? Local100 : float3(EmissionColor.x,EmissionColor.y,EmissionColor.z)) : float3(Local47.x,Local47.y,Local47.z));
715
+ float Local102 = (Local4.x * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).x);
716
+ float Local103 = (Local4.y * float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
717
+ float Local104 = (1.0 - float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).y);
718
+ float Local105 = (Local103 + Local104);
719
+ float Local106 = (float2(Local102,Local105).x + float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).x);
720
+ float Local107 = (float3(ColorOffset.x,ColorOffset.y,ColorOffset.z).y * -1.0);
721
+ float Local108 = (float2(Local102,Local105).y + Local107);
722
+ float2 Local109 = (Local0 + float2(Local106,Local108));
723
+ float Local110 = (float3(ColorUVW.x,ColorUVW.y,ColorUVW.z).z * 6.283185);
724
+ float Local111 = math::cos(Local110);
725
+ float Local112 = math::sin(Local110);
726
+ float Local113 = (Local112 * -1.0);
727
+ float Local114 = math::dot(Local109, float2(Local111,Local113));
728
+ float Local115 = math::dot(Local109, float2(Local112,Local111));
729
+ float2 Local116 = (float2(0.5,0.5) + float2(Local114,Local115));
730
+ float4 Local117 = tex::lookup_float4(ColorTex,float2(Local116.x,1.0-Local116.y),tex::wrap_repeat,tex::wrap_repeat);
731
+ float3 Local118 = ((math::abs(ColorFalloffValue1Type - 1.0) > 0.00001) ? (ColorFalloffValue1Type >= 1.0 ? float3(float2(ColorFalloffFloat,ColorFalloffFloat).x,float2(ColorFalloffFloat,ColorFalloffFloat).y,ColorFalloffFloat) : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
732
+ float Local119 = (Local4.x * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).x);
733
+ float Local120 = (Local4.y * float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
734
+ float Local121 = (1.0 - float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).y);
735
+ float Local122 = (Local120 + Local121);
736
+ float Local123 = (float2(Local119,Local122).x + float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).x);
737
+ float Local124 = (float3(ColorOffset_2.x,ColorOffset_2.y,ColorOffset_2.z).y * -1.0);
738
+ float Local125 = (float2(Local119,Local122).y + Local124);
739
+ float2 Local126 = (Local0 + float2(Local123,Local125));
740
+ float Local127 = (float3(ColorUVW_2.x,ColorUVW_2.y,ColorUVW_2.z).z * 6.283185);
741
+ float Local128 = math::cos(Local127);
742
+ float Local129 = math::sin(Local127);
743
+ float Local130 = (Local129 * -1.0);
744
+ float Local131 = math::dot(Local126, float2(Local128,Local130));
745
+ float Local132 = math::dot(Local126, float2(Local129,Local128));
746
+ float2 Local133 = (float2(0.5,0.5) + float2(Local131,Local132));
747
+ float4 Local134 = tex::lookup_float4(ColorTex_2,float2(Local133.x,1.0-Local133.y),tex::wrap_repeat,tex::wrap_repeat);
748
+ float3 Local135 = ((math::abs(ColorFalloffValue2Type - 1.0) > 0.00001) ? (ColorFalloffValue2Type >= 1.0 ? float3(float2(ColorFalloffFloat_2,ColorFalloffFloat_2).x,float2(ColorFalloffFloat_2,ColorFalloffFloat_2).y,ColorFalloffFloat_2) : float3(ColorColor_2.x,ColorColor_2.y,ColorColor_2.z)) : float3(Local134.x,Local134.y,Local134.z));
749
+ float Local136 = math::min(math::max(ColorFalloffFreshnelIor,0.0),100.0);
750
+ float Local137 = (1.0 / Local136);
751
+ float Local138 = math::max(Local136,Local137);
752
+ float Local139 = (Local138 - 1.0);
753
+ float Local140 = (Local138 * Local138);
754
+ float Local141 = (Local140 + Local72);
755
+ float Local142 = (Local141 - 1.0);
756
+ float Local143 = math::sqrt(Local142);
757
+ float Local144 = (Local143 / Local138);
758
+ float Local145 = ((math::abs(Local144 - 0.99999) > 0.000001) ? (Local144 >= 0.99999 ? 1.0 : 0.0) : 0.0);
759
+ float Local146 = math::max(Local145,Local78);
760
+ float Local147 = (Local71 / Local144);
761
+ float Local148 = (Local138 * Local147);
762
+ float Local149 = (Local148 - 1.0);
763
+ float Local150 = (Local148 + 1.0);
764
+ float Local151 = (Local149 / Local150);
765
+ float Local152 = math::pow(math::max(Local151,float(0.000001)),2.0);
766
+ float Local153 = (Local144 / Local71);
767
+ float Local154 = (Local138 * Local153);
768
+ float Local155 = (Local154 - 1.0);
769
+ float Local156 = (Local154 + 1.0);
770
+ float Local157 = (Local155 / Local156);
771
+ float Local158 = math::pow(math::max(Local157,float(0.000001)),2.0);
772
+ float Local159 = (Local152 + Local158);
773
+ float Local160 = (Local159 * 0.5);
774
+ float Local161 = (Local138 + 1.0);
775
+ float Local162 = (Local139 / Local161);
776
+ float Local163 = math::pow(math::max(Local162,float(0.000001)),2.0);
777
+ float Local164 = ((math::abs(Local146 - 1.0) > 0.1) ? (Local160) : Local163);
778
+ float Local165 = ((math::abs(Local139 - 0.0) > 0.000001) ? (Local164) : 0.0);
779
+ float Local166 = math::saturate(Local165);
780
+ float3 Local167 = math::lerp(Local118,Local135,Local166);
781
+ float3 Local168 = ((math::abs(ColorIsTexType - 1.0) > 0.00001) ? (ColorIsTexType >= 1.0 ? Local167 : float3(ColorColor.x,ColorColor.y,ColorColor.z)) : float3(Local117.x,Local117.y,Local117.z));
782
+ float Local169 = (Local4.x * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).x);
783
+ float Local170 = (Local4.y * float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
784
+ float Local171 = (1.0 - float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).y);
785
+ float Local172 = (Local170 + Local171);
786
+ float Local173 = (float2(Local169,Local172).x + float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).x);
787
+ float Local174 = (float3(MetallicOffset.x,MetallicOffset.y,MetallicOffset.z).y * -1.0);
788
+ float Local175 = (float2(Local169,Local172).y + Local174);
789
+ float2 Local176 = (Local0 + float2(Local173,Local175));
790
+ float Local177 = (float3(MetallicUVW.x,MetallicUVW.y,MetallicUVW.z).z * 6.283185);
791
+ float Local178 = math::cos(Local177);
792
+ float Local179 = math::sin(Local177);
793
+ float Local180 = (Local179 * -1.0);
794
+ float Local181 = math::dot(Local176, float2(Local178,Local180));
795
+ float Local182 = math::dot(Local176, float2(Local179,Local178));
796
+ float2 Local183 = (float2(0.5,0.5) + float2(Local181,Local182));
797
+ float4 Local184 = tex::lookup_float4(MetallicTex,float2(Local183.x,1.0-Local183.y),tex::wrap_repeat,tex::wrap_repeat);
798
+ float3 Local185 = ((math::abs(MetallicFalloffValue1Type - 1.0) > 0.00001) ? (MetallicFalloffValue1Type >= 1.0 ? float3(float2(MetallicFalloffFloat,MetallicFalloffFloat).x,float2(MetallicFalloffFloat,MetallicFalloffFloat).y,MetallicFalloffFloat) : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
799
+ float Local186 = (Local4.x * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).x);
800
+ float Local187 = (Local4.y * float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
801
+ float Local188 = (1.0 - float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).y);
802
+ float Local189 = (Local187 + Local188);
803
+ float Local190 = (float2(Local186,Local189).x + float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).x);
804
+ float Local191 = (float3(MetallicOffset_2.x,MetallicOffset_2.y,MetallicOffset_2.z).y * -1.0);
805
+ float Local192 = (float2(Local186,Local189).y + Local191);
806
+ float2 Local193 = (Local0 + float2(Local190,Local192));
807
+ float Local194 = (float3(MetallicUVW_2.x,MetallicUVW_2.y,MetallicUVW_2.z).z * 6.283185);
808
+ float Local195 = math::cos(Local194);
809
+ float Local196 = math::sin(Local194);
810
+ float Local197 = (Local196 * -1.0);
811
+ float Local198 = math::dot(Local193, float2(Local195,Local197));
812
+ float Local199 = math::dot(Local193, float2(Local196,Local195));
813
+ float2 Local200 = (float2(0.5,0.5) + float2(Local198,Local199));
814
+ float4 Local201 = tex::lookup_float4(MetallicTex_2,float2(Local200.x,1.0-Local200.y),tex::wrap_repeat,tex::wrap_repeat);
815
+ float3 Local202 = ((math::abs(MetallicFalloffValue2Type - 1.0) > 0.00001) ? (MetallicFalloffValue2Type >= 1.0 ? float3(float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).x,float2(MetallicFalloffFloat_2,MetallicFalloffFloat_2).y,MetallicFalloffFloat_2) : float3(MetallicColor_2.x,MetallicColor_2.y,MetallicColor_2.z)) : float3(Local201.x,Local201.y,Local201.z));
816
+ float Local203 = math::min(math::max(MetallicFalloffFreshnelIor,0.0),100.0);
817
+ float Local204 = (1.0 / Local203);
818
+ float Local205 = math::max(Local203,Local204);
819
+ float Local206 = (Local205 - 1.0);
820
+ float Local207 = (Local205 * Local205);
821
+ float Local208 = (Local207 + Local72);
822
+ float Local209 = (Local208 - 1.0);
823
+ float Local210 = math::sqrt(Local209);
824
+ float Local211 = (Local210 / Local205);
825
+ float Local212 = ((math::abs(Local211 - 0.99999) > 0.000001) ? (Local211 >= 0.99999 ? 1.0 : 0.0) : 0.0);
826
+ float Local213 = math::max(Local212,Local78);
827
+ float Local214 = (Local71 / Local211);
828
+ float Local215 = (Local205 * Local214);
829
+ float Local216 = (Local215 - 1.0);
830
+ float Local217 = (Local215 + 1.0);
831
+ float Local218 = (Local216 / Local217);
832
+ float Local219 = math::pow(math::max(Local218,float(0.000001)),2.0);
833
+ float Local220 = (Local211 / Local71);
834
+ float Local221 = (Local205 * Local220);
835
+ float Local222 = (Local221 - 1.0);
836
+ float Local223 = (Local221 + 1.0);
837
+ float Local224 = (Local222 / Local223);
838
+ float Local225 = math::pow(math::max(Local224,float(0.000001)),2.0);
839
+ float Local226 = (Local219 + Local225);
840
+ float Local227 = (Local226 * 0.5);
841
+ float Local228 = (Local205 + 1.0);
842
+ float Local229 = (Local206 / Local228);
843
+ float Local230 = math::pow(math::max(Local229,float(0.000001)),2.0);
844
+ float Local231 = ((math::abs(Local213 - 1.0) > 0.1) ? (Local227) : Local230);
845
+ float Local232 = ((math::abs(Local206 - 0.0) > 0.000001) ? (Local231) : 0.0);
846
+ float Local233 = math::saturate(Local232);
847
+ float3 Local234 = math::lerp(Local185,Local202,Local233);
848
+ float3 Local235 = ((math::abs(MetallicIsTexType - 1.0) > 0.00001) ? (MetallicIsTexType >= 1.0 ? Local234 : float3(float2(MetallicFloat,MetallicFloat).x,float2(MetallicFloat,MetallicFloat).y,MetallicFloat)) : float3(Local184.x,Local184.y,Local184.z));
849
+ float Local236 = (Local4.x * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).x);
850
+ float Local237 = (Local4.y * float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
851
+ float Local238 = (1.0 - float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).y);
852
+ float Local239 = (Local237 + Local238);
853
+ float Local240 = (float2(Local236,Local239).x + float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).x);
854
+ float Local241 = (float3(SpecularOffset.x,SpecularOffset.y,SpecularOffset.z).y * -1.0);
855
+ float Local242 = (float2(Local236,Local239).y + Local241);
856
+ float2 Local243 = (Local0 + float2(Local240,Local242));
857
+ float Local244 = (float3(SpecularUVW.x,SpecularUVW.y,SpecularUVW.z).z * 6.283185);
858
+ float Local245 = math::cos(Local244);
859
+ float Local246 = math::sin(Local244);
860
+ float Local247 = (Local246 * -1.0);
861
+ float Local248 = math::dot(Local243, float2(Local245,Local247));
862
+ float Local249 = math::dot(Local243, float2(Local246,Local245));
863
+ float2 Local250 = (float2(0.5,0.5) + float2(Local248,Local249));
864
+ float4 Local251 = tex::lookup_float4(SpecularTex,float2(Local250.x,1.0-Local250.y),tex::wrap_repeat,tex::wrap_repeat);
865
+ float3 Local252 = ((math::abs(SpecularFalloffValue1Type - 1.0) > 0.00001) ? (SpecularFalloffValue1Type >= 1.0 ? float3(float2(SpecularFalloffFloat,SpecularFalloffFloat).x,float2(SpecularFalloffFloat,SpecularFalloffFloat).y,SpecularFalloffFloat) : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
866
+ float Local253 = (Local4.x * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).x);
867
+ float Local254 = (Local4.y * float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
868
+ float Local255 = (1.0 - float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).y);
869
+ float Local256 = (Local254 + Local255);
870
+ float Local257 = (float2(Local253,Local256).x + float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).x);
871
+ float Local258 = (float3(SpecularOffset_2.x,SpecularOffset_2.y,SpecularOffset_2.z).y * -1.0);
872
+ float Local259 = (float2(Local253,Local256).y + Local258);
873
+ float2 Local260 = (Local0 + float2(Local257,Local259));
874
+ float Local261 = (float3(SpecularUVW_2.x,SpecularUVW_2.y,SpecularUVW_2.z).z * 6.283185);
875
+ float Local262 = math::cos(Local261);
876
+ float Local263 = math::sin(Local261);
877
+ float Local264 = (Local263 * -1.0);
878
+ float Local265 = math::dot(Local260, float2(Local262,Local264));
879
+ float Local266 = math::dot(Local260, float2(Local263,Local262));
880
+ float2 Local267 = (float2(0.5,0.5) + float2(Local265,Local266));
881
+ float4 Local268 = tex::lookup_float4(SpecularTex_2,float2(Local267.x,1.0-Local267.y),tex::wrap_repeat,tex::wrap_repeat);
882
+ float3 Local269 = ((math::abs(SpecularFalloffValue2Type - 1.0) > 0.00001) ? (SpecularFalloffValue2Type >= 1.0 ? float3(float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).x,float2(SpecularFalloffFloat_2,SpecularFalloffFloat_2).y,SpecularFalloffFloat_2) : float3(SpecularColor_2.x,SpecularColor_2.y,SpecularColor_2.z)) : float3(Local268.x,Local268.y,Local268.z));
883
+ float Local270 = math::min(math::max(SpecularFalloffFreshnelIor,0.0),100.0);
884
+ float Local271 = (1.0 / Local270);
885
+ float Local272 = math::max(Local270,Local271);
886
+ float Local273 = (Local272 - 1.0);
887
+ float Local274 = (Local272 * Local272);
888
+ float Local275 = (Local274 + Local72);
889
+ float Local276 = (Local275 - 1.0);
890
+ float Local277 = math::sqrt(Local276);
891
+ float Local278 = (Local277 / Local272);
892
+ float Local279 = ((math::abs(Local278 - 0.99999) > 0.000001) ? (Local278 >= 0.99999 ? 1.0 : 0.0) : 0.0);
893
+ float Local280 = math::max(Local279,Local78);
894
+ float Local281 = (Local71 / Local278);
895
+ float Local282 = (Local272 * Local281);
896
+ float Local283 = (Local282 - 1.0);
897
+ float Local284 = (Local282 + 1.0);
898
+ float Local285 = (Local283 / Local284);
899
+ float Local286 = math::pow(math::max(Local285,float(0.000001)),2.0);
900
+ float Local287 = (Local278 / Local71);
901
+ float Local288 = (Local272 * Local287);
902
+ float Local289 = (Local288 - 1.0);
903
+ float Local290 = (Local288 + 1.0);
904
+ float Local291 = (Local289 / Local290);
905
+ float Local292 = math::pow(math::max(Local291,float(0.000001)),2.0);
906
+ float Local293 = (Local286 + Local292);
907
+ float Local294 = (Local293 * 0.5);
908
+ float Local295 = (Local272 + 1.0);
909
+ float Local296 = (Local273 / Local295);
910
+ float Local297 = math::pow(math::max(Local296,float(0.000001)),2.0);
911
+ float Local298 = ((math::abs(Local280 - 1.0) > 0.1) ? (Local294) : Local297);
912
+ float Local299 = ((math::abs(Local273 - 0.0) > 0.000001) ? (Local298) : 0.0);
913
+ float Local300 = math::saturate(Local299);
914
+ float3 Local301 = math::lerp(Local252,Local269,Local300);
915
+ float3 Local302 = ((math::abs(SpecularIsTexType - 1.0) > 0.00001) ? (SpecularIsTexType >= 1.0 ? Local301 : float3(float2(SpecularFloat,SpecularFloat).x,float2(SpecularFloat,SpecularFloat).y,SpecularFloat)) : float3(Local251.x,Local251.y,Local251.z));
916
+ float Local303 = (Local4.x * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).x);
917
+ float Local304 = (Local4.y * float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
918
+ float Local305 = (1.0 - float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).y);
919
+ float Local306 = (Local304 + Local305);
920
+ float Local307 = (float2(Local303,Local306).x + float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).x);
921
+ float Local308 = (float3(RoughnessOffset.x,RoughnessOffset.y,RoughnessOffset.z).y * -1.0);
922
+ float Local309 = (float2(Local303,Local306).y + Local308);
923
+ float2 Local310 = (Local0 + float2(Local307,Local309));
924
+ float Local311 = (float3(RoughnessUVW.x,RoughnessUVW.y,RoughnessUVW.z).z * 6.283185);
925
+ float Local312 = math::cos(Local311);
926
+ float Local313 = math::sin(Local311);
927
+ float Local314 = (Local313 * -1.0);
928
+ float Local315 = math::dot(Local310, float2(Local312,Local314));
929
+ float Local316 = math::dot(Local310, float2(Local313,Local312));
930
+ float2 Local317 = (float2(0.5,0.5) + float2(Local315,Local316));
931
+ float4 Local318 = tex::lookup_float4(RoughnessTex,float2(Local317.x,1.0-Local317.y),tex::wrap_repeat,tex::wrap_repeat);
932
+ float3 Local319 = ((math::abs(RoughnessFalloffValue1Type - 1.0) > 0.00001) ? (RoughnessFalloffValue1Type >= 1.0 ? float3(float2(RoughnessFalloffFloat,RoughnessFalloffFloat).x,float2(RoughnessFalloffFloat,RoughnessFalloffFloat).y,RoughnessFalloffFloat) : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
933
+ float Local320 = (Local4.x * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).x);
934
+ float Local321 = (Local4.y * float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
935
+ float Local322 = (1.0 - float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).y);
936
+ float Local323 = (Local321 + Local322);
937
+ float Local324 = (float2(Local320,Local323).x + float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).x);
938
+ float Local325 = (float3(RoughnessOffset_2.x,RoughnessOffset_2.y,RoughnessOffset_2.z).y * -1.0);
939
+ float Local326 = (float2(Local320,Local323).y + Local325);
940
+ float2 Local327 = (Local0 + float2(Local324,Local326));
941
+ float Local328 = (float3(RoughnessUVW_2.x,RoughnessUVW_2.y,RoughnessUVW_2.z).z * 6.283185);
942
+ float Local329 = math::cos(Local328);
943
+ float Local330 = math::sin(Local328);
944
+ float Local331 = (Local330 * -1.0);
945
+ float Local332 = math::dot(Local327, float2(Local329,Local331));
946
+ float Local333 = math::dot(Local327, float2(Local330,Local329));
947
+ float2 Local334 = (float2(0.5,0.5) + float2(Local332,Local333));
948
+ float4 Local335 = tex::lookup_float4(RoughnessTex_2,float2(Local334.x,1.0-Local334.y),tex::wrap_repeat,tex::wrap_repeat);
949
+ float3 Local336 = ((math::abs(RoughnessFalloffValue2Type - 1.0) > 0.00001) ? (RoughnessFalloffValue2Type >= 1.0 ? float3(float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).x,float2(RoughnessFalloffFloat_2,RoughnessFalloffFloat_2).y,RoughnessFalloffFloat_2) : float3(RoughnessColor_2.x,RoughnessColor_2.y,RoughnessColor_2.z)) : float3(Local335.x,Local335.y,Local335.z));
950
+ float Local337 = math::min(math::max(RoughnessFalloffFreshnelIor,0.0),100.0);
951
+ float Local338 = (1.0 / Local337);
952
+ float Local339 = math::max(Local337,Local338);
953
+ float Local340 = (Local339 - 1.0);
954
+ float Local341 = (Local339 * Local339);
955
+ float Local342 = (Local341 + Local72);
956
+ float Local343 = (Local342 - 1.0);
957
+ float Local344 = math::sqrt(Local343);
958
+ float Local345 = (Local344 / Local339);
959
+ float Local346 = ((math::abs(Local345 - 0.99999) > 0.000001) ? (Local345 >= 0.99999 ? 1.0 : 0.0) : 0.0);
960
+ float Local347 = math::max(Local346,Local78);
961
+ float Local348 = (Local71 / Local345);
962
+ float Local349 = (Local339 * Local348);
963
+ float Local350 = (Local349 - 1.0);
964
+ float Local351 = (Local349 + 1.0);
965
+ float Local352 = (Local350 / Local351);
966
+ float Local353 = math::pow(math::max(Local352,float(0.000001)),2.0);
967
+ float Local354 = (Local345 / Local71);
968
+ float Local355 = (Local339 * Local354);
969
+ float Local356 = (Local355 - 1.0);
970
+ float Local357 = (Local355 + 1.0);
971
+ float Local358 = (Local356 / Local357);
972
+ float Local359 = math::pow(math::max(Local358,float(0.000001)),2.0);
973
+ float Local360 = (Local353 + Local359);
974
+ float Local361 = (Local360 * 0.5);
975
+ float Local362 = (Local339 + 1.0);
976
+ float Local363 = (Local340 / Local362);
977
+ float Local364 = math::pow(math::max(Local363,float(0.000001)),2.0);
978
+ float Local365 = ((math::abs(Local347 - 1.0) > 0.1) ? (Local361) : Local364);
979
+ float Local366 = ((math::abs(Local340 - 0.0) > 0.000001) ? (Local365) : 0.0);
980
+ float Local367 = math::saturate(Local366);
981
+ float3 Local368 = math::lerp(Local319,Local336,Local367);
982
+ float3 Local369 = ((math::abs(RoughnessIsTexType - 1.0) > 0.00001) ? (RoughnessIsTexType >= 1.0 ? Local368 : float3(float2(RoughnessFloat,RoughnessFloat).x,float2(RoughnessFloat,RoughnessFloat).y,RoughnessFloat)) : float3(Local318.x,Local318.y,Local318.z));
983
+ float Local370 = (Local4.x * float3(OpacityUVW.x,OpacityUVW.y,OpacityUVW.z).x);
984
+ float Local371 = (Local4.y * float3(OpacityUVW.x,OpacityUVW.y,OpacityUVW.z).y);
985
+ float Local372 = (1.0 - float3(OpacityUVW.x,OpacityUVW.y,OpacityUVW.z).y);
986
+ float Local373 = (Local371 + Local372);
987
+ float Local374 = (float2(Local370,Local373).x + float3(OpacityOffset.x,OpacityOffset.y,OpacityOffset.z).x);
988
+ float Local375 = (float3(OpacityOffset.x,OpacityOffset.y,OpacityOffset.z).y * -1.0);
989
+ float Local376 = (float2(Local370,Local373).y + Local375);
990
+ float2 Local377 = (Local0 + float2(Local374,Local376));
991
+ float Local378 = (float3(OpacityUVW.x,OpacityUVW.y,OpacityUVW.z).z * 6.283185);
992
+ float Local379 = math::cos(Local378);
993
+ float Local380 = math::sin(Local378);
994
+ float Local381 = (Local380 * -1.0);
995
+ float Local382 = math::dot(Local377, float2(Local379,Local381));
996
+ float Local383 = math::dot(Local377, float2(Local380,Local379));
997
+ float2 Local384 = (float2(0.5,0.5) + float2(Local382,Local383));
998
+ float4 Local385 = tex::lookup_float4(OpacityTex,float2(Local384.x,1.0-Local384.y),tex::wrap_repeat,tex::wrap_repeat);
999
+ float3 Local386 = ((math::abs(OpacityFalloffValue1Type - 1.0) > 0.00001) ? (OpacityFalloffValue1Type >= 1.0 ? float3(float2(OpacityFalloffFloat,OpacityFalloffFloat).x,float2(OpacityFalloffFloat,OpacityFalloffFloat).y,OpacityFalloffFloat) : float3(float2(OpacityFloat,OpacityFloat).x,float2(OpacityFloat,OpacityFloat).y,OpacityFloat)) : float3(Local385.x,Local385.y,Local385.z));
1000
+ float Local387 = (Local4.x * float3(OpacityUVW_2.x,OpacityUVW_2.y,OpacityUVW_2.z).x);
1001
+ float Local388 = (Local4.y * float3(OpacityUVW_2.x,OpacityUVW_2.y,OpacityUVW_2.z).y);
1002
+ float Local389 = (1.0 - float3(OpacityUVW_2.x,OpacityUVW_2.y,OpacityUVW_2.z).y);
1003
+ float Local390 = (Local388 + Local389);
1004
+ float Local391 = (float2(Local387,Local390).x + float3(OpacityOffset_2.x,OpacityOffset_2.y,OpacityOffset_2.z).x);
1005
+ float Local392 = (float3(OpacityOffset_2.x,OpacityOffset_2.y,OpacityOffset_2.z).y * -1.0);
1006
+ float Local393 = (float2(Local387,Local390).y + Local392);
1007
+ float2 Local394 = (Local0 + float2(Local391,Local393));
1008
+ float Local395 = (float3(OpacityUVW_2.x,OpacityUVW_2.y,OpacityUVW_2.z).z * 6.283185);
1009
+ float Local396 = math::cos(Local395);
1010
+ float Local397 = math::sin(Local395);
1011
+ float Local398 = (Local397 * -1.0);
1012
+ float Local399 = math::dot(Local394, float2(Local396,Local398));
1013
+ float Local400 = math::dot(Local394, float2(Local397,Local396));
1014
+ float2 Local401 = (float2(0.5,0.5) + float2(Local399,Local400));
1015
+ float4 Local402 = tex::lookup_float4(OpacityTex_2,float2(Local401.x,1.0-Local401.y),tex::wrap_repeat,tex::wrap_repeat);
1016
+ float3 Local403 = ((math::abs(OpacityFalloffValue2Type - 1.0) > 0.00001) ? (OpacityFalloffValue2Type >= 1.0 ? float3(float2(OpacityFalloffFloat_2,OpacityFalloffFloat_2).x,float2(OpacityFalloffFloat_2,OpacityFalloffFloat_2).y,OpacityFalloffFloat_2) : float3(OpacityColor_2.x,OpacityColor_2.y,OpacityColor_2.z)) : float3(Local402.x,Local402.y,Local402.z));
1017
+ float Local404 = math::min(math::max(OpacityFalloffFreshnelIor,0.0),100.0);
1018
+ float Local405 = (1.0 / Local404);
1019
+ float Local406 = math::max(Local404,Local405);
1020
+ float Local407 = (Local406 - 1.0);
1021
+ float Local408 = (Local406 * Local406);
1022
+ float Local409 = (Local408 + Local72);
1023
+ float Local410 = (Local409 - 1.0);
1024
+ float Local411 = math::sqrt(Local410);
1025
+ float Local412 = (Local411 / Local406);
1026
+ float Local413 = ((math::abs(Local412 - 0.99999) > 0.000001) ? (Local412 >= 0.99999 ? 1.0 : 0.0) : 0.0);
1027
+ float Local414 = math::max(Local413,Local78);
1028
+ float Local415 = (Local71 / Local412);
1029
+ float Local416 = (Local406 * Local415);
1030
+ float Local417 = (Local416 - 1.0);
1031
+ float Local418 = (Local416 + 1.0);
1032
+ float Local419 = (Local417 / Local418);
1033
+ float Local420 = math::pow(math::max(Local419,float(0.000001)),2.0);
1034
+ float Local421 = (Local412 / Local71);
1035
+ float Local422 = (Local406 * Local421);
1036
+ float Local423 = (Local422 - 1.0);
1037
+ float Local424 = (Local422 + 1.0);
1038
+ float Local425 = (Local423 / Local424);
1039
+ float Local426 = math::pow(math::max(Local425,float(0.000001)),2.0);
1040
+ float Local427 = (Local420 + Local426);
1041
+ float Local428 = (Local427 * 0.5);
1042
+ float Local429 = (Local406 + 1.0);
1043
+ float Local430 = (Local407 / Local429);
1044
+ float Local431 = math::pow(math::max(Local430,float(0.000001)),2.0);
1045
+ float Local432 = ((math::abs(Local414 - 1.0) > 0.1) ? (Local428) : Local431);
1046
+ float Local433 = ((math::abs(Local407 - 0.0) > 0.000001) ? (Local432) : 0.0);
1047
+ float Local434 = math::saturate(Local433);
1048
+ float3 Local435 = math::lerp(Local386,Local403,Local434);
1049
+ float3 Local436 = ((math::abs(OpacityIsTexType - 1.0) > 0.00001) ? (OpacityIsTexType >= 1.0 ? Local435 : float3(float2(OpacityFloat,OpacityFloat).x,float2(OpacityFloat,OpacityFloat).y,OpacityFloat)) : float3(Local385.x,Local385.y,Local385.z));
1050
+
1051
+ float3 EmissiveColor_mdl = Local101;
1052
+ float Opacity_mdl = Local436.x;
1053
+ float OpacityMask_mdl = (math::saturate(Local436.x) - 1.0f / 255.0f) < 0.0f ? 0.0f : 1.0f;
1054
+ float3 BaseColor_mdl = Local168;
1055
+ float Metallic_mdl = Local235.x;
1056
+ float Specular_mdl = Local302.x;
1057
+ float Roughness_mdl = Local369.x;
1058
+ float3 Refraction_mdl = 1.491;
1059
+ float SurfaceThickness_mdl = 0.01;
1060
+
1061
+ } in
1062
+ ::OmniUe4Translucent(
1063
+ base_color: BaseColor_mdl,
1064
+ metallic: Metallic_mdl,
1065
+ roughness: Roughness_mdl,
1066
+ specular: Specular_mdl,
1067
+ normal: Normal_mdl,
1068
+ opacity: Opacity_mdl,
1069
+ opacity_mask: OpacityMask_mdl,
1070
+ emissive_color: EmissiveColor_mdl,
1071
+ displacement: WorldPositionOffset_mdl,
1072
+ refraction: Refraction_mdl.x,
1073
+ two_sided: false);
kujiale_0003/Materials/OmniUe4Base.mdl ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright 2020 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
+ //* 1.0.0 - first version
30
+ //* 1.0.1 - merge unlit template
31
+ //* 1.0.2 - Fix EDF in the back side: the EDF contained in surface is only used for the front side and not for the back side
32
+ //* 1.0.3 - UE4 normal mapping: Geometry normal shouldn't be changed
33
+ //* 1.0.4 - using absolute import paths when importing standard modules
34
+
35
+ mdl 1.3;
36
+
37
+ import ::df::*;
38
+ import ::state::*;
39
+ import ::math::*;
40
+ import ::tex::*;
41
+ import ::anno::*;
42
+
43
+ float emissive_multiplier()
44
+ [[
45
+ anno::description("the multiplier to convert UE4 emissive to raw data"),
46
+ anno::noinline()
47
+ ]]
48
+ {
49
+ return 20.0f * 128.0f;
50
+ }
51
+
52
+ float3 tangent_space_normal(
53
+ float3 normal = float3(0.0,0.0,1.0),
54
+ float3 tangent_u = state::texture_tangent_u(0),
55
+ float3 tangent_v = state::texture_tangent_v(0)
56
+ )
57
+ [[
58
+ anno::description("Interprets the vector in tangent space"),
59
+ anno::noinline()
60
+ ]]
61
+ {
62
+ return math::normalize(
63
+ tangent_u * normal.x - /* flip_tangent_v */
64
+ tangent_v * normal.y +
65
+ state::normal() * (normal.z));
66
+ }
67
+
68
+ float3 world_space_normal(
69
+ float3 normal = float3(0.0,0.0,1.0),
70
+ float3 tangent_u = state::texture_tangent_u(0),
71
+ float3 tangent_v = state::texture_tangent_v(0)
72
+ )
73
+ [[
74
+ anno::description("Interprets the vector in world space"),
75
+ anno::noinline()
76
+ ]]
77
+ {
78
+ return tangent_space_normal(
79
+ math::normalize(
80
+ normal.x * float3(tangent_u.x, tangent_v.x, state::normal().x) -
81
+ normal.y * float3(tangent_u.y, tangent_v.y, state::normal().y) +
82
+ normal.z * float3(tangent_u.z, tangent_v.z, state::normal().z)),
83
+ tangent_u,
84
+ tangent_v
85
+ );
86
+ }
87
+
88
+ export material OmniUe4Base(
89
+ float3 base_color = float3(0.0, 0.0, 0.0),
90
+ float metallic = 0.0,
91
+ float roughness = 0.5,
92
+ float specular = 0.5,
93
+ float3 normal = float3(0.0,0.0,1.0),
94
+ float clearcoat_weight = 0.0,
95
+ float clearcoat_roughness = 0.0,
96
+ float3 clearcoat_normal = float3(0.0,0.0,1.0),
97
+ uniform bool enable_opacity = true,
98
+ float opacity = 1.0,
99
+ float3 emissive_color = float3(0.0, 0.0, 0.0),
100
+ float3 displacement = float3(0.0),
101
+ uniform bool is_tangent_space_normal = true,
102
+ uniform bool two_sided = false,
103
+ uniform bool is_unlit = false
104
+ )
105
+ [[
106
+ anno::display_name("Omni UE4 Base"),
107
+ anno::description("Omni UE4 Base, supports UE4 default lit and clearcoat shading model"),
108
+ anno::version( 1, 0, 0),
109
+ anno::author("NVIDIA CORPORATION"),
110
+ anno::key_words(string[]("omni", "UE4", "omniverse", "lit", "clearcoat", "generic"))
111
+ ]]
112
+ = let {
113
+ color final_base_color = math::saturate(base_color);
114
+ float final_metallic = math::saturate(metallic);
115
+ float final_roughness = math::saturate(roughness);
116
+ float final_specular = math::saturate(specular);
117
+ color final_emissive_color = math::max(emissive_color, 0.0f) * emissive_multiplier(); /*factor for converting ue4 emissive to raw value*/
118
+ float final_clearcoat_weight = math::saturate(clearcoat_weight);
119
+ float final_clearcoat_roughness = math::saturate(clearcoat_roughness);
120
+ float3 final_normal = math::normalize(normal);
121
+ float3 final_clearcoat_normal = math::normalize(clearcoat_normal);
122
+
123
+ // - compute final roughness by squaring the "roughness" parameter
124
+ float alpha = final_roughness * final_roughness;
125
+ // reduce the reflectivity at grazing angles to avoid "dark edges" for high roughness due to the layering
126
+ float grazing_refl = math::max((1.0 - final_roughness), 0.0);
127
+
128
+ float3 the_normal = is_unlit ? state::normal() :
129
+ (is_tangent_space_normal ?
130
+ tangent_space_normal(
131
+ normal: final_normal,
132
+ tangent_u: state::texture_tangent_u(0),
133
+ tangent_v: state::texture_tangent_v(0)
134
+ ) : world_space_normal(
135
+ normal: final_normal,
136
+ tangent_u: state::texture_tangent_u(0),
137
+ tangent_v: state::texture_tangent_v(0)
138
+ ));
139
+
140
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
141
+ // the glossy layer has no color tint
142
+
143
+ bsdf dielectric_component = df::custom_curve_layer(
144
+ weight: final_specular,
145
+ normal_reflectivity: 0.08,
146
+ grazing_reflectivity: grazing_refl,
147
+ layer: df::microfacet_ggx_smith_bsdf(roughness_u: alpha),
148
+ base: df::diffuse_reflection_bsdf(tint: final_base_color),
149
+ normal: the_normal);
150
+
151
+ // the metallic component doesn't have a diffuse component, it's only glossy
152
+ // base_color is applied to tint it
153
+ bsdf metallic_component = df::microfacet_ggx_smith_bsdf(tint: final_base_color, roughness_u: alpha);
154
+
155
+ // final BSDF is a linear blend between dielectric and metallic component
156
+ bsdf dielectric_metal_mix =
157
+ df::normalized_mix(
158
+ components:
159
+ df::bsdf_component[](
160
+ df::bsdf_component(
161
+ component: metallic_component,
162
+ weight: final_metallic),
163
+ df::bsdf_component(
164
+ component: dielectric_component,
165
+ weight: 1.0-final_metallic)
166
+ )
167
+ );
168
+
169
+ // clearcoat layer
170
+ float clearcoat_grazing_refl = math::max((1.0 - final_clearcoat_roughness), 0.0);
171
+ float clearcoat_alpha = final_clearcoat_roughness * final_clearcoat_roughness;
172
+
173
+ float3 the_clearcoat_normal = is_tangent_space_normal ? tangent_space_normal(
174
+ normal: final_clearcoat_normal,
175
+ tangent_u: state::texture_tangent_u(0),
176
+ tangent_v: state::texture_tangent_v(0)
177
+ ) : world_space_normal(
178
+ normal: final_clearcoat_normal,
179
+ tangent_u: state::texture_tangent_u(0),
180
+ tangent_v: state::texture_tangent_v(0)
181
+ );
182
+
183
+
184
+ bsdf clearcoat =
185
+ df::custom_curve_layer(
186
+ base: df::weighted_layer(
187
+ layer: dielectric_metal_mix,
188
+ weight: 1.0,
189
+ normal: final_clearcoat_weight == 0.0 ? state::normal() : the_normal
190
+ ),
191
+ layer: df::microfacet_ggx_smith_bsdf(
192
+ roughness_u: clearcoat_alpha,
193
+ tint: color(1.0)
194
+ ),
195
+ normal_reflectivity: 0.04,
196
+ grazing_reflectivity: clearcoat_grazing_refl,
197
+ normal: the_clearcoat_normal,
198
+ weight: final_clearcoat_weight
199
+ );
200
+ bsdf surface = is_unlit ? bsdf() : clearcoat;
201
+ }
202
+ in material(
203
+ thin_walled: two_sided, // Graphene?
204
+ surface: material_surface(
205
+ scattering: surface,
206
+ emission:
207
+ material_emission (
208
+ emission: df::diffuse_edf (),
209
+ intensity: final_emissive_color
210
+ )
211
+ ),
212
+ backface: material_surface(
213
+ emission:
214
+ material_emission (
215
+ emission: df::diffuse_edf (),
216
+ intensity: final_emissive_color
217
+ )
218
+ ),
219
+ geometry: material_geometry(
220
+ displacement: displacement,
221
+ normal: final_clearcoat_weight == 0.0 ? the_normal : state::normal(),
222
+ cutout_opacity: enable_opacity ? opacity : 1.0
223
+ )
224
+ );
kujiale_0003/Materials/OmniUe4Function.mdl ADDED
@@ -0,0 +1,1413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright 2020 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
+ //* 1.0.1 - using absolute import paths when importing standard modules
30
+
31
+ mdl 1.6;
32
+
33
+ import ::df::*;
34
+ import ::state::*;
35
+ import ::math::*;
36
+ import ::tex::*;
37
+ import ::anno::*;
38
+
39
+
40
+ export float3 convert_to_left_hand(float3 vec3, uniform bool up_z = true, uniform bool is_position = true)
41
+ [[
42
+ anno::description("convert from RH to LH"),
43
+ anno::noinline()
44
+ ]]
45
+ {
46
+ float4x4 ZupConversion = float4x4(
47
+ 1.0f, 0.0f, 0.0f, 0.0f,
48
+ 0.0f, -1.0f, 0.0f, 0.0f,
49
+ 0.0f, 0.0f, 1.0f, 0.0f,
50
+ 0.0f, 0.0f, 0.0f, 1.0f
51
+ );
52
+
53
+ float4x4 YupConversion = float4x4(
54
+ 1.0f, 0.0f, 0.0f, 0.0f,
55
+ 0.0f, 0.0f, 1.0f, 0.0f,
56
+ 0.0f, 1.0f, 0.0f, 0.0f,
57
+ 0.0f, 0.0f, 0.0f, 1.0f
58
+ );
59
+
60
+ float4 vec4 = float4(vec3.x, vec3.y, vec3.z, is_position ? 1.0f : 0.0f);
61
+
62
+ vec4 = vec4 * (up_z ? ZupConversion : YupConversion);
63
+
64
+ return float3(vec4.x, vec4.y, vec4.z);
65
+ }
66
+
67
+ export float3 transform_vector_from_tangent_to_world(float3 vector,
68
+ uniform bool up_z = true,
69
+ float3 tangent_u = state::texture_tangent_u(0),
70
+ float3 tangent_v = state::texture_tangent_v(0))
71
+ [[
72
+ anno::description("Transform vector from tangent space to world space"),
73
+ anno::noinline()
74
+ ]]
75
+ {
76
+ /* flip_tangent_v */
77
+ return convert_to_left_hand(
78
+ tangent_u * vector.x - tangent_v * vector.y + state::normal() * vector.z,
79
+ up_z, false);
80
+ }
81
+
82
+ export float3 transform_vector_from_world_to_tangent(float3 vector,
83
+ uniform bool up_z = true,
84
+ float3 tangent_u = state::texture_tangent_u(0),
85
+ float3 tangent_v = state::texture_tangent_v(0))
86
+ [[
87
+ anno::description("Transform vector from world space to tangent space"),
88
+ anno::noinline()
89
+ ]]
90
+ {
91
+ float3 vecRH = convert_to_left_hand(vector, up_z, false);
92
+ /* flip_tangent_v */
93
+ return vecRH.x * float3(tangent_u.x, -tangent_v.x, state::normal().x) +
94
+ vecRH.y * float3(tangent_u.y, -tangent_v.y, state::normal().y) +
95
+ vecRH.z * float3(tangent_u.z, -tangent_v.z, state::normal().z);
96
+ }
97
+
98
+ export float4 unpack_normal_map(
99
+ float4 texture_sample = float4(0.0, 0.0, 1.0, 1.0)
100
+ )
101
+ [[
102
+ anno::description("Unpack a normal stored in a normal map"),
103
+ anno::noinline()
104
+ ]]
105
+ {
106
+ float2 normal_xy = float2(texture_sample.x, texture_sample.y);
107
+
108
+ normal_xy = normal_xy * float2(2.0,2.0) - float2(1.0,1.0);
109
+ float normal_z = math::sqrt( math::saturate( 1.0 - math::dot( normal_xy, normal_xy ) ) );
110
+ return float4( normal_xy.x, normal_xy.y, normal_z, 1.0 );
111
+ }
112
+
113
+ // for get color value from normal.
114
+ export float4 pack_normal_map(
115
+ float4 texture_sample = float4(0.0, 0.0, 1.0, 1.0)
116
+ )
117
+ [[
118
+ anno::description("Pack to color from a normal")
119
+ ]]
120
+ {
121
+ float2 return_xy = float2(texture_sample.x, texture_sample.y);
122
+
123
+ return_xy = (return_xy + float2(1.0,1.0)) / float2(2.0,2.0);
124
+
125
+ return float4( return_xy.x, return_xy.y, 0.0, 1.0 );
126
+ }
127
+
128
+ export float4 greyscale_texture_lookup(
129
+ float4 texture_sample = float4(0.0, 0.0, 0.0, 1.0)
130
+ )
131
+ [[
132
+ anno::description("Sampling a greyscale texture"),
133
+ anno::noinline()
134
+ ]]
135
+ {
136
+ return float4(texture_sample.x, texture_sample.x, texture_sample.x, texture_sample.x);
137
+ }
138
+
139
+ export float3 pixel_normal_world_space(uniform bool up_z = true)
140
+ [[
141
+ anno::description("Pixel normal in world space"),
142
+ anno::noinline()
143
+ ]]
144
+ {
145
+ return convert_to_left_hand(state::transform_normal(state::coordinate_internal,state::coordinate_world,state::normal()), up_z, false);
146
+ }
147
+
148
+ export float3 vertex_normal_world_space(uniform bool up_z = true)
149
+ [[
150
+ anno::description("Vertex normal in world space"),
151
+ anno::noinline()
152
+ ]]
153
+ {
154
+ return convert_to_left_hand(state::transform_normal(state::coordinate_internal,state::coordinate_world,state::normal()), up_z, false);
155
+ }
156
+
157
+ export float3 landscape_normal_world_space(uniform bool up_z = true)
158
+ [[
159
+ anno::description("Landscape normal in world space")
160
+ ]]
161
+ {
162
+ float3 normalFromNormalmap = math::floor((::vertex_normal_world_space(up_z) * 0.5 + 0.5) * 255.0) / 255.0 * 2.0 - 1.0;
163
+
164
+ float2 normalXY = float2(normalFromNormalmap.x, normalFromNormalmap.y);
165
+ return float3(normalXY.x, normalXY.y, math::sqrt(math::saturate(1.0 - math::dot(normalXY, normalXY))));
166
+ }
167
+
168
+ // Different implementation specific between mdl and hlsl for smoothstep
169
+ export float smoothstep(float a, float b, float l)
170
+ {
171
+ if (a < b)
172
+ {
173
+ return math::smoothstep(a, b, l);
174
+ }
175
+ else if (a > b)
176
+ {
177
+ return 1.0 - math::smoothstep(b, a, l);
178
+ }
179
+ else
180
+ {
181
+ return l <= a ? 0.0 : 1.0;
182
+ }
183
+ }
184
+
185
+ export float2 smoothstep(float2 a, float2 b, float2 l)
186
+ {
187
+ return float2(smoothstep(a.x, b.x, l.x), smoothstep(a.y, b.y, l.y));
188
+ }
189
+
190
+ export float3 smoothstep(float3 a, float3 b, float3 l)
191
+ {
192
+ return float3(smoothstep(a.x, b.x, l.x), smoothstep(a.y, b.y, l.y), smoothstep(a.z, b.z, l.z));
193
+ }
194
+
195
+ export float4 smoothstep(float4 a, float4 b, float4 l)
196
+ {
197
+ return float4(smoothstep(a.x, b.x, l.x), smoothstep(a.y, b.y, l.y), smoothstep(a.z, b.z, l.z), smoothstep(a.w, b.w, l.w));
198
+ }
199
+
200
+ export float2 smoothstep(float2 a, float2 b, float l)
201
+ {
202
+ return float2(smoothstep(a.x, b.x, l), smoothstep(a.y, b.y, l));
203
+ }
204
+
205
+ export float3 smoothstep(float3 a, float3 b, float l)
206
+ {
207
+ return float3(smoothstep(a.x, b.x, l), smoothstep(a.y, b.y, l), smoothstep(a.z, b.z, l));
208
+ }
209
+
210
+ export float4 smoothstep(float4 a, float4 b, float l)
211
+ {
212
+ return float4(smoothstep(a.x, b.x, l), smoothstep(a.y, b.y, l), smoothstep(a.z, b.z, l), smoothstep(a.w, b.w, l));
213
+ }
214
+
215
+ export float2 smoothstep(float a, float b, float2 l)
216
+ {
217
+ return float2(smoothstep(a, b, l.x), smoothstep(a, b, l.y));
218
+ }
219
+
220
+ export float3 smoothstep(float a, float b, float3 l)
221
+ {
222
+ return float3(smoothstep(a, b, l.x), smoothstep(a, b, l.y), smoothstep(a, b, l.z));
223
+ }
224
+
225
+ export float4 smoothstep(float a, float b, float4 l)
226
+ {
227
+ return float4(smoothstep(a, b, l.x), smoothstep(a, b, l.y), smoothstep(a, b, l.z), smoothstep(a, b, l.w));
228
+ }
229
+
230
+ //------------------ Random from UE4 -----------------------
231
+ float length2(float3 v)
232
+ {
233
+ return math::dot(v, v);
234
+ }
235
+
236
+ float3 GetPerlinNoiseGradientTextureAt(uniform texture_2d PerlinNoiseGradientTexture, float3 v)
237
+ {
238
+ const float2 ZShear = float2(17.0f, 89.0f);
239
+
240
+ float2 OffsetA = v.z * ZShear;
241
+ float2 TexA = (float2(v.x, v.y) + OffsetA + 0.5f) / 128.0f;
242
+ float4 PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexA.x,1.0-TexA.y),tex::wrap_repeat,tex::wrap_repeat);
243
+ return float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z) * 2.0 - 1.0;
244
+ }
245
+
246
+ float3 SkewSimplex(float3 In)
247
+ {
248
+ return In + math::dot(In, float3(1.0 / 3.0f) );
249
+ }
250
+ float3 UnSkewSimplex(float3 In)
251
+ {
252
+ return In - math::dot(In, float3(1.0 / 6.0f) );
253
+ }
254
+
255
+ // 3D random number generator inspired by PCGs (permuted congruential generator)
256
+ // Using a **simple** Feistel cipher in place of the usual xor shift permutation step
257
+ // @param v = 3D integer coordinate
258
+ // @return three elements w/ 16 random bits each (0-0xffff).
259
+ // ~8 ALU operations for result.x (7 mad, 1 >>)
260
+ // ~10 ALU operations for result.xy (8 mad, 2 >>)
261
+ // ~12 ALU operations for result.xyz (9 mad, 3 >>)
262
+
263
+ //TODO: uint3
264
+ int3 Rand3DPCG16(int3 p)
265
+ {
266
+ // taking a signed int then reinterpreting as unsigned gives good behavior for negatives
267
+ //TODO: uint3
268
+ int3 v = int3(p);
269
+
270
+ // Linear congruential step. These LCG constants are from Numerical Recipies
271
+ // For additional #'s, PCG would do multiple LCG steps and scramble each on output
272
+ // So v here is the RNG state
273
+ v = v * 1664525 + 1013904223;
274
+
275
+ // PCG uses xorshift for the final shuffle, but it is expensive (and cheap
276
+ // versions of xorshift have visible artifacts). Instead, use simple MAD Feistel steps
277
+ //
278
+ // Feistel ciphers divide the state into separate parts (usually by bits)
279
+ // then apply a series of permutation steps one part at a time. The permutations
280
+ // use a reversible operation (usually ^) to part being updated with the result of
281
+ // a permutation function on the other parts and the key.
282
+ //
283
+ // In this case, I'm using v.x, v.y and v.z as the parts, using + instead of ^ for
284
+ // the combination function, and just multiplying the other two parts (no key) for
285
+ // the permutation function.
286
+ //
287
+ // That gives a simple mad per round.
288
+ v.x += v.y*v.z;
289
+ v.y += v.z*v.x;
290
+ v.z += v.x*v.y;
291
+ v.x += v.y*v.z;
292
+ v.y += v.z*v.x;
293
+ v.z += v.x*v.y;
294
+
295
+ // only top 16 bits are well shuffled
296
+ return v >> 16;
297
+ }
298
+
299
+ // Wraps noise for tiling texture creation
300
+ // @param v = unwrapped texture parameter
301
+ // @param bTiling = true to tile, false to not tile
302
+ // @param RepeatSize = number of units before repeating
303
+ // @return either original or wrapped coord
304
+ float3 NoiseTileWrap(float3 v, bool bTiling, float RepeatSize)
305
+ {
306
+ return bTiling ? (math::frac(v / RepeatSize) * RepeatSize) : v;
307
+ }
308
+
309
+ // Evaluate polynomial to get smooth transitions for Perlin noise
310
+ // only needed by Perlin functions in this file
311
+ // scalar(per component): 2 add, 5 mul
312
+ float4 PerlinRamp(float4 t)
313
+ {
314
+ return t * t * t * (t * (t * 6 - 15) + 10);
315
+ }
316
+
317
+ // Blum-Blum-Shub-inspired pseudo random number generator
318
+ // http://www.umbc.edu/~olano/papers/mNoise.pdf
319
+ // real BBS uses ((s*s) mod M) with bignums and M as the product of two huge Blum primes
320
+ // instead, we use a single prime M just small enough not to overflow
321
+ // note that the above paper used 61, which fits in a half, but is unusably bad
322
+ // @param Integer valued floating point seed
323
+ // @return random number in range [0,1)
324
+ // ~8 ALU operations (5 *, 3 frac)
325
+ float RandBBSfloat(float seed)
326
+ {
327
+ float BBS_PRIME24 = 4093.0;
328
+ float s = math::frac(seed / BBS_PRIME24);
329
+ s = math::frac(s * s * BBS_PRIME24);
330
+ s = math::frac(s * s * BBS_PRIME24);
331
+ return s;
332
+ }
333
+
334
+ // Modified noise gradient term
335
+ // @param seed - random seed for integer lattice position
336
+ // @param offset - [-1,1] offset of evaluation point from lattice point
337
+ // @return gradient direction (xyz) and contribution (w) from this lattice point
338
+ float4 MGradient(int seed, float3 offset)
339
+ {
340
+ //TODO uint
341
+ int rand = Rand3DPCG16(int3(seed,0,0)).x;
342
+ int3 MGradientMask = int3(0x8000, 0x4000, 0x2000);
343
+ float3 MGradientScale = float3(1.0 / 0x4000, 1.0 / 0x2000, 1.0 / 0x1000);
344
+ float3 direction = float3(int3(rand, rand, rand) & MGradientMask) * MGradientScale - 1;
345
+ return float4(direction.x, direction.y, direction.z, math::dot(direction, offset));
346
+ }
347
+
348
+ // compute Perlin and related noise corner seed values
349
+ // @param v = 3D noise argument, use float3(x,y,0) for 2D or float3(x,0,0) for 1D
350
+ // @param bTiling = true to return seed values for a repeating noise pattern
351
+ // @param RepeatSize = integer units before tiling in each dimension
352
+ // @param seed000-seed111 = hash function seeds for the eight corners
353
+ // @return fractional part of v
354
+ struct SeedValue
355
+ {
356
+ float3 fv = float3(0);
357
+ float seed000 = 0;
358
+ float seed001 = 0;
359
+ float seed010 = 0;
360
+ float seed011 = 0;
361
+ float seed100 = 0;
362
+ float seed101 = 0;
363
+ float seed110 = 0;
364
+ float seed111 = 0;
365
+ };
366
+
367
+ SeedValue NoiseSeeds(float3 v, bool bTiling, float RepeatSize)
368
+ {
369
+ SeedValue seeds;
370
+ seeds.fv = math::frac(v);
371
+ float3 iv = math::floor(v);
372
+
373
+ const float3 primes = float3(19, 47, 101);
374
+
375
+ if (bTiling)
376
+ { // can't algebraically combine with primes
377
+ seeds.seed000 = math::dot(primes, NoiseTileWrap(iv, true, RepeatSize));
378
+ seeds.seed100 = math::dot(primes, NoiseTileWrap(iv + float3(1, 0, 0), true, RepeatSize));
379
+ seeds.seed010 = math::dot(primes, NoiseTileWrap(iv + float3(0, 1, 0), true, RepeatSize));
380
+ seeds.seed110 = math::dot(primes, NoiseTileWrap(iv + float3(1, 1, 0), true, RepeatSize));
381
+ seeds.seed001 = math::dot(primes, NoiseTileWrap(iv + float3(0, 0, 1), true, RepeatSize));
382
+ seeds.seed101 = math::dot(primes, NoiseTileWrap(iv + float3(1, 0, 1), true, RepeatSize));
383
+ seeds.seed011 = math::dot(primes, NoiseTileWrap(iv + float3(0, 1, 1), true, RepeatSize));
384
+ seeds.seed111 = math::dot(primes, NoiseTileWrap(iv + float3(1, 1, 1), true, RepeatSize));
385
+ }
386
+ else
387
+ { // get to combine offsets with multiplication by primes in this case
388
+ seeds.seed000 = math::dot(iv, primes);
389
+ seeds.seed100 = seeds.seed000 + primes.x;
390
+ seeds.seed010 = seeds.seed000 + primes.y;
391
+ seeds.seed110 = seeds.seed100 + primes.y;
392
+ seeds.seed001 = seeds.seed000 + primes.z;
393
+ seeds.seed101 = seeds.seed100 + primes.z;
394
+ seeds.seed011 = seeds.seed010 + primes.z;
395
+ seeds.seed111 = seeds.seed110 + primes.z;
396
+ }
397
+
398
+ return seeds;
399
+ }
400
+
401
+ struct SimplexWeights
402
+ {
403
+ float4 Result = float4(0);
404
+ float3 PosA = float3(0);
405
+ float3 PosB = float3(0);
406
+ float3 PosC = float3(0);
407
+ float3 PosD = float3(0);
408
+ };
409
+
410
+ // Computed weights and sample positions for simplex interpolation
411
+ // @return float4(a,b,c, d) Barycentric coordinate defined as Filtered = Tex(PosA) * a + Tex(PosB) * b + Tex(PosC) * c + Tex(PosD) * d
412
+ SimplexWeights ComputeSimplexWeights3D(float3 OrthogonalPos)
413
+ {
414
+ SimplexWeights weights;
415
+ float3 OrthogonalPosFloor = math::floor(OrthogonalPos);
416
+
417
+ weights.PosA = OrthogonalPosFloor;
418
+ weights.PosB = weights.PosA + float3(1, 1, 1);
419
+
420
+ OrthogonalPos -= OrthogonalPosFloor;
421
+
422
+ float Largest = math::max(OrthogonalPos.x, math::max(OrthogonalPos.y, OrthogonalPos.z));
423
+ float Smallest = math::min(OrthogonalPos.x, math::min(OrthogonalPos.y, OrthogonalPos.z));
424
+
425
+ weights.PosC = weights.PosA + float3(Largest == OrthogonalPos.x, Largest == OrthogonalPos.y, Largest == OrthogonalPos.z);
426
+ weights.PosD = weights.PosA + float3(Smallest != OrthogonalPos.x, Smallest != OrthogonalPos.y, Smallest != OrthogonalPos.z);
427
+
428
+ float RG = OrthogonalPos.x - OrthogonalPos.y;
429
+ float RB = OrthogonalPos.x - OrthogonalPos.z;
430
+ float GB = OrthogonalPos.y - OrthogonalPos.z;
431
+
432
+ weights.Result.z =
433
+ math::min(math::max(0, RG), math::max(0, RB)) // X
434
+ + math::min(math::max(0, -RG), math::max(0, GB)) // Y
435
+ + math::min(math::max(0, -RB), math::max(0, -GB)); // Z
436
+
437
+ weights.Result.w =
438
+ math::min(math::max(0, -RG), math::max(0, -RB)) // X
439
+ + math::min(math::max(0, RG), math::max(0, -GB)) // Y
440
+ + math::min(math::max(0, RB), math::max(0, GB)); // Z
441
+
442
+ weights.Result.y = Smallest;
443
+ weights.Result.x = 1.0f - weights.Result.y - weights.Result.z - weights.Result.w;
444
+
445
+ return weights;
446
+ }
447
+
448
+ // filtered 3D gradient simple noise (few texture lookups, high quality)
449
+ // @param v >0
450
+ // @return random number in the range -1 .. 1
451
+ float SimplexNoise3D_TEX(uniform texture_2d PerlinNoiseGradientTexture, float3 EvalPos)
452
+ {
453
+ float3 OrthogonalPos = SkewSimplex(EvalPos);
454
+
455
+ SimplexWeights Weights = ComputeSimplexWeights3D(OrthogonalPos);
456
+
457
+ // can be optimized to 1 or 2 texture lookups (4 or 8 channel encoded in 32 bit)
458
+ float3 A = GetPerlinNoiseGradientTextureAt(PerlinNoiseGradientTexture, Weights.PosA);
459
+ float3 B = GetPerlinNoiseGradientTextureAt(PerlinNoiseGradientTexture, Weights.PosB);
460
+ float3 C = GetPerlinNoiseGradientTextureAt(PerlinNoiseGradientTexture, Weights.PosC);
461
+ float3 D = GetPerlinNoiseGradientTextureAt(PerlinNoiseGradientTexture, Weights.PosD);
462
+
463
+ Weights.PosA = UnSkewSimplex(Weights.PosA);
464
+ Weights.PosB = UnSkewSimplex(Weights.PosB);
465
+ Weights.PosC = UnSkewSimplex(Weights.PosC);
466
+ Weights.PosD = UnSkewSimplex(Weights.PosD);
467
+
468
+ float DistanceWeight;
469
+
470
+ DistanceWeight = math::saturate(0.6f - length2(EvalPos - Weights.PosA)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
471
+ float a = math::dot(A, EvalPos - Weights.PosA) * DistanceWeight;
472
+ DistanceWeight = math::saturate(0.6f - length2(EvalPos - Weights.PosB)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
473
+ float b = math::dot(B, EvalPos - Weights.PosB) * DistanceWeight;
474
+ DistanceWeight = math::saturate(0.6f - length2(EvalPos - Weights.PosC)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
475
+ float c = math::dot(C, EvalPos - Weights.PosC) * DistanceWeight;
476
+ DistanceWeight = math::saturate(0.6f - length2(EvalPos - Weights.PosD)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
477
+ float d = math::dot(D, EvalPos - Weights.PosD) * DistanceWeight;
478
+
479
+ return 32 * (a + b + c + d);
480
+ }
481
+
482
+ // filtered 3D noise, can be optimized
483
+ // @param v = 3D noise argument, use float3(x,y,0) for 2D or float3(x,0,0) for 1D
484
+ // @param bTiling = repeat noise pattern
485
+ // @param RepeatSize = integer units before tiling in each dimension
486
+ // @return random number in the range -1 .. 1
487
+ float GradientNoise3D_TEX(uniform texture_2d PerlinNoiseGradientTexture, float3 v, bool bTiling, float RepeatSize)
488
+ {
489
+ bTiling = true;
490
+ float3 fv = math::frac(v);
491
+ float3 iv0 = NoiseTileWrap(math::floor(v), bTiling, RepeatSize);
492
+ float3 iv1 = NoiseTileWrap(iv0 + 1, bTiling, RepeatSize);
493
+
494
+ const int2 ZShear = int2(17, 89);
495
+
496
+ float2 OffsetA = iv0.z * ZShear;
497
+ float2 OffsetB = OffsetA + ZShear; // non-tiling, use relative offset
498
+ if (bTiling) // tiling, have to compute from wrapped coordinates
499
+ {
500
+ OffsetB = iv1.z * ZShear;
501
+ }
502
+
503
+ // Texture size scale factor
504
+ float ts = 1 / 128.0f;
505
+
506
+ // texture coordinates for iv0.xy, as offset for both z slices
507
+ float2 TexA0 = (float2(iv0.x, iv0.y) + OffsetA + 0.5f) * ts;
508
+ float2 TexB0 = (float2(iv0.x, iv0.y) + OffsetB + 0.5f) * ts;
509
+
510
+ // texture coordinates for iv1.xy, as offset for both z slices
511
+ float2 TexA1 = TexA0 + ts; // for non-tiling, can compute relative to existing coordinates
512
+ float2 TexB1 = TexB0 + ts;
513
+ if (bTiling) // for tiling, need to compute from wrapped coordinates
514
+ {
515
+ TexA1 = (float2(iv1.x, iv1.y) + OffsetA + 0.5f) * ts;
516
+ TexB1 = (float2(iv1.x, iv1.y) + OffsetB + 0.5f) * ts;
517
+ }
518
+
519
+
520
+ // can be optimized to 1 or 2 texture lookups (4 or 8 channel encoded in 8, 16 or 32 bit)
521
+ float4 PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexA0.x,1.0-TexA0.y),tex::wrap_repeat,tex::wrap_repeat);
522
+ float3 PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
523
+ float3 A = PerlinNoiseColor * 2 - 1;
524
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexA1.x,1.0-TexA0.y),tex::wrap_repeat,tex::wrap_repeat);
525
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
526
+ float3 B = PerlinNoiseColor * 2 - 1;
527
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexA0.x,1.0-TexA1.y),tex::wrap_repeat,tex::wrap_repeat);
528
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
529
+ float3 C = PerlinNoiseColor * 2 - 1;
530
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexA1.x,1.0-TexA1.y),tex::wrap_repeat,tex::wrap_repeat);
531
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
532
+ float3 D = PerlinNoiseColor * 2 - 1;
533
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexB0.x,1.0-TexB0.y),tex::wrap_repeat,tex::wrap_repeat);
534
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
535
+ float3 E = PerlinNoiseColor * 2 - 1;
536
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexB1.x,1.0-TexB0.y),tex::wrap_repeat,tex::wrap_repeat);
537
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
538
+ float3 F = PerlinNoiseColor * 2 - 1;
539
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexB0.x,1.0-TexB1.y),tex::wrap_repeat,tex::wrap_repeat);
540
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
541
+ float3 G = PerlinNoiseColor * 2 - 1;
542
+ PerlinNoise = tex::lookup_float4(PerlinNoiseGradientTexture,float2(TexB1.x,1.0-TexB1.y),tex::wrap_repeat,tex::wrap_repeat);
543
+ PerlinNoiseColor = float3(PerlinNoise.x, PerlinNoise.y, PerlinNoise.z);
544
+ float3 H = PerlinNoiseColor * 2 - 1;
545
+
546
+ float a = math::dot(A, fv - float3(0, 0, 0));
547
+ float b = math::dot(B, fv - float3(1, 0, 0));
548
+ float c = math::dot(C, fv - float3(0, 1, 0));
549
+ float d = math::dot(D, fv - float3(1, 1, 0));
550
+ float e = math::dot(E, fv - float3(0, 0, 1));
551
+ float f = math::dot(F, fv - float3(1, 0, 1));
552
+ float g = math::dot(G, fv - float3(0, 1, 1));
553
+ float h = math::dot(H, fv - float3(1, 1, 1));
554
+
555
+ float4 Weights = PerlinRamp(math::frac(float4(fv.x, fv.y, fv.z, 0)));
556
+
557
+ float i = math::lerp(math::lerp(a, b, Weights.x), math::lerp(c, d, Weights.x), Weights.y);
558
+ float j = math::lerp(math::lerp(e, f, Weights.x), math::lerp(g, h, Weights.x), Weights.y);
559
+
560
+ return math::lerp(i, j, Weights.z);
561
+ }
562
+
563
+ // @return random number in the range -1 .. 1
564
+ // scalar: 6 frac, 31 mul/mad, 15 add,
565
+ float FastGradientPerlinNoise3D_TEX(uniform texture_3d PerlinNoise3DTexture, float3 xyz)
566
+ {
567
+ // needs to be the same value when creating the PerlinNoise3D texture
568
+ float Extent = 16;
569
+
570
+ // last texel replicated and needed for filtering
571
+ // scalar: 3 frac, 6 mul
572
+ xyz = math::frac(xyz / (Extent - 1)) * (Extent - 1);
573
+
574
+ // scalar: 3 frac
575
+ float3 uvw = math::frac(xyz);
576
+ // = floor(xyz);
577
+ // scalar: 3 add
578
+ float3 p0 = xyz - uvw;
579
+ // float3 f = math::pow(uvw, 2) * 3.0f - math::pow(uvw, 3) * 2.0f; // original perlin hermite (ok when used without bump mapping)
580
+ // scalar: 2*3 add 5*3 mul
581
+ float4 pr = PerlinRamp(float4(uvw.x, uvw.y, uvw.z, 0));
582
+ float3 f = float3(pr.x, pr.y, pr.z); // new, better with continues second derivative for bump mapping
583
+ // scalar: 3 add
584
+ float3 p = p0 + f;
585
+ // scalar: 3 mad
586
+ // TODO: need reverse???
587
+ float4 NoiseSample = tex::lookup_float4(PerlinNoise3DTexture, p / Extent + 0.5f / Extent); // +0.5f to get rid of bilinear offset
588
+
589
+ // reconstruct from 8bit (using mad with 2 constants and dot4 was same instruction count)
590
+ // scalar: 4 mad, 3 mul, 3 add
591
+ float3 n = float3(NoiseSample.x, NoiseSample.y, NoiseSample.z) * 255.0f / 127.0f - 1.0f;
592
+ float d = NoiseSample.w * 255.f - 127;
593
+ return math::dot(xyz, n) - d;
594
+ }
595
+
596
+ // Perlin-style "Modified Noise"
597
+ // http://www.umbc.edu/~olano/papers/index.html#mNoise
598
+ // @param v = 3D noise argument, use float3(x,y,0) for 2D or float3(x,0,0) for 1D
599
+ // @param bTiling = repeat noise pattern
600
+ // @param RepeatSize = integer units before tiling in each dimension
601
+ // @return random number in the range -1 .. 1
602
+ float GradientNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
603
+ {
604
+ SeedValue seeds = NoiseSeeds(v, bTiling, RepeatSize);
605
+
606
+ float rand000 = MGradient(int(seeds.seed000), seeds.fv - float3(0, 0, 0)).w;
607
+ float rand100 = MGradient(int(seeds.seed100), seeds.fv - float3(1, 0, 0)).w;
608
+ float rand010 = MGradient(int(seeds.seed010), seeds.fv - float3(0, 1, 0)).w;
609
+ float rand110 = MGradient(int(seeds.seed110), seeds.fv - float3(1, 1, 0)).w;
610
+ float rand001 = MGradient(int(seeds.seed001), seeds.fv - float3(0, 0, 1)).w;
611
+ float rand101 = MGradient(int(seeds.seed101), seeds.fv - float3(1, 0, 1)).w;
612
+ float rand011 = MGradient(int(seeds.seed011), seeds.fv - float3(0, 1, 1)).w;
613
+ float rand111 = MGradient(int(seeds.seed111), seeds.fv - float3(1, 1, 1)).w;
614
+
615
+ float4 Weights = PerlinRamp(float4(seeds.fv.x, seeds.fv.y, seeds.fv.z, 0));
616
+
617
+ float i = math::lerp(math::lerp(rand000, rand100, Weights.x), math::lerp(rand010, rand110, Weights.x), Weights.y);
618
+ float j = math::lerp(math::lerp(rand001, rand101, Weights.x), math::lerp(rand011, rand111, Weights.x), Weights.y);
619
+ return math::lerp(i, j, Weights.z);
620
+ }
621
+
622
+ // 3D value noise - used to be incorrectly called Perlin noise
623
+ // @param v = 3D noise argument, use float3(x,y,0) for 2D or float3(x,0,0) for 1D
624
+ // @param bTiling = repeat noise pattern
625
+ // @param RepeatSize = integer units before tiling in each dimension
626
+ // @return random number in the range -1 .. 1
627
+ float ValueNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
628
+ {
629
+ SeedValue seeds = NoiseSeeds(v, bTiling, RepeatSize);
630
+
631
+ float rand000 = RandBBSfloat(seeds.seed000) * 2 - 1;
632
+ float rand100 = RandBBSfloat(seeds.seed100) * 2 - 1;
633
+ float rand010 = RandBBSfloat(seeds.seed010) * 2 - 1;
634
+ float rand110 = RandBBSfloat(seeds.seed110) * 2 - 1;
635
+ float rand001 = RandBBSfloat(seeds.seed001) * 2 - 1;
636
+ float rand101 = RandBBSfloat(seeds.seed101) * 2 - 1;
637
+ float rand011 = RandBBSfloat(seeds.seed011) * 2 - 1;
638
+ float rand111 = RandBBSfloat(seeds.seed111) * 2 - 1;
639
+
640
+ float4 Weights = PerlinRamp(float4(seeds.fv.x, seeds.fv.y, seeds.fv.z, 0));
641
+
642
+ float i = math::lerp(math::lerp(rand000, rand100, Weights.x), math::lerp(rand010, rand110, Weights.x), Weights.y);
643
+ float j = math::lerp(math::lerp(rand001, rand101, Weights.x), math::lerp(rand011, rand111, Weights.x), Weights.y);
644
+ return math::lerp(i, j, Weights.z);
645
+ }
646
+
647
+ // 3D jitter offset within a voronoi noise cell
648
+ // @param pos - integer lattice corner
649
+ // @return random offsets vector
650
+ float3 VoronoiCornerSample(float3 pos, int Quality)
651
+ {
652
+ // random values in [-0.5, 0.5]
653
+ float3 noise = float3(Rand3DPCG16(int3(pos))) / 0xffff - 0.5;
654
+
655
+ // quality level 1 or 2: searches a 2x2x2 neighborhood with points distributed on a sphere
656
+ // scale factor to guarantee jittered points will be found within a 2x2x2 search
657
+ if (Quality <= 2)
658
+ {
659
+ return math::normalize(noise) * 0.2588;
660
+ }
661
+
662
+ // quality level 3: searches a 3x3x3 neighborhood with points distributed on a sphere
663
+ // scale factor to guarantee jittered points will be found within a 3x3x3 search
664
+ if (Quality == 3)
665
+ {
666
+ return math::normalize(noise) * 0.3090;
667
+ }
668
+
669
+ // quality level 4: jitter to anywhere in the cell, needs 4x4x4 search
670
+ return noise;
671
+ }
672
+
673
+ // compare previous best with a new candidate
674
+ // not producing point locations makes it easier for compiler to eliminate calculations when they're not needed
675
+ // @param minval = location and distance of best candidate seed point before the new one
676
+ // @param candidate = candidate seed point
677
+ // @param offset = 3D offset to new candidate seed point
678
+ // @param bDistanceOnly = if true, only set maxval.w with distance, otherwise maxval.w is distance and maxval.xyz is position
679
+ // @return position (if bDistanceOnly is false) and distance to closest seed point so far
680
+ float4 VoronoiCompare(float4 minval, float3 candidate, float3 offset, bool bDistanceOnly)
681
+ {
682
+ if (bDistanceOnly)
683
+ {
684
+ return float4(0, 0, 0, math::min(minval.w, math::dot(offset, offset)));
685
+ }
686
+ else
687
+ {
688
+ float newdist = math::dot(offset, offset);
689
+ return newdist > minval.w ? minval : float4(candidate.x, candidate.y, candidate.z, newdist);
690
+ }
691
+ }
692
+
693
+ // 220 instruction Worley noise
694
+ float4 VoronoiNoise3D_ALU(float3 v, int Quality, bool bTiling, float RepeatSize, bool bDistanceOnly)
695
+ {
696
+ float3 fv = math::frac(v), fv2 = math::frac(v + 0.5);
697
+ float3 iv = math::floor(v), iv2 = math::floor(v + 0.5);
698
+
699
+ // with initial minimum distance = infinity (or at least bigger than 4), first min is optimized away
700
+ float4 mindist = float4(0,0,0,100);
701
+ float3 p, offset;
702
+
703
+ // quality level 3: do a 3x3x3 search
704
+ if (Quality == 3)
705
+ {
706
+ int offset_x;
707
+ int offset_y;
708
+ int offset_z;
709
+ for (offset_x = -1; offset_x <= 1; ++offset_x)
710
+ {
711
+ for (offset_y = -1; offset_y <= 1; ++offset_y)
712
+ {
713
+ for (offset_z = -1; offset_z <= 1; ++offset_z)
714
+ {
715
+ offset = float3(offset_x, offset_y, offset_z);
716
+ p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize), Quality);
717
+ mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
718
+ }
719
+ }
720
+ }
721
+ }
722
+
723
+ // everybody else searches a base 2x2x2 neighborhood
724
+ else
725
+ {
726
+ int offset_x;
727
+ int offset_y;
728
+ int offset_z;
729
+ for (offset_x = 0; offset_x <= 1; ++offset_x)
730
+ {
731
+ for (offset_y = 0; offset_y <= 1; ++offset_y)
732
+ {
733
+ for (offset_z = 0; offset_z <= 1; ++offset_z)
734
+ {
735
+ offset = float3(offset_x, offset_y, offset_z);
736
+ p = offset + VoronoiCornerSample(NoiseTileWrap(iv + offset, bTiling, RepeatSize), Quality);
737
+ mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
738
+
739
+ // quality level 2, do extra set of points, offset by half a cell
740
+ if (Quality == 2)
741
+ {
742
+ // 467 is just an offset to a different area in the random number field to avoid similar neighbor artifacts
743
+ p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize) + 467, Quality);
744
+ mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
745
+ }
746
+ }
747
+ }
748
+ }
749
+ }
750
+
751
+ // quality level 4: add extra sets of four cells in each direction
752
+ if (Quality >= 4)
753
+ {
754
+ int offset_x;
755
+ int offset_y;
756
+ int offset_z;
757
+ for (offset_x = -1; offset_x <= 2; offset_x += 3)
758
+ {
759
+ for (offset_y = 0; offset_y <= 1; ++offset_y)
760
+ {
761
+ for (offset_z = 0; offset_z <= 1; ++offset_z)
762
+ {
763
+ offset = float3(offset_x, offset_y, offset_z);
764
+ // along x axis
765
+ p = offset + VoronoiCornerSample(NoiseTileWrap(iv + offset, bTiling, RepeatSize), Quality);
766
+ mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
767
+
768
+ // along y axis
769
+ p = float3(offset.y, offset.z, offset.x) + VoronoiCornerSample(NoiseTileWrap(iv + float3(offset.y, offset.z, offset.x), bTiling, RepeatSize), Quality);
770
+ mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
771
+
772
+ // along z axis
773
+ p = float3(offset.z, offset.x, offset.y) + VoronoiCornerSample(NoiseTileWrap(iv + float3(offset.z, offset.x, offset.y), bTiling, RepeatSize), Quality);
774
+ mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
775
+ }
776
+ }
777
+ }
778
+ }
779
+
780
+ // transform squared distance to real distance
781
+ return float4(mindist.x, mindist.y, mindist.z, math::sqrt(mindist.w));
782
+ }
783
+
784
+ // Coordinates for corners of a Simplex tetrahedron
785
+ // Based on McEwan et al., Efficient computation of noise in GLSL, JGT 2011
786
+ // @param v = 3D noise argument
787
+ // @return 4 corner locations
788
+ float4x3 SimplexCorners(float3 v)
789
+ {
790
+ // find base corner by skewing to tetrahedral space and back
791
+ float3 tet = math::floor(v + v.x/3 + v.y/3 + v.z/3);
792
+ float3 base = tet - tet.x/6 - tet.y/6 - tet.z/6;
793
+ float3 f = v - base;
794
+
795
+ // Find offsets to other corners (McEwan did this in tetrahedral space,
796
+ // but since skew is along x=y=z axis, this works in Euclidean space too.)
797
+ float3 g = math::step(float3(f.y,f.z,f.x), float3(f.x,f.y,f.z)), h = 1 - float3(g.z, g.x, g.y);
798
+ float3 a1 = math::min(g, h) - 1.0 / 6.0, a2 = math::max(g, h) - 1.0 / 3.0;
799
+
800
+ // four corners
801
+ return float4x3(base, base + a1, base + a2, base + 0.5);
802
+ }
803
+
804
+ // Improved smoothing function for simplex noise
805
+ // @param f = fractional distance to four tetrahedral corners
806
+ // @return weight for each corner
807
+ float4 SimplexSmooth(float4x3 f)
808
+ {
809
+ const float scale = 1024. / 375.; // scale factor to make noise -1..1
810
+ float4 d = float4(math::dot(f[0], f[0]), math::dot(f[1], f[1]), math::dot(f[2], f[2]), math::dot(f[3], f[3]));
811
+ float4 s = math::saturate(2 * d);
812
+ return (1 * scale + s*(-3 * scale + s*(3 * scale - s*scale)));
813
+ }
814
+
815
+ // Derivative of simplex noise smoothing function
816
+ // @param f = fractional distanc eto four tetrahedral corners
817
+ // @return derivative of smoothing function for each corner by x, y and z
818
+ float3x4 SimplexDSmooth(float4x3 f)
819
+ {
820
+ const float scale = 1024. / 375.; // scale factor to make noise -1..1
821
+ float4 d = float4(math::dot(f[0], f[0]), math::dot(f[1], f[1]), math::dot(f[2], f[2]), math::dot(f[3], f[3]));
822
+ float4 s = math::saturate(2 * d);
823
+ s = -12 * scale + s*(24 * scale - s * 12 * scale);
824
+
825
+ return float3x4(
826
+ s * float4(f[0][0], f[1][0], f[2][0], f[3][0]),
827
+ s * float4(f[0][1], f[1][1], f[2][1], f[3][1]),
828
+ s * float4(f[0][2], f[1][2], f[2][2], f[3][2]));
829
+ }
830
+
831
+ // Simplex noise and its Jacobian derivative
832
+ // @param v = 3D noise argument
833
+ // @param bTiling = whether to repeat noise pattern
834
+ // @param RepeatSize = integer units before tiling in each dimension, must be a multiple of 3
835
+ // @return float3x3 Jacobian in J[*].xyz, vector noise in J[*].w
836
+ // J[0].w, J[1].w, J[2].w is a Perlin-style simplex noise with vector output, e.g. (Nx, Ny, Nz)
837
+ // J[i].x is X derivative of the i'th component of the noise so J[2].x is dNz/dx
838
+ // You can use this to compute the noise, gradient, curl, or divergence:
839
+ // float3x4 J = JacobianSimplex_ALU(...);
840
+ // float3 VNoise = float3(J[0].w, J[1].w, J[2].w); // 3D noise
841
+ // float3 Grad = J[0].xyz; // gradient of J[0].w
842
+ // float3 Curl = float3(J[1][2]-J[2][1], J[2][0]-J[0][2], J[0][1]-J[1][2]);
843
+ // float Div = J[0][0]+J[1][1]+J[2][2];
844
+ // All of these are confirmed to compile out all unneeded terms.
845
+ // So Grad of X doesn't compute Y or Z components, and VNoise doesn't do any of the derivative computation.
846
+ float3x4 JacobianSimplex_ALU(float3 v, bool bTiling, float RepeatSize)
847
+ {
848
+ int3 MGradientMask = int3(0x8000, 0x4000, 0x2000);
849
+ float3 MGradientScale = float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000);
850
+
851
+ // corners of tetrahedron
852
+ float4x3 T = SimplexCorners(v);
853
+ // TODO: uint3
854
+ int3 rand = int3(0);
855
+ float4x3 gvec0 = float4x3(1.0);
856
+ float4x3 gvec1 = float4x3(1.0);
857
+ float4x3 gvec2 = float4x3(1.0);
858
+ float4x3 fv = float4x3(1.0);
859
+ float3x4 grad = float3x4(1.0);
860
+
861
+ // processing of tetrahedral vertices, unrolled
862
+ // to compute gradient at each corner
863
+ fv[0] = v - T[0];
864
+ rand = Rand3DPCG16(int3(math::floor(NoiseTileWrap(6 * T[0] + 0.5, bTiling, RepeatSize))));
865
+ gvec0[0] = float3(int3(rand.x,rand.x,rand.x) & MGradientMask) * MGradientScale - 1;
866
+ gvec1[0] = float3(int3(rand.y,rand.y,rand.y) & MGradientMask) * MGradientScale - 1;
867
+ gvec2[0] = float3(int3(rand.z,rand.z,rand.z) & MGradientMask) * MGradientScale - 1;
868
+ grad[0][0] = math::dot(gvec0[0], fv[0]);
869
+ grad[1][0] = math::dot(gvec1[0], fv[0]);
870
+ grad[2][0] = math::dot(gvec2[0], fv[0]);
871
+
872
+ fv[1] = v - T[1];
873
+ rand = Rand3DPCG16(int3(math::floor(NoiseTileWrap(6 * T[1] + 0.5, bTiling, RepeatSize))));
874
+ gvec0[1] = float3(int3(rand.x,rand.x,rand.x) & MGradientMask) * MGradientScale - 1;
875
+ gvec1[1] = float3(int3(rand.y,rand.y,rand.y) & MGradientMask) * MGradientScale - 1;
876
+ gvec1[1] = float3(int3(rand.z,rand.z,rand.z) & MGradientMask) * MGradientScale - 1;
877
+ grad[0][1] = math::dot(gvec0[1], fv[1]);
878
+ grad[1][1] = math::dot(gvec1[1], fv[1]);
879
+ grad[2][1] = math::dot(gvec2[1], fv[1]);
880
+
881
+ fv[2] = v - T[2];
882
+ rand = Rand3DPCG16(int3(math::floor(NoiseTileWrap(6 * T[2] + 0.5, bTiling, RepeatSize))));
883
+ gvec0[2] = float3(int3(rand.x,rand.x,rand.x) & MGradientMask) * MGradientScale - 1;
884
+ gvec1[2] = float3(int3(rand.y,rand.y,rand.y) & MGradientMask) * MGradientScale - 1;
885
+ gvec2[2] = float3(int3(rand.z,rand.z,rand.z) & MGradientMask) * MGradientScale - 1;
886
+ grad[0][2] = math::dot(gvec0[2], fv[2]);
887
+ grad[1][2] = math::dot(gvec1[2], fv[2]);
888
+ grad[2][2] = math::dot(gvec2[2], fv[2]);
889
+
890
+ fv[3] = v - T[3];
891
+ rand = Rand3DPCG16(int3(math::floor(NoiseTileWrap(6 * T[3] + 0.5, bTiling, RepeatSize))));
892
+ gvec0[3] = float3(int3(rand.x,rand.x,rand.x) & MGradientMask) * MGradientScale - 1;
893
+ gvec1[3] = float3(int3(rand.y,rand.y,rand.y) & MGradientMask) * MGradientScale - 1;
894
+ gvec2[3] = float3(int3(rand.z,rand.z,rand.z) & MGradientMask) * MGradientScale - 1;
895
+ grad[0][3] = math::dot(gvec0[3], fv[3]);
896
+ grad[1][3] = math::dot(gvec1[3], fv[3]);
897
+ grad[2][3] = math::dot(gvec2[3], fv[3]);
898
+
899
+ // blend gradients
900
+ float4 sv = SimplexSmooth(fv);
901
+ float3x4 ds = SimplexDSmooth(fv);
902
+
903
+ float3x4 jacobian = float3x4(1.0);
904
+ float3 vec0 = gvec0*sv + grad[0]*ds; // NOTE: mdl is column major, convert from UE4 (row major)
905
+ jacobian[0] = float4(vec0.x, vec0.y, vec0.z, math::dot(sv, grad[0]));
906
+ float3 vec1 = gvec1*sv + grad[1]*ds;
907
+ jacobian[1] = float4(vec1.x, vec1.y, vec1.z, math::dot(sv, grad[1]));
908
+ float3 vec2 = gvec2*sv + grad[2]*ds;
909
+ jacobian[2] = float4(vec2.x, vec2.y, vec2.z, math::dot(sv, grad[2]));
910
+
911
+ return jacobian;
912
+ }
913
+
914
+ // While RepeatSize is a float here, the expectation is that it would be largely integer values coming in from the UI. The downstream logic assumes
915
+ // floats for all called functions (NoiseTileWrap) and this prevents any float-to-int conversion errors from automatic type conversion.
916
+ float Noise3D_Multiplexer(uniform texture_2d PerlinNoiseGradientTexture, uniform texture_3d PerlinNoise3DTexture, int Function, float3 Position, int Quality, bool bTiling, float RepeatSize)
917
+ {
918
+ // verified, HLSL compiled out the switch if Function is a constant
919
+ switch(Function)
920
+ {
921
+ case 0:
922
+ return SimplexNoise3D_TEX(PerlinNoiseGradientTexture, Position);
923
+ case 1:
924
+ return GradientNoise3D_TEX(PerlinNoiseGradientTexture, Position, bTiling, RepeatSize);
925
+ case 2:
926
+ return FastGradientPerlinNoise3D_TEX(PerlinNoise3DTexture, Position);
927
+ case 3:
928
+ return GradientNoise3D_ALU(Position, bTiling, RepeatSize);
929
+ case 4:
930
+ return ValueNoise3D_ALU(Position, bTiling, RepeatSize);
931
+ case 5:
932
+ return VoronoiNoise3D_ALU(Position, Quality, bTiling, RepeatSize, true).w * 2.0 - 1.0;
933
+ }
934
+ return 0;
935
+ }
936
+ //----------------------------------------------------------
937
+
938
+ export float noise(uniform texture_2d PerlinNoiseGradientTexture, uniform texture_3d PerlinNoise3DTexture, float3 Position, float Scale, float Quality, float Function, float Turbulence, float Levels, float OutputMin, float OutputMax, float LevelScale, float FilterWidth, float Tiling, float RepeatSize)
939
+ [[
940
+ anno::description("Noise"),
941
+ anno::noinline()
942
+ ]]
943
+ {
944
+ Position *= Scale;
945
+ FilterWidth *= Scale;
946
+
947
+ float Out = 0.0f;
948
+ float OutScale = 1.0f;
949
+ float InvLevelScale = 1.0f / LevelScale;
950
+
951
+ int iFunction(Function);
952
+ int iQuality(Quality);
953
+ int iLevels(Levels);
954
+ bool bTurbulence(Turbulence);
955
+ bool bTiling(Tiling);
956
+
957
+ for(int i = 0; i < iLevels; ++i)
958
+ {
959
+ // fade out noise level that are too high frequent (not done through dynamic branching as it usually requires gradient instructions)
960
+ OutScale *= math::saturate(1.0 - FilterWidth);
961
+
962
+ if(bTurbulence)
963
+ {
964
+ Out += math::abs(Noise3D_Multiplexer(PerlinNoiseGradientTexture, PerlinNoise3DTexture, iFunction, Position, iQuality, bTiling, RepeatSize)) * OutScale;
965
+ }
966
+ else
967
+ {
968
+ Out += Noise3D_Multiplexer(PerlinNoiseGradientTexture, PerlinNoise3DTexture, iFunction, Position, iQuality, bTiling, RepeatSize) * OutScale;
969
+ }
970
+
971
+ Position *= LevelScale;
972
+ RepeatSize *= LevelScale;
973
+ OutScale *= InvLevelScale;
974
+ FilterWidth *= LevelScale;
975
+ }
976
+
977
+ if(!bTurbulence)
978
+ {
979
+ // bring -1..1 to 0..1 range
980
+ Out = Out * 0.5f + 0.5f;
981
+ }
982
+
983
+ // Out is in 0..1 range
984
+ return math::lerp(OutputMin, OutputMax, Out);
985
+ }
986
+
987
+ // Material node for noise functions returning a vector value
988
+ // @param LevelScale usually 2 but higher values allow efficient use of few levels
989
+ // @return in user defined range (OutputMin..OutputMax)
990
+ export float4 vector4_noise(float3 Position, float Quality, float Function, float Tiling, float TileSize)
991
+ [[
992
+ anno::description("Vector Noise"),
993
+ anno::noinline()
994
+ ]]
995
+ {
996
+ float4 result = float4(0,0,0,1);
997
+ float3 ret = float3(0);
998
+ int iQuality = int(Quality);
999
+ int iFunction = int(Function);
1000
+ bool bTiling = Tiling > 0.0;
1001
+
1002
+ float3x4 Jacobian = JacobianSimplex_ALU(Position, bTiling, TileSize); // compiled out if not used
1003
+
1004
+ // verified, HLSL compiled out the switch if Function is a constant
1005
+ switch (iFunction)
1006
+ {
1007
+ case 0: // Cellnoise
1008
+ ret = float3(Rand3DPCG16(int3(math::floor(NoiseTileWrap(Position, bTiling, TileSize))))) / 0xffff;
1009
+ result = float4(ret.x, ret.y, ret.z, 1);
1010
+ break;
1011
+ case 1: // Color noise
1012
+ ret = float3(Jacobian[0].w, Jacobian[1].w, Jacobian[2].w);
1013
+ result = float4(ret.x, ret.y, ret.z, 1);
1014
+ break;
1015
+ case 2: // Gradient
1016
+ result = Jacobian[0];
1017
+ break;
1018
+ case 3: // Curl
1019
+ ret = float3(Jacobian[2][1] - Jacobian[1][2], Jacobian[0][2] - Jacobian[2][0], Jacobian[1][0] - Jacobian[0][1]);
1020
+ result = float4(ret.x, ret.y, ret.z, 1);
1021
+ break;
1022
+ case 4: // Voronoi
1023
+ result = VoronoiNoise3D_ALU(Position, iQuality, bTiling, TileSize, false);
1024
+ break;
1025
+ }
1026
+ return result;
1027
+ }
1028
+
1029
+ export float3 vector3_noise(float3 Position, float Quality, float Function, float Tiling, float TileSize)
1030
+ [[
1031
+ anno::description("Vector Noise float3 version"),
1032
+ anno::noinline()
1033
+ ]]
1034
+ {
1035
+ float4 noise = vector4_noise(Position, Quality, Function, Tiling, TileSize);
1036
+ return float3(noise.x, noise.y, noise.z);
1037
+ }
1038
+
1039
+
1040
+ // workaround for ue4 fresnel (without supporting for camera vector) : replacing it with 0.0, means facing to the view
1041
+ export float fresnel(float exponent [[anno::unused()]], float base_reflect_fraction [[anno::unused()]], float3 normal [[anno::unused()]])
1042
+ [[
1043
+ anno::description("Fresnel"),
1044
+ anno::noinline()
1045
+ ]]
1046
+ {
1047
+ return 0.0;
1048
+ }
1049
+
1050
+ export float fresnel_function(float3 normal_vector [[anno::unused()]], float3 camera_vector [[anno::unused()]],
1051
+ bool invert_fresnel [[anno::unused()]], float power [[anno::unused()]],
1052
+ bool use_cheap_contrast [[anno::unused()]], float cheap_contrast_dark [[anno::unused()]], float cheap_contrast_bright [[anno::unused()]],
1053
+ bool clamp_fresnel_dot_product [[anno::unused()]])
1054
+ [[
1055
+ anno::description("Fresnel Function"),
1056
+ anno::noinline()
1057
+ ]]
1058
+ {
1059
+ return 0.0;
1060
+ }
1061
+
1062
+ export float3 camera_vector(uniform bool up_z = true)
1063
+ [[
1064
+ anno::description("Camera Vector"),
1065
+ anno::noinline()
1066
+ ]]
1067
+ {
1068
+ // assume camera postion is 0,0,0
1069
+ return math::normalize(float3(0) - convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), up_z));
1070
+ }
1071
+
1072
+ export float pixel_depth()
1073
+ [[
1074
+ anno::description("Pixel Depth"),
1075
+ anno::noinline()
1076
+ ]]
1077
+ {
1078
+ return 256.0f;
1079
+ }
1080
+
1081
+ export float scene_depth()
1082
+ [[
1083
+ anno::description("Scene Depth")
1084
+ ]]
1085
+ {
1086
+ return 65500.0f;
1087
+ }
1088
+
1089
+ export float3 scene_color()
1090
+ [[
1091
+ anno::description("Scene Color")
1092
+ ]]
1093
+ {
1094
+ return float3(1.0f);
1095
+ }
1096
+
1097
+ export float4 vertex_color()
1098
+ [[
1099
+ anno::description("Vertex Color"),
1100
+ anno::noinline()
1101
+ ]]
1102
+ {
1103
+ return float4(1.0f);
1104
+ }
1105
+
1106
+ export float4 vertex_color_from_coordinate(int VertexColorCoordinateIndex)
1107
+ [[
1108
+ anno::description("Vertex Color for float2 PrimVar"),
1109
+ anno::noinline()
1110
+ ]]
1111
+ {
1112
+ // Kit only supports 4 uv sets, 2 uvs are available to vertex color. if vertex color index is invalid, output the constant WHITE color intead
1113
+ return (VertexColorCoordinateIndex > 2) ? float4(1.0f) : float4(state::texture_coordinate(VertexColorCoordinateIndex).x, state::texture_coordinate(VertexColorCoordinateIndex).y, state::texture_coordinate(VertexColorCoordinateIndex+1).x, state::texture_coordinate(VertexColorCoordinateIndex+1).y);
1114
+ }
1115
+
1116
+ export float3 camera_position()
1117
+ [[
1118
+ anno::description("Camera Position"),
1119
+ anno::noinline()
1120
+ ]]
1121
+ {
1122
+ return float3(1000.0f, 0, 0);
1123
+ }
1124
+
1125
+ export float3 rotate_about_axis(float4 NormalizedRotationAxisAndAngle, float3 PositionOnAxis, float3 Position)
1126
+ [[
1127
+ anno::description("Rotates Position about the given axis by the given angle")
1128
+ ]]
1129
+ {
1130
+ // Project Position onto the rotation axis and find the closest point on the axis to Position
1131
+ float3 NormalizedRotationAxis = float3(NormalizedRotationAxisAndAngle.x,NormalizedRotationAxisAndAngle.y,NormalizedRotationAxisAndAngle.z);
1132
+ float3 ClosestPointOnAxis = PositionOnAxis + NormalizedRotationAxis * math::dot(NormalizedRotationAxis, Position - PositionOnAxis);
1133
+ // Construct orthogonal axes in the plane of the rotation
1134
+ float3 UAxis = Position - ClosestPointOnAxis;
1135
+ float3 VAxis = math::cross(NormalizedRotationAxis, UAxis);
1136
+ float[2] SinCosAngle = math::sincos(NormalizedRotationAxisAndAngle.w);
1137
+ // Rotate using the orthogonal axes
1138
+ float3 R = UAxis * SinCosAngle[1] + VAxis * SinCosAngle[0];
1139
+ // Reconstruct the rotated world space position
1140
+ float3 RotatedPosition = ClosestPointOnAxis + R;
1141
+ // Convert from position to a position offset
1142
+ return RotatedPosition - Position;
1143
+ }
1144
+
1145
+ export float2 rotate_scale_offset_texcoords(float2 InTexCoords, float4 InRotationScale, float2 InOffset)
1146
+ [[
1147
+ anno::description("Returns a float2 texture coordinate after 2x2 transform and offset applied")
1148
+ ]]
1149
+ {
1150
+ return float2(math::dot(InTexCoords, float2(InRotationScale.x, InRotationScale.y)), math::dot(InTexCoords, float2(InRotationScale.z, InRotationScale.w))) + InOffset;
1151
+ }
1152
+
1153
+ export float3 reflection_custom_world_normal(float3 WorldNormal, bool bNormalizeInputNormal, uniform bool up_z = true)
1154
+ [[
1155
+ anno::description("Reflection vector about the specified world space normal")
1156
+ ]]
1157
+ {
1158
+ if (bNormalizeInputNormal)
1159
+ {
1160
+ WorldNormal = math::normalize(WorldNormal);
1161
+ }
1162
+
1163
+ return -camera_vector(up_z) + WorldNormal * math::dot(WorldNormal, camera_vector(up_z)) * 2.0;
1164
+ }
1165
+
1166
+ export float3 reflection_vector(uniform bool up_z = true)
1167
+ [[
1168
+ anno::description("Reflection Vector"),
1169
+ anno::noinline()
1170
+ ]]
1171
+ {
1172
+ float3 normal = convert_to_left_hand(state::transform_normal(state::coordinate_internal,state::coordinate_world,state::normal()), up_z, false);
1173
+ return reflection_custom_world_normal(normal, false, up_z);
1174
+ }
1175
+
1176
+ export float dither_temporalAA(float AlphaThreshold = 0.5f, float Random = 1.0f [[anno::unused()]])
1177
+ [[
1178
+ anno::description("Dither TemporalAA"),
1179
+ anno::noinline()
1180
+ ]]
1181
+ {
1182
+ return AlphaThreshold;
1183
+ }
1184
+
1185
+ export float3 black_body( float Temp )
1186
+ [[
1187
+ anno::description("Black Body"),
1188
+ anno::noinline()
1189
+ ]]
1190
+ {
1191
+ float u = ( 0.860117757f + 1.54118254e-4f * Temp + 1.28641212e-7f * Temp*Temp ) / ( 1.0f + 8.42420235e-4f * Temp + 7.08145163e-7f * Temp*Temp );
1192
+ float v = ( 0.317398726f + 4.22806245e-5f * Temp + 4.20481691e-8f * Temp*Temp ) / ( 1.0f - 2.89741816e-5f * Temp + 1.61456053e-7f * Temp*Temp );
1193
+
1194
+ float x = 3*u / ( 2*u - 8*v + 4 );
1195
+ float y = 2*v / ( 2*u - 8*v + 4 );
1196
+ float z = 1 - x - y;
1197
+
1198
+ float Y = 1;
1199
+ float X = Y/y * x;
1200
+ float Z = Y/y * z;
1201
+
1202
+ float3x3 XYZtoRGB = float3x3(
1203
+ float3(3.2404542, -1.5371385, -0.4985314),
1204
+ float3(-0.9692660, 1.8760108, 0.0415560),
1205
+ float3(0.0556434, -0.2040259, 1.0572252)
1206
+ );
1207
+
1208
+ return XYZtoRGB * float3( X, Y, Z ) * math::pow( 0.0004 * Temp, 4 );
1209
+ }
1210
+
1211
+ export float per_instance_random(uniform texture_2d PerlinNoiseGradientTexture, int NumberInstances)
1212
+ [[
1213
+ anno::description("Per Instance Random"),
1214
+ anno::noinline()
1215
+ ]]
1216
+ {
1217
+ float weight = state::object_id() / float(NumberInstances);
1218
+ return NumberInstances == 0 ? 0.0 : tex::lookup_float4(PerlinNoiseGradientTexture, float2(weight, 1.0 - weight), tex::wrap_repeat, tex::wrap_repeat).x;
1219
+ }
1220
+
1221
+ //------------------ Hair from UE4 -----------------------
1222
+ float3 hair_absorption_to_color(float3 A)
1223
+ {
1224
+ const float B = 0.3f;
1225
+ float b2 = B * B;
1226
+ float b3 = B * b2;
1227
+ float b4 = b2 * b2;
1228
+ float b5 = B * b4;
1229
+ float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
1230
+ return math::exp(-math::sqrt(A) * D);
1231
+ }
1232
+
1233
+ float3 hair_color_to_absorption(float3 C)
1234
+ {
1235
+ const float B = 0.3f;
1236
+ float b2 = B * B;
1237
+ float b3 = B * b2;
1238
+ float b4 = b2 * b2;
1239
+ float b5 = B * b4;
1240
+ float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
1241
+ return math::pow(math::log(C) / D, 2.0f);
1242
+ }
1243
+
1244
+ export float3 get_hair_color_from_melanin(float InMelanin, float InRedness, float3 InDyeColor)
1245
+ [[
1246
+ anno::description("Hair Color")
1247
+ ]]
1248
+ {
1249
+ InMelanin = math::saturate(InMelanin);
1250
+ InRedness = math::saturate(InRedness);
1251
+ float Melanin = -math::log(math::max(1 - InMelanin, 0.0001f));
1252
+ float Eumelanin = Melanin * (1 - InRedness);
1253
+ float Pheomelanin = Melanin * InRedness;
1254
+
1255
+ float3 DyeAbsorption = hair_color_to_absorption(math::saturate(InDyeColor));
1256
+ float3 Absorption = Eumelanin * float3(0.506f, 0.841f, 1.653f) + Pheomelanin * float3(0.343f, 0.733f, 1.924f);
1257
+
1258
+ return hair_absorption_to_color(Absorption + DyeAbsorption);
1259
+ }
1260
+
1261
+ export float3 local_object_bounds_min()
1262
+ [[
1263
+ anno::description("Local Object Bounds Min"),
1264
+ anno::noinline()
1265
+ ]]
1266
+ {
1267
+ return float3(0.0);
1268
+ }
1269
+
1270
+ export float3 local_object_bounds_max()
1271
+ [[
1272
+ anno::description("Local Object Bounds Max"),
1273
+ anno::noinline()
1274
+ ]]
1275
+ {
1276
+ return float3(100.0);
1277
+ }
1278
+
1279
+ export float3 object_bounds()
1280
+ [[
1281
+ anno::description("Object Bounds"),
1282
+ anno::noinline()
1283
+ ]]
1284
+ {
1285
+ return float3(100.0);
1286
+ }
1287
+
1288
+ export float object_radius()
1289
+ [[
1290
+ anno::description("Object Radius"),
1291
+ anno::noinline()
1292
+ ]]
1293
+ {
1294
+ return 100.0f;
1295
+ }
1296
+
1297
+ export float3 object_world_position(uniform bool up_z = true)
1298
+ [[
1299
+ anno::description("Object World Position"),
1300
+ anno::noinline()
1301
+ ]]
1302
+ {
1303
+ return convert_to_left_hand(state::transform_point(state::coordinate_internal,state::coordinate_world,state::position()), up_z)*state::meters_per_scene_unit()*100.0;
1304
+ }
1305
+
1306
+ export float3 object_orientation()
1307
+ [[
1308
+ anno::description("Object Orientation"),
1309
+ anno::noinline()
1310
+ ]]
1311
+ {
1312
+ return float3(0);
1313
+ }
1314
+
1315
+ export float rcp(float x)
1316
+ [[
1317
+ anno::description("hlsl rcp"),
1318
+ anno::noinline()
1319
+ ]]
1320
+ {
1321
+ return 1.0f / x;
1322
+ }
1323
+
1324
+ export float2 rcp(float2 x)
1325
+ [[
1326
+ anno::description("hlsl rcp"),
1327
+ anno::noinline()
1328
+ ]]
1329
+ {
1330
+ return 1.0f / x;
1331
+ }
1332
+
1333
+ export float3 rcp(float3 x)
1334
+ [[
1335
+ anno::description("hlsl rcp"),
1336
+ anno::noinline()
1337
+ ]]
1338
+ {
1339
+ return 1.0f / x;
1340
+ }
1341
+
1342
+ export float4 rcp(float4 x)
1343
+ [[
1344
+ anno::description("hlsl rcp"),
1345
+ anno::noinline()
1346
+ ]]
1347
+ {
1348
+ return 1.0f / x;
1349
+ }
1350
+
1351
+ export int BitFieldExtractI32(int Data, int Size, int Offset)
1352
+ [[
1353
+ anno::description("BitFieldExtractI32 int"),
1354
+ anno::noinline()
1355
+ ]]
1356
+ {
1357
+ Size &= 3;
1358
+ Offset &= 3;
1359
+
1360
+ if (Size == 0)
1361
+ return 0;
1362
+ else if (Offset + Size < 32)
1363
+ return (Data << (32 - Size - Offset)) >> (32 - Size);
1364
+ else
1365
+ return Data >> Offset;
1366
+ }
1367
+
1368
+ export int BitFieldExtractI32(float Data, float Size, float Offset)
1369
+ [[
1370
+ anno::description("BitFieldExtractI32 float"),
1371
+ anno::noinline()
1372
+ ]]
1373
+ {
1374
+ return BitFieldExtractI32(int(Data), int(Size), int(Offset));
1375
+ }
1376
+
1377
+ export int BitFieldExtractU32(float Data, float Size, float Offset)
1378
+ [[
1379
+ anno::description("BitFieldExtractU32 float"),
1380
+ anno::noinline()
1381
+ ]]
1382
+ {
1383
+ return BitFieldExtractI32(Data, Size, Offset);
1384
+ }
1385
+
1386
+ export int BitFieldExtractU32(int Data, int Size, int Offset)
1387
+ [[
1388
+ anno::description("BitFieldExtractU32 int"),
1389
+ anno::noinline()
1390
+ ]]
1391
+ {
1392
+ return BitFieldExtractI32(Data, Size, Offset);
1393
+ }
1394
+
1395
+ export float3 EyeAdaptationInverseLookup(float3 LightValue, float Alpha)
1396
+ [[
1397
+ anno::description("EyeAdaptationInverseLookup"),
1398
+ anno::noinline()
1399
+ ]]
1400
+ {
1401
+ float Adaptation = 1.0f;
1402
+
1403
+ // When Alpha=0.0, we want to multiply by 1.0. when Alpha = 1.0, we want to multiply by 1/Adaptation.
1404
+ // So the lerped value is:
1405
+ // LerpLogScale = Lerp(log(1),log(1/Adaptaiton),T)
1406
+ // Which is simplified as:
1407
+ // LerpLogScale = Lerp(0,-log(Adaptation),T)
1408
+ // LerpLogScale = -T * logAdaptation;
1409
+
1410
+ float LerpLogScale = -Alpha * math::log(Adaptation);
1411
+ float Scale = math::exp(LerpLogScale);
1412
+ return LightValue * Scale;
1413
+ }
kujiale_0003/Materials/OmniUe4Translucent.mdl ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright 2020 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
+ //* 1.0.0 - first version
30
+ //* 1.0.1 - Emissive color affected by opacity
31
+ // - Support opacity mask
32
+ //* 1.0.2 - Unlit translucent
33
+ //* 1.0.3 - specular bsdf instead of microfacet ggx smith bsdf
34
+ //* 1.0.4 - using absolute import paths when importing standard modules
35
+
36
+ mdl 1.3;
37
+
38
+ import ::df::*;
39
+ import ::state::*;
40
+ import ::math::*;
41
+ import ::tex::*;
42
+ import ::anno::*;
43
+
44
+ float emissive_multiplier()
45
+ [[
46
+ anno::description("the multiplier to convert UE4 emissive to raw data"),
47
+ anno::noinline()
48
+ ]]
49
+ {
50
+ return 20.0f * 128.0f;
51
+ }
52
+
53
+ color get_translucent_tint(color base_color, float opacity)
54
+ [[
55
+ anno::description("base color of UE4 translucent"),
56
+ anno::noinline()
57
+ ]]
58
+ {
59
+ return math::lerp(color(1.0), base_color, opacity);
60
+ }
61
+
62
+ // Just for UE4 distilling
63
+ float get_translucent_opacity(float opacity)
64
+ [[
65
+ anno::noinline()
66
+ ]]
67
+ {
68
+ return opacity;
69
+ }
70
+
71
+ color get_emissive_intensity(color emissive, float opacity)
72
+ [[
73
+ anno::description("emissive color of UE4 translucent"),
74
+ anno::noinline()
75
+ ]]
76
+ {
77
+ return emissive * opacity;
78
+ }
79
+
80
+ float3 tangent_space_normal(
81
+ float3 normal = float3(0.0,0.0,1.0),
82
+ float3 tangent_u = state::texture_tangent_u(0),
83
+ float3 tangent_v = state::texture_tangent_v(0)
84
+ )
85
+ [[
86
+ anno::description("Interprets the vector in tangent space"),
87
+ anno::noinline()
88
+ ]]
89
+ {
90
+ return math::normalize(
91
+ tangent_u * normal.x -
92
+ tangent_v * normal.y + /* flip_tangent_v */
93
+ state::normal() * (normal.z));
94
+ }
95
+
96
+ float3 world_space_normal(
97
+ float3 normal = float3(0.0,0.0,1.0),
98
+ float3 tangent_u = state::texture_tangent_u(0),
99
+ float3 tangent_v = state::texture_tangent_v(0)
100
+ )
101
+ [[
102
+ anno::description("Interprets the vector in world space"),
103
+ anno::noinline()
104
+ ]]
105
+ {
106
+ return tangent_space_normal(
107
+ math::normalize(
108
+ normal.x * float3(tangent_u.x, tangent_v.x, state::normal().x) -
109
+ normal.y * float3(tangent_u.y, tangent_v.y, state::normal().y) +
110
+ normal.z * float3(tangent_u.z, tangent_v.z, state::normal().z)),
111
+ tangent_u,
112
+ tangent_v
113
+ );
114
+ }
115
+
116
+ export material OmniUe4Translucent(
117
+ float3 base_color = float3(0.0, 0.0, 0.0),
118
+ float metallic = 0.0,
119
+ float roughness = 0.5,
120
+ float specular = 0.5,
121
+ float3 normal = float3(0.0,0.0,1.0),
122
+ uniform bool enable_opacity = true,
123
+ float opacity = 1.0,
124
+ float opacity_mask = 1.0,
125
+ float3 emissive_color = float3(0.0, 0.0, 0.0),
126
+ float3 displacement = float3(0.0),
127
+ uniform float refraction = 1.0,
128
+ uniform bool two_sided = false,
129
+ uniform bool is_tangent_space_normal = true,
130
+ uniform bool is_unlit = false
131
+ )
132
+ [[
133
+ anno::display_name("Omni UE4 Translucent"),
134
+ anno::description("Omni UE4 Translucent, supports UE4 Translucent shading model"),
135
+ anno::version( 1, 0, 0),
136
+ anno::author("NVIDIA CORPORATION"),
137
+ anno::key_words(string[]("omni", "UE4", "omniverse", "translucent"))
138
+ ]]
139
+ = let {
140
+ color final_base_color = math::saturate(base_color);
141
+ float final_metallic = math::min(math::max(metallic, 0.0f), 0.99f);
142
+ float final_roughness = math::saturate(roughness);
143
+ float final_specular = math::saturate(specular);
144
+ color final_emissive_color = math::max(emissive_color, 0.0f) * emissive_multiplier(); /*factor for converting ue4 emissive to raw value*/
145
+ float final_opacity = math::saturate(opacity);
146
+ float3 final_normal = math::normalize(normal);
147
+
148
+
149
+ // - compute final roughness by squaring the "roughness" parameter
150
+ float alpha = final_roughness * final_roughness;
151
+ // reduce the reflectivity at grazing angles to avoid "dark edges" for high roughness due to the layering
152
+ float grazing_refl = math::max((1.0 - final_roughness), 0.0);
153
+
154
+ float3 the_normal = is_unlit ? state::normal() :
155
+ (is_tangent_space_normal ?
156
+ tangent_space_normal(
157
+ normal: final_normal,
158
+ tangent_u: state::texture_tangent_u(0),
159
+ tangent_v: state::texture_tangent_v(0)
160
+ ) : world_space_normal(
161
+ normal: final_normal,
162
+ tangent_u: state::texture_tangent_u(0),
163
+ tangent_v: state::texture_tangent_v(0)
164
+ ));
165
+
166
+ // for the dielectric component we layer the glossy component on top of the diffuse one,
167
+ // the glossy layer has no color tint
168
+
169
+ bsdf dielectric_component = df::custom_curve_layer(
170
+ weight: final_specular,
171
+ normal_reflectivity: 0.08,
172
+ grazing_reflectivity: grazing_refl,
173
+ layer: df::microfacet_ggx_smith_bsdf(roughness_u: alpha),
174
+ base: df::diffuse_reflection_bsdf(tint: final_base_color));
175
+
176
+ // the metallic component doesn't have a diffuse component, it's only glossy
177
+ // base_color is applied to tint it
178
+ bsdf metallic_component = df::microfacet_ggx_smith_bsdf(tint: final_base_color, roughness_u: alpha);
179
+
180
+ // final BSDF is a linear blend between dielectric and metallic component
181
+ bsdf dielectric_metal_mix =
182
+ df::normalized_mix(
183
+ components:
184
+ df::bsdf_component[](
185
+ df::bsdf_component(
186
+ component: metallic_component,
187
+ weight: final_metallic),
188
+ df::bsdf_component(
189
+ component: dielectric_component,
190
+ weight: 1.0-final_metallic)
191
+ )
192
+ );
193
+
194
+ bsdf frosted_bsdf = df::specular_bsdf(
195
+ tint: color(1),
196
+ mode: df::scatter_reflect_transmit
197
+ );
198
+
199
+ bsdf final_mix_bsdf =
200
+ is_unlit ? df::specular_bsdf(
201
+ tint: get_translucent_tint(base_color: final_base_color, opacity: final_opacity),
202
+ mode: df::scatter_reflect_transmit
203
+ )
204
+ : df::normalized_mix(
205
+ components:
206
+ df::bsdf_component[](
207
+ df::bsdf_component(
208
+ component: dielectric_metal_mix,
209
+ weight: get_translucent_opacity(final_opacity)),
210
+ df::bsdf_component(
211
+ component: frosted_bsdf,
212
+ weight: 1.0-get_translucent_opacity(final_opacity))
213
+ )
214
+ );
215
+ }
216
+ in material(
217
+ thin_walled: two_sided, // Graphene?
218
+ ior: color(refraction), //refraction
219
+ surface: material_surface(
220
+ scattering: final_mix_bsdf,
221
+ emission:
222
+ material_emission (
223
+ emission: df::diffuse_edf (),
224
+ intensity: get_emissive_intensity(emissive: final_emissive_color, opacity: final_opacity)
225
+ )
226
+ ),
227
+
228
+ geometry: material_geometry(
229
+ displacement: displacement,
230
+ normal: the_normal,
231
+ cutout_opacity: enable_opacity ? opacity_mask : 1.0
232
+ )
233
+ );
kujiale_0003/Materials/Textures/BlackPlaceholder.png ADDED

Git LFS Details

  • SHA256: b1fe09d073788819ad2747115939aac07b13e49213a790ddf57aae4cec4d5803
  • Pointer size: 128 Bytes
  • Size of remote file: 110 Bytes
kujiale_0003/Materials/Textures/DefaultDiffuse.png ADDED

Git LFS Details

  • SHA256: 2ee4a01a1731ecf55df4086f81d4be55d41d251522508fbd7da51b08cd4ac38c
  • Pointer size: 132 Bytes
  • Size of remote file: 2.03 MB
kujiale_0003/Materials/Textures/DefaultNormal.png ADDED

Git LFS Details

  • SHA256: b5c0e3a8cc3bc960467544a14b9d0b881c833b30316a67863cc5a42e5d3225df
  • Pointer size: 132 Bytes
  • Size of remote file: 2.13 MB
kujiale_0003/Materials/Textures/DefaultTexture.png ADDED

Git LFS Details

  • SHA256: 419d93e5d7b7de8efd84800724ebef5f26569b197a27c111eeccfb9c9b1665b8
  • Pointer size: 130 Bytes
  • Size of remote file: 29.3 kB
kujiale_0003/Materials/Textures/Fabric_00.png ADDED

Git LFS Details

  • SHA256: 0c9c17d3c2672f6b43b03b21dfe96a6c1bd1d3fa0bd39b382c163442b0256bf5
  • Pointer size: 132 Bytes
  • Size of remote file: 8.87 MB
kujiale_0003/Materials/Textures/Fabric_000.jpeg ADDED

Git LFS Details

  • SHA256: a8979775ae20104c275f1d0fe9cf8aab63e5b29d1e47b0bd2aef2966ce98bef4
  • Pointer size: 132 Bytes
  • Size of remote file: 4.18 MB
kujiale_0003/Materials/Textures/Glass_Normal01.jpeg ADDED

Git LFS Details

  • SHA256: 7cbe0aace19c4dbc47849c2b4882661b73bc66e0adf05c9acc74bf08ae4ee46f
  • Pointer size: 131 Bytes
  • Size of remote file: 972 kB
kujiale_0003/Materials/Textures/Placeholder_Normal.png ADDED

Git LFS Details

  • SHA256: e8e7ed59149450e8d2e04080b275cf7c3d7b3072aa7baba6050acf85576746ee
  • Pointer size: 128 Bytes
  • Size of remote file: 108 Bytes
kujiale_0003/Materials/Textures/T_52ae9f19e4b0b61ad72e5426_color.png ADDED

Git LFS Details

  • SHA256: f264115ccf53d49dd00059152b28edb1ae98ea476cde4f07f21965d8bc8cdc95
  • Pointer size: 131 Bytes
  • Size of remote file: 309 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12be_color.png ADDED

Git LFS Details

  • SHA256: 74520165af23828324e6c61af8c5008c09791773a36766f092e61fa3e74ff93a
  • Pointer size: 131 Bytes
  • Size of remote file: 121 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12be_metallic.png ADDED

Git LFS Details

  • SHA256: bf2558369ec117ef4924a6a4e096f462588ec2306bdc774a0a9c1bb980bd379b
  • Pointer size: 130 Bytes
  • Size of remote file: 33 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12bf_color.png ADDED

Git LFS Details

  • SHA256: 37c13b612b9df2f546149ea6b96597a51391bd96f2e41eb3ab200d541f2de189
  • Pointer size: 130 Bytes
  • Size of remote file: 87.9 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12bf_metallic.png ADDED

Git LFS Details

  • SHA256: 87c587f6cb3ba8c5872f04a696b0d477759c956b10c6e0adf46e4ceaf694e733
  • Pointer size: 130 Bytes
  • Size of remote file: 45.5 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c0_color.png ADDED

Git LFS Details

  • SHA256: f72f8d52ede5506dea195c40d5d48f4fff7b08bebba4b93801095465321f18d1
  • Pointer size: 131 Bytes
  • Size of remote file: 360 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c0_metallic.png ADDED

Git LFS Details

  • SHA256: 6410f6891b3c5d5340736ca37629ef74b7d1b8c05e603f960378c3e46a081c7a
  • Pointer size: 131 Bytes
  • Size of remote file: 127 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c1_color.png ADDED

Git LFS Details

  • SHA256: a5bc101656a21d7d90fdb8d2f3cb1357c5061e0de0317d3dd5d8a46770a63a92
  • Pointer size: 131 Bytes
  • Size of remote file: 688 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c1_metallic.png ADDED

Git LFS Details

  • SHA256: 4459127db6d6366ba3fe2d47e51829666882cb86f32566929c32ade67119a9c9
  • Pointer size: 131 Bytes
  • Size of remote file: 423 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c2_color.png ADDED

Git LFS Details

  • SHA256: c74e93142b5c0d756d9eb7fe9650694357ead0fd9aa1c9f866fce396fe976b4a
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c2_metallic.png ADDED

Git LFS Details

  • SHA256: a9aefda7316eefeefa1850f8e7ac34b4512db52f6d39119c6d9a2c58c7ee9357
  • Pointer size: 130 Bytes
  • Size of remote file: 30.2 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c3_color.png ADDED

Git LFS Details

  • SHA256: 76ca22e4f8a53313f8433fc0162b1657bb7ad919a02095faf9a1a6b24f164c15
  • Pointer size: 131 Bytes
  • Size of remote file: 644 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c3_metallic.png ADDED

Git LFS Details

  • SHA256: 3fad51890a83714df6338b828dc65698795ecf50a47eedfd55de53e697273fc1
  • Pointer size: 131 Bytes
  • Size of remote file: 388 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c4_color.png ADDED

Git LFS Details

  • SHA256: 37c13b612b9df2f546149ea6b96597a51391bd96f2e41eb3ab200d541f2de189
  • Pointer size: 130 Bytes
  • Size of remote file: 87.9 kB
kujiale_0003/Materials/Textures/T_52d4a3b2e4b0c1cd9e8f12c4_metallic.png ADDED

Git LFS Details

  • SHA256: 87c587f6cb3ba8c5872f04a696b0d477759c956b10c6e0adf46e4ceaf694e733
  • Pointer size: 130 Bytes
  • Size of remote file: 45.5 kB
kujiale_0003/Materials/Textures/T_530d982ae4b074e6429be7a2_color.png ADDED

Git LFS Details

  • SHA256: e2d6bcaaca013425402f3a7b78a06e18d545722de0bfe2b03c8f6e02b5a55f1e
  • Pointer size: 131 Bytes
  • Size of remote file: 315 kB
kujiale_0003/Materials/Textures/T_531d6b93ec95ea1a4e99d820_color.png ADDED

Git LFS Details

  • SHA256: 2ebac9baa944544f4a7134aba8a819f46fb37f51148bc7fa00544d0678294bcf
  • Pointer size: 131 Bytes
  • Size of remote file: 114 kB
kujiale_0003/Materials/Textures/T_531d6b93ec95ea1a4e99d820_metallic.png ADDED

Git LFS Details

  • SHA256: 8422d7265c9731892bc135bbc8706f35f8b38d6f589013d23d7e9188ebd562ff
  • Pointer size: 130 Bytes
  • Size of remote file: 33.4 kB
kujiale_0003/Materials/Textures/T_5497cf8de4b0c4fb5caca231_emission.png ADDED

Git LFS Details

  • SHA256: caf45372c633b2b0355f0c646dd30d87b061e92be87bc09c494180229de2b1aa
  • Pointer size: 129 Bytes
  • Size of remote file: 2.86 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82dde_color.png ADDED

Git LFS Details

  • SHA256: 974409e3e6a7bbd33c86dc3d83859f80c57e529698ef6626aff778af9eec6890
  • Pointer size: 129 Bytes
  • Size of remote file: 6.99 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82dde_metallic.png ADDED

Git LFS Details

  • SHA256: 193f2ebb2727714268653d7d6cff0c5360ab8f33eaf5341215314a0fb3d823c8
  • Pointer size: 130 Bytes
  • Size of remote file: 11.9 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82ddf_color.png ADDED

Git LFS Details

  • SHA256: 0630de30d7d02527e52bffcefd0565229493d31aa7e9c830f1b411588a864432
  • Pointer size: 130 Bytes
  • Size of remote file: 58.3 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82ddf_metallic.png ADDED

Git LFS Details

  • SHA256: b8160d7650d0ba47d4050467f16e9a72b68aa9023f637ada91a7827149878620
  • Pointer size: 130 Bytes
  • Size of remote file: 70 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de0_color.png ADDED

Git LFS Details

  • SHA256: 76c515d7eac24a485b5e5fa195a5e166346e4fb78d6e36bf2a1275193251c76a
  • Pointer size: 131 Bytes
  • Size of remote file: 909 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de0_metallic.png ADDED

Git LFS Details

  • SHA256: a045914642c78f11ad6a8bf2c7b556b38e3094ca1ea40700789b0794d007d143
  • Pointer size: 131 Bytes
  • Size of remote file: 298 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de7_color.png ADDED

Git LFS Details

  • SHA256: 8f67235418b9063846c54baa9d2e9e299e5eecc11bec438f31b10401f1070218
  • Pointer size: 131 Bytes
  • Size of remote file: 730 kB
kujiale_0003/Materials/Textures/T_54c072c8e4b04c6011f82de7_metallic.png ADDED

Git LFS Details

  • SHA256: 08972a74fca356c125f59b58e71a65bde673c2743a69f240122d5cfec92bb455
  • Pointer size: 131 Bytes
  • Size of remote file: 243 kB