@babylonjs/viewer 7.25.0-alpha → 7.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (522) hide show
  1. package/configuration/configuration.d.ts +107 -0
  2. package/configuration/configuration.js +16 -0
  3. package/configuration/configuration.js.map +1 -0
  4. package/configuration/configurationCompatibility.d.ts +8 -0
  5. package/configuration/configurationCompatibility.js +66 -0
  6. package/configuration/configurationCompatibility.js.map +1 -0
  7. package/configuration/configurationContainer.d.ts +10 -0
  8. package/configuration/configurationContainer.js +10 -0
  9. package/configuration/configurationContainer.js.map +1 -0
  10. package/configuration/globals.d.ts +6 -0
  11. package/configuration/globals.js +18 -0
  12. package/configuration/globals.js.map +1 -0
  13. package/configuration/index.d.ts +2 -0
  14. package/configuration/index.js +4 -0
  15. package/configuration/index.js.map +1 -0
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
  17. package/configuration/interfaces/cameraConfiguration.js +2 -0
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -0
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
  20. package/configuration/interfaces/colorGradingConfiguration.js +2 -0
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
  26. package/configuration/interfaces/environmentMapConfiguration.js +2 -0
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -0
  29. package/configuration/interfaces/groundConfiguration.js +2 -0
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -0
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
  32. package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
  34. package/configuration/interfaces/index.d.ts +15 -0
  35. package/configuration/interfaces/index.js +16 -0
  36. package/configuration/interfaces/index.js.map +1 -0
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -0
  38. package/configuration/interfaces/lightConfiguration.js +2 -0
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -0
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
  41. package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -0
  44. package/configuration/interfaces/modelConfiguration.js +2 -0
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -0
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -0
  47. package/configuration/interfaces/observersConfiguration.js +2 -0
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -0
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
  50. package/configuration/interfaces/sceneConfiguration.js +2 -0
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -0
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
  56. package/configuration/interfaces/skyboxConfiguration.js +2 -0
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -0
  59. package/configuration/interfaces/templateConfiguration.js +2 -0
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -0
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -0
  62. package/configuration/interfaces/vrConfiguration.js +2 -0
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -0
  64. package/configuration/loader.d.ts +4 -0
  65. package/configuration/loader.js +17 -0
  66. package/configuration/loader.js.map +1 -0
  67. package/configuration/mappers.d.ts +43 -0
  68. package/configuration/mappers.js +192 -0
  69. package/configuration/mappers.js.map +1 -0
  70. package/configuration/renderOnlyLoader.d.ts +33 -0
  71. package/configuration/renderOnlyLoader.js +162 -0
  72. package/configuration/renderOnlyLoader.js.map +1 -0
  73. package/configuration/types/default.d.ts +6 -0
  74. package/configuration/types/default.js +121 -0
  75. package/configuration/types/default.js.map +1 -0
  76. package/configuration/types/environmentMap.d.ts +5 -0
  77. package/configuration/types/environmentMap.js +14 -0
  78. package/configuration/types/environmentMap.js.map +1 -0
  79. package/configuration/types/extended.d.ts +6 -0
  80. package/configuration/types/extended.js +317 -0
  81. package/configuration/types/extended.js.map +1 -0
  82. package/configuration/types/index.d.ts +14 -0
  83. package/configuration/types/index.js +51 -0
  84. package/configuration/types/index.js.map +1 -0
  85. package/configuration/types/minimal.d.ts +6 -0
  86. package/configuration/types/minimal.js +43 -0
  87. package/configuration/types/minimal.js.map +1 -0
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -0
  89. package/configuration/types/renderOnlyDefault.js +31 -0
  90. package/configuration/types/renderOnlyDefault.js.map +1 -0
  91. package/configuration/types/shadowLight.d.ts +9 -0
  92. package/configuration/types/shadowLight.js +64 -0
  93. package/configuration/types/shadowLight.js.map +1 -0
  94. package/helper/index.d.ts +29 -0
  95. package/helper/index.js +66 -0
  96. package/helper/index.js.map +1 -0
  97. package/index.d.ts +30 -0
  98. package/index.js +46 -0
  99. package/index.js.map +1 -0
  100. package/initializer.d.ts +11 -0
  101. package/initializer.js +35 -0
  102. package/initializer.js.map +1 -0
  103. package/interfaces.d.ts +5 -0
  104. package/interfaces.js +7 -0
  105. package/interfaces.js.map +1 -0
  106. package/labs/environmentSerializer.d.ts +126 -0
  107. package/labs/environmentSerializer.js +191 -0
  108. package/labs/environmentSerializer.js.map +1 -0
  109. package/labs/texture.d.ts +183 -0
  110. package/labs/texture.js +350 -0
  111. package/labs/texture.js.map +1 -0
  112. package/labs/viewerLabs.d.ts +51 -0
  113. package/labs/viewerLabs.js +134 -0
  114. package/labs/viewerLabs.js.map +1 -0
  115. package/loader/modelLoader.d.ts +56 -0
  116. package/loader/modelLoader.js +199 -0
  117. package/loader/modelLoader.js.map +1 -0
  118. package/loader/plugins/applyMaterialConfig.d.ts +12 -0
  119. package/loader/plugins/applyMaterialConfig.js +16 -0
  120. package/loader/plugins/applyMaterialConfig.js.map +1 -0
  121. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
  122. package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
  124. package/loader/plugins/index.d.ts +19 -0
  125. package/loader/plugins/index.js +44 -0
  126. package/loader/plugins/index.js.map +1 -0
  127. package/loader/plugins/loaderPlugin.d.ts +24 -0
  128. package/loader/plugins/loaderPlugin.js +2 -0
  129. package/loader/plugins/loaderPlugin.js.map +1 -0
  130. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
  131. package/loader/plugins/msftLodLoaderPlugin.js +21 -0
  132. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
  133. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
  134. package/loader/plugins/telemetryLoaderPlugin.js +36 -0
  135. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
  136. package/managers/observablesManager.d.ts +66 -0
  137. package/managers/observablesManager.js +35 -0
  138. package/managers/observablesManager.js.map +1 -0
  139. package/managers/sceneManager.d.ts +245 -0
  140. package/managers/sceneManager.js +1375 -0
  141. package/managers/sceneManager.js.map +1 -0
  142. package/managers/telemetryManager.d.ts +78 -0
  143. package/managers/telemetryManager.js +117 -0
  144. package/managers/telemetryManager.js.map +1 -0
  145. package/model/modelAnimation.d.ts +215 -0
  146. package/model/modelAnimation.js +237 -0
  147. package/model/modelAnimation.js.map +1 -0
  148. package/model/viewerModel.d.ts +233 -0
  149. package/model/viewerModel.js +673 -0
  150. package/model/viewerModel.js.map +1 -0
  151. package/optimizer/custom/extended.d.ts +13 -0
  152. package/optimizer/custom/extended.js +101 -0
  153. package/optimizer/custom/extended.js.map +1 -0
  154. package/optimizer/custom/index.d.ts +9 -0
  155. package/optimizer/custom/index.js +26 -0
  156. package/optimizer/custom/index.js.map +1 -0
  157. package/package.json +27 -17
  158. package/readme.md +21 -35
  159. package/renderOnlyIndex.d.ts +11 -0
  160. package/renderOnlyIndex.js +18 -0
  161. package/renderOnlyIndex.js.map +1 -0
  162. package/templating/eventManager.d.ts +35 -0
  163. package/templating/eventManager.js +66 -0
  164. package/templating/eventManager.js.map +1 -0
  165. package/templating/plugins/hdButtonPlugin.d.ts +9 -0
  166. package/templating/plugins/hdButtonPlugin.js +21 -0
  167. package/templating/plugins/hdButtonPlugin.js.map +1 -0
  168. package/templating/plugins/printButton.d.ts +9 -0
  169. package/templating/plugins/printButton.js +40 -0
  170. package/templating/plugins/printButton.js.map +1 -0
  171. package/templating/templateManager.d.ts +197 -0
  172. package/templating/templateManager.js +561 -0
  173. package/templating/templateManager.js.map +1 -0
  174. package/templating/viewerTemplatePlugin.d.ts +21 -0
  175. package/templating/viewerTemplatePlugin.js +69 -0
  176. package/templating/viewerTemplatePlugin.js.map +1 -0
  177. package/viewer/defaultViewer.d.ts +130 -0
  178. package/viewer/defaultViewer.js +675 -0
  179. package/viewer/defaultViewer.js.map +1 -0
  180. package/viewer/renderOnlyViewer.d.ts +9 -0
  181. package/viewer/renderOnlyViewer.js +46 -0
  182. package/viewer/renderOnlyViewer.js.map +1 -0
  183. package/viewer/viewer.d.ts +258 -0
  184. package/viewer/viewer.js +783 -0
  185. package/viewer/viewer.js.map +1 -0
  186. package/viewer/viewerManager.d.ts +58 -0
  187. package/viewer/viewerManager.js +91 -0
  188. package/viewer/viewerManager.js.map +1 -0
  189. package/viewer/viewerWithTemplate.d.ts +9 -0
  190. package/viewer/viewerWithTemplate.js +20 -0
  191. package/viewer/viewerWithTemplate.js.map +1 -0
  192. package/dist/babylon-viewer.esm.js +0 -2
  193. package/dist/babylon-viewer.esm.js.map +0 -1
  194. package/dist/babylon-viewer.esm.min.js +0 -2
  195. package/dist/babylon-viewer.esm.min.js.map +0 -1
  196. package/dist/chunks/EXT_lights_image_based-DC9fPJli.esm.min.js +0 -2
  197. package/dist/chunks/EXT_lights_image_based-DC9fPJli.esm.min.js.map +0 -1
  198. package/dist/chunks/EXT_lights_image_based-DfFQ31PL.esm.js +0 -170
  199. package/dist/chunks/EXT_lights_image_based-DfFQ31PL.esm.js.map +0 -1
  200. package/dist/chunks/EXT_mesh_gpu_instancing-DepTQjtD.esm.min.js +0 -2
  201. package/dist/chunks/EXT_mesh_gpu_instancing-DepTQjtD.esm.min.js.map +0 -1
  202. package/dist/chunks/EXT_mesh_gpu_instancing-cqFbSeIg.esm.js +0 -86
  203. package/dist/chunks/EXT_mesh_gpu_instancing-cqFbSeIg.esm.js.map +0 -1
  204. package/dist/chunks/EXT_meshopt_compression-BZz8a7N9.esm.js +0 -134
  205. package/dist/chunks/EXT_meshopt_compression-BZz8a7N9.esm.js.map +0 -1
  206. package/dist/chunks/EXT_meshopt_compression-CjMbh6eU.esm.min.js +0 -2
  207. package/dist/chunks/EXT_meshopt_compression-CjMbh6eU.esm.min.js.map +0 -1
  208. package/dist/chunks/EXT_texture_avif-DBTOdhvO.esm.js +0 -44
  209. package/dist/chunks/EXT_texture_avif-DBTOdhvO.esm.js.map +0 -1
  210. package/dist/chunks/EXT_texture_avif-DVAZSRkl.esm.min.js +0 -2
  211. package/dist/chunks/EXT_texture_avif-DVAZSRkl.esm.min.js.map +0 -1
  212. package/dist/chunks/EXT_texture_webp-BWiEqn-s.esm.min.js +0 -2
  213. package/dist/chunks/EXT_texture_webp-BWiEqn-s.esm.min.js.map +0 -1
  214. package/dist/chunks/EXT_texture_webp-Bgb7TgNp.esm.js +0 -43
  215. package/dist/chunks/EXT_texture_webp-Bgb7TgNp.esm.js.map +0 -1
  216. package/dist/chunks/ExtrasAsMetadata-Cr7Llzvd.esm.js +0 -64
  217. package/dist/chunks/ExtrasAsMetadata-Cr7Llzvd.esm.js.map +0 -1
  218. package/dist/chunks/ExtrasAsMetadata-DGIXOpGN.esm.min.js +0 -2
  219. package/dist/chunks/ExtrasAsMetadata-DGIXOpGN.esm.min.js.map +0 -1
  220. package/dist/chunks/KHR_animation_pointer-DrmQLtaw.esm.js +0 -343
  221. package/dist/chunks/KHR_animation_pointer-DrmQLtaw.esm.js.map +0 -1
  222. package/dist/chunks/KHR_animation_pointer-IVYLBxVU.esm.min.js +0 -2
  223. package/dist/chunks/KHR_animation_pointer-IVYLBxVU.esm.min.js.map +0 -1
  224. package/dist/chunks/KHR_draco_mesh_compression-CfqHokQU.esm.min.js +0 -2
  225. package/dist/chunks/KHR_draco_mesh_compression-CfqHokQU.esm.min.js.map +0 -1
  226. package/dist/chunks/KHR_draco_mesh_compression-DZR9h5nP.esm.js +0 -610
  227. package/dist/chunks/KHR_draco_mesh_compression-DZR9h5nP.esm.js.map +0 -1
  228. package/dist/chunks/KHR_interactivity-BQOxjpC1.esm.min.js +0 -2
  229. package/dist/chunks/KHR_interactivity-BQOxjpC1.esm.min.js.map +0 -1
  230. package/dist/chunks/KHR_interactivity-BbEGVmbr.esm.js +0 -4033
  231. package/dist/chunks/KHR_interactivity-BbEGVmbr.esm.js.map +0 -1
  232. package/dist/chunks/KHR_lights_punctual-5wF2wPZ4.esm.js +0 -1253
  233. package/dist/chunks/KHR_lights_punctual-5wF2wPZ4.esm.js.map +0 -1
  234. package/dist/chunks/KHR_lights_punctual-CxE0tWFW.esm.min.js +0 -2
  235. package/dist/chunks/KHR_lights_punctual-CxE0tWFW.esm.min.js.map +0 -1
  236. package/dist/chunks/KHR_materials_anisotropy-D5wj2P4R.esm.js +0 -64
  237. package/dist/chunks/KHR_materials_anisotropy-D5wj2P4R.esm.js.map +0 -1
  238. package/dist/chunks/KHR_materials_anisotropy-DzShF01_.esm.min.js +0 -2
  239. package/dist/chunks/KHR_materials_anisotropy-DzShF01_.esm.min.js.map +0 -1
  240. package/dist/chunks/KHR_materials_clearcoat-CVlq2-J0.esm.min.js +0 -2
  241. package/dist/chunks/KHR_materials_clearcoat-CVlq2-J0.esm.min.js.map +0 -1
  242. package/dist/chunks/KHR_materials_clearcoat-v7Cuht8B.esm.js +0 -96
  243. package/dist/chunks/KHR_materials_clearcoat-v7Cuht8B.esm.js.map +0 -1
  244. package/dist/chunks/KHR_materials_diffuse_transmission-Btv08kRf.esm.min.js +0 -2
  245. package/dist/chunks/KHR_materials_diffuse_transmission-Btv08kRf.esm.min.js.map +0 -1
  246. package/dist/chunks/KHR_materials_diffuse_transmission-DxEe_ssV.esm.js +0 -95
  247. package/dist/chunks/KHR_materials_diffuse_transmission-DxEe_ssV.esm.js.map +0 -1
  248. package/dist/chunks/KHR_materials_dispersion-BIMxA8Vq.esm.min.js +0 -2
  249. package/dist/chunks/KHR_materials_dispersion-BIMxA8Vq.esm.min.js.map +0 -1
  250. package/dist/chunks/KHR_materials_dispersion-D_4Rt_AT.esm.js +0 -62
  251. package/dist/chunks/KHR_materials_dispersion-D_4Rt_AT.esm.js.map +0 -1
  252. package/dist/chunks/KHR_materials_emissive_strength-BImvoUuh.esm.js +0 -55
  253. package/dist/chunks/KHR_materials_emissive_strength-BImvoUuh.esm.js.map +0 -1
  254. package/dist/chunks/KHR_materials_emissive_strength-BidGyKyI.esm.min.js +0 -2
  255. package/dist/chunks/KHR_materials_emissive_strength-BidGyKyI.esm.min.js.map +0 -1
  256. package/dist/chunks/KHR_materials_ior-DRDijE46.esm.min.js +0 -2
  257. package/dist/chunks/KHR_materials_ior-DRDijE46.esm.min.js.map +0 -1
  258. package/dist/chunks/KHR_materials_ior-Qsq8sSTQ.esm.js +0 -64
  259. package/dist/chunks/KHR_materials_ior-Qsq8sSTQ.esm.js.map +0 -1
  260. package/dist/chunks/KHR_materials_iridescence-BO-OSEkK.esm.min.js +0 -2
  261. package/dist/chunks/KHR_materials_iridescence-BO-OSEkK.esm.min.js.map +0 -1
  262. package/dist/chunks/KHR_materials_iridescence-Cc8j46MB.esm.js +0 -72
  263. package/dist/chunks/KHR_materials_iridescence-Cc8j46MB.esm.js.map +0 -1
  264. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Cd2w1hlF.esm.min.js +0 -2
  265. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Cd2w1hlF.esm.min.js.map +0 -1
  266. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DEtDFZPX.esm.js +0 -81
  267. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DEtDFZPX.esm.js.map +0 -1
  268. package/dist/chunks/KHR_materials_sheen-2GP5jiCT.esm.min.js +0 -2
  269. package/dist/chunks/KHR_materials_sheen-2GP5jiCT.esm.min.js.map +0 -1
  270. package/dist/chunks/KHR_materials_sheen-CQ3Q14sp.esm.js +0 -85
  271. package/dist/chunks/KHR_materials_sheen-CQ3Q14sp.esm.js.map +0 -1
  272. package/dist/chunks/KHR_materials_specular-B8bgMjMv.esm.min.js +0 -2
  273. package/dist/chunks/KHR_materials_specular-B8bgMjMv.esm.min.js.map +0 -1
  274. package/dist/chunks/KHR_materials_specular-D7P48RHW.esm.js +0 -75
  275. package/dist/chunks/KHR_materials_specular-D7P48RHW.esm.js.map +0 -1
  276. package/dist/chunks/KHR_materials_transmission-B6NtjEPp.esm.js +0 -306
  277. package/dist/chunks/KHR_materials_transmission-B6NtjEPp.esm.js.map +0 -1
  278. package/dist/chunks/KHR_materials_transmission-DPUUVLV8.esm.min.js +0 -2
  279. package/dist/chunks/KHR_materials_transmission-DPUUVLV8.esm.min.js.map +0 -1
  280. package/dist/chunks/KHR_materials_unlit-BRJnLegu.esm.min.js +0 -2
  281. package/dist/chunks/KHR_materials_unlit-BRJnLegu.esm.min.js.map +0 -1
  282. package/dist/chunks/KHR_materials_unlit-jqO9HFUm.esm.js +0 -74
  283. package/dist/chunks/KHR_materials_unlit-jqO9HFUm.esm.js.map +0 -1
  284. package/dist/chunks/KHR_materials_variants-D3zo3Fn8.esm.min.js +0 -2
  285. package/dist/chunks/KHR_materials_variants-D3zo3Fn8.esm.min.js.map +0 -1
  286. package/dist/chunks/KHR_materials_variants-DVhDwsbf.esm.js +0 -238
  287. package/dist/chunks/KHR_materials_variants-DVhDwsbf.esm.js.map +0 -1
  288. package/dist/chunks/KHR_materials_volume-BBlHI00R.esm.min.js +0 -2
  289. package/dist/chunks/KHR_materials_volume-BBlHI00R.esm.min.js.map +0 -1
  290. package/dist/chunks/KHR_materials_volume-pazjLjwn.esm.js +0 -87
  291. package/dist/chunks/KHR_materials_volume-pazjLjwn.esm.js.map +0 -1
  292. package/dist/chunks/KHR_mesh_quantization-BFCOpPq5.esm.min.js +0 -2
  293. package/dist/chunks/KHR_mesh_quantization-BFCOpPq5.esm.min.js.map +0 -1
  294. package/dist/chunks/KHR_mesh_quantization-DPAOJj_N.esm.js +0 -26
  295. package/dist/chunks/KHR_mesh_quantization-DPAOJj_N.esm.js.map +0 -1
  296. package/dist/chunks/KHR_texture_basisu-BGQg840h.esm.js +0 -43
  297. package/dist/chunks/KHR_texture_basisu-BGQg840h.esm.js.map +0 -1
  298. package/dist/chunks/KHR_texture_basisu-DjOd_UYI.esm.min.js +0 -2
  299. package/dist/chunks/KHR_texture_basisu-DjOd_UYI.esm.min.js.map +0 -1
  300. package/dist/chunks/KHR_texture_transform-CIEkHeKT.esm.js +0 -63
  301. package/dist/chunks/KHR_texture_transform-CIEkHeKT.esm.js.map +0 -1
  302. package/dist/chunks/KHR_texture_transform-LAK_4q2j.esm.min.js +0 -2
  303. package/dist/chunks/KHR_texture_transform-LAK_4q2j.esm.min.js.map +0 -1
  304. package/dist/chunks/KHR_xmp_json_ld-ByF20O9F.esm.min.js +0 -2
  305. package/dist/chunks/KHR_xmp_json_ld-ByF20O9F.esm.min.js.map +0 -1
  306. package/dist/chunks/KHR_xmp_json_ld-if0NXwJy.esm.js +0 -51
  307. package/dist/chunks/KHR_xmp_json_ld-if0NXwJy.esm.js.map +0 -1
  308. package/dist/chunks/MSFT_audio_emitter-D2B5Hzz0.esm.js +0 -1608
  309. package/dist/chunks/MSFT_audio_emitter-D2B5Hzz0.esm.js.map +0 -1
  310. package/dist/chunks/MSFT_audio_emitter-k-n62mVd.esm.min.js +0 -2
  311. package/dist/chunks/MSFT_audio_emitter-k-n62mVd.esm.min.js.map +0 -1
  312. package/dist/chunks/MSFT_lod-CpIv0Ill.esm.min.js +0 -2
  313. package/dist/chunks/MSFT_lod-CpIv0Ill.esm.min.js.map +0 -1
  314. package/dist/chunks/MSFT_lod-DZ3Pv8Ql.esm.js +0 -337
  315. package/dist/chunks/MSFT_lod-DZ3Pv8Ql.esm.js.map +0 -1
  316. package/dist/chunks/MSFT_minecraftMesh-GnUA-Z1C.esm.min.js +0 -2
  317. package/dist/chunks/MSFT_minecraftMesh-GnUA-Z1C.esm.min.js.map +0 -1
  318. package/dist/chunks/MSFT_minecraftMesh-KL-RFOpw.esm.js +0 -46
  319. package/dist/chunks/MSFT_minecraftMesh-KL-RFOpw.esm.js.map +0 -1
  320. package/dist/chunks/MSFT_sRGBFactors-BqvzNhFN.esm.js +0 -47
  321. package/dist/chunks/MSFT_sRGBFactors-BqvzNhFN.esm.js.map +0 -1
  322. package/dist/chunks/MSFT_sRGBFactors-BzPS1BeM.esm.min.js +0 -2
  323. package/dist/chunks/MSFT_sRGBFactors-BzPS1BeM.esm.min.js.map +0 -1
  324. package/dist/chunks/assetContainer-CaFtpYEC.esm.min.js +0 -2
  325. package/dist/chunks/assetContainer-CaFtpYEC.esm.min.js.map +0 -1
  326. package/dist/chunks/assetContainer-DEN9e8ap.esm.js +0 -1598
  327. package/dist/chunks/assetContainer-DEN9e8ap.esm.js.map +0 -1
  328. package/dist/chunks/basisTextureLoader-4lvRsW5R.esm.js +0 -600
  329. package/dist/chunks/basisTextureLoader-4lvRsW5R.esm.js.map +0 -1
  330. package/dist/chunks/basisTextureLoader-CSgqqtvQ.esm.min.js +0 -2
  331. package/dist/chunks/basisTextureLoader-CSgqqtvQ.esm.min.js.map +0 -1
  332. package/dist/chunks/ddsTextureLoader-BIGKoQfH.esm.min.js +0 -2
  333. package/dist/chunks/ddsTextureLoader-BIGKoQfH.esm.min.js.map +0 -1
  334. package/dist/chunks/ddsTextureLoader-WkW9Z98R.esm.js +0 -87
  335. package/dist/chunks/ddsTextureLoader-WkW9Z98R.esm.js.map +0 -1
  336. package/dist/chunks/default.fragment-C5qVdkwU.esm.min.js +0 -2
  337. package/dist/chunks/default.fragment-C5qVdkwU.esm.min.js.map +0 -1
  338. package/dist/chunks/default.fragment-KU3HcVdD.esm.js +0 -515
  339. package/dist/chunks/default.fragment-KU3HcVdD.esm.js.map +0 -1
  340. package/dist/chunks/default.fragment-YuNZ7QG_.esm.js +0 -456
  341. package/dist/chunks/default.fragment-YuNZ7QG_.esm.js.map +0 -1
  342. package/dist/chunks/default.fragment-tBVj8NVU.esm.min.js +0 -2
  343. package/dist/chunks/default.fragment-tBVj8NVU.esm.min.js.map +0 -1
  344. package/dist/chunks/default.vertex-BO-PPsjL.esm.min.js +0 -2
  345. package/dist/chunks/default.vertex-BO-PPsjL.esm.min.js.map +0 -1
  346. package/dist/chunks/default.vertex-BVid4c1x.esm.js +0 -199
  347. package/dist/chunks/default.vertex-BVid4c1x.esm.js.map +0 -1
  348. package/dist/chunks/default.vertex-DyVCLPqJ.esm.js +0 -178
  349. package/dist/chunks/default.vertex-DyVCLPqJ.esm.js.map +0 -1
  350. package/dist/chunks/default.vertex-Jx_lr96D.esm.min.js +0 -2
  351. package/dist/chunks/default.vertex-Jx_lr96D.esm.min.js.map +0 -1
  352. package/dist/chunks/defaultUboDeclaration-BCAmDlbI.esm.min.js +0 -2
  353. package/dist/chunks/defaultUboDeclaration-BCAmDlbI.esm.min.js.map +0 -1
  354. package/dist/chunks/defaultUboDeclaration-Bc5r1i_z.esm.js +0 -13
  355. package/dist/chunks/defaultUboDeclaration-Bc5r1i_z.esm.js.map +0 -1
  356. package/dist/chunks/defaultUboDeclaration-BuE-DHID.esm.js +0 -15
  357. package/dist/chunks/defaultUboDeclaration-BuE-DHID.esm.js.map +0 -1
  358. package/dist/chunks/defaultUboDeclaration-DSNWa2yC.esm.min.js +0 -2
  359. package/dist/chunks/defaultUboDeclaration-DSNWa2yC.esm.min.js.map +0 -1
  360. package/dist/chunks/envTextureLoader-DMQ4NJ4V.esm.js +0 -63
  361. package/dist/chunks/envTextureLoader-DMQ4NJ4V.esm.js.map +0 -1
  362. package/dist/chunks/envTextureLoader-a8A_Oy6u.esm.min.js +0 -2
  363. package/dist/chunks/envTextureLoader-a8A_Oy6u.esm.min.js.map +0 -1
  364. package/dist/chunks/environmentTextureTools-DUKiZwIi.esm.min.js +0 -2
  365. package/dist/chunks/environmentTextureTools-DUKiZwIi.esm.min.js.map +0 -1
  366. package/dist/chunks/environmentTextureTools-nMKhR78g.esm.js +0 -381
  367. package/dist/chunks/environmentTextureTools-nMKhR78g.esm.js.map +0 -1
  368. package/dist/chunks/exrTextureLoader-D5NU09ih.esm.js +0 -1682
  369. package/dist/chunks/exrTextureLoader-D5NU09ih.esm.js.map +0 -1
  370. package/dist/chunks/exrTextureLoader-N-X2bKA6.esm.min.js +0 -2
  371. package/dist/chunks/exrTextureLoader-N-X2bKA6.esm.min.js.map +0 -1
  372. package/dist/chunks/fogFragment-D6bC8Ff4.esm.min.js +0 -2
  373. package/dist/chunks/fogFragment-D6bC8Ff4.esm.min.js.map +0 -1
  374. package/dist/chunks/fogFragment-I5stYsjp.esm.js +0 -102
  375. package/dist/chunks/fogFragment-I5stYsjp.esm.js.map +0 -1
  376. package/dist/chunks/glTFLoader-Da2YOCGR.esm.js +0 -7552
  377. package/dist/chunks/glTFLoader-Da2YOCGR.esm.js.map +0 -1
  378. package/dist/chunks/glTFLoader-Is2_r9v2.esm.min.js +0 -2
  379. package/dist/chunks/glTFLoader-Is2_r9v2.esm.min.js.map +0 -1
  380. package/dist/chunks/glTFLoaderAnimation-Bglz6m7h.esm.min.js +0 -2
  381. package/dist/chunks/glTFLoaderAnimation-Bglz6m7h.esm.min.js.map +0 -1
  382. package/dist/chunks/glTFLoaderAnimation-CbznFn_D.esm.js +0 -77
  383. package/dist/chunks/glTFLoaderAnimation-CbznFn_D.esm.js.map +0 -1
  384. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
  385. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
  386. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
  387. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
  388. package/dist/chunks/harmonicsFunctions-BetF_GFT.esm.js +0 -35
  389. package/dist/chunks/harmonicsFunctions-BetF_GFT.esm.js.map +0 -1
  390. package/dist/chunks/harmonicsFunctions-CilRmaCi.esm.js +0 -34
  391. package/dist/chunks/harmonicsFunctions-CilRmaCi.esm.js.map +0 -1
  392. package/dist/chunks/harmonicsFunctions-DeWuwYX2.esm.min.js +0 -2
  393. package/dist/chunks/harmonicsFunctions-DeWuwYX2.esm.min.js.map +0 -1
  394. package/dist/chunks/harmonicsFunctions-DvXfJIer.esm.min.js +0 -2
  395. package/dist/chunks/harmonicsFunctions-DvXfJIer.esm.min.js.map +0 -1
  396. package/dist/chunks/hdrTextureLoader-Dcqnpgjb.esm.min.js +0 -2
  397. package/dist/chunks/hdrTextureLoader-Dcqnpgjb.esm.min.js.map +0 -1
  398. package/dist/chunks/hdrTextureLoader-byrfFp-O.esm.js +0 -252
  399. package/dist/chunks/hdrTextureLoader-byrfFp-O.esm.js.map +0 -1
  400. package/dist/chunks/helperFunctions-B7m7R064.esm.js +0 -108
  401. package/dist/chunks/helperFunctions-B7m7R064.esm.js.map +0 -1
  402. package/dist/chunks/helperFunctions-BAP7B_1V.esm.min.js +0 -2
  403. package/dist/chunks/helperFunctions-BAP7B_1V.esm.min.js.map +0 -1
  404. package/dist/chunks/helperFunctions-CigixUGL.esm.min.js +0 -2
  405. package/dist/chunks/helperFunctions-CigixUGL.esm.min.js.map +0 -1
  406. package/dist/chunks/helperFunctions-D2JAu3Um.esm.js +0 -80
  407. package/dist/chunks/helperFunctions-D2JAu3Um.esm.js.map +0 -1
  408. package/dist/chunks/index-Ba-YQVRw.esm.min.js +0 -57
  409. package/dist/chunks/index-Ba-YQVRw.esm.min.js.map +0 -1
  410. package/dist/chunks/index-DCMXQRx5.esm.js +0 -81652
  411. package/dist/chunks/index-DCMXQRx5.esm.js.map +0 -1
  412. package/dist/chunks/ktxTextureLoader-B7JJ6I6Z.esm.js +0 -814
  413. package/dist/chunks/ktxTextureLoader-B7JJ6I6Z.esm.js.map +0 -1
  414. package/dist/chunks/ktxTextureLoader-BVcuaoad.esm.min.js +0 -2
  415. package/dist/chunks/ktxTextureLoader-BVcuaoad.esm.min.js.map +0 -1
  416. package/dist/chunks/logDepthDeclaration-BJgjCQaD.esm.js +0 -42
  417. package/dist/chunks/logDepthDeclaration-BJgjCQaD.esm.js.map +0 -1
  418. package/dist/chunks/logDepthDeclaration-Bsw_jD9J.esm.js +0 -35
  419. package/dist/chunks/logDepthDeclaration-Bsw_jD9J.esm.js.map +0 -1
  420. package/dist/chunks/logDepthDeclaration-C0bLjDGt.esm.min.js +0 -2
  421. package/dist/chunks/logDepthDeclaration-C0bLjDGt.esm.min.js.map +0 -1
  422. package/dist/chunks/logDepthDeclaration-CF5JhF4_.esm.min.js +0 -2
  423. package/dist/chunks/logDepthDeclaration-CF5JhF4_.esm.min.js.map +0 -1
  424. package/dist/chunks/logDepthVertex-Bu3IKzw6.esm.min.js +0 -2
  425. package/dist/chunks/logDepthVertex-Bu3IKzw6.esm.min.js.map +0 -1
  426. package/dist/chunks/logDepthVertex-D6ApgK5s.esm.js +0 -77
  427. package/dist/chunks/logDepthVertex-D6ApgK5s.esm.js.map +0 -1
  428. package/dist/chunks/logDepthVertex-RSueoP5o.esm.min.js +0 -2
  429. package/dist/chunks/logDepthVertex-RSueoP5o.esm.min.js.map +0 -1
  430. package/dist/chunks/logDepthVertex-jmh6sp9r.esm.js +0 -605
  431. package/dist/chunks/logDepthVertex-jmh6sp9r.esm.js.map +0 -1
  432. package/dist/chunks/mainUVVaryingDeclaration-BNr0GD05.esm.min.js +0 -2
  433. package/dist/chunks/mainUVVaryingDeclaration-BNr0GD05.esm.min.js.map +0 -1
  434. package/dist/chunks/mainUVVaryingDeclaration-ZPe9Pfpm.esm.js +0 -11
  435. package/dist/chunks/mainUVVaryingDeclaration-ZPe9Pfpm.esm.js.map +0 -1
  436. package/dist/chunks/objFileLoader-B1j9OyPi.esm.js +0 -1280
  437. package/dist/chunks/objFileLoader-B1j9OyPi.esm.js.map +0 -1
  438. package/dist/chunks/objFileLoader-B2Z0kBGZ.esm.min.js +0 -2
  439. package/dist/chunks/objFileLoader-B2Z0kBGZ.esm.min.js.map +0 -1
  440. package/dist/chunks/oitFragment-C7OX8yZO.esm.js +0 -1166
  441. package/dist/chunks/oitFragment-C7OX8yZO.esm.js.map +0 -1
  442. package/dist/chunks/oitFragment-CROGuom4.esm.min.js +0 -2
  443. package/dist/chunks/oitFragment-CROGuom4.esm.min.js.map +0 -1
  444. package/dist/chunks/oitFragment-Cx8fxkh0.esm.min.js +0 -2
  445. package/dist/chunks/oitFragment-Cx8fxkh0.esm.min.js.map +0 -1
  446. package/dist/chunks/oitFragment-QaeREI-l.esm.js +0 -1210
  447. package/dist/chunks/oitFragment-QaeREI-l.esm.js.map +0 -1
  448. package/dist/chunks/pass.fragment-Cp76VdVm.esm.min.js +0 -2
  449. package/dist/chunks/pass.fragment-Cp76VdVm.esm.min.js.map +0 -1
  450. package/dist/chunks/pass.fragment-DWGZaulM.esm.js +0 -15
  451. package/dist/chunks/pass.fragment-DWGZaulM.esm.js.map +0 -1
  452. package/dist/chunks/pbr.fragment-1MSLuKxt.esm.min.js +0 -2
  453. package/dist/chunks/pbr.fragment-1MSLuKxt.esm.min.js.map +0 -1
  454. package/dist/chunks/pbr.fragment-CVVaxHTM.esm.js +0 -3172
  455. package/dist/chunks/pbr.fragment-CVVaxHTM.esm.js.map +0 -1
  456. package/dist/chunks/pbr.fragment-DjDXkzPC.esm.js +0 -3228
  457. package/dist/chunks/pbr.fragment-DjDXkzPC.esm.js.map +0 -1
  458. package/dist/chunks/pbr.fragment-u-qCDBnn.esm.min.js +0 -2
  459. package/dist/chunks/pbr.fragment-u-qCDBnn.esm.min.js.map +0 -1
  460. package/dist/chunks/pbr.vertex-CY3atoVH.esm.min.js +0 -2
  461. package/dist/chunks/pbr.vertex-CY3atoVH.esm.min.js.map +0 -1
  462. package/dist/chunks/pbr.vertex-CvBNpmrL.esm.js +0 -335
  463. package/dist/chunks/pbr.vertex-CvBNpmrL.esm.js.map +0 -1
  464. package/dist/chunks/pbr.vertex-Cz1vuu4g.esm.min.js +0 -2
  465. package/dist/chunks/pbr.vertex-Cz1vuu4g.esm.min.js.map +0 -1
  466. package/dist/chunks/pbr.vertex-DmN6aBEn.esm.js +0 -208
  467. package/dist/chunks/pbr.vertex-DmN6aBEn.esm.js.map +0 -1
  468. package/dist/chunks/postprocess.vertex-C1KLVO46.esm.min.js +0 -2
  469. package/dist/chunks/postprocess.vertex-C1KLVO46.esm.min.js.map +0 -1
  470. package/dist/chunks/postprocess.vertex-bRjFMMTw.esm.js +0 -20
  471. package/dist/chunks/postprocess.vertex-bRjFMMTw.esm.js.map +0 -1
  472. package/dist/chunks/rawTexture-CnRJFGS0.esm.min.js +0 -2
  473. package/dist/chunks/rawTexture-CnRJFGS0.esm.min.js.map +0 -1
  474. package/dist/chunks/rawTexture-DqO-U47x.esm.js +0 -562
  475. package/dist/chunks/rawTexture-DqO-U47x.esm.js.map +0 -1
  476. package/dist/chunks/rgbdDecode.fragment-B3x1NGLA.esm.js +0 -17
  477. package/dist/chunks/rgbdDecode.fragment-B3x1NGLA.esm.js.map +0 -1
  478. package/dist/chunks/rgbdDecode.fragment-Ced65A9P.esm.js +0 -17
  479. package/dist/chunks/rgbdDecode.fragment-Ced65A9P.esm.js.map +0 -1
  480. package/dist/chunks/rgbdDecode.fragment-DeTDMkx-.esm.min.js +0 -2
  481. package/dist/chunks/rgbdDecode.fragment-DeTDMkx-.esm.min.js.map +0 -1
  482. package/dist/chunks/rgbdDecode.fragment-I4vSkcn6.esm.min.js +0 -2
  483. package/dist/chunks/rgbdDecode.fragment-I4vSkcn6.esm.min.js.map +0 -1
  484. package/dist/chunks/rgbdEncode.fragment-BI_5lpaM.esm.js +0 -17
  485. package/dist/chunks/rgbdEncode.fragment-BI_5lpaM.esm.js.map +0 -1
  486. package/dist/chunks/rgbdEncode.fragment-CvsdJfL-.esm.min.js +0 -2
  487. package/dist/chunks/rgbdEncode.fragment-CvsdJfL-.esm.min.js.map +0 -1
  488. package/dist/chunks/rgbdEncode.fragment-DBV9U7_S.esm.js +0 -17
  489. package/dist/chunks/rgbdEncode.fragment-DBV9U7_S.esm.js.map +0 -1
  490. package/dist/chunks/rgbdEncode.fragment-Ga_wck8r.esm.min.js +0 -2
  491. package/dist/chunks/rgbdEncode.fragment-Ga_wck8r.esm.min.js.map +0 -1
  492. package/dist/chunks/splatFileLoader-CqZQp8gT.esm.min.js +0 -2
  493. package/dist/chunks/splatFileLoader-CqZQp8gT.esm.min.js.map +0 -1
  494. package/dist/chunks/splatFileLoader-Ojz6wPQF.esm.js +0 -3154
  495. package/dist/chunks/splatFileLoader-Ojz6wPQF.esm.js.map +0 -1
  496. package/dist/chunks/standardMaterial-BRFkCYek.esm.min.js +0 -2
  497. package/dist/chunks/standardMaterial-BRFkCYek.esm.min.js.map +0 -1
  498. package/dist/chunks/standardMaterial-CrPdkeQ7.esm.js +0 -1809
  499. package/dist/chunks/standardMaterial-CrPdkeQ7.esm.js.map +0 -1
  500. package/dist/chunks/stlFileLoader-CZ4gnzj5.esm.js +0 -237
  501. package/dist/chunks/stlFileLoader-CZ4gnzj5.esm.js.map +0 -1
  502. package/dist/chunks/stlFileLoader-vUsEa3k7.esm.min.js +0 -2
  503. package/dist/chunks/stlFileLoader-vUsEa3k7.esm.min.js.map +0 -1
  504. package/dist/chunks/tgaTextureLoader-CWw7TE84.esm.js +0 -349
  505. package/dist/chunks/tgaTextureLoader-CWw7TE84.esm.js.map +0 -1
  506. package/dist/chunks/tgaTextureLoader-z-0S-ufz.esm.min.js +0 -2
  507. package/dist/chunks/tgaTextureLoader-z-0S-ufz.esm.min.js.map +0 -1
  508. package/dist/chunks/thinInstanceMesh-BPnShKmm.esm.min.js +0 -2
  509. package/dist/chunks/thinInstanceMesh-BPnShKmm.esm.min.js.map +0 -1
  510. package/dist/chunks/thinInstanceMesh-BvcXpcNe.esm.js +0 -314
  511. package/dist/chunks/thinInstanceMesh-BvcXpcNe.esm.js.map +0 -1
  512. package/dist/chunks/vertexColorMixing-BY_oWZih.esm.min.js +0 -2
  513. package/dist/chunks/vertexColorMixing-BY_oWZih.esm.min.js.map +0 -1
  514. package/dist/chunks/vertexColorMixing-Cq9NDkQU.esm.js +0 -528
  515. package/dist/chunks/vertexColorMixing-Cq9NDkQU.esm.js.map +0 -1
  516. package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
  517. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
  518. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
  519. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
  520. package/lib/index.d.ts +0 -237
  521. package/lib/index.js +0 -871
  522. package/lib/index.js.map +0 -1
@@ -1,3172 +0,0 @@
1
- import { S as ShaderStore } from './index-DCMXQRx5.esm.js';
2
- import './oitFragment-C7OX8yZO.esm.js';
3
- import './harmonicsFunctions-CilRmaCi.esm.js';
4
- import './logDepthDeclaration-BJgjCQaD.esm.js';
5
- import './helperFunctions-D2JAu3Um.esm.js';
6
-
7
- // Do not edit.
8
- const name$y = "pbrFragmentExtraDeclaration";
9
- const shader$y = `varying vPositionW: vec3f;
10
- #if DEBUGMODE>0
11
- varying vClipSpacePosition: vec4f;
12
- #endif
13
- #include<mainUVVaryingDeclaration>[1..7]
14
- #ifdef NORMAL
15
- varying vNormalW: vec3f;
16
- #if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
17
- varying vEnvironmentIrradiance: vec3f;
18
- #endif
19
- #endif
20
- #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
21
- varying vColor: vec4f;
22
- #endif
23
- `;
24
- // Sideeffect
25
- ShaderStore.IncludesShadersStoreWGSL[name$y] = shader$y;
26
-
27
- // Do not edit.
28
- const name$x = "samplerFragmentAlternateDeclaration";
29
- const shader$x = `#ifdef _DEFINENAME_
30
- #if _DEFINENAME_DIRECTUV==1
31
- #define v_VARYINGNAME_UV vMainUV1
32
- #elif _DEFINENAME_DIRECTUV==2
33
- #define v_VARYINGNAME_UV vMainUV2
34
- #elif _DEFINENAME_DIRECTUV==3
35
- #define v_VARYINGNAME_UV vMainUV3
36
- #elif _DEFINENAME_DIRECTUV==4
37
- #define v_VARYINGNAME_UV vMainUV4
38
- #elif _DEFINENAME_DIRECTUV==5
39
- #define v_VARYINGNAME_UV vMainUV5
40
- #elif _DEFINENAME_DIRECTUV==6
41
- #define v_VARYINGNAME_UV vMainUV6
42
- #else
43
- varying v_VARYINGNAME_UV: vec2f;
44
- #endif
45
- #endif
46
- `;
47
- // Sideeffect
48
- ShaderStore.IncludesShadersStoreWGSL[name$x] = shader$x;
49
-
50
- // Do not edit.
51
- const name$w = "pbrFragmentSamplersDeclaration";
52
- const shader$w = `#include<samplerFragmentDeclaration>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)
53
- #include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
54
- #include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
55
- #include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
56
- #include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
57
- #include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)
58
- #include<samplerFragmentDeclaration>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)
59
- #include<samplerFragmentDeclaration>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)
60
- #include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)
61
- #include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
62
- #ifdef CLEARCOAT
63
- #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)
64
- #include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)
65
- #if defined(CLEARCOAT_TEXTURE_ROUGHNESS)
66
- var clearCoatRoughnessSamplerSampler: sampler;var clearCoatRoughnessSampler: texture_2d<f32>;
67
- #endif
68
- #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)
69
- #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)
70
- #endif
71
- #ifdef IRIDESCENCE
72
- #include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)
73
- #include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)
74
- #endif
75
- #ifdef SHEEN
76
- #include<samplerFragmentDeclaration>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)
77
- #include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)
78
- #if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS)
79
- var sheenRoughnessSamplerSampler: sampler;var sheenRoughnessSampler: texture_2d<f32>;
80
- #endif
81
- #endif
82
- #ifdef ANISOTROPIC
83
- #include<samplerFragmentDeclaration>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)
84
- #endif
85
- #ifdef REFLECTION
86
- #ifdef REFLECTIONMAP_3D
87
- var reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube<f32>;
88
- #ifdef LODBASEDMICROSFURACE
89
- #else
90
- var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube<f32>;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube<f32>;
91
- #endif
92
- #ifdef USEIRRADIANCEMAP
93
- var irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube<f32>;
94
- #endif
95
- #else
96
- var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d<f32>;
97
- #ifdef LODBASEDMICROSFURACE
98
- #else
99
- var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d<f32>;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d<f32>;
100
- #endif
101
- #ifdef USEIRRADIANCEMAP
102
- var irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d<f32>;
103
- #endif
104
- #endif
105
- #ifdef REFLECTIONMAP_SKYBOX
106
- varying vPositionUVW: vec3f;
107
- #else
108
- #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
109
- varying vDirectionW: vec3f;
110
- #endif
111
- #endif
112
- #endif
113
- #ifdef ENVIRONMENTBRDF
114
- var environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d<f32>;
115
- #endif
116
- #ifdef SUBSURFACE
117
- #ifdef SS_REFRACTION
118
- #ifdef SS_REFRACTIONMAP_3D
119
- var refractionSamplerSampler: sampler;var refractionSampler: texture_cube<f32>;
120
- #ifdef LODBASEDMICROSFURACE
121
- #else
122
- var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_cube<f32>;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_cube<f32>;
123
- #endif
124
- #else
125
- var refractionSamplerSampler: sampler;var refractionSampler: texture_2d<f32>;
126
- #ifdef LODBASEDMICROSFURACE
127
- #else
128
- var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_2d<f32>;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_2d<f32>;
129
- #endif
130
- #endif
131
- #endif
132
- #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)
133
- #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)
134
- #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)
135
- #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor)
136
- #endif
137
- `;
138
- // Sideeffect
139
- ShaderStore.IncludesShadersStoreWGSL[name$w] = shader$w;
140
-
141
- // Do not edit.
142
- const name$v = "subSurfaceScatteringFunctions";
143
- const shader$v = `fn testLightingForSSS(diffusionProfile: f32)->bool
144
- {return diffusionProfile<1.;}`;
145
- // Sideeffect
146
- ShaderStore.IncludesShadersStoreWGSL[name$v] = shader$v;
147
-
148
- // Do not edit.
149
- const name$u = "importanceSampling";
150
- const shader$u = `fn hemisphereCosSample(u: vec2f)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=1.-u.y;var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
151
- fn hemisphereImportanceSampleDggx(u: vec2f,a: f32)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
152
- fn hemisphereImportanceSampleDCharlie(u: vec2f,a: f32)->vec3f {
153
- var phi: f32=2.*PI*u.x;var sinTheta: f32=pow(u.y,a/(2.*a+1.));var cosTheta: f32=sqrt(1.-sinTheta*sinTheta);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;
154
- // Sideeffect
155
- ShaderStore.IncludesShadersStoreWGSL[name$u] = shader$u;
156
-
157
- // Do not edit.
158
- const name$t = "pbrHelperFunctions";
159
- const shader$t = `#define MINIMUMVARIANCE 0.0005
160
- fn convertRoughnessToAverageSlope(roughness: f32)->f32
161
- {return roughness*roughness+MINIMUMVARIANCE;}
162
- fn fresnelGrazingReflectance(reflectance0: f32)->f32 {var reflectance90: f32=saturate(reflectance0*25.0);return reflectance90;}
163
- fn getAARoughnessFactors(normalVector: vec3f)->vec2f {
164
- #ifdef SPECULARAA
165
- var nDfdx: vec3f=dpdx(normalVector.xyz);var nDfdy: vec3f=dpdy(normalVector.xyz);var slopeSquare: f32=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));var geometricRoughnessFactor: f32=pow(saturate(slopeSquare),0.333);var geometricAlphaGFactor: f32=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2f(geometricRoughnessFactor,geometricAlphaGFactor);
166
- #else
167
- return vec2f(0.);
168
- #endif
169
- }
170
- #ifdef ANISOTROPIC
171
- #ifdef ANISOTROPIC_LEGACY
172
- fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}
173
- fn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var anisotropicFrameDirection: vec3f=select(T,B,anisotropy>=0.0);var anisotropicFrameTangent: vec3f=cross(normalize(anisotropicFrameDirection),V);var anisotropicFrameNormal: vec3f=cross(anisotropicFrameTangent,anisotropicFrameDirection);var anisotropicNormal: vec3f=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
174
- #else
175
- fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG,MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}
176
- fn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var bentNormal: vec3f=cross(B,V);bentNormal=normalize(cross(bentNormal,B));var sq=1.0-anisotropy*(1.0-roughness);var a: f32=sq*sq*sq*sq;bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}
177
- #endif
178
- #endif
179
- #if defined(CLEARCOAT) || defined(SS_REFRACTION)
180
- fn cocaLambertVec3(alpha: vec3f,distance: f32)->vec3f {return exp(-alpha*distance);}
181
- fn cocaLambert(NdotVRefract: f32,NdotLRefract: f32,alpha: vec3f,thickness: f32)->vec3f {return cocaLambertVec3(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
182
- fn computeColorAtDistanceInMedia(color: vec3f,distance: f32)->vec3f {return -log(color)/distance;}
183
- fn computeClearCoatAbsorption(NdotVRefract: f32,NdotLRefract: f32,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var clearCoatAbsorption: vec3f=mix( vec3f(1.0),
184
- cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
185
- clearCoatIntensity);return clearCoatAbsorption;}
186
- #endif
187
- #ifdef MICROSURFACEAUTOMATIC
188
- fn computeDefaultMicroSurface(microSurface: f32,reflectivityColor: vec3f)->f32
189
- {const kReflectivityNoAlphaWorkflow_SmoothnessMax: f32=0.95;var reflectivityLuminance: f32=getLuminance(reflectivityColor);var reflectivityLuma: f32=sqrt(reflectivityLuminance);var resultMicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return resultMicroSurface;}
190
- #endif
191
- `;
192
- // Sideeffect
193
- ShaderStore.IncludesShadersStoreWGSL[name$t] = shader$t;
194
-
195
- // Do not edit.
196
- const name$s = "pbrDirectLightingSetupFunctions";
197
- const shader$s = `struct preLightingInfo
198
- {lightOffset: vec3f,
199
- lightDistanceSquared: f32,
200
- lightDistance: f32,
201
- attenuation: f32,
202
- L: vec3f,
203
- H: vec3f,
204
- NdotV: f32,
205
- NdotLUnclamped: f32,
206
- NdotL: f32,
207
- VdotH: f32,
208
- roughness: f32,
209
- #ifdef IRIDESCENCE
210
- iridescenceIntensity: f32
211
- #endif
212
- };fn computePointAndSpotPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f,posW: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;}
213
- fn computeDirectionalPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;}
214
- fn computeHemisphericPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;
215
- #ifdef SPECULARTERM
216
- result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
217
- #endif
218
- return result;}`;
219
- // Sideeffect
220
- ShaderStore.IncludesShadersStoreWGSL[name$s] = shader$s;
221
-
222
- // Do not edit.
223
- const name$r = "pbrDirectLightingFalloffFunctions";
224
- const shader$r = `fn computeDistanceLightFalloff_Standard(lightOffset: vec3f,range: f32)->f32
225
- {return max(0.,1.0-length(lightOffset)/range);}
226
- fn computeDistanceLightFalloff_Physical(lightDistanceSquared: f32)->f32
227
- {return 1.0/maxEps(lightDistanceSquared);}
228
- fn computeDistanceLightFalloff_GLTF(lightDistanceSquared: f32,inverseSquaredRange: f32)->f32
229
- {var lightDistanceFalloff: f32=1.0/maxEps(lightDistanceSquared);var factor: f32=lightDistanceSquared*inverseSquaredRange;var attenuation: f32=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
230
- fn computeDistanceLightFalloff(lightOffset: vec3f,lightDistanceSquared: f32,range: f32,inverseSquaredRange: f32)->f32
231
- {
232
- #ifdef USEPHYSICALLIGHTFALLOFF
233
- return computeDistanceLightFalloff_Physical(lightDistanceSquared);
234
- #elif defined(USEGLTFLIGHTFALLOFF)
235
- return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
236
- #else
237
- return computeDistanceLightFalloff_Standard(lightOffset,range);
238
- #endif
239
- }
240
- fn computeDirectionalLightFalloff_Standard(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32)->f32
241
- {var falloff: f32=0.0;var cosAngle: f32=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
242
- {falloff=max(0.,pow(cosAngle,exponent));}
243
- return falloff;}
244
- fn computeDirectionalLightFalloff_Physical(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32)->f32
245
- {const kMinusLog2ConeAngleIntensityRatio: f32=6.64385618977;
246
- var concentrationKappa: f32=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);var lightDirectionSpreadSG: vec4f= vec4f(-lightDirection*concentrationKappa,-concentrationKappa);var falloff: f32=exp2(dot( vec4f(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
247
- fn computeDirectionalLightFalloff_GLTF(lightDirection: vec3f,directionToLightCenterW: vec3f,lightAngleScale: f32,lightAngleOffset: f32)->f32
248
- {var cd: f32=dot(-lightDirection,directionToLightCenterW);var falloff: f32=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
249
- fn computeDirectionalLightFalloff(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32,lightAngleScale: f32,lightAngleOffset: f32)->f32
250
- {
251
- #ifdef USEPHYSICALLIGHTFALLOFF
252
- return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
253
- #elif defined(USEGLTFLIGHTFALLOFF)
254
- return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
255
- #else
256
- return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
257
- #endif
258
- }`;
259
- // Sideeffect
260
- ShaderStore.IncludesShadersStoreWGSL[name$r] = shader$r;
261
-
262
- // Do not edit.
263
- const name$q = "pbrBRDFFunctions";
264
- const shader$q = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
265
- #ifdef MS_BRDF_ENERGY_CONSERVATION
266
- fn getEnergyConservationFactor(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
267
- #endif
268
- #ifdef ENVIRONMENTBRDF
269
- fn getBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {var UV: vec2f= vec2f(NdotV,perceptualRoughness);var brdfLookup: vec4f= textureSample(environmentBrdfSampler,environmentBrdfSamplerSampler,UV);
270
- #ifdef ENVIRONMENTBRDF_RGBD
271
- brdfLookup=vec4f(fromRGBD(brdfLookup.rgba),brdfLookup.a);
272
- #endif
273
- return brdfLookup.rgb;}
274
- fn getReflectanceFromBRDFWithEnvLookup(specularEnvironmentR0: vec3f,specularEnvironmentR90: vec3f,environmentBrdf: vec3f)->vec3f {
275
- #ifdef BRDF_V_HEIGHT_CORRELATED
276
- var reflectance: vec3f=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
277
- #else
278
- var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
279
- #endif
280
- return reflectance;}
281
- fn getReflectanceFromBRDFLookup(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {
282
- #ifdef BRDF_V_HEIGHT_CORRELATED
283
- var reflectance: vec3f=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
284
- #else
285
- var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
286
- #endif
287
- return reflectance;}
288
- #endif
289
- /* NOT USED
290
- #if defined(SHEEN) && defined(SHEEN_SOFTER)
291
- fn getBRDFLookupCharlieSheen(NdotV: f32,perceptualRoughness: f32)->f32
292
- {var c: f32=1.0-NdotV;var c3: f32=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
293
- #endif
294
- */
295
- #if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
296
- fn getReflectanceFromAnalyticalBRDFLookup_Jones(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f
297
- {var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
298
- #endif
299
- #if defined(SHEEN) && defined(ENVIRONMENTBRDF)
300
- /**
301
- * The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
302
- * The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
303
- */
304
- fn getSheenReflectanceFromBRDFLookup(reflectance0: vec3f,environmentBrdf: vec3f)->vec3f {var sheenEnvironmentReflectance: vec3f=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
305
- #endif
306
- fn fresnelSchlickGGXVec3(VdotH: f32,reflectance0: vec3f,reflectance90: vec3f)->vec3f
307
- {return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
308
- fn fresnelSchlickGGX(VdotH: f32,reflectance0: f32,reflectance90: f32)->f32
309
- {return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
310
- #ifdef CLEARCOAT
311
- fn getR0RemappedForClearCoat(f0: vec3f)->vec3f {
312
- #ifdef CLEARCOAT_DEFAULTIOR
313
- #ifdef MOBILE
314
- return saturateVec3(f0*(f0*0.526868+0.529324)-0.0482256);
315
- #else
316
- return saturateVec3(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
317
- #endif
318
- #else
319
- var s: vec3f=sqrt(f0);var t: vec3f=(uniforms.vClearCoatRefractionParams.z+uniforms.vClearCoatRefractionParams.w*s)/(uniforms.vClearCoatRefractionParams.w+uniforms.vClearCoatRefractionParams.z*s);return squareVec3(t);
320
- #endif
321
- }
322
- #endif
323
- #ifdef IRIDESCENCE
324
- const XYZ_TO_REC709: mat3x3f= mat3x3f(
325
- 3.2404542,-0.9692660, 0.0556434,
326
- -1.5371385, 1.8760108,-0.2040259,
327
- -0.4985314, 0.0415560, 1.0572252
328
- );fn getIORTfromAirToSurfaceR0(f0: vec3f)->vec3f {var sqrtF0: vec3f=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
329
- fn getR0fromIORsVec3(iorT: vec3f,iorI: f32)->vec3f {return squareVec3((iorT- vec3f(iorI))/(iorT+ vec3f(iorI)));}
330
- fn getR0fromIORs(iorT: f32,iorI: f32)->f32 {return square((iorT-iorI)/(iorT+iorI));}
331
- fn evalSensitivity(opd: f32,shift: vec3f)->vec3f {var phase: f32=2.0*PI*opd*1.0e-9;const val: vec3f= vec3f(5.4856e-13,4.4201e-13,5.2481e-13);const pos: vec3f= vec3f(1.6810e+06,1.7953e+06,2.2084e+06);const vr: vec3f= vec3f(4.3278e+09,9.3046e+09,6.6121e+09);var xyz: vec3f=val*sqrt(2.0*PI*vr)*cos(pos*phase+shift)*exp(-square(phase)*vr);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;var srgb: vec3f=XYZ_TO_REC709*xyz;return srgb;}
332
- fn evalIridescence(outsideIOR: f32,eta2: f32,cosTheta1: f32,thinFilmThickness: f32,baseF0: vec3f)->vec3f {var I: vec3f= vec3f(1.0);var iridescenceIOR: f32=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));var sinTheta2Sq: f32=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));var cosTheta2Sq: f32=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}
333
- var cosTheta2: f32=sqrt(cosTheta2Sq);var R0: f32=getR0fromIORs(iridescenceIOR,outsideIOR);var R12: f32=fresnelSchlickGGX(cosTheta1,R0,1.);var R21: f32=R12;var T121: f32=1.0-R12;var phi12: f32=0.0;if (iridescenceIOR<outsideIOR) {phi12=PI;}
334
- var phi21: f32=PI-phi12;var baseIOR: vec3f=getIORTfromAirToSurfaceR0(clamp(baseF0,vec3f(0.0),vec3f(0.9999)));
335
- var R1: vec3f=getR0fromIORsVec3(baseIOR,iridescenceIOR);var R23: vec3f=fresnelSchlickGGXVec3(cosTheta2,R1, vec3f(1.));var phi23: vec3f= vec3f(0.0);if (baseIOR[0]<iridescenceIOR) {phi23[0]=PI;}
336
- if (baseIOR[1]<iridescenceIOR) {phi23[1]=PI;}
337
- if (baseIOR[2]<iridescenceIOR) {phi23[2]=PI;}
338
- var opd: f32=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;var phi: vec3f= vec3f(phi21)+phi23;var R123: vec3f=clamp(R12*R23,vec3f(1e-5),vec3f(0.9999));var r123: vec3f=sqrt(R123);var Rs: vec3f=(T121*T121)*R23/( vec3f(1.0)-R123);var C0: vec3f=R12+Rs;I=C0;var Cm: vec3f=Rs-T121;for (var m: i32=1; m<=2; m++)
339
- {Cm*=r123;var Sm: vec3f=2.0*evalSensitivity( f32(m)*opd, f32(m)*phi);I+=Cm*Sm;}
340
- return max(I, vec3f(0.0));}
341
- #endif
342
- fn normalDistributionFunction_TrowbridgeReitzGGX(NdotH: f32,alphaG: f32)->f32
343
- {var a2: f32=alphaG*alphaG;var d: f32=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
344
- #ifdef SHEEN
345
- fn normalDistributionFunction_CharlieSheen(NdotH: f32,alphaG: f32)->f32
346
- {var invR: f32=1./alphaG;var cos2h: f32=NdotH*NdotH;var sin2h: f32=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
347
- #endif
348
- #ifdef ANISOTROPIC
349
- fn normalDistributionFunction_BurleyGGX_Anisotropic(NdotH: f32,TdotH: f32,BdotH: f32,alphaTB: vec2f)->f32 {var a2: f32=alphaTB.x*alphaTB.y;var v: vec3f= vec3f(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);var v2: f32=dot(v,v);var w2: f32=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}
350
- #endif
351
- #ifdef BRDF_V_HEIGHT_CORRELATED
352
- fn smithVisibility_GGXCorrelated(NdotL: f32,NdotV: f32,alphaG: f32)->f32 {
353
- #ifdef MOBILE
354
- var GGXV: f32=NdotL*(NdotV*(1.0-alphaG)+alphaG);var GGXL: f32=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
355
- #else
356
- var a2: f32=alphaG*alphaG;var GGXV: f32=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);var GGXL: f32=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);
357
- #endif
358
- }
359
- #else
360
- fn smithVisibilityG1_TrowbridgeReitzGGXFast(dot: f32,alphaG: f32)->f32
361
- {
362
- #ifdef MOBILE
363
- return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
364
- #else
365
- var alphaSquared: f32=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
366
- #endif
367
- }
368
- fn smithVisibility_TrowbridgeReitzGGXFast(NdotL: f32,NdotV: f32,alphaG: f32)->f32
369
- {var visibility: f32=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
370
- #endif
371
- #ifdef ANISOTROPIC
372
- fn smithVisibility_GGXCorrelated_Anisotropic(NdotL: f32,NdotV: f32,TdotV: f32,BdotV: f32,TdotL: f32,BdotL: f32,alphaTB: vec2f)->f32 {var lambdaV: f32=NdotL*length( vec3f(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));var lambdaL: f32=NdotV*length( vec3f(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));var v: f32=0.5/(lambdaV+lambdaL);return v;}
373
- #endif
374
- #ifdef CLEARCOAT
375
- fn visibility_Kelemen(VdotH: f32)->f32 {return 0.25/(VdotH*VdotH); }
376
- #endif
377
- #ifdef SHEEN
378
- fn visibility_Ashikhmin(NdotL: f32,NdotV: f32)->f32
379
- {return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
380
- /* NOT USED
381
- #ifdef SHEEN_SOFTER
382
- fn l(x: f32,alphaG: f32)->f32
383
- {var oneMinusAlphaSq: f32=(1.0-alphaG)*(1.0-alphaG);var a: f32=mix(21.5473,25.3245,oneMinusAlphaSq);var b: f32=mix(3.82987,3.32435,oneMinusAlphaSq);var c: f32=mix(0.19823,0.16801,oneMinusAlphaSq);var d: f32=mix(-1.97760,-1.27393,oneMinusAlphaSq);var e: f32=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}
384
- fn lambdaSheen(cosTheta: f32,alphaG: f32)->f32
385
- {return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
386
- fn visibility_CharlieSheen(NdotL: f32,NdotV: f32,alphaG: f32)->f32
387
- {var G: f32=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
388
- #endif
389
- */
390
- #endif
391
- fn diffuseBRDF_Burley(NdotL: f32,NdotV: f32,VdotH: f32,roughness: f32)->f32 {var diffuseFresnelNV: f32=pow5(saturateEps(1.0-NdotL));var diffuseFresnelNL: f32=pow5(saturateEps(1.0-NdotV));var diffuseFresnel90: f32=0.5+2.0*VdotH*VdotH*roughness;var fresnel: f32 =
392
- (1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
393
- (1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
394
- #ifdef SS_TRANSLUCENCY
395
- fn transmittanceBRDF_Burley(tintColor: vec3f,diffusionDistance: vec3f,thickness: f32)->vec3f {var S: vec3f=1./maxEpsVec3(diffusionDistance);var temp: vec3f=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}
396
- fn computeWrappedDiffuseNdotL(NdotL: f32,w: f32)->f32 {var t: f32=1.0+w;var invt2: f32=1.0/(t*t);return saturate((NdotL+w)*invt2);}
397
- #endif
398
- `;
399
- // Sideeffect
400
- ShaderStore.IncludesShadersStoreWGSL[name$q] = shader$q;
401
-
402
- // Do not edit.
403
- const name$p = "hdrFilteringFunctions";
404
- const shader$p = `#ifdef NUM_SAMPLES
405
- #if NUM_SAMPLES>0
406
- fn radicalInverse_VdC(value: u32)->f32
407
- {var bits=(value<<16u) | (value>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return f32(bits)*2.3283064365386963e-10; }
408
- fn hammersley(i: u32,N: u32)->vec2f
409
- {return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}
410
- fn log4(x: f32)->f32 {return log2(x)/2.;}
411
- const NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f
412
- {var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);for(var i: u32=0u; i<NUM_SAMPLES; i++)
413
- {var Xi: vec2f=hammersley(i,NUM_SAMPLES);var Ls: vec3f=hemisphereCosSample(Xi);Ls=normalize(Ls);var Ns: vec3f= vec3f(0.,0.,1.);var NoL: f32=dot(Ns,Ls);if (NoL>0.) {var pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;
414
- #ifdef GAMMA_INPUT
415
- c=toLinearSpaceVec3(c);
416
- #endif
417
- result+=c;}}
418
- result=result*NUM_SAMPLES_FLOAT_INVERSED;return result;}
419
- fn radiance(alphaG: f32,inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f
420
- {var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb;
421
- if (alphaG==0.) {
422
- #ifdef GAMMA_INPUT
423
- c=toLinearSpace(c);
424
- #endif
425
- return c;} else {var result: vec3f= vec3f(0.);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var weight: f32=0.;for(var i: u32=0u; i<NUM_SAMPLES; i++)
426
- {var Xi: vec2f=hammersley(i,NUM_SAMPLES);var H: vec3f=hemisphereImportanceSampleDggx(Xi,alphaG);var NoV: f32=1.;var NoH: f32=H.z;var NoH2: f32=H.z*H.z;var NoL: f32=2.*NoH2-1.;var L: vec3f= vec3f(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {var pdf_inversed: f32=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp( f32(l),0.0,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*L,mipLevel).rgb;
427
- #ifdef GAMMA_INPUT
428
- c=toLinearSpace(c);
429
- #endif
430
- result+=c*NoL;}}
431
- result=result/weight;return result;}}
432
- #endif
433
- #endif
434
- `;
435
- // Sideeffect
436
- ShaderStore.IncludesShadersStoreWGSL[name$p] = shader$p;
437
-
438
- // Do not edit.
439
- const name$o = "pbrDirectLightingFunctions";
440
- const shader$o = `#define CLEARCOATREFLECTANCE90 1.0
441
- struct lightingInfo
442
- {diffuse: vec3f,
443
- #ifdef SPECULARTERM
444
- specular: vec3f,
445
- #endif
446
- #ifdef CLEARCOAT
447
- clearCoat: vec4f,
448
- #endif
449
- #ifdef SHEEN
450
- sheen: vec3f
451
- #endif
452
- };fn adjustRoughnessFromLightProperties(roughness: f32,lightRadius: f32,lightDistance: f32)->f32 {
453
- #if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
454
- var lightRoughness: f32=lightRadius/lightDistance;var totalRoughness: f32=saturate(lightRoughness+roughness);return totalRoughness;
455
- #else
456
- return roughness;
457
- #endif
458
- }
459
- fn computeHemisphericDiffuseLighting(info: preLightingInfo,lightColor: vec3f,groundColor: vec3f)->vec3f {return mix(groundColor,lightColor,info.NdotL);}
460
- fn computeDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {var diffuseTerm: f32=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
461
- fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d<f32>,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f{var strq: vec4f=textureProjectionMatrix* vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return toLinearSpaceVec3(textureColor);}
462
- #ifdef SS_TRANSLUCENCY
463
- fn computeDiffuseAndTransmittedLighting(info: preLightingInfo,lightColor: vec3f,transmittance: vec3f)->vec3f {var NdotL: f32=absEps(info.NdotLUnclamped);var wrapNdotL: f32=computeWrappedDiffuseNdotL(NdotL,0.02);var trAdapt: f32=step(0.,info.NdotLUnclamped);var transmittanceNdotL: vec3f=mix(transmittance*wrapNdotL, vec3f(wrapNdotL),trAdapt);var diffuseTerm: f32=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
464
- #endif
465
- #ifdef SPECULARTERM
466
- fn computeSpecularLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var fresnel: vec3f=fresnelSchlickGGXVec3(info.VdotH,reflectance0,reflectance90);
467
- #ifdef IRIDESCENCE
468
- fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
469
- #endif
470
- var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
471
- #ifdef BRDF_V_HEIGHT_CORRELATED
472
- var smithVisibility: f32=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
473
- #else
474
- var smithVisibility: f32=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
475
- #endif
476
- var specTerm: vec3f=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
477
- #endif
478
- #ifdef ANISOTROPIC
479
- fn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var TdotH: f32=dot(T,info.H);var BdotH: f32=dot(B,info.H);var TdotV: f32=dot(T,V);var BdotV: f32=dot(B,V);var TdotL: f32=dot(T,info.L);var BdotL: f32=dot(B,info.L);var alphaG: f32=convertRoughnessToAverageSlope(info.roughness);var alphaTB: vec2f=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,vec2f(geometricRoughnessFactor*geometricRoughnessFactor));var fresnel: vec3f=fresnelSchlickGGXVec3(info.VdotH,reflectance0,reflectance90);
480
- #ifdef IRIDESCENCE
481
- fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
482
- #endif
483
- var distribution: f32=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);var smithVisibility: f32=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);var specTerm: vec3f=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
484
- #endif
485
- #ifdef CLEARCOAT
486
- fn computeClearCoatLighting(info: preLightingInfo,Ncc: vec3f,geometricRoughnessFactor: f32,clearCoatIntensity: f32,lightColor: vec3f)->vec4f {var NccdotL: f32=saturateEps(dot(Ncc,info.L));var NccdotH: f32=saturateEps(dot(Ncc,info.H));var clearCoatRoughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness);var fresnel: f32=fresnelSchlickGGX(info.VdotH,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);var kelemenVisibility: f32=visibility_Kelemen(info.VdotH);var clearCoatTerm: f32=fresnel*distribution*kelemenVisibility;return vec4f(
487
- clearCoatTerm*info.attenuation*NccdotL*lightColor,
488
- 1.0-fresnel
489
- );}
490
- fn computeClearCoatLightingAbsorption(NdotVRefract: f32,L: vec3f,Ncc: vec3f,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var LRefract: vec3f=-refract(L,Ncc,uniforms.vClearCoatRefractionParams.y);var NdotLRefract: f32=saturateEps(dot(Ncc,LRefract));var absorption: vec3f=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}
491
- #endif
492
- #ifdef SHEEN
493
- fn computeSheenLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var fresnel: f32=1.;var distribution: f32=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER
494
- var visibility: f32=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
495
- #else */
496
- var visibility: f32=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
497
- var sheenTerm: f32=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
498
- #endif
499
- `;
500
- // Sideeffect
501
- ShaderStore.IncludesShadersStoreWGSL[name$o] = shader$o;
502
-
503
- // Do not edit.
504
- const name$n = "pbrIBLFunctions";
505
- const shader$n = `#if defined(REFLECTION) || defined(SS_REFRACTION)
506
- fn getLodFromAlphaG(cubeMapDimensionPixels: f32,microsurfaceAverageSlope: f32)->f32 {var microsurfaceAverageSlopeTexels: f32=cubeMapDimensionPixels*microsurfaceAverageSlope;var lod: f32=log2(microsurfaceAverageSlopeTexels);return lod;}
507
- fn getLinearLodFromRoughness(cubeMapDimensionPixels: f32,roughness: f32)->f32 {var lod: f32=log2(cubeMapDimensionPixels)*roughness;return lod;}
508
- #endif
509
- #if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
510
- fn environmentRadianceOcclusion(ambientOcclusion: f32,NdotVUnclamped: f32)->f32 {var temp: f32=NdotVUnclamped+ambientOcclusion;return saturate(temp*temp-1.0+ambientOcclusion);}
511
- #endif
512
- #if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
513
- fn environmentHorizonOcclusion(view: vec3f,normal: vec3f,geometricNormal: vec3f)->f32 {var reflection: vec3f=reflect(view,normal);var temp: f32=saturate(1.0+1.1*dot(reflection,geometricNormal));return temp*temp;}
514
- #endif
515
- #if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
516
- fn UNPACK_LOD(x: f32)->f32 {return (1.0-x)*255.0;}
517
- fn getLodFromAlphaGNdotV(cubeMapDimensionPixels: f32,alphaG: f32,NdotV: f32)->f32 {var microsurfaceAverageSlope: f32=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
518
- #endif
519
- `;
520
- // Sideeffect
521
- ShaderStore.IncludesShadersStoreWGSL[name$n] = shader$n;
522
-
523
- // Do not edit.
524
- const name$m = "pbrBlockAlbedoOpacity";
525
- const shader$m = `struct albedoOpacityOutParams
526
- {surfaceAlbedo: vec3f,
527
- alpha: f32};
528
- #define pbr_inline
529
- fn albedoOpacityBlock(
530
- vAlbedoColor: vec4f
531
- #ifdef ALBEDO
532
- ,albedoTexture: vec4f
533
- ,albedoInfos: vec2f
534
- #endif
535
- #ifdef OPACITY
536
- ,opacityMap: vec4f
537
- ,vOpacityInfos: vec2f
538
- #endif
539
- #ifdef DETAIL
540
- ,detailColor: vec4f
541
- ,vDetailInfos: vec4f
542
- #endif
543
- #ifdef DECAL
544
- ,decalColor: vec4f
545
- ,vDecalInfos: vec4f
546
- #endif
547
- )->albedoOpacityOutParams
548
- {var outParams: albedoOpacityOutParams;var surfaceAlbedo: vec3f=vAlbedoColor.rgb;var alpha: f32=vAlbedoColor.a;
549
- #ifdef ALBEDO
550
- #if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)
551
- alpha*=albedoTexture.a;
552
- #endif
553
- #ifdef GAMMAALBEDO
554
- surfaceAlbedo*=toLinearSpaceVec3(albedoTexture.rgb);
555
- #else
556
- surfaceAlbedo*=albedoTexture.rgb;
557
- #endif
558
- surfaceAlbedo*=albedoInfos.y;
559
- #endif
560
- #ifndef DECAL_AFTER_DETAIL
561
- #include<decalFragment>
562
- #endif
563
- #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
564
- surfaceAlbedo*=fragmentInputs.vColor.rgb;
565
- #endif
566
- #ifdef DETAIL
567
- var detailAlbedo: f32=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;
568
- #endif
569
- #ifdef DECAL_AFTER_DETAIL
570
- #include<decalFragment>
571
- #endif
572
- #define CUSTOM_FRAGMENT_UPDATE_ALBEDO
573
- #ifdef OPACITY
574
- #ifdef OPACITYRGB
575
- alpha=getLuminance(opacityMap.rgb);
576
- #else
577
- alpha*=opacityMap.a;
578
- #endif
579
- alpha*=vOpacityInfos.y;
580
- #endif
581
- #if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
582
- alpha*=fragmentInputs.vColor.a;
583
- #endif
584
- #if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)
585
- #ifdef ALPHATEST
586
- #if DEBUGMODE != 88
587
- if (alpha<ALPHATESTVALUE) {discard;}
588
- #endif
589
- #ifndef ALPHABLEND
590
- alpha=1.0;
591
- #endif
592
- #endif
593
- #endif
594
- outParams.surfaceAlbedo=surfaceAlbedo;outParams.alpha=alpha;return outParams;}
595
- `;
596
- // Sideeffect
597
- ShaderStore.IncludesShadersStoreWGSL[name$m] = shader$m;
598
-
599
- // Do not edit.
600
- const name$l = "pbrBlockReflectivity";
601
- const shader$l = `struct reflectivityOutParams
602
- {microSurface: f32,
603
- roughness: f32,
604
- surfaceReflectivityColor: vec3f,
605
- #ifdef METALLICWORKFLOW
606
- surfaceAlbedo: vec3f,
607
- #endif
608
- #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
609
- ambientOcclusionColor: vec3f,
610
- #endif
611
- #if DEBUGMODE>0
612
- #ifdef METALLICWORKFLOW
613
- metallicRoughness: vec2f,
614
- #ifdef REFLECTIVITY
615
- surfaceMetallicColorMap: vec4f,
616
- #endif
617
- #ifndef FROSTBITE_REFLECTANCE
618
- metallicF0: vec3f,
619
- #endif
620
- #else
621
- #ifdef REFLECTIVITY
622
- surfaceReflectivityColorMap: vec4f,
623
- #endif
624
- #endif
625
- #endif
626
- };
627
- #define pbr_inline
628
- fn reflectivityBlock(
629
- vReflectivityColor: vec4f
630
- #ifdef METALLICWORKFLOW
631
- ,surfaceAlbedo: vec3f
632
- ,metallicReflectanceFactors: vec4f
633
- #endif
634
- #ifdef REFLECTIVITY
635
- ,reflectivityInfos: vec3f
636
- ,surfaceMetallicOrReflectivityColorMap: vec4f
637
- #endif
638
- #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
639
- ,ambientOcclusionColorIn: vec3f
640
- #endif
641
- #ifdef MICROSURFACEMAP
642
- ,microSurfaceTexel: vec4f
643
- #endif
644
- #ifdef DETAIL
645
- ,detailColor: vec4f
646
- ,vDetailInfos: vec4f
647
- #endif
648
- )->reflectivityOutParams
649
- {var outParams: reflectivityOutParams;var microSurface: f32=vReflectivityColor.a;var surfaceReflectivityColor: vec3f=vReflectivityColor.rgb;
650
- #ifdef METALLICWORKFLOW
651
- var metallicRoughness: vec2f=surfaceReflectivityColor.rg;
652
- #ifdef REFLECTIVITY
653
- #if DEBUGMODE>0
654
- outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;
655
- #endif
656
- #ifdef AOSTOREINMETALMAPRED
657
- var aoStoreInMetalMap: vec3f= vec3f(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);
658
- #endif
659
- #ifdef METALLNESSSTOREINMETALMAPBLUE
660
- metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;
661
- #else
662
- metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;
663
- #endif
664
- #ifdef ROUGHNESSSTOREINMETALMAPALPHA
665
- metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;
666
- #else
667
- #ifdef ROUGHNESSSTOREINMETALMAPGREEN
668
- metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;
669
- #endif
670
- #endif
671
- #endif
672
- #ifdef DETAIL
673
- var detailRoughness: f32=mix(0.5,detailColor.b,vDetailInfos.w);var loLerp: f32=mix(0.,metallicRoughness.g,detailRoughness*2.);var hiLerp: f32=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));
674
- #endif
675
- #ifdef MICROSURFACEMAP
676
- metallicRoughness.g*=microSurfaceTexel.r;
677
- #endif
678
- #if DEBUGMODE>0
679
- outParams.metallicRoughness=metallicRoughness;
680
- #endif
681
- #define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS
682
- microSurface=1.0-metallicRoughness.g;var baseColor: vec3f=surfaceAlbedo;
683
- #ifdef FROSTBITE_REFLECTANCE
684
- outParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);surfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);
685
- #else
686
- var metallicF0: vec3f=metallicReflectanceFactors.rgb;
687
- #if DEBUGMODE>0
688
- outParams.metallicF0=metallicF0;
689
- #endif
690
- outParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0), vec3f(0.,0.,0.),metallicRoughness.r);surfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);
691
- #endif
692
- #else
693
- #ifdef REFLECTIVITY
694
- surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;
695
- #if DEBUGMODE>0
696
- outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;
697
- #endif
698
- #ifdef MICROSURFACEFROMREFLECTIVITYMAP
699
- microSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z;
700
- #else
701
- #ifdef MICROSURFACEAUTOMATIC
702
- microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
703
- #endif
704
- #ifdef MICROSURFACEMAP
705
- microSurface*=microSurfaceTexel.r;
706
- #endif
707
- #define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE
708
- #endif
709
- #endif
710
- #endif
711
- microSurface=saturate(microSurface);var roughness: f32=1.-microSurface;outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.surfaceReflectivityColor=surfaceReflectivityColor;return outParams;}
712
- `;
713
- // Sideeffect
714
- ShaderStore.IncludesShadersStoreWGSL[name$l] = shader$l;
715
-
716
- // Do not edit.
717
- const name$k = "pbrBlockAmbientOcclusion";
718
- const shader$k = `struct ambientOcclusionOutParams
719
- {ambientOcclusionColor: vec3f,
720
- #if DEBUGMODE>0 && defined(AMBIENT)
721
- ambientOcclusionColorMap: vec3f
722
- #endif
723
- };
724
- #define pbr_inline
725
- fn ambientOcclusionBlock(
726
- #ifdef AMBIENT
727
- ambientOcclusionColorMap_: vec3f,
728
- vAmbientInfos: vec4f
729
- #endif
730
- )->ambientOcclusionOutParams
731
- {
732
- var outParams: ambientOcclusionOutParams;var ambientOcclusionColor: vec3f= vec3f(1.,1.,1.);
733
- #ifdef AMBIENT
734
- var ambientOcclusionColorMap: vec3f=ambientOcclusionColorMap_*vAmbientInfos.y;
735
- #ifdef AMBIENTINGRAYSCALE
736
- ambientOcclusionColorMap= vec3f(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);
737
- #endif
738
- ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);
739
- #if DEBUGMODE>0
740
- outParams.ambientOcclusionColorMap=ambientOcclusionColorMap;
741
- #endif
742
- #endif
743
- outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;}
744
- `;
745
- // Sideeffect
746
- ShaderStore.IncludesShadersStoreWGSL[name$k] = shader$k;
747
-
748
- // Do not edit.
749
- const name$j = "pbrBlockAlphaFresnel";
750
- const shader$j = `#ifdef ALPHAFRESNEL
751
- #if defined(ALPHATEST) || defined(ALPHABLEND)
752
- struct alphaFresnelOutParams
753
- {alpha: f32};fn faceforward(N: vec3<f32>,I: vec3<f32>,Nref: vec3<f32>)->vec3<f32> {return select(N,-N,dot(Nref,I)>0.0);}
754
- #define pbr_inline
755
- fn alphaFresnelBlock(
756
- normalW: vec3f,
757
- viewDirectionW: vec3f,
758
- alpha: f32,
759
- microSurface: f32
760
- )->alphaFresnelOutParams
761
- {var outParams: alphaFresnelOutParams;var opacityPerceptual: f32=alpha;
762
- #ifdef LINEARALPHAFRESNEL
763
- var opacity0: f32=opacityPerceptual;
764
- #else
765
- var opacity0: f32=opacityPerceptual*opacityPerceptual;
766
- #endif
767
- var opacity90: f32=fresnelGrazingReflectance(opacity0);var normalForward: vec3f=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)), vec3f(opacity0), vec3f(opacity90),sqrt(microSurface)).x;
768
- #ifdef ALPHATEST
769
- if (outParams.alpha<ALPHATESTVALUE) {discard;}
770
- #ifndef ALPHABLEND
771
- outParams.alpha=1.0;
772
- #endif
773
- #endif
774
- return outParams;}
775
- #endif
776
- #endif
777
- `;
778
- // Sideeffect
779
- ShaderStore.IncludesShadersStoreWGSL[name$j] = shader$j;
780
-
781
- // Do not edit.
782
- const name$i = "pbrBlockAnisotropic";
783
- const shader$i = `#ifdef ANISOTROPIC
784
- struct anisotropicOutParams
785
- {anisotropy: f32,
786
- anisotropicTangent: vec3f,
787
- anisotropicBitangent: vec3f,
788
- anisotropicNormal: vec3f,
789
- #if DEBUGMODE>0 && defined(ANISOTROPIC_TEXTURE)
790
- anisotropyMapData: vec3f
791
- #endif
792
- };
793
- #define pbr_inline
794
- fn anisotropicBlock(
795
- vAnisotropy: vec3f,
796
- roughness: f32,
797
- #ifdef ANISOTROPIC_TEXTURE
798
- anisotropyMapData: vec3f,
799
- #endif
800
- TBN: mat3x3f,
801
- normalW: vec3f,
802
- viewDirectionW: vec3f
803
- )->anisotropicOutParams
804
- {
805
- var outParams: anisotropicOutParams;var anisotropy: f32=vAnisotropy.b;var anisotropyDirection: vec3f= vec3f(vAnisotropy.xy,0.);
806
- #ifdef ANISOTROPIC_TEXTURE
807
- var amd=anisotropyMapData.rg;anisotropy*=anisotropyMapData.b;
808
- #if DEBUGMODE>0
809
- outParams.anisotropyMapData=anisotropyMapData;
810
- #endif
811
- amd=amd*2.0-1.0;
812
- #ifdef ANISOTROPIC_LEGACY
813
- anisotropyDirection=vec3f(anisotropyDirection.xy*amd,anisotropyDirection.z);
814
- #else
815
- anisotropyDirection=vec3f(mat2x2f(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(amd),anisotropyDirection.z);
816
- #endif
817
- #endif
818
- var anisoTBN: mat3x3f= mat3x3f(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));var anisotropicTangent: vec3f=normalize(anisoTBN*anisotropyDirection);var anisotropicBitangent: vec3f=normalize(cross(anisoTBN[2],anisotropicTangent));outParams.anisotropy=anisotropy;outParams.anisotropicTangent=anisotropicTangent;outParams.anisotropicBitangent=anisotropicBitangent;outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy,roughness);return outParams;}
819
- #endif
820
- `;
821
- // Sideeffect
822
- ShaderStore.IncludesShadersStoreWGSL[name$i] = shader$i;
823
-
824
- // Do not edit.
825
- const name$h = "pbrBlockReflection";
826
- const shader$h = `#ifdef REFLECTION
827
- struct reflectionOutParams
828
- {environmentRadiance: vec4f
829
- ,environmentIrradiance: vec3f
830
- #ifdef REFLECTIONMAP_3D
831
- ,reflectionCoords: vec3f
832
- #else
833
- ,reflectionCoords: vec2f
834
- #endif
835
- #ifdef SS_TRANSLUCENCY
836
- #ifdef USESPHERICALFROMREFLECTIONMAP
837
- #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
838
- ,irradianceVector: vec3f
839
- #endif
840
- #endif
841
- #endif
842
- };
843
- #define pbr_inline
844
- #ifdef REFLECTIONMAP_3D
845
- fn createReflectionCoords(
846
- vPositionW: vec3f,
847
- normalW: vec3f,
848
- #ifdef ANISOTROPIC
849
- anisotropicOut: anisotropicOutParams,
850
- #endif
851
- )->vec3f
852
- {var reflectionCoords: vec3f;
853
- #else
854
- fn createReflectionCoords(
855
- vPositionW: vec3f,
856
- normalW: vec3f,
857
- #ifdef ANISOTROPIC
858
- anisotropicOut: anisotropicOutParams,
859
- #endif
860
- )->vec2f
861
- {
862
- var reflectionCoords: vec2f;
863
- #endif
864
- #ifdef ANISOTROPIC
865
- var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),anisotropicOut.anisotropicNormal);
866
- #else
867
- var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),normalW);
868
- #endif
869
- #ifdef REFLECTIONMAP_OPPOSITEZ
870
- reflectionVector.z*=-1.0;
871
- #endif
872
- #ifdef REFLECTIONMAP_3D
873
- reflectionCoords=reflectionVector;
874
- #else
875
- reflectionCoords=reflectionVector.xy;
876
- #ifdef REFLECTIONMAP_PROJECTION
877
- reflectionCoords/=reflectionVector.z;
878
- #endif
879
- reflectionCoords.y=1.0-reflectionCoords.y;
880
- #endif
881
- return reflectionCoords;}
882
- #define pbr_inline
883
- fn sampleReflectionTexture(
884
- alphaG: f32
885
- ,vReflectionMicrosurfaceInfos: vec3f
886
- ,vReflectionInfos: vec2f
887
- ,vReflectionColor: vec3f
888
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
889
- ,NdotVUnclamped: f32
890
- #endif
891
- #ifdef LINEARSPECULARREFLECTION
892
- ,roughness: f32
893
- #endif
894
- #ifdef REFLECTIONMAP_3D
895
- ,reflectionSampler: texture_cube<f32>
896
- ,reflectionSamplerSampler: sampler
897
- ,reflectionCoords: vec3f
898
- #else
899
- ,reflectionSampler: texture_2d<f32>
900
- ,reflectionSamplerSampler: sampler
901
- ,reflectionCoords: vec2f
902
- #endif
903
- #ifndef LODBASEDMICROSFURACE
904
- #ifdef REFLECTIONMAP_3D
905
- ,reflectionLowSampler: texture_cube<f32>
906
- ,reflectionLowSamplerSampler: sampler
907
- ,reflectionHighSampler: texture_cube<f32>
908
- ,reflectionHighSamplerSampler: sampler
909
- #else
910
- ,reflectionLowSampler: texture_2d<f32>
911
- ,reflectionLowSamplerSampler: sampler
912
- ,reflectionHighSampler: texture_2d<f32>
913
- ,reflectionHighSamplerSampler: sampler
914
- #endif
915
- #endif
916
- #ifdef REALTIME_FILTERING
917
- ,vReflectionFilteringInfo: vec2f
918
- #endif
919
- )->vec4f
920
- {var environmentRadiance: vec4f;
921
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
922
- var reflectionLOD: f32=getLodFromAlphaGNdotV(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);
923
- #elif defined(LINEARSPECULARREFLECTION)
924
- var reflectionLOD: f32=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
925
- #else
926
- var reflectionLOD: f32=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
927
- #endif
928
- #ifdef LODBASEDMICROSFURACE
929
- reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
930
- #ifdef LODINREFLECTIONALPHA
931
- var automaticReflectionLOD: f32=UNPACK_LOD(textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords).a);var requestedReflectionLOD: f32=max(automaticReflectionLOD,reflectionLOD);
932
- #else
933
- var requestedReflectionLOD: f32=reflectionLOD;
934
- #endif
935
- #ifdef REALTIME_FILTERING
936
- environmentRadiance= vec4f(radiance(alphaG,reflectionSampler,reflectionSamplerSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
937
- #else
938
- environmentRadiance=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD);
939
- #endif
940
- #else
941
- var lodReflectionNormalized: f32=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));var lodReflectionNormalizedDoubled: f32=lodReflectionNormalized*2.0;var environmentMid: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);if (lodReflectionNormalizedDoubled<1.0){environmentRadiance=mix(
942
- textureSample(reflectionHighSampler,reflectionHighSamplerSampler,reflectionCoords),
943
- environmentMid,
944
- lodReflectionNormalizedDoubled
945
- );} else {environmentRadiance=mix(
946
- environmentMid,
947
- textureSample(reflectionLowSampler,reflectionLowSamplerSampler,reflectionCoords),
948
- lodReflectionNormalizedDoubled-1.0
949
- );}
950
- #endif
951
- var envRadiance=environmentRadiance.rgb;
952
- #ifdef RGBDREFLECTION
953
- envRadiance=fromRGBD(environmentRadiance);
954
- #endif
955
- #ifdef GAMMAREFLECTION
956
- envRadiance=toLinearSpaceVec3(environmentRadiance.rgb);
957
- #endif
958
- envRadiance*=vReflectionInfos.x;envRadiance*=vReflectionColor.rgb;return vec4f(envRadiance,environmentRadiance.a);}
959
- #define pbr_inline
960
- fn reflectionBlock(
961
- vPositionW: vec3f
962
- ,normalW: vec3f
963
- ,alphaG: f32
964
- ,vReflectionMicrosurfaceInfos: vec3f
965
- ,vReflectionInfos: vec2f
966
- ,vReflectionColor: vec3f
967
- #ifdef ANISOTROPIC
968
- ,anisotropicOut: anisotropicOutParams
969
- #endif
970
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
971
- ,NdotVUnclamped: f32
972
- #endif
973
- #ifdef LINEARSPECULARREFLECTION
974
- ,roughness: f32
975
- #endif
976
- #ifdef REFLECTIONMAP_3D
977
- ,reflectionSampler: texture_cube<f32>
978
- ,reflectionSamplerSampler: sampler
979
- #else
980
- ,reflectionSampler: texture_2d<f32>
981
- ,reflectionSamplerSampler: sampler
982
- #endif
983
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
984
- ,vEnvironmentIrradiance: vec3f
985
- #endif
986
- #ifdef USESPHERICALFROMREFLECTIONMAP
987
- #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
988
- ,reflectionMatrix: mat4x4f
989
- #endif
990
- #endif
991
- #ifdef USEIRRADIANCEMAP
992
- #ifdef REFLECTIONMAP_3D
993
- ,irradianceSampler: texture_cube<f32>
994
- ,irradianceSamplerSampler: sampler
995
- #else
996
- ,irradianceSampler: texture_2d<f32>
997
- ,irradianceSamplerSampler: sampler
998
- #endif
999
- #endif
1000
- #ifndef LODBASEDMICROSFURACE
1001
- #ifdef REFLECTIONMAP_3D
1002
- ,reflectionLowSampler: texture_cube<f32>
1003
- ,reflectionLowSamplerSampler: sampler
1004
- ,reflectionHighSampler: texture_cube<f32>
1005
- ,reflectionHighSamplerSampler: sampler
1006
- #else
1007
- ,reflectionLowSampler: texture_2d<f32>
1008
- ,reflectionLowSamplerSampler: sampler
1009
- ,reflectionHighSampler: texture_2d<f32>
1010
- ,reflectionHighSamplerSampler: sampler
1011
- #endif
1012
- #endif
1013
- #ifdef REALTIME_FILTERING
1014
- ,vReflectionFilteringInfo: vec2f
1015
- #endif
1016
- )->reflectionOutParams
1017
- {var outParams: reflectionOutParams;var environmentRadiance: vec4f= vec4f(0.,0.,0.,0.);
1018
- #ifdef REFLECTIONMAP_3D
1019
- var reflectionCoords: vec3f= vec3f(0.);
1020
- #else
1021
- var reflectionCoords: vec2f= vec2f(0.);
1022
- #endif
1023
- reflectionCoords=createReflectionCoords(
1024
- vPositionW,
1025
- normalW,
1026
- #ifdef ANISOTROPIC
1027
- anisotropicOut,
1028
- #endif
1029
- );environmentRadiance=sampleReflectionTexture(
1030
- alphaG
1031
- ,vReflectionMicrosurfaceInfos
1032
- ,vReflectionInfos
1033
- ,vReflectionColor
1034
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1035
- ,NdotVUnclamped
1036
- #endif
1037
- #ifdef LINEARSPECULARREFLECTION
1038
- ,roughness
1039
- #endif
1040
- #ifdef REFLECTIONMAP_3D
1041
- ,reflectionSampler
1042
- ,reflectionSamplerSampler
1043
- ,reflectionCoords
1044
- #else
1045
- ,reflectionSampler
1046
- ,reflectionSamplerSampler
1047
- ,reflectionCoords
1048
- #endif
1049
- #ifndef LODBASEDMICROSFURACE
1050
- ,reflectionLowSampler
1051
- ,reflectionLowSamplerSampler
1052
- ,reflectionHighSampler
1053
- ,reflectionHighSamplerSampler
1054
- #endif
1055
- #ifdef REALTIME_FILTERING
1056
- ,vReflectionFilteringInfo
1057
- #endif
1058
- );var environmentIrradiance: vec3f= vec3f(0.,0.,0.);
1059
- #ifdef USESPHERICALFROMREFLECTIONMAP
1060
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
1061
- environmentIrradiance=vEnvironmentIrradiance;
1062
- #else
1063
- #ifdef ANISOTROPIC
1064
- var irradianceVector: vec3f= (reflectionMatrix* vec4f(anisotropicOut.anisotropicNormal,0)).xyz;
1065
- #else
1066
- var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz;
1067
- #endif
1068
- #ifdef REFLECTIONMAP_OPPOSITEZ
1069
- irradianceVector.z*=-1.0;
1070
- #endif
1071
- #ifdef INVERTCUBICMAP
1072
- irradianceVector.y*=-1.0;
1073
- #endif
1074
- #if defined(REALTIME_FILTERING)
1075
- environmentIrradiance=irradiance(reflectionSampler,reflectionSamplerSampler,irradianceVector,vReflectionFilteringInfo);
1076
- #else
1077
- environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
1078
- #endif
1079
- #ifdef SS_TRANSLUCENCY
1080
- outParams.irradianceVector=irradianceVector;
1081
- #endif
1082
- #endif
1083
- #elif defined(USEIRRADIANCEMAP)
1084
- var environmentIrradiance4: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,reflectionCoords);environmentIrradiance=environmentIrradiance4.rgb;
1085
- #ifdef RGBDREFLECTION
1086
- environmentIrradiance=fromRGBD(environmentIrradiance4);
1087
- #endif
1088
- #ifdef GAMMAREFLECTION
1089
- environmentIrradiance=toLinearSpaceVec3(environmentIrradiance.rgb);
1090
- #endif
1091
- #endif
1092
- environmentIrradiance*=vReflectionColor.rgb;outParams.environmentRadiance=environmentRadiance;outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;return outParams;}
1093
- #endif
1094
- `;
1095
- // Sideeffect
1096
- ShaderStore.IncludesShadersStoreWGSL[name$h] = shader$h;
1097
-
1098
- // Do not edit.
1099
- const name$g = "pbrBlockSheen";
1100
- const shader$g = `#ifdef SHEEN
1101
- struct sheenOutParams
1102
- {sheenIntensity: f32
1103
- ,sheenColor: vec3f
1104
- ,sheenRoughness: f32
1105
- #ifdef SHEEN_LINKWITHALBEDO
1106
- ,surfaceAlbedo: vec3f
1107
- #endif
1108
- #if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
1109
- ,sheenAlbedoScaling: f32
1110
- #endif
1111
- #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1112
- ,finalSheenRadianceScaled: vec3f
1113
- #endif
1114
- #if DEBUGMODE>0
1115
- #ifdef SHEEN_TEXTURE
1116
- ,sheenMapData: vec4f
1117
- #endif
1118
- #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1119
- ,sheenEnvironmentReflectance: vec3f
1120
- #endif
1121
- #endif
1122
- };
1123
- #define pbr_inline
1124
- fn sheenBlock(
1125
- vSheenColor: vec4f
1126
- #ifdef SHEEN_ROUGHNESS
1127
- ,vSheenRoughness: f32
1128
- #if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
1129
- ,sheenMapRoughnessData: vec4f
1130
- #endif
1131
- #endif
1132
- ,roughness: f32
1133
- #ifdef SHEEN_TEXTURE
1134
- ,sheenMapData: vec4f
1135
- ,sheenMapLevel: f32
1136
- #endif
1137
- ,reflectance: f32
1138
- #ifdef SHEEN_LINKWITHALBEDO
1139
- ,baseColor: vec3f
1140
- ,surfaceAlbedo: vec3f
1141
- #endif
1142
- #ifdef ENVIRONMENTBRDF
1143
- ,NdotV: f32
1144
- ,environmentBrdf: vec3f
1145
- #endif
1146
- #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1147
- ,AARoughnessFactors: vec2f
1148
- ,vReflectionMicrosurfaceInfos: vec3f
1149
- ,vReflectionInfos: vec2f
1150
- ,vReflectionColor: vec3f
1151
- ,vLightingIntensity: vec4f
1152
- #ifdef REFLECTIONMAP_3D
1153
- ,reflectionSampler: texture_cube<f32>
1154
- ,reflectionSamplerSampler: sampler
1155
- ,reflectionCoords: vec3f
1156
- #else
1157
- ,reflectionSampler: texture_2d<f32>
1158
- ,reflectionSamplerSampler: sampler
1159
- ,reflectionCoords: vec2f
1160
- #endif
1161
- ,NdotVUnclamped: f32
1162
- #ifndef LODBASEDMICROSFURACE
1163
- #ifdef REFLECTIONMAP_3D
1164
- ,reflectionLowSampler: texture_cube<f32>
1165
- ,reflectionLowSamplerSampler: sampler
1166
- ,reflectionHighSampler: texture_cube<f32>
1167
- ,reflectionHighSamplerSampler: sampler
1168
- #else
1169
- ,reflectionLowSampler: texture_2d<f32>
1170
- ,reflectionLowSamplerSampler: sampler
1171
- ,reflectionHighSampler: texture_2d<f32>
1172
- ,reflectionHighSamplerSampler: sampler
1173
- #endif
1174
- #endif
1175
- #ifdef REALTIME_FILTERING
1176
- ,vReflectionFilteringInfo: vec2f
1177
- #endif
1178
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
1179
- ,seo: f32
1180
- #endif
1181
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
1182
- ,eho: f32
1183
- #endif
1184
- #endif
1185
- )->sheenOutParams
1186
- {var outParams: sheenOutParams;var sheenIntensity: f32=vSheenColor.a;
1187
- #ifdef SHEEN_TEXTURE
1188
- #if DEBUGMODE>0
1189
- outParams.sheenMapData=sheenMapData;
1190
- #endif
1191
- #endif
1192
- #ifdef SHEEN_LINKWITHALBEDO
1193
- var sheenFactor: f32=pow5(1.0-sheenIntensity);var sheenColor: vec3f=baseColor.rgb*(1.0-sheenFactor);var sheenRoughness: f32=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;
1194
- #ifdef SHEEN_TEXTURE
1195
- sheenIntensity*=sheenMapData.a;
1196
- #endif
1197
- #else
1198
- var sheenColor: vec3f=vSheenColor.rgb;
1199
- #ifdef SHEEN_TEXTURE
1200
- #ifdef SHEEN_GAMMATEXTURE
1201
- sheenColor*=toLinearSpaceVec3(sheenMapData.rgb);
1202
- #else
1203
- sheenColor*=sheenMapData.rgb;
1204
- #endif
1205
- sheenColor*=sheenMapLevel;
1206
- #endif
1207
- #ifdef SHEEN_ROUGHNESS
1208
- var sheenRoughness: f32=vSheenRoughness;
1209
- #ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE
1210
- #if defined(SHEEN_TEXTURE)
1211
- sheenRoughness*=sheenMapData.a;
1212
- #endif
1213
- #elif defined(SHEEN_TEXTURE_ROUGHNESS)
1214
- sheenRoughness*=sheenMapRoughnessData.a;
1215
- #endif
1216
- #else
1217
- var sheenRoughness: f32=roughness;
1218
- #ifdef SHEEN_TEXTURE
1219
- sheenIntensity*=sheenMapData.a;
1220
- #endif
1221
- #endif
1222
- #if !defined(SHEEN_ALBEDOSCALING)
1223
- sheenIntensity*=(1.-reflectance);
1224
- #endif
1225
- sheenColor*=sheenIntensity;
1226
- #endif
1227
- #ifdef ENVIRONMENTBRDF
1228
- /*#ifdef SHEEN_SOFTER
1229
- var environmentSheenBrdf: vec3f= vec3f(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));
1230
- #else*/
1231
- #ifdef SHEEN_ROUGHNESS
1232
- var environmentSheenBrdf: vec3f=getBRDFLookup(NdotV,sheenRoughness);
1233
- #else
1234
- var environmentSheenBrdf: vec3f=environmentBrdf;
1235
- #endif
1236
- /*#endif*/
1237
- #endif
1238
- #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1239
- var sheenAlphaG: f32=convertRoughnessToAverageSlope(sheenRoughness);
1240
- #ifdef SPECULARAA
1241
- sheenAlphaG+=AARoughnessFactors.y;
1242
- #endif
1243
- var environmentSheenRadiance: vec4f= vec4f(0.,0.,0.,0.);environmentSheenRadiance=sampleReflectionTexture(
1244
- sheenAlphaG
1245
- ,vReflectionMicrosurfaceInfos
1246
- ,vReflectionInfos
1247
- ,vReflectionColor
1248
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1249
- ,NdotVUnclamped
1250
- #endif
1251
- #ifdef LINEARSPECULARREFLECTION
1252
- ,sheenRoughness
1253
- #endif
1254
- ,reflectionSampler
1255
- ,reflectionSamplerSampler
1256
- ,reflectionCoords
1257
- #ifndef LODBASEDMICROSFURACE
1258
- ,reflectionLowSampler
1259
- ,reflectionLowSamplerSampler
1260
- ,reflectionHighSampler
1261
- ,reflectionHighSamplerSampler
1262
- #endif
1263
- #ifdef REALTIME_FILTERING
1264
- ,vReflectionFilteringInfo
1265
- #endif
1266
- );var sheenEnvironmentReflectance: vec3f=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);
1267
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
1268
- sheenEnvironmentReflectance*=seo;
1269
- #endif
1270
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
1271
- sheenEnvironmentReflectance*=eho;
1272
- #endif
1273
- #if DEBUGMODE>0
1274
- outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;
1275
- #endif
1276
- outParams.finalSheenRadianceScaled=
1277
- environmentSheenRadiance.rgb *
1278
- sheenEnvironmentReflectance *
1279
- vLightingIntensity.z;
1280
- #endif
1281
- #if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
1282
- outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;
1283
- #endif
1284
- outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;}
1285
- #endif
1286
- `;
1287
- // Sideeffect
1288
- ShaderStore.IncludesShadersStoreWGSL[name$g] = shader$g;
1289
-
1290
- // Do not edit.
1291
- const name$f = "pbrBlockClearcoat";
1292
- const shader$f = `struct clearcoatOutParams
1293
- {specularEnvironmentR0: vec3f,
1294
- conservationFactor: f32,
1295
- clearCoatNormalW: vec3f,
1296
- clearCoatAARoughnessFactors: vec2f,
1297
- clearCoatIntensity: f32,
1298
- clearCoatRoughness: f32,
1299
- #ifdef REFLECTION
1300
- finalClearCoatRadianceScaled: vec3f,
1301
- #endif
1302
- #ifdef CLEARCOAT_TINT
1303
- absorption: vec3f,
1304
- clearCoatNdotVRefract: f32,
1305
- clearCoatColor: vec3f,
1306
- clearCoatThickness: f32,
1307
- #endif
1308
- #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
1309
- energyConservationFactorClearCoat: vec3f,
1310
- #endif
1311
- #if DEBUGMODE>0
1312
- #ifdef CLEARCOAT_BUMP
1313
- TBNClearCoat: mat3x3f,
1314
- #endif
1315
- #ifdef CLEARCOAT_TEXTURE
1316
- clearCoatMapData: vec2f,
1317
- #endif
1318
- #if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
1319
- clearCoatTintMapData: vec4f,
1320
- #endif
1321
- #ifdef REFLECTION
1322
- environmentClearCoatRadiance: vec4f,
1323
- clearCoatEnvironmentReflectance: vec3f,
1324
- #endif
1325
- clearCoatNdotV: f32
1326
- #endif
1327
- };
1328
- #ifdef CLEARCOAT
1329
- #define pbr_inline
1330
- fn clearcoatBlock(
1331
- vPositionW: vec3f
1332
- ,geometricNormalW: vec3f
1333
- ,viewDirectionW: vec3f
1334
- ,vClearCoatParams: vec2f
1335
- #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
1336
- ,clearCoatMapRoughnessData: vec4f
1337
- #endif
1338
- ,specularEnvironmentR0: vec3f
1339
- #ifdef CLEARCOAT_TEXTURE
1340
- ,clearCoatMapData: vec2f
1341
- #endif
1342
- #ifdef CLEARCOAT_TINT
1343
- ,vClearCoatTintParams: vec4f
1344
- ,clearCoatColorAtDistance: f32
1345
- ,vClearCoatRefractionParams: vec4f
1346
- #ifdef CLEARCOAT_TINT_TEXTURE
1347
- ,clearCoatTintMapData: vec4f
1348
- #endif
1349
- #endif
1350
- #ifdef CLEARCOAT_BUMP
1351
- ,vClearCoatBumpInfos: vec2f
1352
- ,clearCoatBumpMapData: vec4f
1353
- ,vClearCoatBumpUV: vec2f
1354
- #if defined(TANGENT) && defined(NORMAL)
1355
- ,vTBN: mat3x3f
1356
- #else
1357
- ,vClearCoatTangentSpaceParams: vec2f
1358
- #endif
1359
- #ifdef OBJECTSPACE_NORMALMAP
1360
- ,normalMatrix: mat4x4f
1361
- #endif
1362
- #endif
1363
- #if defined(FORCENORMALFORWARD) && defined(NORMAL)
1364
- ,faceNormal: vec3f
1365
- #endif
1366
- #ifdef REFLECTION
1367
- ,vReflectionMicrosurfaceInfos: vec3f
1368
- ,vReflectionInfos: vec2f
1369
- ,vReflectionColor: vec3f
1370
- ,vLightingIntensity: vec4f
1371
- #ifdef REFLECTIONMAP_3D
1372
- ,reflectionSampler: texture_cube<f32>
1373
- ,reflectionSamplerSampler: sampler
1374
- #else
1375
- ,reflectionSampler: texture_2d<f32>
1376
- ,reflectionSamplerSampler: sampler
1377
- #endif
1378
- #ifndef LODBASEDMICROSFURACE
1379
- #ifdef REFLECTIONMAP_3D
1380
- ,reflectionLowSampler: texture_cube<f32>
1381
- ,reflectionLowSamplerSampler: sampler
1382
- ,reflectionHighSampler: texture_cube<f32>
1383
- ,reflectionHighSamplerSampler: sampler
1384
- #else
1385
- ,reflectionLowSampler: texture_2d<f32>
1386
- ,reflectionLowSamplerSampler: sampler
1387
- ,reflectionHighSampler: texture_2d<f32>
1388
- ,reflectionHighSamplerSampler: sampler
1389
- #endif
1390
- #endif
1391
- #ifdef REALTIME_FILTERING
1392
- ,vReflectionFilteringInfo: vec2f
1393
- #endif
1394
- #endif
1395
- #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1396
- #ifdef RADIANCEOCCLUSION
1397
- ,ambientMonochrome: f32
1398
- #endif
1399
- #endif
1400
- #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
1401
- ,frontFacingMultiplier: f32
1402
- #endif
1403
- )->clearcoatOutParams
1404
- {var outParams: clearcoatOutParams;var clearCoatIntensity: f32=vClearCoatParams.x;var clearCoatRoughness: f32=vClearCoatParams.y;
1405
- #ifdef CLEARCOAT_TEXTURE
1406
- clearCoatIntensity*=clearCoatMapData.x;
1407
- #ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE
1408
- clearCoatRoughness*=clearCoatMapData.y;
1409
- #endif
1410
- #if DEBUGMODE>0
1411
- outParams.clearCoatMapData=clearCoatMapData;
1412
- #endif
1413
- #endif
1414
- #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
1415
- clearCoatRoughness*=clearCoatMapRoughnessData.y;
1416
- #endif
1417
- outParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness;
1418
- #ifdef CLEARCOAT_TINT
1419
- var clearCoatColor: vec3f=vClearCoatTintParams.rgb;var clearCoatThickness: f32=vClearCoatTintParams.a;
1420
- #ifdef CLEARCOAT_TINT_TEXTURE
1421
- #ifdef CLEARCOAT_TINT_GAMMATEXTURE
1422
- clearCoatColor*=toLinearSpaceVec3(clearCoatTintMapData.rgb);
1423
- #else
1424
- clearCoatColor*=clearCoatTintMapData.rgb;
1425
- #endif
1426
- clearCoatThickness*=clearCoatTintMapData.a;
1427
- #if DEBUGMODE>0
1428
- outParams.clearCoatTintMapData=clearCoatTintMapData;
1429
- #endif
1430
- #endif
1431
- outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness;
1432
- #endif
1433
- #ifdef CLEARCOAT_REMAP_F0
1434
- var specularEnvironmentR0Updated: vec3f=getR0RemappedForClearCoat(specularEnvironmentR0);
1435
- #else
1436
- var specularEnvironmentR0Updated: vec3f=specularEnvironmentR0;
1437
- #endif
1438
- outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);var clearCoatNormalW: vec3f=geometricNormalW;
1439
- #ifdef CLEARCOAT_BUMP
1440
- #ifdef NORMALXYSCALE
1441
- var clearCoatNormalScale: f32=1.0;
1442
- #else
1443
- var clearCoatNormalScale: f32=vClearCoatBumpInfos.y;
1444
- #endif
1445
- #if defined(TANGENT) && defined(NORMAL)
1446
- var TBNClearCoat: mat3x3f=vTBN;
1447
- #else
1448
- var TBNClearCoatUV: vec2f=vClearCoatBumpUV*frontFacingMultiplier;var TBNClearCoat: mat3x3f=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);
1449
- #endif
1450
- #if DEBUGMODE>0
1451
- outParams.TBNClearCoat=TBNClearCoat;
1452
- #endif
1453
- #ifdef OBJECTSPACE_NORMALMAP
1454
- clearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize( mat3x3f(normalMatrix[0].xyz,normalMatrix[1].xyz,normalMatrix[2].xyz)*clearCoatNormalW);
1455
- #else
1456
- clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);
1457
- #endif
1458
- #endif
1459
- #if defined(FORCENORMALFORWARD) && defined(NORMAL)
1460
- clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));
1461
- #endif
1462
- #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
1463
- clearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;
1464
- #endif
1465
- outParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);var clearCoatNdotVUnclamped: f32=dot(clearCoatNormalW,viewDirectionW);var clearCoatNdotV: f32=absEps(clearCoatNdotVUnclamped);
1466
- #if DEBUGMODE>0
1467
- outParams.clearCoatNdotV=clearCoatNdotV;
1468
- #endif
1469
- #ifdef CLEARCOAT_TINT
1470
- var clearCoatVRefract: vec3f=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));
1471
- #endif
1472
- #if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))
1473
- var environmentClearCoatBrdf: vec3f=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);
1474
- #endif
1475
- #if defined(REFLECTION)
1476
- var clearCoatAlphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness);
1477
- #ifdef SPECULARAA
1478
- clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;
1479
- #endif
1480
- var environmentClearCoatRadiance: vec4f= vec4f(0.,0.,0.,0.);var clearCoatReflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),clearCoatNormalW);
1481
- #ifdef REFLECTIONMAP_OPPOSITEZ
1482
- clearCoatReflectionVector.z*=-1.0;
1483
- #endif
1484
- #ifdef REFLECTIONMAP_3D
1485
- var clearCoatReflectionCoords: vec3f=clearCoatReflectionVector;
1486
- #else
1487
- var clearCoatReflectionCoords: vec2f=clearCoatReflectionVector.xy;
1488
- #ifdef REFLECTIONMAP_PROJECTION
1489
- clearCoatReflectionCoords/=clearCoatReflectionVector.z;
1490
- #endif
1491
- clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;
1492
- #endif
1493
- environmentClearCoatRadiance=sampleReflectionTexture(
1494
- clearCoatAlphaG
1495
- ,vReflectionMicrosurfaceInfos
1496
- ,vReflectionInfos
1497
- ,vReflectionColor
1498
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1499
- ,clearCoatNdotVUnclamped
1500
- #endif
1501
- #ifdef LINEARSPECULARREFLECTION
1502
- ,clearCoatRoughness
1503
- #endif
1504
- ,reflectionSampler
1505
- ,reflectionSamplerSampler
1506
- ,clearCoatReflectionCoords
1507
- #ifndef LODBASEDMICROSFURACE
1508
- ,reflectionLowSampler
1509
- ,reflectionLowSamplerSampler
1510
- ,reflectionHighSampler
1511
- ,reflectionHighSamplerSampler
1512
- #endif
1513
- #ifdef REALTIME_FILTERING
1514
- ,vReflectionFilteringInfo
1515
- #endif
1516
- );
1517
- #if DEBUGMODE>0
1518
- outParams.environmentClearCoatRadiance=environmentClearCoatRadiance;
1519
- #endif
1520
- #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1521
- var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromBRDFLookup(vec3f(uniforms.vClearCoatRefractionParams.x),environmentClearCoatBrdf);
1522
- #ifdef HORIZONOCCLUSION
1523
- #ifdef BUMP
1524
- #ifdef REFLECTIONMAP_3D
1525
- var clearCoatEho: f32=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho;
1526
- #endif
1527
- #endif
1528
- #endif
1529
- #else
1530
- var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV, vec3f(1.), vec3f(1.),sqrt(1.-clearCoatRoughness));
1531
- #endif
1532
- clearCoatEnvironmentReflectance*=clearCoatIntensity;
1533
- #if DEBUGMODE>0
1534
- outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;
1535
- #endif
1536
- outParams.finalClearCoatRadianceScaled=
1537
- environmentClearCoatRadiance.rgb *
1538
- clearCoatEnvironmentReflectance *
1539
- vLightingIntensity.z;
1540
- #endif
1541
- #if defined(CLEARCOAT_TINT)
1542
- outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);
1543
- #endif
1544
- var fresnelIBLClearCoat: f32=fresnelSchlickGGX(clearCoatNdotV,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat);
1545
- #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
1546
- outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);
1547
- #endif
1548
- return outParams;}
1549
- #endif
1550
- `;
1551
- // Sideeffect
1552
- ShaderStore.IncludesShadersStoreWGSL[name$f] = shader$f;
1553
-
1554
- // Do not edit.
1555
- const name$e = "pbrBlockIridescence";
1556
- const shader$e = `struct iridescenceOutParams
1557
- {iridescenceIntensity: f32,
1558
- iridescenceIOR: f32,
1559
- iridescenceThickness: f32,
1560
- specularEnvironmentR0: vec3f};
1561
- #ifdef IRIDESCENCE
1562
- fn iridescenceBlock(
1563
- vIridescenceParams: vec4f
1564
- ,viewAngle: f32
1565
- ,specularEnvironmentR0: vec3f
1566
- #ifdef IRIDESCENCE_TEXTURE
1567
- ,iridescenceMapData: vec2f
1568
- #endif
1569
- #ifdef IRIDESCENCE_THICKNESS_TEXTURE
1570
- ,iridescenceThicknessMapData: vec2f
1571
- #endif
1572
- #ifdef CLEARCOAT
1573
- ,NdotVUnclamped: f32
1574
- #ifdef CLEARCOAT_TEXTURE
1575
- ,clearCoatMapData: vec2f
1576
- #endif
1577
- #endif
1578
- )->iridescenceOutParams
1579
- {var outParams: iridescenceOutParams;var iridescenceIntensity: f32=vIridescenceParams.x;var iridescenceIOR: f32=vIridescenceParams.y;var iridescenceThicknessMin: f32=vIridescenceParams.z;var iridescenceThicknessMax: f32=vIridescenceParams.w;var iridescenceThicknessWeight: f32=1.;
1580
- #ifdef IRIDESCENCE_TEXTURE
1581
- iridescenceIntensity*=iridescenceMapData.x;
1582
- #endif
1583
- #if defined(IRIDESCENCE_THICKNESS_TEXTURE)
1584
- iridescenceThicknessWeight=iridescenceThicknessMapData.g;
1585
- #endif
1586
- var iridescenceThickness: f32=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);var topIor: f32=1.;
1587
- #ifdef CLEARCOAT
1588
- var clearCoatIntensity: f32=vClearCoatParams.x;
1589
- #ifdef CLEARCOAT_TEXTURE
1590
- clearCoatIntensity*=clearCoatMapData.x;
1591
- #endif
1592
- topIor=mix(1.0,uniforms.vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+((1.0/topIor)*(1.0/topIor))*((NdotVUnclamped*NdotVUnclamped)-1.0));
1593
- #endif
1594
- var iridescenceFresnel: vec3f=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);outParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);outParams.iridescenceIntensity=iridescenceIntensity;outParams.iridescenceThickness=iridescenceThickness;outParams.iridescenceIOR=iridescenceIOR;return outParams;}
1595
- #endif
1596
- `;
1597
- // Sideeffect
1598
- ShaderStore.IncludesShadersStoreWGSL[name$e] = shader$e;
1599
-
1600
- // Do not edit.
1601
- const name$d = "pbrBlockSubSurface";
1602
- const shader$d = `struct subSurfaceOutParams
1603
- {specularEnvironmentReflectance: vec3f,
1604
- #ifdef SS_REFRACTION
1605
- finalRefraction: vec3f,
1606
- surfaceAlbedo: vec3f,
1607
- #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1608
- alpha: f32,
1609
- #endif
1610
- #ifdef REFLECTION
1611
- refractionFactorForIrradiance: f32,
1612
- #endif
1613
- #endif
1614
- #ifdef SS_TRANSLUCENCY
1615
- transmittance: vec3f,
1616
- translucencyIntensity: f32,
1617
- #ifdef REFLECTION
1618
- refractionIrradiance: vec3f,
1619
- #endif
1620
- #endif
1621
- #if DEBUGMODE>0
1622
- #ifdef SS_THICKNESSANDMASK_TEXTURE
1623
- thicknessMap: vec4f,
1624
- #endif
1625
- #ifdef SS_REFRACTION
1626
- environmentRefraction: vec4f,
1627
- refractionTransmittance: vec3f
1628
- #endif
1629
- #endif
1630
- };
1631
- #ifdef SUBSURFACE
1632
- #ifdef SS_REFRACTION
1633
- #define pbr_inline
1634
- fn sampleEnvironmentRefraction(
1635
- ior: f32
1636
- ,thickness: f32
1637
- ,refractionLOD: f32
1638
- ,normalW: vec3f
1639
- ,vPositionW: vec3f
1640
- ,viewDirectionW: vec3f
1641
- ,view: mat4x4f
1642
- ,vRefractionInfos: vec4f
1643
- ,refractionMatrix: mat4x4f
1644
- ,vRefractionMicrosurfaceInfos: vec4f
1645
- ,alphaG: f32
1646
- #ifdef SS_REFRACTIONMAP_3D
1647
- ,refractionSampler: texture_cube<f32>
1648
- ,refractionSamplerSampler: sampler
1649
- #ifndef LODBASEDMICROSFURACE
1650
- ,refractionLowSampler: texture_cube<f32>
1651
- ,refractionLowSamplerSampler: sampler
1652
- ,refractionHighSampler: texture_cube<f32>
1653
- ,refractionHighSamplerSampler: sampler
1654
- #endif
1655
- #else
1656
- ,refractionSampler: texture_2d<f32>
1657
- ,refractionSamplerSampler: sampler
1658
- #ifndef LODBASEDMICROSFURACE
1659
- ,refractionLowSampler: texture_2d<f32>
1660
- ,refractionLowSamplerSampler: sampler
1661
- ,refractionHighSampler: texture_2d<f32>
1662
- ,refractionHighSamplerSampler: sampler
1663
- #endif
1664
- #endif
1665
- #ifdef ANISOTROPIC
1666
- ,anisotropicOut: anisotropicOutParams
1667
- #endif
1668
- #ifdef REALTIME_FILTERING
1669
- ,vRefractionFilteringInfo: vec2f
1670
- #endif
1671
- #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1672
- ,refractionPosition: vec3f
1673
- ,refractionSize: vec3f
1674
- #endif
1675
- )->vec4f {var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.);
1676
- #ifdef ANISOTROPIC
1677
- var refractionVector: vec3f=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior);
1678
- #else
1679
- var refractionVector: vec3f=refract(-viewDirectionW,normalW,ior);
1680
- #endif
1681
- #ifdef SS_REFRACTIONMAP_OPPOSITEZ
1682
- refractionVector.z*=-1.0;
1683
- #endif
1684
- #ifdef SS_REFRACTIONMAP_3D
1685
- #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1686
- refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);
1687
- #endif
1688
- refractionVector.y=refractionVector.y*vRefractionInfos.w;var refractionCoords: vec3f=refractionVector;refractionCoords= (refractionMatrix* vec4f(refractionCoords,0)).xyz;
1689
- #else
1690
- #ifdef SS_USE_THICKNESS_AS_DEPTH
1691
- var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*thickness,1.0))).xyz;
1692
- #else
1693
- var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*vRefractionInfos.z,1.0))).xyz;
1694
- #endif
1695
- var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;
1696
- #endif
1697
- #ifdef LODBASEDMICROSFURACE
1698
- var lod=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;
1699
- #ifdef SS_LODINREFRACTIONALPHA
1700
- var automaticRefractionLOD: f32=UNPACK_LOD(textureSample(refractionSampler,refractionSamplerSampler,refractionCoords).a);var requestedRefractionLOD: f32=max(automaticRefractionLOD,lod);
1701
- #else
1702
- var requestedRefractionLOD: f32=lod;
1703
- #endif
1704
- #if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)
1705
- environmentRefraction= vec4f(radiance(alphaG,refractionSampler,refractionSamplerSampler,refractionCoords,vRefractionFilteringInfo),1.0);
1706
- #else
1707
- environmentRefraction=textureSampleLevel(refractionSampler,refractionSamplerSampler,refractionCoords,requestedRefractionLOD);
1708
- #endif
1709
- #else
1710
- var lodRefractionNormalized: f32=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));var lodRefractionNormalizedDoubled: f32=lodRefractionNormalized*2.0;var environmentRefractionMid: vec4f=textureSample(refractionSampler,refractionSamplerSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix(
1711
- textureSample(refractionHighSampler,refractionHighSamplerSampler,refractionCoords),
1712
- environmentRefractionMid,
1713
- lodRefractionNormalizedDoubled
1714
- );} else {environmentRefraction=mix(
1715
- environmentRefractionMid,
1716
- textureSample(refractionLowSampler,refractionLowSamplerSampler,refractionCoords),
1717
- lodRefractionNormalizedDoubled-1.0
1718
- );}
1719
- #endif
1720
- var refraction=environmentRefraction.rgb;
1721
- #ifdef SS_RGBDREFRACTION
1722
- refraction=fromRGBD(environmentRefraction);
1723
- #endif
1724
- #ifdef SS_GAMMAREFRACTION
1725
- refraction=toLinearSpaceVec3(environmentRefraction.rgb);
1726
- #endif
1727
- return vec4f(refraction,environmentRefraction.a);}
1728
- #endif
1729
- #define pbr_inline
1730
- fn subSurfaceBlock(
1731
- vSubSurfaceIntensity: vec3f
1732
- ,vThicknessParam: vec2f
1733
- ,vTintColor: vec4f
1734
- ,normalW: vec3f
1735
- ,specularEnvironmentReflectance: vec3f
1736
- #ifdef SS_THICKNESSANDMASK_TEXTURE
1737
- ,thicknessMap: vec4f
1738
- #endif
1739
- #ifdef SS_REFRACTIONINTENSITY_TEXTURE
1740
- ,refractionIntensityMap: vec4f
1741
- #endif
1742
- #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
1743
- ,translucencyIntensityMap: vec4f
1744
- #endif
1745
- #ifdef REFLECTION
1746
- #ifdef SS_TRANSLUCENCY
1747
- ,reflectionMatrix: mat4x4f
1748
- #ifdef USESPHERICALFROMREFLECTIONMAP
1749
- #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
1750
- ,irradianceVector_: vec3f
1751
- #endif
1752
- #if defined(REALTIME_FILTERING)
1753
- ,reflectionSampler: texture_cube<f32>
1754
- ,reflectionSamplerSampler: sampler
1755
- ,vReflectionFilteringInfo: vec2f
1756
- #endif
1757
- #endif
1758
- #ifdef USEIRRADIANCEMAP
1759
- #ifdef REFLECTIONMAP_3D
1760
- ,irradianceSampler: texture_cube<f32>
1761
- ,irradianceSamplerSampler: sampler
1762
- #else
1763
- ,irradianceSampler: texture_2d<f32>
1764
- ,irradianceSamplerSampler: sampler
1765
- #endif
1766
- #endif
1767
- #endif
1768
- #endif
1769
- #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
1770
- ,surfaceAlbedo: vec3f
1771
- #endif
1772
- #ifdef SS_REFRACTION
1773
- ,vPositionW: vec3f
1774
- ,viewDirectionW: vec3f
1775
- ,view: mat4x4f
1776
- ,vRefractionInfos: vec4f
1777
- ,refractionMatrix: mat4x4f
1778
- ,vRefractionMicrosurfaceInfos: vec4f
1779
- ,vLightingIntensity: vec4f
1780
- #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1781
- ,alpha: f32
1782
- #endif
1783
- #ifdef SS_LODINREFRACTIONALPHA
1784
- ,NdotVUnclamped: f32
1785
- #endif
1786
- #ifdef SS_LINEARSPECULARREFRACTION
1787
- ,roughness: f32
1788
- #endif
1789
- ,alphaG: f32
1790
- #ifdef SS_REFRACTIONMAP_3D
1791
- ,refractionSampler: texture_cube<f32>
1792
- ,refractionSamplerSampler: sampler
1793
- #ifndef LODBASEDMICROSFURACE
1794
- ,refractionLowSampler: texture_cube<f32>
1795
- ,refractionLowSamplerSampler: sampler
1796
- ,refractionHighSampler: texture_cube<f32>
1797
- ,refractionHighSamplerSampler: sampler
1798
- #endif
1799
- #else
1800
- ,refractionSampler: texture_2d<f32>
1801
- ,refractionSamplerSampler: sampler
1802
- #ifndef LODBASEDMICROSFURACE
1803
- ,refractionLowSampler: texture_2d<f32>
1804
- ,refractionLowSamplerSampler: sampler
1805
- ,refractionHighSampler: texture_2d<f32>
1806
- ,refractionHighSamplerSampler: sampler
1807
- #endif
1808
- #endif
1809
- #ifdef ANISOTROPIC
1810
- ,anisotropicOut: anisotropicOutParams
1811
- #endif
1812
- #ifdef REALTIME_FILTERING
1813
- ,vRefractionFilteringInfo: vec2f
1814
- #endif
1815
- #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1816
- ,refractionPosition: vec3f
1817
- ,refractionSize: vec3f
1818
- #endif
1819
- #ifdef SS_DISPERSION
1820
- ,dispersion: f32
1821
- #endif
1822
- #endif
1823
- #ifdef SS_TRANSLUCENCY
1824
- ,vDiffusionDistance: vec3f
1825
- ,vTranslucencyColor: vec4f
1826
- #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
1827
- ,translucencyColorMap: vec4f
1828
- #endif
1829
- #endif
1830
- )->subSurfaceOutParams
1831
- {var outParams: subSurfaceOutParams;outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;
1832
- #ifdef SS_REFRACTION
1833
- var refractionIntensity: f32=vSubSurfaceIntensity.x;
1834
- #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1835
- refractionIntensity*=(1.0-alpha);outParams.alpha=1.0;
1836
- #endif
1837
- #endif
1838
- #ifdef SS_TRANSLUCENCY
1839
- var translucencyIntensity: f32=vSubSurfaceIntensity.y;
1840
- #endif
1841
- #ifdef SS_THICKNESSANDMASK_TEXTURE
1842
- #ifdef SS_USE_GLTF_TEXTURES
1843
- var thickness: f32=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;
1844
- #else
1845
- var thickness: f32=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;
1846
- #endif
1847
- #if DEBUGMODE>0
1848
- outParams.thicknessMap=thicknessMap;
1849
- #endif
1850
- #if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS)
1851
- #ifdef SS_USE_GLTF_TEXTURES
1852
- refractionIntensity*=thicknessMap.r;
1853
- #else
1854
- refractionIntensity*=thicknessMap.g;
1855
- #endif
1856
- #endif
1857
- #if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS)
1858
- #ifdef SS_USE_GLTF_TEXTURES
1859
- translucencyIntensity*=thicknessMap.a;
1860
- #else
1861
- translucencyIntensity*=thicknessMap.b;
1862
- #endif
1863
- #endif
1864
- #else
1865
- var thickness: f32=vThicknessParam.y;
1866
- #endif
1867
- #if defined(SS_REFRACTION) && defined(SS_REFRACTIONINTENSITY_TEXTURE)
1868
- #ifdef SS_USE_GLTF_TEXTURES
1869
- refractionIntensity*=refractionIntensityMap.r;
1870
- #else
1871
- refractionIntensity*=refractionIntensityMap.g;
1872
- #endif
1873
- #endif
1874
- #if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCYINTENSITY_TEXTURE)
1875
- #ifdef SS_USE_GLTF_TEXTURES
1876
- translucencyIntensity*=translucencyIntensityMap.a;
1877
- #else
1878
- translucencyIntensity*=translucencyIntensityMap.b;
1879
- #endif
1880
- #endif
1881
- #ifdef SS_TRANSLUCENCY
1882
- thickness=maxEps(thickness);var translucencyColor: vec4f=vTranslucencyColor;
1883
- #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
1884
- translucencyColor*=translucencyColorMap;
1885
- #endif
1886
- var transmittance: vec3f=transmittanceBRDF_Burley(translucencyColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;
1887
- #endif
1888
- #ifdef SS_REFRACTION
1889
- var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.);
1890
- #ifdef SS_HAS_THICKNESS
1891
- var ior: f32=vRefractionInfos.y;
1892
- #else
1893
- var ior: f32=vRefractionMicrosurfaceInfos.w;
1894
- #endif
1895
- #ifdef SS_LODINREFRACTIONALPHA
1896
- var refractionAlphaG: f32=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLodFromAlphaGNdotV(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);
1897
- #elif defined(SS_LINEARSPECULARREFRACTION)
1898
- var refractionRoughness: f32=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);
1899
- #else
1900
- var refractionAlphaG: f32=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);
1901
- #endif
1902
- var refraction_ior: f32=vRefractionInfos.y;
1903
- #ifdef SS_DISPERSION
1904
- var realIOR: f32=1.0/refraction_ior;var iorDispersionSpread: f32=0.04*dispersion*(realIOR-1.0);var iors: vec3f= vec3f(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (var i: i32=0; i<3; i++) {refraction_ior=iors[i];
1905
- #endif
1906
- var envSample: vec4f=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG
1907
- #ifdef SS_REFRACTIONMAP_3D
1908
- ,refractionSampler
1909
- ,refractionSamplerSampler
1910
- #ifndef LODBASEDMICROSFURACE
1911
- ,refractionLowSampler
1912
- ,refractionLowSamplerSampler
1913
- ,refractionHighSampler
1914
- ,refractionHighSamplerSampler
1915
- #endif
1916
- #else
1917
- ,refractionSampler
1918
- ,refractionSamplerSampler
1919
- #ifndef LODBASEDMICROSFURACE
1920
- ,refractionLowSampler
1921
- ,refractionLowSamplerSampler
1922
- ,refractionHighSampler
1923
- ,refractionHighSamplerSampler
1924
- #endif
1925
- #endif
1926
- #ifdef ANISOTROPIC
1927
- ,anisotropicOut
1928
- #endif
1929
- #ifdef REALTIME_FILTERING
1930
- ,vRefractionFilteringInfo
1931
- #endif
1932
- #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1933
- ,refractionPosition
1934
- ,refractionSize
1935
- #endif
1936
- );
1937
- #ifdef SS_DISPERSION
1938
- environmentRefraction[i]=envSample[i];}
1939
- #else
1940
- environmentRefraction=envSample;
1941
- #endif
1942
- environmentRefraction=vec4f(environmentRefraction.rgb*vRefractionInfos.x,environmentRefraction.a);
1943
- #endif
1944
- #ifdef SS_REFRACTION
1945
- var refractionTransmittance: vec3f= vec3f(refractionIntensity);
1946
- #ifdef SS_THICKNESSANDMASK_TEXTURE
1947
- var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,thickness);
1948
- #elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)
1949
- var maxChannel: f32=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);var volumeAlbedo: vec3f=saturateVec3(maxChannel*surfaceAlbedo);environmentRefraction=vec4f(environmentRefraction.rgb*volumeAlbedo,environmentRefraction.a);
1950
- #else
1951
- var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,vThicknessParam.y);
1952
- #endif
1953
- #ifdef SS_ALBEDOFORREFRACTIONTINT
1954
- environmentRefraction=vec4f(environmentRefraction.rgb*surfaceAlbedo.rgb,environmentRefraction.a);
1955
- #endif
1956
- outParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);
1957
- #ifdef REFLECTION
1958
- outParams.refractionFactorForIrradiance=(1.-refractionIntensity);
1959
- #endif
1960
- #ifdef UNUSED_MULTIPLEBOUNCES
1961
- var bounceSpecularEnvironmentReflectance: vec3f=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);
1962
- #endif
1963
- refractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;
1964
- #if DEBUGMODE>0
1965
- outParams.refractionTransmittance=refractionTransmittance;
1966
- #endif
1967
- outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;
1968
- #if DEBUGMODE>0
1969
- outParams.environmentRefraction=environmentRefraction;
1970
- #endif
1971
- #endif
1972
- #if defined(REFLECTION) && defined(SS_TRANSLUCENCY)
1973
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)
1974
- var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz;
1975
- #ifdef REFLECTIONMAP_OPPOSITEZ
1976
- irradianceVector.z*=-1.0;
1977
- #endif
1978
- #ifdef INVERTCUBICMAP
1979
- irradianceVector.y*=-1.0;
1980
- #endif
1981
- #else
1982
- var irradianceVector: vec3f=irradianceVector_;
1983
- #endif
1984
- #if defined(USESPHERICALFROMREFLECTIONMAP)
1985
- #if defined(REALTIME_FILTERING)
1986
- var refractionIrradiance: vec3f=irradiance(reflectionSampler,reflectionSamplerSampler,-irradianceVector,vReflectionFilteringInfo);
1987
- #else
1988
- var refractionIrradiance: vec3f=computeEnvironmentIrradiance(-irradianceVector);
1989
- #endif
1990
- #elif defined(USEIRRADIANCEMAP)
1991
- #ifdef REFLECTIONMAP_3D
1992
- var irradianceCoords: vec3f=irradianceVector;
1993
- #else
1994
- var irradianceCoords: vec2f=irradianceVector.xy;
1995
- #ifdef REFLECTIONMAP_PROJECTION
1996
- irradianceCoords/=irradianceVector.z;
1997
- #endif
1998
- irradianceCoords.y=1.0-irradianceCoords.y;
1999
- #endif
2000
- var temp: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,-irradianceCoords);var refractionIrradiance=temp.rgb;
2001
- #ifdef RGBDREFLECTION
2002
- refractionIrradiance=fromRGBD(temp).rgb;
2003
- #endif
2004
- #ifdef GAMMAREFLECTION
2005
- refractionIrradiance=toLinearSpaceVec3(refractionIrradiance);
2006
- #endif
2007
- #else
2008
- var refractionIrradiance: vec3f= vec3f(0.);
2009
- #endif
2010
- refractionIrradiance*=transmittance;
2011
- #ifdef SS_ALBEDOFORTRANSLUCENCYTINT
2012
- refractionIrradiance*=surfaceAlbedo.rgb;
2013
- #endif
2014
- outParams.refractionIrradiance=refractionIrradiance;
2015
- #endif
2016
- return outParams;}
2017
- #endif
2018
- `;
2019
- // Sideeffect
2020
- ShaderStore.IncludesShadersStoreWGSL[name$d] = shader$d;
2021
-
2022
- // Do not edit.
2023
- const name$c = "pbrBlockNormalGeometric";
2024
- const shader$c = `var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW);
2025
- #ifdef NORMAL
2026
- var normalW: vec3f=normalize(input.vNormalW);
2027
- #else
2028
- var normalW: vec3f=normalize(cross(dpdx(input.vPositionW),dpdy(input.vPositionW)))*scene.vEyePosition.w;
2029
- #endif
2030
- var geometricNormalW: vec3f=normalW;
2031
- #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
2032
- geometricNormalW=select(-geometricNormalW,geometricNormalW,fragmentInputs.frontFacing);
2033
- #endif
2034
- `;
2035
- // Sideeffect
2036
- ShaderStore.IncludesShadersStoreWGSL[name$c] = shader$c;
2037
-
2038
- // Do not edit.
2039
- const name$b = "pbrBlockNormalFinal";
2040
- const shader$b = `#if defined(FORCENORMALFORWARD) && defined(NORMAL)
2041
- var faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w;
2042
- #if defined(TWOSIDEDLIGHTING)
2043
- faceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing);
2044
- #endif
2045
- normalW*=sign(dot(normalW,faceNormal));
2046
- #endif
2047
- #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
2048
- normalW=select(-normalW,normalW,fragmentInputs.frontFacing);
2049
- #endif
2050
- `;
2051
- // Sideeffect
2052
- ShaderStore.IncludesShadersStoreWGSL[name$b] = shader$b;
2053
-
2054
- // Do not edit.
2055
- const name$a = "pbrBlockLightmapInit";
2056
- const shader$a = `#ifdef LIGHTMAP
2057
- var lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset);
2058
- #ifdef RGBDLIGHTMAP
2059
- lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a);
2060
- #endif
2061
- #ifdef GAMMALIGHTMAP
2062
- lightmapColor=vec4f(toLinearSpaceVec3(lightmapColor.rgb),lightmapColor.a);
2063
- #endif
2064
- lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a);
2065
- #endif
2066
- `;
2067
- // Sideeffect
2068
- ShaderStore.IncludesShadersStoreWGSL[name$a] = shader$a;
2069
-
2070
- // Do not edit.
2071
- const name$9 = "pbrBlockGeometryInfo";
2072
- const shader$9 = `var NdotVUnclamped: f32=dot(normalW,viewDirectionW);var NdotV: f32=absEps(NdotVUnclamped);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var AARoughnessFactors: vec2f=getAARoughnessFactors(normalW.xyz);
2073
- #ifdef SPECULARAA
2074
- alphaG+=AARoughnessFactors.y;
2075
- #endif
2076
- #if defined(ENVIRONMENTBRDF)
2077
- var environmentBrdf: vec3f=getBRDFLookup(NdotV,roughness);
2078
- #endif
2079
- #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2080
- #ifdef RADIANCEOCCLUSION
2081
- #ifdef AMBIENTINGRAYSCALE
2082
- var ambientMonochrome: f32=aoOut.ambientOcclusionColor.r;
2083
- #else
2084
- var ambientMonochrome: f32=getLuminance(aoOut.ambientOcclusionColor);
2085
- #endif
2086
- var seo: f32=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);
2087
- #endif
2088
- #ifdef HORIZONOCCLUSION
2089
- #ifdef BUMP
2090
- #ifdef REFLECTIONMAP_3D
2091
- var eho: f32=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
2092
- #endif
2093
- #endif
2094
- #endif
2095
- #endif
2096
- `;
2097
- // Sideeffect
2098
- ShaderStore.IncludesShadersStoreWGSL[name$9] = shader$9;
2099
-
2100
- // Do not edit.
2101
- const name$8 = "pbrBlockReflectance0";
2102
- const shader$8 = `var reflectance: f32=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);var specularEnvironmentR0: vec3f=reflectivityOut.surfaceReflectivityColor.rgb;
2103
- #ifdef METALLICWORKFLOW
2104
- var specularEnvironmentR90: vec3f= vec3f(metallicReflectanceFactors.a);
2105
- #else
2106
- var specularEnvironmentR90: vec3f= vec3f(1.0,1.0,1.0);
2107
- #endif
2108
- #ifdef ALPHAFRESNEL
2109
- var reflectance90: f32=fresnelGrazingReflectance(reflectance);specularEnvironmentR90=specularEnvironmentR90*reflectance90;
2110
- #endif
2111
- `;
2112
- // Sideeffect
2113
- ShaderStore.IncludesShadersStoreWGSL[name$8] = shader$8;
2114
-
2115
- // Do not edit.
2116
- const name$7 = "pbrBlockReflectance";
2117
- const shader$7 = `#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2118
- var specularEnvironmentReflectance: vec3f=getReflectanceFromBRDFWithEnvLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);
2119
- #ifdef RADIANCEOCCLUSION
2120
- specularEnvironmentReflectance*=seo;
2121
- #endif
2122
- #ifdef HORIZONOCCLUSION
2123
- #ifdef BUMP
2124
- #ifdef REFLECTIONMAP_3D
2125
- specularEnvironmentReflectance*=eho;
2126
- #endif
2127
- #endif
2128
- #endif
2129
- #else
2130
- var specularEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));
2131
- #endif
2132
- #ifdef CLEARCOAT
2133
- specularEnvironmentReflectance*=clearcoatOut.conservationFactor;
2134
- #if defined(CLEARCOAT_TINT)
2135
- specularEnvironmentReflectance*=clearcoatOut.absorption;
2136
- #endif
2137
- #endif
2138
- `;
2139
- // Sideeffect
2140
- ShaderStore.IncludesShadersStoreWGSL[name$7] = shader$7;
2141
-
2142
- // Do not edit.
2143
- const name$6 = "pbrBlockDirectLighting";
2144
- const shader$6 = `var diffuseBase: vec3f=vec3f(0.,0.,0.);
2145
- #ifdef SPECULARTERM
2146
- var specularBase: vec3f=vec3f(0.,0.,0.);
2147
- #endif
2148
- #ifdef CLEARCOAT
2149
- var clearCoatBase: vec3f=vec3f(0.,0.,0.);
2150
- #endif
2151
- #ifdef SHEEN
2152
- var sheenBase: vec3f=vec3f(0.,0.,0.);
2153
- #endif
2154
- var preInfo: preLightingInfo;var info: lightingInfo;var shadow: f32=1.;
2155
- var aggShadow: f32=0.;var numLights: f32=0.;
2156
- #if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
2157
- var absorption: vec3f=vec3f(0.);
2158
- #endif
2159
- `;
2160
- // Sideeffect
2161
- ShaderStore.IncludesShadersStoreWGSL[name$6] = shader$6;
2162
-
2163
- // Do not edit.
2164
- const name$5 = "pbrBlockFinalLitComponents";
2165
- const shader$5 = `aggShadow=aggShadow/numLights;
2166
- #if defined(ENVIRONMENTBRDF)
2167
- #ifdef MS_BRDF_ENERGY_CONSERVATION
2168
- var energyConservationFactor: vec3f=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);
2169
- #endif
2170
- #endif
2171
- #ifndef METALLICWORKFLOW
2172
- #ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION
2173
- surfaceAlbedo=(1.-reflectance)*surfaceAlbedo.rgb;
2174
- #endif
2175
- #endif
2176
- #if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)
2177
- surfaceAlbedo=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;
2178
- #endif
2179
- #ifdef REFLECTION
2180
- var finalIrradiance: vec3f=reflectionOut.environmentIrradiance;
2181
- #if defined(CLEARCOAT)
2182
- finalIrradiance*=clearcoatOut.conservationFactor;
2183
- #if defined(CLEARCOAT_TINT)
2184
- finalIrradiance*=clearcoatOut.absorption;
2185
- #endif
2186
- #endif
2187
- #if defined(SS_REFRACTION)
2188
- finalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;
2189
- #endif
2190
- #if defined(SS_TRANSLUCENCY)
2191
- finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;
2192
- #endif
2193
- finalIrradiance*=surfaceAlbedo.rgb;finalIrradiance*=uniforms.vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;
2194
- #endif
2195
- #ifdef SPECULARTERM
2196
- var finalSpecular: vec3f=specularBase;finalSpecular=max(finalSpecular,vec3f(0.0));var finalSpecularScaled: vec3f=finalSpecular*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2197
- #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2198
- finalSpecularScaled*=energyConservationFactor;
2199
- #endif
2200
- #if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
2201
- finalSpecularScaled*=sheenOut.sheenAlbedoScaling;
2202
- #endif
2203
- #endif
2204
- #ifdef REFLECTION
2205
- var finalRadiance: vec3f=reflectionOut.environmentRadiance.rgb;finalRadiance*=subSurfaceOut.specularEnvironmentReflectance;var finalRadianceScaled: vec3f=finalRadiance*uniforms.vLightingIntensity.z;
2206
- #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2207
- finalRadianceScaled*=energyConservationFactor;
2208
- #endif
2209
- #if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
2210
- finalRadianceScaled*=sheenOut.sheenAlbedoScaling;
2211
- #endif
2212
- #endif
2213
- #ifdef SHEEN
2214
- var finalSheen: vec3f=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,vec3f(0.0));var finalSheenScaled: vec3f=finalSheen*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2215
- #if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)
2216
- sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;
2217
- #if defined(CLEARCOAT_TINT)
2218
- sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;
2219
- #endif
2220
- #endif
2221
- #endif
2222
- #ifdef CLEARCOAT
2223
- var finalClearCoat: vec3f=clearCoatBase;finalClearCoat=max(finalClearCoat,vec3f(0.0));var finalClearCoatScaled: vec3f=finalClearCoat*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2224
- #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2225
- finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;
2226
- #endif
2227
- #ifdef SS_REFRACTION
2228
- subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;
2229
- #ifdef CLEARCOAT_TINT
2230
- subSurfaceOut.finalRefraction*=clearcoatOut.absorption;
2231
- #endif
2232
- #endif
2233
- #endif
2234
- #ifdef ALPHABLEND
2235
- var luminanceOverAlpha: f32=0.0;
2236
- #if defined(REFLECTION) && defined(RADIANCEOVERALPHA)
2237
- luminanceOverAlpha+=getLuminance(finalRadianceScaled);
2238
- #if defined(CLEARCOAT)
2239
- luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);
2240
- #endif
2241
- #endif
2242
- #if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)
2243
- luminanceOverAlpha+=getLuminance(finalSpecularScaled);
2244
- #endif
2245
- #if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)
2246
- luminanceOverAlpha+=getLuminance(finalClearCoatScaled);
2247
- #endif
2248
- #if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)
2249
- alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);
2250
- #endif
2251
- #endif
2252
- `;
2253
- // Sideeffect
2254
- ShaderStore.IncludesShadersStoreWGSL[name$5] = shader$5;
2255
-
2256
- // Do not edit.
2257
- const name$4 = "pbrBlockFinalUnlitComponents";
2258
- const shader$4 = `var finalDiffuse: vec3f=diffuseBase;finalDiffuse*=surfaceAlbedo.rgb;finalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient*=surfaceAlbedo.rgb;var finalEmissive: vec3f=uniforms.vEmissiveColor;
2259
- #ifdef EMISSIVE
2260
- var emissiveColorTex: vec3f=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb;
2261
- #ifdef GAMMAEMISSIVE
2262
- finalEmissive*=toLinearSpaceVec3(emissiveColorTex.rgb);
2263
- #else
2264
- finalEmissive*=emissiveColorTex.rgb;
2265
- #endif
2266
- finalEmissive*= uniforms.vEmissiveInfos.y;
2267
- #endif
2268
- finalEmissive*=uniforms.vLightingIntensity.y;
2269
- #ifdef AMBIENT
2270
- var ambientOcclusionForDirectDiffuse: vec3f=mix( vec3f(1.),aoOut.ambientOcclusionColor,uniforms.vAmbientInfos.w);
2271
- #else
2272
- var ambientOcclusionForDirectDiffuse: vec3f=aoOut.ambientOcclusionColor;
2273
- #endif
2274
- finalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse;
2275
- `;
2276
- // Sideeffect
2277
- ShaderStore.IncludesShadersStoreWGSL[name$4] = shader$4;
2278
-
2279
- // Do not edit.
2280
- const name$3 = "pbrBlockFinalColorComposition";
2281
- const shader$3 = `var finalColor: vec4f= vec4f(
2282
- #ifndef UNLIT
2283
- #ifdef REFLECTION
2284
- finalIrradiance +
2285
- #endif
2286
- #ifdef SPECULARTERM
2287
- finalSpecularScaled +
2288
- #endif
2289
- #ifdef SHEEN
2290
- finalSheenScaled +
2291
- #endif
2292
- #ifdef CLEARCOAT
2293
- finalClearCoatScaled +
2294
- #endif
2295
- #ifdef REFLECTION
2296
- finalRadianceScaled +
2297
- #if defined(SHEEN) && defined(ENVIRONMENTBRDF)
2298
- sheenOut.finalSheenRadianceScaled +
2299
- #endif
2300
- #ifdef CLEARCOAT
2301
- clearcoatOut.finalClearCoatRadianceScaled +
2302
- #endif
2303
- #endif
2304
- #ifdef SS_REFRACTION
2305
- subSurfaceOut.finalRefraction +
2306
- #endif
2307
- #endif
2308
- finalAmbient +
2309
- finalDiffuse,
2310
- alpha);
2311
- #ifdef LIGHTMAP
2312
- #ifndef LIGHTMAPEXCLUDED
2313
- #ifdef USELIGHTMAPASSHADOWMAP
2314
- finalColor=vec4f(finalColor.rgb*lightmapColor.rgb,finalColor.a);
2315
- #else
2316
- finalColor=vec4f(finalColor.rgb+lightmapColor.rgb,finalColor.a);
2317
- #endif
2318
- #endif
2319
- #endif
2320
- finalColor=vec4f(finalColor.rgb+finalEmissive,finalColor.a);
2321
- #define CUSTOM_FRAGMENT_BEFORE_FOG
2322
- finalColor=max(finalColor,vec4f(0.0));
2323
- `;
2324
- // Sideeffect
2325
- ShaderStore.IncludesShadersStoreWGSL[name$3] = shader$3;
2326
-
2327
- // Do not edit.
2328
- const name$2 = "pbrBlockImageProcessing";
2329
- const shader$2 = `#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
2330
- #if !defined(SKIPFINALCOLORCLAMP)
2331
- finalColor=vec4f(clamp(finalColor.rgb,vec3f(0.),vec3f(30.0)),finalColor.a);
2332
- #endif
2333
- #else
2334
- finalColor=applyImageProcessing(finalColor);
2335
- #endif
2336
- finalColor=vec4f(finalColor.rgb,finalColor.a*mesh.visibility);
2337
- #ifdef PREMULTIPLYALPHA
2338
- finalColor=vec4f(finalColor.rgb*finalColor.a,finalColor.a);;
2339
- #endif
2340
- `;
2341
- // Sideeffect
2342
- ShaderStore.IncludesShadersStoreWGSL[name$2] = shader$2;
2343
-
2344
- // Do not edit.
2345
- const name$1 = "pbrDebug";
2346
- const shader$1 = `#if DEBUGMODE>0
2347
- if (input.vClipSpacePosition.x/input.vClipSpacePosition.w>=uniforms.vDebugMode.x) {var color: vec3f;
2348
- #if DEBUGMODE==1
2349
- color=fragmentInputs.vPositionW.rgb;
2350
- #define DEBUGMODE_NORMALIZE
2351
- #elif DEBUGMODE==2 && defined(NORMAL)
2352
- color=fragmentInputs.vNormalW.rgb;
2353
- #define DEBUGMODE_NORMALIZE
2354
- #elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
2355
- color=TBN[0];
2356
- #define DEBUGMODE_NORMALIZE
2357
- #elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
2358
- color=TBN[1];
2359
- #define DEBUGMODE_NORMALIZE
2360
- #elif DEBUGMODE==5
2361
- color=normalW;
2362
- #define DEBUGMODE_NORMALIZE
2363
- #elif DEBUGMODE==6 && defined(MAINUV1)
2364
- color= vec3f(input.vMainUV1,0.0);
2365
- #elif DEBUGMODE==7 && defined(MAINUV2)
2366
- color= vec3f(input.vMainUV2,0.0);
2367
- #elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
2368
- color=clearcoatOut.TBNClearCoat[0];
2369
- #define DEBUGMODE_NORMALIZE
2370
- #elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
2371
- color=clearcoatOut.TBNClearCoat[1];
2372
- #define DEBUGMODE_NORMALIZE
2373
- #elif DEBUGMODE==10 && defined(CLEARCOAT)
2374
- color=clearcoatOut.clearCoatNormalW;
2375
- #define DEBUGMODE_NORMALIZE
2376
- #elif DEBUGMODE==11 && defined(ANISOTROPIC)
2377
- color=anisotropicOut.anisotropicNormal;
2378
- #define DEBUGMODE_NORMALIZE
2379
- #elif DEBUGMODE==12 && defined(ANISOTROPIC)
2380
- color=anisotropicOut.anisotropicTangent;
2381
- #define DEBUGMODE_NORMALIZE
2382
- #elif DEBUGMODE==13 && defined(ANISOTROPIC)
2383
- color=anisotropicOut.anisotropicBitangent;
2384
- #define DEBUGMODE_NORMALIZE
2385
- #elif DEBUGMODE==20 && defined(ALBEDO)
2386
- color=albedoTexture.rgb;
2387
- #ifndef GAMMAALBEDO
2388
- #define DEBUGMODE_GAMMA
2389
- #endif
2390
- #elif DEBUGMODE==21 && defined(AMBIENT)
2391
- color=aoOut.ambientOcclusionColorMap.rgb;
2392
- #elif DEBUGMODE==22 && defined(OPACITY)
2393
- color=opacityMap.rgb;
2394
- #elif DEBUGMODE==23 && defined(EMISSIVE)
2395
- color=emissiveColorTex.rgb;
2396
- #ifndef GAMMAEMISSIVE
2397
- #define DEBUGMODE_GAMMA
2398
- #endif
2399
- #elif DEBUGMODE==24 && defined(LIGHTMAP)
2400
- color=lightmapColor;
2401
- #ifndef GAMMALIGHTMAP
2402
- #define DEBUGMODE_GAMMA
2403
- #endif
2404
- #elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
2405
- color=reflectivityOut.surfaceMetallicColorMap.rgb;
2406
- #elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
2407
- color=reflectivityOut.surfaceReflectivityColorMap.rgb;
2408
- #define DEBUGMODE_GAMMA
2409
- #elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
2410
- color= vec3f(clearcoatOut.clearCoatMapData.rg,0.0);
2411
- #elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
2412
- color=clearcoatOut.clearCoatTintMapData.rgb;
2413
- #elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
2414
- color=sheenOut.sheenMapData.rgb;
2415
- #elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
2416
- color=anisotropicOut.anisotropyMapData.rgb;
2417
- #elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
2418
- color=subSurfaceOut.thicknessMap.rgb;
2419
- #elif DEBUGMODE==32 && defined(BUMP)
2420
- color=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).rgb;
2421
- #elif DEBUGMODE==40 && defined(SS_REFRACTION)
2422
- color=subSurfaceOut.environmentRefraction.rgb;
2423
- #define DEBUGMODE_GAMMA
2424
- #elif DEBUGMODE==41 && defined(REFLECTION)
2425
- color=reflectionOut.environmentRadiance.rgb;
2426
- #ifndef GAMMAREFLECTION
2427
- #define DEBUGMODE_GAMMA
2428
- #endif
2429
- #elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
2430
- color=clearcoatOut.environmentClearCoatRadiance.rgb;
2431
- #define DEBUGMODE_GAMMA
2432
- #elif DEBUGMODE==50
2433
- color=diffuseBase.rgb;
2434
- #define DEBUGMODE_GAMMA
2435
- #elif DEBUGMODE==51 && defined(SPECULARTERM)
2436
- color=specularBase.rgb;
2437
- #define DEBUGMODE_GAMMA
2438
- #elif DEBUGMODE==52 && defined(CLEARCOAT)
2439
- color=clearCoatBase.rgb;
2440
- #define DEBUGMODE_GAMMA
2441
- #elif DEBUGMODE==53 && defined(SHEEN)
2442
- color=sheenBase.rgb;
2443
- #define DEBUGMODE_GAMMA
2444
- #elif DEBUGMODE==54 && defined(REFLECTION)
2445
- color=reflectionOut.environmentIrradiance.rgb;
2446
- #ifndef GAMMAREFLECTION
2447
- #define DEBUGMODE_GAMMA
2448
- #endif
2449
- #elif DEBUGMODE==60
2450
- color=surfaceAlbedo.rgb;
2451
- #define DEBUGMODE_GAMMA
2452
- #elif DEBUGMODE==61
2453
- color=clearcoatOut.specularEnvironmentR0;
2454
- #define DEBUGMODE_GAMMA
2455
- #elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
2456
- color= vec3f(reflectivityOut.metallicRoughness.r);
2457
- #elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
2458
- color=reflectivityOut.metallicF0;
2459
- #elif DEBUGMODE==63
2460
- color= vec3f(roughness);
2461
- #elif DEBUGMODE==64
2462
- color= vec3f(alphaG);
2463
- #elif DEBUGMODE==65
2464
- color= vec3f(NdotV);
2465
- #elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
2466
- color=clearcoatOut.clearCoatColor;
2467
- #define DEBUGMODE_GAMMA
2468
- #elif DEBUGMODE==67 && defined(CLEARCOAT)
2469
- color= vec3f(clearcoatOut.clearCoatRoughness);
2470
- #elif DEBUGMODE==68 && defined(CLEARCOAT)
2471
- color= vec3f(clearcoatOut.clearCoatNdotV);
2472
- #elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
2473
- color=subSurfaceOut.transmittance;
2474
- #elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
2475
- color=subSurfaceOut.refractionTransmittance;
2476
- #elif DEBUGMODE==72
2477
- color= vec3f(microSurface);
2478
- #elif DEBUGMODE==73
2479
- color=uniforms.vAlbedoColor.rgb;
2480
- #define DEBUGMODE_GAMMA
2481
- #elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
2482
- color=uniforms.vReflectivityColor.rgb;
2483
- #define DEBUGMODE_GAMMA
2484
- #elif DEBUGMODE==75
2485
- color=uniforms.vEmissiveColor;
2486
- #define DEBUGMODE_GAMMA
2487
- #elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
2488
- color= vec3f(seo);
2489
- #elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
2490
- color= vec3f(eho);
2491
- #elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
2492
- color= vec3f(energyConservationFactor);
2493
- #elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2494
- color=specularEnvironmentReflectance;
2495
- #define DEBUGMODE_GAMMA
2496
- #elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2497
- color=clearcoatOut.clearCoatEnvironmentReflectance;
2498
- #define DEBUGMODE_GAMMA
2499
- #elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
2500
- color=sheenOut.sheenEnvironmentReflectance;
2501
- #define DEBUGMODE_GAMMA
2502
- #elif DEBUGMODE==86 && defined(ALPHABLEND)
2503
- color= vec3f(luminanceOverAlpha);
2504
- #elif DEBUGMODE==87
2505
- color= vec3f(alpha);
2506
- #elif DEBUGMODE==88 && defined(ALBEDO)
2507
- color= vec3f(albedoTexture.a);
2508
- #elif DEBUGMODE==89
2509
- color=aoOut.ambientOcclusionColor;
2510
- #else
2511
- var stripeWidth: f32=30.;var stripePos: f32=abs(floor(input.position.x/stripeWidth));var whichColor: f32=((stripePos)%(2.));var color1: vec3f= vec3f(.6,.2,.2);var color2: vec3f= vec3f(.3,.1,.1);color=mix(color1,color2,whichColor);
2512
- #endif
2513
- color*=uniforms.vDebugMode.y;
2514
- #ifdef DEBUGMODE_NORMALIZE
2515
- color=normalize(color)*0.5+0.5;
2516
- #endif
2517
- #ifdef DEBUGMODE_GAMMA
2518
- color=toGammaSpaceVec3(color);
2519
- #endif
2520
- fragmentOutputs.color=vec4f(color,1.0);
2521
- #ifdef PREPASS
2522
- fragmentOutputs.fragData0=toLinearSpaceVec3(color);
2523
- fragmentOutputs.fragData1=vec4f(0.,0.,0.,0.);
2524
- #endif
2525
- #ifdef DEBUGMODE_FORCERETURN
2526
- return fragmentOutputs;
2527
- #endif
2528
- }
2529
- #endif
2530
- `;
2531
- // Sideeffect
2532
- ShaderStore.IncludesShadersStoreWGSL[name$1] = shader$1;
2533
-
2534
- // Do not edit.
2535
- const name = "pbrPixelShader";
2536
- const shader = `#define CUSTOM_FRAGMENT_BEGIN
2537
- #include<prePassDeclaration>[SCENE_MRT_COUNT]
2538
- #include<oitDeclaration>
2539
- #ifndef FROMLINEARSPACE
2540
- #define FROMLINEARSPACE
2541
- #endif
2542
- #include<pbrUboDeclaration>
2543
- #include<pbrFragmentExtraDeclaration>
2544
- #include<lightUboDeclaration>[0..maxSimultaneousLights]
2545
- #include<pbrFragmentSamplersDeclaration>
2546
- #include<imageProcessingDeclaration>
2547
- #include<clipPlaneFragmentDeclaration>
2548
- #include<logDepthDeclaration>
2549
- #include<fogFragmentDeclaration>
2550
- #include<helperFunctions>
2551
- #include<subSurfaceScatteringFunctions>
2552
- #include<importanceSampling>
2553
- #include<pbrHelperFunctions>
2554
- #include<imageProcessingFunctions>
2555
- #include<shadowsFragmentFunctions>
2556
- #include<harmonicsFunctions>
2557
- #include<pbrDirectLightingSetupFunctions>
2558
- #include<pbrDirectLightingFalloffFunctions>
2559
- #include<pbrBRDFFunctions>
2560
- #include<hdrFilteringFunctions>
2561
- #include<pbrDirectLightingFunctions>
2562
- #include<pbrIBLFunctions>
2563
- #include<bumpFragmentMainFunctions>
2564
- #include<bumpFragmentFunctions>
2565
- #ifdef REFLECTION
2566
- #include<reflectionFunction>
2567
- #endif
2568
- #define CUSTOM_FRAGMENT_DEFINITIONS
2569
- #include<pbrBlockAlbedoOpacity>
2570
- #include<pbrBlockReflectivity>
2571
- #include<pbrBlockAmbientOcclusion>
2572
- #include<pbrBlockAlphaFresnel>
2573
- #include<pbrBlockAnisotropic>
2574
- #include<pbrBlockReflection>
2575
- #include<pbrBlockSheen>
2576
- #include<pbrBlockClearcoat>
2577
- #include<pbrBlockIridescence>
2578
- #include<pbrBlockSubSurface>
2579
- @fragment
2580
- fn main(input: FragmentInputs)->FragmentOutputs {
2581
- #define CUSTOM_FRAGMENT_MAIN_BEGIN
2582
- #include<clipPlaneFragment>
2583
- #include<pbrBlockNormalGeometric>
2584
- #include<bumpFragment>
2585
- #include<pbrBlockNormalFinal>
2586
- var albedoOpacityOut: albedoOpacityOutParams;
2587
- #ifdef ALBEDO
2588
- var albedoTexture: vec4f=textureSample(albedoSampler,albedoSamplerSampler,fragmentInputs.vAlbedoUV+uvOffset);
2589
- #endif
2590
- #ifdef OPACITY
2591
- var opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);
2592
- #endif
2593
- #ifdef DECAL
2594
- var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
2595
- #endif
2596
- albedoOpacityOut=albedoOpacityBlock(
2597
- uniforms.vAlbedoColor
2598
- #ifdef ALBEDO
2599
- ,albedoTexture
2600
- ,uniforms.vAlbedoInfos
2601
- #endif
2602
- #ifdef OPACITY
2603
- ,opacityMap
2604
- ,uniforms.vOpacityInfos
2605
- #endif
2606
- #ifdef DETAIL
2607
- ,detailColor
2608
- ,uniforms.vDetailInfos
2609
- #endif
2610
- #ifdef DECAL
2611
- ,decalColor
2612
- ,uniforms.vDecalInfos
2613
- #endif
2614
- );var surfaceAlbedo: vec3f=albedoOpacityOut.surfaceAlbedo;var alpha: f32=albedoOpacityOut.alpha;
2615
- #define CUSTOM_FRAGMENT_UPDATE_ALPHA
2616
- #include<depthPrePass>
2617
- #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
2618
- var aoOut: ambientOcclusionOutParams;
2619
- #ifdef AMBIENT
2620
- var ambientOcclusionColorMap: vec3f=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb;
2621
- #endif
2622
- aoOut=ambientOcclusionBlock(
2623
- #ifdef AMBIENT
2624
- ambientOcclusionColorMap,
2625
- uniforms.vAmbientInfos
2626
- #endif
2627
- );
2628
- #include<pbrBlockLightmapInit>
2629
- #ifdef UNLIT
2630
- var diffuseBase: vec3f= vec3f(1.,1.,1.);
2631
- #else
2632
- var baseColor: vec3f=surfaceAlbedo;var reflectivityOut: reflectivityOutParams;
2633
- #if defined(REFLECTIVITY)
2634
- var surfaceMetallicOrReflectivityColorMap: vec4f=textureSample(reflectivitySampler,reflectivitySamplerSampler,fragmentInputs.vReflectivityUV+uvOffset);var baseReflectivity: vec4f=surfaceMetallicOrReflectivityColorMap;
2635
- #ifndef METALLICWORKFLOW
2636
- #ifdef REFLECTIVITY_GAMMA
2637
- surfaceMetallicOrReflectivityColorMap=toLinearSpaceVec4(surfaceMetallicOrReflectivityColorMap);
2638
- #endif
2639
- surfaceMetallicOrReflectivityColorMap=vec4f(surfaceMetallicOrReflectivityColorMap.rgb*uniforms.vReflectivityInfos.y,surfaceMetallicOrReflectivityColorMap.a);
2640
- #endif
2641
- #endif
2642
- #if defined(MICROSURFACEMAP)
2643
- var microSurfaceTexel: vec4f=textureSample(microSurfaceSampler,microSurfaceSamplerSampler,fragmentInputs.vMicroSurfaceSamplerUV+uvOffset)*uniforms.vMicroSurfaceSamplerInfos.y;
2644
- #endif
2645
- #ifdef METALLICWORKFLOW
2646
- var metallicReflectanceFactors: vec4f=uniforms.vMetallicReflectanceFactors;
2647
- #ifdef REFLECTANCE
2648
- var reflectanceFactorsMap: vec4f=textureSample(reflectanceSampler,reflectanceSamplerSampler,fragmentInputs.vReflectanceUV+uvOffset);
2649
- #ifdef REFLECTANCE_GAMMA
2650
- reflectanceFactorsMap=toLinearSpaceVec4(reflectanceFactorsMap);
2651
- #endif
2652
- metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*reflectanceFactorsMap.rgb,metallicReflectanceFactors.a);
2653
- #endif
2654
- #ifdef METALLIC_REFLECTANCE
2655
- var metallicReflectanceFactorsMap: vec4f=textureSample(metallicReflectanceSampler,metallicReflectanceSamplerSampler,fragmentInputs.vMetallicReflectanceUV+uvOffset);
2656
- #ifdef METALLIC_REFLECTANCE_GAMMA
2657
- metallicReflectanceFactorsMap=toLinearSpaceVec4(metallicReflectanceFactorsMap);
2658
- #endif
2659
- #ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY
2660
- metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*reflectanceFactorsMap.rgb,metallicReflectanceFactors.a);
2661
- #endif
2662
- metallicReflectanceFactors*=metallicReflectanceFactorsMap.a;
2663
- #endif
2664
- #endif
2665
- reflectivityOut=reflectivityBlock(
2666
- uniforms.vReflectivityColor
2667
- #ifdef METALLICWORKFLOW
2668
- ,surfaceAlbedo
2669
- ,metallicReflectanceFactors
2670
- #endif
2671
- #ifdef REFLECTIVITY
2672
- ,uniforms.vReflectivityInfos
2673
- ,surfaceMetallicOrReflectivityColorMap
2674
- #endif
2675
- #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
2676
- ,aoOut.ambientOcclusionColor
2677
- #endif
2678
- #ifdef MICROSURFACEMAP
2679
- ,microSurfaceTexel
2680
- #endif
2681
- #ifdef DETAIL
2682
- ,detailColor
2683
- ,uniforms.vDetailInfos
2684
- #endif
2685
- );var microSurface: f32=reflectivityOut.microSurface;var roughness: f32=reflectivityOut.roughness;
2686
- #ifdef METALLICWORKFLOW
2687
- surfaceAlbedo=reflectivityOut.surfaceAlbedo;
2688
- #endif
2689
- #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
2690
- aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;
2691
- #endif
2692
- #ifdef ALPHAFRESNEL
2693
- #if defined(ALPHATEST) || defined(ALPHABLEND)
2694
- var alphaFresnelOut: alphaFresnelOutParams;alphaFresnelOut=alphaFresnelBlock(
2695
- normalW,
2696
- viewDirectionW,
2697
- alpha,
2698
- microSurface
2699
- );alpha=alphaFresnelOut.alpha;
2700
- #endif
2701
- #endif
2702
- #include<pbrBlockGeometryInfo>
2703
- #ifdef ANISOTROPIC
2704
- var anisotropicOut: anisotropicOutParams;
2705
- #ifdef ANISOTROPIC_TEXTURE
2706
- var anisotropyMapData: vec3f=textureSample(anisotropySampler,anisotropySamplerSampler,fragmentInputs.vAnisotropyUV+uvOffset).rgb*uniforms.vAnisotropyInfos.y;
2707
- #endif
2708
- anisotropicOut=anisotropicBlock(
2709
- uniforms.vAnisotropy,
2710
- roughness,
2711
- #ifdef ANISOTROPIC_TEXTURE
2712
- anisotropyMapData,
2713
- #endif
2714
- TBN,
2715
- normalW,
2716
- viewDirectionW
2717
- );
2718
- #endif
2719
- #ifdef REFLECTION
2720
- var reflectionOut: reflectionOutParams;
2721
- #ifndef USE_CUSTOM_REFLECTION
2722
- reflectionOut=reflectionBlock(
2723
- fragmentInputs.vPositionW
2724
- ,normalW
2725
- ,alphaG
2726
- ,uniforms.vReflectionMicrosurfaceInfos
2727
- ,uniforms.vReflectionInfos
2728
- ,uniforms.vReflectionColor
2729
- #ifdef ANISOTROPIC
2730
- ,anisotropicOut
2731
- #endif
2732
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
2733
- ,NdotVUnclamped
2734
- #endif
2735
- #ifdef LINEARSPECULARREFLECTION
2736
- ,roughness
2737
- #endif
2738
- ,reflectionSampler
2739
- ,reflectionSamplerSampler
2740
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
2741
- ,fragmentInputs.vEnvironmentIrradiance
2742
- #endif
2743
- #ifdef USESPHERICALFROMREFLECTIONMAP
2744
- #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
2745
- ,uniforms.reflectionMatrix
2746
- #endif
2747
- #endif
2748
- #ifdef USEIRRADIANCEMAP
2749
- ,irradianceSampler
2750
- ,irradianceSamplerSampler
2751
- #endif
2752
- #ifndef LODBASEDMICROSFURACE
2753
- ,reflectionLowSampler
2754
- ,reflectionLowSamplerSampler
2755
- ,reflectionHighSampler
2756
- ,reflectionHighSamplerSampler
2757
- #endif
2758
- #ifdef REALTIME_FILTERING
2759
- ,uniforms.vReflectionFilteringInfo
2760
- #endif
2761
- );
2762
- #else
2763
- #define CUSTOM_REFLECTION
2764
- #endif
2765
- #endif
2766
- #include<pbrBlockReflectance0>
2767
- #ifdef SHEEN
2768
- var sheenOut: sheenOutParams;
2769
- #ifdef SHEEN_TEXTURE
2770
- var sheenMapData: vec4f=textureSample(sheenSampler,sheenSamplerSampler,fragmentInputs.vSheenUV+uvOffset);
2771
- #endif
2772
- #if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
2773
- var sheenMapRoughnessData: vec4f=textureSample(sheenRoughnessSampler,sheenRoughnessSamplerSampler,fragmentInputs.vSheenRoughnessUV+uvOffset)*uniforms.vSheenInfos.w;
2774
- #endif
2775
- sheenOut=sheenBlock(
2776
- uniforms.vSheenColor
2777
- #ifdef SHEEN_ROUGHNESS
2778
- ,uniforms.vSheenRoughness
2779
- #if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
2780
- ,sheenMapRoughnessData
2781
- #endif
2782
- #endif
2783
- ,roughness
2784
- #ifdef SHEEN_TEXTURE
2785
- ,sheenMapData
2786
- ,uniforms.vSheenInfos.y
2787
- #endif
2788
- ,reflectance
2789
- #ifdef SHEEN_LINKWITHALBEDO
2790
- ,baseColor
2791
- ,surfaceAlbedo
2792
- #endif
2793
- #ifdef ENVIRONMENTBRDF
2794
- ,NdotV
2795
- ,environmentBrdf
2796
- #endif
2797
- #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
2798
- ,AARoughnessFactors
2799
- ,uniforms.vReflectionMicrosurfaceInfos
2800
- ,uniforms.vReflectionInfos
2801
- ,uniforms.vReflectionColor
2802
- ,uniforms.vLightingIntensity
2803
- ,reflectionSampler
2804
- ,reflectionSamplerSampler
2805
- ,reflectionOut.reflectionCoords
2806
- ,NdotVUnclamped
2807
- #ifndef LODBASEDMICROSFURACE
2808
- ,reflectionLowSampler
2809
- ,reflectionLowSamplerSampler
2810
- ,reflectionHighSampler
2811
- ,reflectionHighSamplerSampler
2812
- #endif
2813
- #ifdef REALTIME_FILTERING
2814
- ,vReflectionFilteringInfo
2815
- #endif
2816
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
2817
- ,seo
2818
- #endif
2819
- #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
2820
- ,eho
2821
- #endif
2822
- #endif
2823
- );
2824
- #ifdef SHEEN_LINKWITHALBEDO
2825
- surfaceAlbedo=sheenOut.surfaceAlbedo;
2826
- #endif
2827
- #endif
2828
- #ifdef CLEARCOAT
2829
- #ifdef CLEARCOAT_TEXTURE
2830
- var clearCoatMapData: vec2f=textureSample(clearCoatSampler,clearCoatSamplerSampler,fragmentInputs.vClearCoatUV+uvOffset).rg*uniforms.vClearCoatInfos.y;
2831
- #endif
2832
- #endif
2833
- #ifdef IRIDESCENCE
2834
- var iridescenceOut: iridescenceOutParams;
2835
- #ifdef IRIDESCENCE_TEXTURE
2836
- var iridescenceMapData: vec2f=textureSample(iridescenceSampler,iridescenceSamplerSampler,fragmentInputs.vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;
2837
- #endif
2838
- #ifdef IRIDESCENCE_THICKNESS_TEXTURE
2839
- var iridescenceThicknessMapData: vec2f=textureSample(iridescenceThicknessSampler,iridescenceThicknessSamplerSampler,fragmentInputs.vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;
2840
- #endif
2841
- iridescenceOut=iridescenceBlock(
2842
- uniforms.vIridescenceParams
2843
- ,NdotV
2844
- ,specularEnvironmentR0
2845
- #ifdef IRIDESCENCE_TEXTURE
2846
- ,iridescenceMapData
2847
- #endif
2848
- #ifdef IRIDESCENCE_THICKNESS_TEXTURE
2849
- ,iridescenceThicknessMapData
2850
- #endif
2851
- #ifdef CLEARCOAT
2852
- ,NdotVUnclamped
2853
- #ifdef CLEARCOAT_TEXTURE
2854
- ,clearCoatMapData
2855
- #endif
2856
- #endif
2857
- );var iridescenceIntensity: f32=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0;
2858
- #endif
2859
- var clearcoatOut: clearcoatOutParams;
2860
- #ifdef CLEARCOAT
2861
- #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
2862
- var clearCoatMapRoughnessData: vec4f=textureSample(clearCoatRoughnessSampler,clearCoatRoughnessSamplerSampler,fragmentInputs.vClearCoatRoughnessUV+uvOffset)*uniforms.vClearCoatInfos.w;
2863
- #endif
2864
- #if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
2865
- var clearCoatTintMapData: vec4f=textureSample(clearCoatTintSampler,clearCoatTintSamplerSampler,fragmentInputs.vClearCoatTintUV+uvOffset);
2866
- #endif
2867
- #ifdef CLEARCOAT_BUMP
2868
- var clearCoatBumpMapData: vec4f=textureSample(clearCoatBumpSampler,clearCoatBumpSamplerSampler,fragmentInputs.vClearCoatBumpUV+uvOffset);
2869
- #endif
2870
- clearcoatOut=clearcoatBlock(
2871
- fragmentInputs.vPositionW
2872
- ,geometricNormalW
2873
- ,viewDirectionW
2874
- ,uniforms.vClearCoatParams
2875
- #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
2876
- ,clearCoatMapRoughnessData
2877
- #endif
2878
- ,specularEnvironmentR0
2879
- #ifdef CLEARCOAT_TEXTURE
2880
- ,clearCoatMapData
2881
- #endif
2882
- #ifdef CLEARCOAT_TINT
2883
- ,uniforms.vClearCoatTintParams
2884
- ,uniforms.clearCoatColorAtDistance
2885
- ,uniforms.vClearCoatRefractionParams
2886
- #ifdef CLEARCOAT_TINT_TEXTURE
2887
- ,clearCoatTintMapData
2888
- #endif
2889
- #endif
2890
- #ifdef CLEARCOAT_BUMP
2891
- ,uniforms.vClearCoatBumpInfos
2892
- ,clearCoatBumpMapData
2893
- ,fragmentInputs.vClearCoatBumpUV
2894
- #if defined(TANGENT) && defined(NORMAL)
2895
- ,vTBN
2896
- #else
2897
- ,uniforms.vClearCoatTangentSpaceParams
2898
- #endif
2899
- #ifdef OBJECTSPACE_NORMALMAP
2900
- ,uniforms.normalMatrix
2901
- #endif
2902
- #endif
2903
- #if defined(FORCENORMALFORWARD) && defined(NORMAL)
2904
- ,faceNormal
2905
- #endif
2906
- #ifdef REFLECTION
2907
- ,uniforms.vReflectionMicrosurfaceInfos
2908
- ,uniforms.vReflectionInfos
2909
- ,uniforms.vReflectionColor
2910
- ,uniforms.vLightingIntensity
2911
- ,reflectionSampler
2912
- ,reflectionSamplerSampler
2913
- #ifndef LODBASEDMICROSFURACE
2914
- ,reflectionLowSampler
2915
- ,reflectionLowSamplerSampler
2916
- ,reflectionHighSampler
2917
- ,reflectionHighSamplerSampler
2918
- #endif
2919
- #ifdef REALTIME_FILTERING
2920
- ,uniforms.vReflectionFilteringInfo
2921
- #endif
2922
- #endif
2923
- #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2924
- #ifdef RADIANCEOCCLUSION
2925
- ,ambientMonochrome
2926
- #endif
2927
- #endif
2928
- #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
2929
- ,select(-1.,1.,fragmentInputs.frontFacing)
2930
- #endif
2931
- );
2932
- #else
2933
- clearcoatOut.specularEnvironmentR0=specularEnvironmentR0;
2934
- #endif
2935
- #include<pbrBlockReflectance>
2936
- var subSurfaceOut: subSurfaceOutParams;
2937
- #ifdef SUBSURFACE
2938
- #ifdef SS_THICKNESSANDMASK_TEXTURE
2939
- var thicknessMap: vec4f=textureSample(thicknessSampler,thicknessSamplerSampler,fragmentInputs.vThicknessUV+uvOffset);
2940
- #endif
2941
- #ifdef SS_REFRACTIONINTENSITY_TEXTURE
2942
- var refractionIntensityMap: vec4f=textureSample(refractionIntensitySampler,refractionIntensitySamplerSampler,fragmentInputs.vRefractionIntensityUV+uvOffset);
2943
- #endif
2944
- #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
2945
- var translucencyIntensityMap: vec4f=textureSample(translucencyIntensitySampler,translucencyIntensitySamplerSampler,fragmentInputs.vTranslucencyIntensityUV+uvOffset);
2946
- #endif
2947
- #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
2948
- var translucencyColorMap: vec4f=textureSample(translucencyColorSampler,translucencyColorSamplerSampler,fragmentInputs.vTranslucencyColorUV+uvOffset);
2949
- #endif
2950
- subSurfaceOut=subSurfaceBlock(
2951
- uniforms.vSubSurfaceIntensity
2952
- ,uniforms.vThicknessParam
2953
- ,uniforms.vTintColor
2954
- ,normalW
2955
- ,specularEnvironmentReflectance
2956
- #ifdef SS_THICKNESSANDMASK_TEXTURE
2957
- ,thicknessMap
2958
- #endif
2959
- #ifdef SS_REFRACTIONINTENSITY_TEXTURE
2960
- ,refractionIntensityMap
2961
- #endif
2962
- #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
2963
- ,translucencyIntensityMap
2964
- #endif
2965
- #ifdef REFLECTION
2966
- #ifdef SS_TRANSLUCENCY
2967
- ,uniforms.reflectionMatrix
2968
- #ifdef USESPHERICALFROMREFLECTIONMAP
2969
- #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
2970
- ,reflectionOut.irradianceVector
2971
- #endif
2972
- #if defined(REALTIME_FILTERING)
2973
- ,reflectionSampler
2974
- ,reflectionSamplerSampler
2975
- ,vReflectionFilteringInfo
2976
- #endif
2977
- #endif
2978
- #ifdef USEIRRADIANCEMAP
2979
- ,irradianceSampler
2980
- ,irradianceSamplerSampler
2981
- #endif
2982
- #endif
2983
- #endif
2984
- #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
2985
- ,surfaceAlbedo
2986
- #endif
2987
- #ifdef SS_REFRACTION
2988
- ,fragmentInputs.vPositionW
2989
- ,viewDirectionW
2990
- ,scene.view
2991
- ,uniforms.vRefractionInfos
2992
- ,uniforms.refractionMatrix
2993
- ,uniforms.vRefractionMicrosurfaceInfos
2994
- ,uniforms.vLightingIntensity
2995
- #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
2996
- ,alpha
2997
- #endif
2998
- #ifdef SS_LODINREFRACTIONALPHA
2999
- ,NdotVUnclamped
3000
- #endif
3001
- #ifdef SS_LINEARSPECULARREFRACTION
3002
- ,roughness
3003
- #endif
3004
- ,alphaG
3005
- ,refractionSampler
3006
- ,refractionSamplerSampler
3007
- #ifndef LODBASEDMICROSFURACE
3008
- ,refractionLowSampler
3009
- ,refractionLowSamplerSampler
3010
- ,refractionHighSampler
3011
- ,refractionHighSamplerSampler
3012
- #endif
3013
- #ifdef ANISOTROPIC
3014
- ,anisotropicOut
3015
- #endif
3016
- #ifdef REALTIME_FILTERING
3017
- ,uniforms.vRefractionFilteringInfo
3018
- #endif
3019
- #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
3020
- ,uniforms.vRefractionPosition
3021
- ,uniforms.vRefractionSize
3022
- #endif
3023
- #ifdef SS_DISPERSION
3024
- ,dispersion
3025
- #endif
3026
- #endif
3027
- #ifdef SS_TRANSLUCENCY
3028
- ,uniforms.vDiffusionDistance
3029
- ,uniforms.vTranslucencyColor
3030
- #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
3031
- ,translucencyColorMap
3032
- #endif
3033
- #endif
3034
- );
3035
- #ifdef SS_REFRACTION
3036
- surfaceAlbedo=subSurfaceOut.surfaceAlbedo;
3037
- #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
3038
- alpha=subSurfaceOut.alpha;
3039
- #endif
3040
- #endif
3041
- #else
3042
- subSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;
3043
- #endif
3044
- #include<pbrBlockDirectLighting>
3045
- #include<lightFragment>[0..maxSimultaneousLights]
3046
- #include<pbrBlockFinalLitComponents>
3047
- #endif
3048
- #include<pbrBlockFinalUnlitComponents>
3049
- #define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION
3050
- #include<pbrBlockFinalColorComposition>
3051
- #include<logDepthFragment>
3052
- #include<fogFragment>(color,finalColor)
3053
- #include<pbrBlockImageProcessing>
3054
- #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
3055
- #ifdef PREPASS
3056
- var writeGeometryInfo: f32=select(0.0,1.0,finalColor.a>ALPHATESTVALUE);var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
3057
- #ifdef PREPASS_POSITION
3058
- fragData[PREPASS_POSITION_INDEX]= vec4f(fragmentInputs.vPositionW,writeGeometryInfo);
3059
- #endif
3060
- #ifdef PREPASS_LOCAL_POSITION
3061
- fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition*0.5+0.5,writeGeometryInfo);
3062
- #endif
3063
- #ifdef PREPASS_VELOCITY
3064
- var a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo);
3065
- #elif defined(PREPASS_VELOCITY_LINEAR)
3066
- var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy /
3067
- fragmentInputs.vPreviousPosition.w) -
3068
- (fragmentInputs.vCurrentPosition.xy /
3069
- fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX] =
3070
- vec4f(velocity,0.0,writeGeometryInfo);
3071
- #endif
3072
- #ifdef PREPASS_ALBEDO_SQRT
3073
- var sqAlbedo : vec3f=sqrt(surfaceAlbedo);
3074
- #endif
3075
- #ifdef PREPASS_IRRADIANCE
3076
- var irradiance : vec3f=finalDiffuse;
3077
- #ifndef UNLIT
3078
- #ifdef REFLECTION
3079
- irradiance+=finalIrradiance;
3080
- #endif
3081
- #endif
3082
- #ifdef SS_SCATTERING
3083
- fragData[0]=vec4f(finalColor.rgb-irradiance,
3084
- finalColor.a);
3085
- irradiance/=sqAlbedo;
3086
- #else
3087
- fragData[0]=finalColor;
3088
- var scatteringDiffusionProfile : f32=255.;
3089
- #endif
3090
- fragData[PREPASS_IRRADIANCE_INDEX] =
3091
- vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),
3092
- writeGeometryInfo*scatteringDiffusionProfile /
3093
- 255.);
3094
- #else
3095
- fragData[0]=vec4f(finalColor.rgb,finalColor.a);
3096
- #endif
3097
- #ifdef PREPASS_DEPTH
3098
- fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,
3099
- writeGeometryInfo);
3100
- #endif
3101
- #ifdef PREPASS_NDC_DEPTH
3102
- fragData[PREPASS_NDC_DEPTH_INDEX]=vec4f(
3103
- fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);
3104
- #endif
3105
- #ifdef PREPASS_NORMAL
3106
- #ifdef PREPASS_NORMAL_WORLDSPACE
3107
- fragData[PREPASS_NORMAL_INDEX] =
3108
- vec4f(normalW,writeGeometryInfo);
3109
- #else
3110
- fragData[PREPASS_NORMAL_INDEX] =
3111
- vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),
3112
- writeGeometryInfo);
3113
- #endif
3114
- #endif
3115
- #ifdef PREPASS_WORLD_NORMAL
3116
- fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);
3117
- #endif
3118
- #ifdef PREPASS_ALBEDO_SQRT
3119
- fragData[PREPASS_ALBEDO_SQRT_INDEX] =
3120
- vec4f(sqAlbedo,writeGeometryInfo);
3121
- #endif
3122
- #ifdef PREPASS_REFLECTIVITY
3123
- #ifndef UNLIT
3124
- fragData[PREPASS_REFLECTIVITY_INDEX] =
3125
- vec4f(specularEnvironmentR0,microSurface)*writeGeometryInfo;
3126
- #else
3127
- fragData[PREPASS_REFLECTIVITY_INDEX] =
3128
- vec4f(0.0,0.0,0.0,1.0)*writeGeometryInfo;
3129
- #endif
3130
- #endif
3131
- #if SCENE_MRT_COUNT>0
3132
- fragmentOutputs.fragData0=fragData[0];
3133
- #endif
3134
- #if SCENE_MRT_COUNT>1
3135
- fragmentOutputs.fragData1=fragData[1];
3136
- #endif
3137
- #if SCENE_MRT_COUNT>2
3138
- fragmentOutputs.fragData2=fragData[2];
3139
- #endif
3140
- #if SCENE_MRT_COUNT>3
3141
- fragmentOutputs.fragData3=fragData[3];
3142
- #endif
3143
- #if SCENE_MRT_COUNT>4
3144
- fragmentOutputs.fragData4=fragData[4];
3145
- #endif
3146
- #if SCENE_MRT_COUNT>5
3147
- fragmentOutputs.fragData5=fragData[5];
3148
- #endif
3149
- #if SCENE_MRT_COUNT>6
3150
- fragmentOutputs.fragData6=fragData[6];
3151
- #endif
3152
- #if SCENE_MRT_COUNT>7
3153
- fragmentOutputs.fragData7=fragData[7];
3154
- #endif
3155
- #endif
3156
- #if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
3157
- fragmentOutputs.color=finalColor;
3158
- #endif
3159
- #include<oitFragment>
3160
- #if ORDER_INDEPENDENT_TRANSPARENCY
3161
- if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+finalColor.rgb*finalColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-finalColor.a));} else {fragmentOutputs.backColor+=finalColor;}
3162
- #endif
3163
- #include<pbrDebug>
3164
- #define CUSTOM_FRAGMENT_MAIN_END
3165
- }`;
3166
- // Sideeffect
3167
- ShaderStore.ShadersStoreWGSL[name] = shader;
3168
- /** @internal */
3169
- const pbrPixelShaderWGSL = { name, shader };
3170
-
3171
- export { pbrPixelShaderWGSL };
3172
- //# sourceMappingURL=pbr.fragment-CVVaxHTM.esm.js.map