@fps-games/editor-deployment 0.2.3-beta.10

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 (533) hide show
  1. package/bin/fps-editor-agent.mjs +5 -0
  2. package/bin/fps-editor-prepare.mjs +5 -0
  3. package/bin/fps-editor-project.mjs +18 -0
  4. package/bin/fps-editor-server.mjs +2 -0
  5. package/licenses/THIRD_PARTY_NOTICES.txt +7 -0
  6. package/manifest.json +2688 -0
  7. package/npm-shrinkwrap.json +21 -0
  8. package/package.json +44 -0
  9. package/public/assets/abstractAudioBus-BRAC2GY2.js +1 -0
  10. package/public/assets/animation-C6iNAO1g.js +1 -0
  11. package/public/assets/animation-C6iNAO1g.js.br +0 -0
  12. package/public/assets/animation-C6iNAO1g.js.gz +0 -0
  13. package/public/assets/animationGroup-C74XVFRE.js +1 -0
  14. package/public/assets/animationGroup-C74XVFRE.js.br +0 -0
  15. package/public/assets/animationGroup-C74XVFRE.js.gz +0 -0
  16. package/public/assets/arcRotateCamera-CIQYNBBJ.js +1 -0
  17. package/public/assets/arcRotateCamera-CIQYNBBJ.js.br +0 -0
  18. package/public/assets/arcRotateCamera-CIQYNBBJ.js.gz +0 -0
  19. package/public/assets/babylon-core-PuGyjHMj.js +13882 -0
  20. package/public/assets/babylon-core-PuGyjHMj.js.br +0 -0
  21. package/public/assets/babylon-core-PuGyjHMj.js.gz +0 -0
  22. package/public/assets/babylon-core-S0gBQJVe.js +1 -0
  23. package/public/assets/babylon-core-S0gBQJVe.js.br +0 -0
  24. package/public/assets/babylon-core-S0gBQJVe.js.gz +0 -0
  25. package/public/assets/basisTextureLoader-BdapVvhf.js +1 -0
  26. package/public/assets/basisTextureLoader-BdapVvhf.js.br +0 -0
  27. package/public/assets/basisTextureLoader-BdapVvhf.js.gz +0 -0
  28. package/public/assets/bumpVertex-DMhnr4dz.js +173 -0
  29. package/public/assets/bumpVertex-DMhnr4dz.js.br +0 -0
  30. package/public/assets/bumpVertex-DMhnr4dz.js.gz +0 -0
  31. package/public/assets/bumpVertex-DpGOKCkn.js +177 -0
  32. package/public/assets/bumpVertex-DpGOKCkn.js.br +0 -0
  33. package/public/assets/bumpVertex-DpGOKCkn.js.gz +0 -0
  34. package/public/assets/chromaticAberration.fragment-BgX-2zxS.js +7 -0
  35. package/public/assets/chromaticAberration.fragment-BgX-2zxS.js.br +0 -0
  36. package/public/assets/chromaticAberration.fragment-BgX-2zxS.js.gz +0 -0
  37. package/public/assets/chromaticAberration.fragment-D7t6Txg4.js +6 -0
  38. package/public/assets/chromaticAberration.fragment-D7t6Txg4.js.br +0 -0
  39. package/public/assets/chromaticAberration.fragment-D7t6Txg4.js.gz +0 -0
  40. package/public/assets/circleOfConfusion.fragment-D1RtHaPm.js +17 -0
  41. package/public/assets/circleOfConfusion.fragment-D1RtHaPm.js.br +0 -0
  42. package/public/assets/circleOfConfusion.fragment-D1RtHaPm.js.gz +0 -0
  43. package/public/assets/circleOfConfusion.fragment-D8geMRma.js +17 -0
  44. package/public/assets/circleOfConfusion.fragment-D8geMRma.js.br +0 -0
  45. package/public/assets/circleOfConfusion.fragment-D8geMRma.js.gz +0 -0
  46. package/public/assets/clipPlaneFragment-Bgl3Usc4.js +46 -0
  47. package/public/assets/clipPlaneFragment-Bgl3Usc4.js.br +0 -0
  48. package/public/assets/clipPlaneFragment-Bgl3Usc4.js.gz +0 -0
  49. package/public/assets/clipPlaneVertex-BxK9aoI2.js +177 -0
  50. package/public/assets/clipPlaneVertex-BxK9aoI2.js.br +0 -0
  51. package/public/assets/clipPlaneVertex-BxK9aoI2.js.gz +0 -0
  52. package/public/assets/color.fragment-BUdIBar6.js +20 -0
  53. package/public/assets/color.fragment-BUdIBar6.js.br +0 -0
  54. package/public/assets/color.fragment-BUdIBar6.js.gz +0 -0
  55. package/public/assets/color.fragment-CDn4ZgkT.js +21 -0
  56. package/public/assets/color.fragment-CDn4ZgkT.js.br +0 -0
  57. package/public/assets/color.fragment-CDn4ZgkT.js.gz +0 -0
  58. package/public/assets/color.vertex-CaMOSKlC.js +39 -0
  59. package/public/assets/color.vertex-CaMOSKlC.js.br +5 -0
  60. package/public/assets/color.vertex-CaMOSKlC.js.gz +0 -0
  61. package/public/assets/color.vertex-dgbB6mhK.js +32 -0
  62. package/public/assets/color.vertex-dgbB6mhK.js.br +0 -0
  63. package/public/assets/color.vertex-dgbB6mhK.js.gz +0 -0
  64. package/public/assets/dds-3J0FZYX1.js +1 -0
  65. package/public/assets/dds-3J0FZYX1.js.br +0 -0
  66. package/public/assets/dds-3J0FZYX1.js.gz +0 -0
  67. package/public/assets/ddsTextureLoader-s5HptTVZ.js +1 -0
  68. package/public/assets/ddsTextureLoader-s5HptTVZ.js.br +0 -0
  69. package/public/assets/ddsTextureLoader-s5HptTVZ.js.gz +0 -0
  70. package/public/assets/default.fragment-C4xg7O-P.js +526 -0
  71. package/public/assets/default.fragment-C4xg7O-P.js.br +0 -0
  72. package/public/assets/default.fragment-C4xg7O-P.js.gz +0 -0
  73. package/public/assets/default.fragment-C4zjkcFb.js +468 -0
  74. package/public/assets/default.fragment-C4zjkcFb.js.br +0 -0
  75. package/public/assets/default.fragment-C4zjkcFb.js.gz +0 -0
  76. package/public/assets/default.vertex-A8wQopNr.js +193 -0
  77. package/public/assets/default.vertex-A8wQopNr.js.br +0 -0
  78. package/public/assets/default.vertex-A8wQopNr.js.gz +0 -0
  79. package/public/assets/default.vertex-YrvIUn4x.js +181 -0
  80. package/public/assets/default.vertex-YrvIUn4x.js.br +0 -0
  81. package/public/assets/default.vertex-YrvIUn4x.js.gz +0 -0
  82. package/public/assets/defaultUboDeclaration-C8GCosBM.js +5 -0
  83. package/public/assets/defaultUboDeclaration-C8GCosBM.js.br +0 -0
  84. package/public/assets/defaultUboDeclaration-C8GCosBM.js.gz +0 -0
  85. package/public/assets/defaultUboDeclaration-D26o_DDO.js +7 -0
  86. package/public/assets/defaultUboDeclaration-D26o_DDO.js.br +0 -0
  87. package/public/assets/defaultUboDeclaration-D26o_DDO.js.gz +0 -0
  88. package/public/assets/depth.fragment-Bn8G24s-.js +40 -0
  89. package/public/assets/depth.fragment-Bn8G24s-.js.br +4 -0
  90. package/public/assets/depth.fragment-Bn8G24s-.js.gz +0 -0
  91. package/public/assets/depth.vertex-B2lrdlJh.js +57 -0
  92. package/public/assets/depth.vertex-B2lrdlJh.js.br +0 -0
  93. package/public/assets/depth.vertex-B2lrdlJh.js.gz +0 -0
  94. package/public/assets/depthBoxBlur.fragment-BtTv8wid.js +5 -0
  95. package/public/assets/depthBoxBlur.fragment-BtTv8wid.js.br +0 -0
  96. package/public/assets/depthBoxBlur.fragment-BtTv8wid.js.gz +0 -0
  97. package/public/assets/depthBoxBlur.fragment-DViDG6Vb.js +6 -0
  98. package/public/assets/depthBoxBlur.fragment-DViDG6Vb.js.br +0 -0
  99. package/public/assets/depthBoxBlur.fragment-DViDG6Vb.js.gz +0 -0
  100. package/public/assets/depthOfFieldMerge.fragment-DCspcdWZ.js +26 -0
  101. package/public/assets/depthOfFieldMerge.fragment-DCspcdWZ.js.br +0 -0
  102. package/public/assets/depthOfFieldMerge.fragment-DCspcdWZ.js.gz +0 -0
  103. package/public/assets/depthOfFieldMerge.fragment-Ds-g4Ln8.js +21 -0
  104. package/public/assets/depthOfFieldMerge.fragment-Ds-g4Ln8.js.br +0 -0
  105. package/public/assets/depthOfFieldMerge.fragment-Ds-g4Ln8.js.gz +0 -0
  106. package/public/assets/dynamicTexture-Cuby-VOT.js +1329 -0
  107. package/public/assets/dynamicTexture-Cuby-VOT.js.br +0 -0
  108. package/public/assets/dynamicTexture-Cuby-VOT.js.gz +0 -0
  109. package/public/assets/easing-DbzzrXOl.js +1 -0
  110. package/public/assets/easing-DbzzrXOl.js.br +0 -0
  111. package/public/assets/easing-DbzzrXOl.js.gz +0 -0
  112. package/public/assets/editor-core-plugin-host-c2002442.js +1 -0
  113. package/public/assets/editor-core-plugin-host-c2002442.js.br +0 -0
  114. package/public/assets/editor-core-plugin-host-c2002442.js.gz +0 -0
  115. package/public/assets/exrTextureLoader-D39k4eK_.js +1 -0
  116. package/public/assets/exrTextureLoader-D39k4eK_.js.br +0 -0
  117. package/public/assets/exrTextureLoader-D39k4eK_.js.gz +0 -0
  118. package/public/assets/flowGraphArrayIndexBlock-C8nTWR8h.js +1 -0
  119. package/public/assets/flowGraphArrayIndexBlock-C8nTWR8h.js.br +0 -0
  120. package/public/assets/flowGraphArrayIndexBlock-C8nTWR8h.js.gz +0 -0
  121. package/public/assets/flowGraphBezierCurveEasingBlock-Izh7s0Zh.js +1 -0
  122. package/public/assets/flowGraphBezierCurveEasingBlock-Izh7s0Zh.js.br +0 -0
  123. package/public/assets/flowGraphBezierCurveEasingBlock-Izh7s0Zh.js.gz +0 -0
  124. package/public/assets/flowGraphBinaryOperationBlock-BRfalQP5.js +1 -0
  125. package/public/assets/flowGraphBinaryOperationBlock-BRfalQP5.js.br +0 -0
  126. package/public/assets/flowGraphBinaryOperationBlock-BRfalQP5.js.gz +0 -0
  127. package/public/assets/flowGraphBranchBlock-CV_leJX3.js +1 -0
  128. package/public/assets/flowGraphBranchBlock-CV_leJX3.js.br +0 -0
  129. package/public/assets/flowGraphBranchBlock-CV_leJX3.js.gz +0 -0
  130. package/public/assets/flowGraphCachedOperationBlock-BysRM-Ha.js +1 -0
  131. package/public/assets/flowGraphCachedOperationBlock-BysRM-Ha.js.br +2 -0
  132. package/public/assets/flowGraphCachedOperationBlock-BysRM-Ha.js.gz +0 -0
  133. package/public/assets/flowGraphCancelDelayBlock-BK6tDTGy.js +1 -0
  134. package/public/assets/flowGraphCancelDelayBlock-BK6tDTGy.js.br +0 -0
  135. package/public/assets/flowGraphCancelDelayBlock-BK6tDTGy.js.gz +0 -0
  136. package/public/assets/flowGraphCodeExecutionBlock-CQABvaP8.js +1 -0
  137. package/public/assets/flowGraphCodeExecutionBlock-CQABvaP8.js.br +0 -0
  138. package/public/assets/flowGraphCodeExecutionBlock-CQABvaP8.js.gz +0 -0
  139. package/public/assets/flowGraphConditionalDataBlock-D7OU_UOM.js +1 -0
  140. package/public/assets/flowGraphConditionalDataBlock-D7OU_UOM.js.br +0 -0
  141. package/public/assets/flowGraphConditionalDataBlock-D7OU_UOM.js.gz +0 -0
  142. package/public/assets/flowGraphConsoleLogBlock-BBxVDGOV.js +1 -0
  143. package/public/assets/flowGraphConsoleLogBlock-BBxVDGOV.js.br +0 -0
  144. package/public/assets/flowGraphConsoleLogBlock-BBxVDGOV.js.gz +0 -0
  145. package/public/assets/flowGraphConstantBlock-Cn3ZMGR0.js +1 -0
  146. package/public/assets/flowGraphConstantBlock-Cn3ZMGR0.js.br +0 -0
  147. package/public/assets/flowGraphConstantBlock-Cn3ZMGR0.js.gz +0 -0
  148. package/public/assets/flowGraphContextBlock-BS3b2XbE.js +1 -0
  149. package/public/assets/flowGraphContextBlock-BS3b2XbE.js.br +0 -0
  150. package/public/assets/flowGraphContextBlock-BS3b2XbE.js.gz +0 -0
  151. package/public/assets/flowGraphCounterBlock-xdcRCw4l.js +1 -0
  152. package/public/assets/flowGraphCounterBlock-xdcRCw4l.js.br +0 -0
  153. package/public/assets/flowGraphCounterBlock-xdcRCw4l.js.gz +0 -0
  154. package/public/assets/flowGraphDataSwitchBlock-dY8TSZtd.js +1 -0
  155. package/public/assets/flowGraphDataSwitchBlock-dY8TSZtd.js.br +0 -0
  156. package/public/assets/flowGraphDataSwitchBlock-dY8TSZtd.js.gz +0 -0
  157. package/public/assets/flowGraphDebounceBlock-Q_f2x-ID.js +1 -0
  158. package/public/assets/flowGraphDebounceBlock-Q_f2x-ID.js.br +0 -0
  159. package/public/assets/flowGraphDebounceBlock-Q_f2x-ID.js.gz +0 -0
  160. package/public/assets/flowGraphDoNBlock-COo31G00.js +1 -0
  161. package/public/assets/flowGraphDoNBlock-COo31G00.js.br +0 -0
  162. package/public/assets/flowGraphDoNBlock-COo31G00.js.gz +0 -0
  163. package/public/assets/flowGraphEasingBlock-jGW-fKIB.js +1 -0
  164. package/public/assets/flowGraphEasingBlock-jGW-fKIB.js.br +0 -0
  165. package/public/assets/flowGraphEasingBlock-jGW-fKIB.js.gz +0 -0
  166. package/public/assets/flowGraphFlipFlopBlock-B8znf-3o.js +1 -0
  167. package/public/assets/flowGraphFlipFlopBlock-B8znf-3o.js.br +0 -0
  168. package/public/assets/flowGraphFlipFlopBlock-B8znf-3o.js.gz +0 -0
  169. package/public/assets/flowGraphForLoopBlock-UxZSh8US.js +1 -0
  170. package/public/assets/flowGraphForLoopBlock-UxZSh8US.js.br +0 -0
  171. package/public/assets/flowGraphForLoopBlock-UxZSh8US.js.gz +0 -0
  172. package/public/assets/flowGraphFunctionReferenceBlock-c3ZQWBhk.js +1 -0
  173. package/public/assets/flowGraphFunctionReferenceBlock-c3ZQWBhk.js.br +0 -0
  174. package/public/assets/flowGraphFunctionReferenceBlock-c3ZQWBhk.js.gz +0 -0
  175. package/public/assets/flowGraphGetAssetBlock-B3zYUZmJ.js +1 -0
  176. package/public/assets/flowGraphGetAssetBlock-B3zYUZmJ.js.br +0 -0
  177. package/public/assets/flowGraphGetAssetBlock-B3zYUZmJ.js.gz +0 -0
  178. package/public/assets/flowGraphGetPropertyBlock-D--vcmMS.js +1 -0
  179. package/public/assets/flowGraphGetPropertyBlock-D--vcmMS.js.br +0 -0
  180. package/public/assets/flowGraphGetPropertyBlock-D--vcmMS.js.gz +0 -0
  181. package/public/assets/flowGraphGetVariableBlock-BkCEyiL6.js +1 -0
  182. package/public/assets/flowGraphGetVariableBlock-BkCEyiL6.js.br +0 -0
  183. package/public/assets/flowGraphGetVariableBlock-BkCEyiL6.js.gz +0 -0
  184. package/public/assets/flowGraphIndexOfBlock-C4ipR7YB.js +1 -0
  185. package/public/assets/flowGraphIndexOfBlock-C4ipR7YB.js.br +0 -0
  186. package/public/assets/flowGraphIndexOfBlock-C4ipR7YB.js.gz +0 -0
  187. package/public/assets/flowGraphInterpolationBlock-DuRc3LX7.js +1 -0
  188. package/public/assets/flowGraphInterpolationBlock-DuRc3LX7.js.br +0 -0
  189. package/public/assets/flowGraphInterpolationBlock-DuRc3LX7.js.gz +0 -0
  190. package/public/assets/flowGraphJsonPointerParserBlock-urEWktqi.js +1 -0
  191. package/public/assets/flowGraphJsonPointerParserBlock-urEWktqi.js.br +0 -0
  192. package/public/assets/flowGraphJsonPointerParserBlock-urEWktqi.js.gz +0 -0
  193. package/public/assets/flowGraphMathBlocks-CGTCQVqz.js +1 -0
  194. package/public/assets/flowGraphMathBlocks-CGTCQVqz.js.br +0 -0
  195. package/public/assets/flowGraphMathBlocks-CGTCQVqz.js.gz +0 -0
  196. package/public/assets/flowGraphMathCombineExtractBlocks-DDHGbRPt.js +1 -0
  197. package/public/assets/flowGraphMathCombineExtractBlocks-DDHGbRPt.js.br +0 -0
  198. package/public/assets/flowGraphMathCombineExtractBlocks-DDHGbRPt.js.gz +0 -0
  199. package/public/assets/flowGraphMatrixMathBlocks-Bwp1BysB.js +1 -0
  200. package/public/assets/flowGraphMatrixMathBlocks-Bwp1BysB.js.br +0 -0
  201. package/public/assets/flowGraphMatrixMathBlocks-Bwp1BysB.js.gz +0 -0
  202. package/public/assets/flowGraphMeshPickEventBlock-2wkqhQCG.js +1 -0
  203. package/public/assets/flowGraphMeshPickEventBlock-2wkqhQCG.js.br +0 -0
  204. package/public/assets/flowGraphMeshPickEventBlock-2wkqhQCG.js.gz +0 -0
  205. package/public/assets/flowGraphMultiGateBlock-BuKmvqC8.js +1 -0
  206. package/public/assets/flowGraphMultiGateBlock-BuKmvqC8.js.br +0 -0
  207. package/public/assets/flowGraphMultiGateBlock-BuKmvqC8.js.gz +0 -0
  208. package/public/assets/flowGraphPauseAnimationBlock-T_-VP-t5.js +1 -0
  209. package/public/assets/flowGraphPauseAnimationBlock-T_-VP-t5.js.br +0 -0
  210. package/public/assets/flowGraphPauseAnimationBlock-T_-VP-t5.js.gz +0 -0
  211. package/public/assets/flowGraphPlayAnimationBlock-DDVrE__n.js +1 -0
  212. package/public/assets/flowGraphPlayAnimationBlock-DDVrE__n.js.br +0 -0
  213. package/public/assets/flowGraphPlayAnimationBlock-DDVrE__n.js.gz +0 -0
  214. package/public/assets/flowGraphPointerOutEventBlock-Cx15Sf5R.js +1 -0
  215. package/public/assets/flowGraphPointerOutEventBlock-Cx15Sf5R.js.br +0 -0
  216. package/public/assets/flowGraphPointerOutEventBlock-Cx15Sf5R.js.gz +0 -0
  217. package/public/assets/flowGraphPointerOverEventBlock-DzzHa-dN.js +1 -0
  218. package/public/assets/flowGraphPointerOverEventBlock-DzzHa-dN.js.br +0 -0
  219. package/public/assets/flowGraphPointerOverEventBlock-DzzHa-dN.js.gz +0 -0
  220. package/public/assets/flowGraphReceiveCustomEventBlock-DKfLODu3.js +1 -0
  221. package/public/assets/flowGraphReceiveCustomEventBlock-DKfLODu3.js.br +0 -0
  222. package/public/assets/flowGraphReceiveCustomEventBlock-DKfLODu3.js.gz +0 -0
  223. package/public/assets/flowGraphSceneReadyEventBlock-ClJu3s64.js +1 -0
  224. package/public/assets/flowGraphSceneReadyEventBlock-ClJu3s64.js.br +0 -0
  225. package/public/assets/flowGraphSceneReadyEventBlock-ClJu3s64.js.gz +0 -0
  226. package/public/assets/flowGraphSceneTickEventBlock-3ZNr4eqw.js +1 -0
  227. package/public/assets/flowGraphSceneTickEventBlock-3ZNr4eqw.js.br +0 -0
  228. package/public/assets/flowGraphSceneTickEventBlock-3ZNr4eqw.js.gz +0 -0
  229. package/public/assets/flowGraphSendCustomEventBlock-CdKQeuma.js +1 -0
  230. package/public/assets/flowGraphSendCustomEventBlock-CdKQeuma.js.br +0 -0
  231. package/public/assets/flowGraphSendCustomEventBlock-CdKQeuma.js.gz +0 -0
  232. package/public/assets/flowGraphSequenceBlock-D0-_bFV3.js +1 -0
  233. package/public/assets/flowGraphSequenceBlock-D0-_bFV3.js.br +0 -0
  234. package/public/assets/flowGraphSequenceBlock-D0-_bFV3.js.gz +0 -0
  235. package/public/assets/flowGraphSetDelayBlock-B8946WOc.js +1 -0
  236. package/public/assets/flowGraphSetDelayBlock-B8946WOc.js.br +0 -0
  237. package/public/assets/flowGraphSetDelayBlock-B8946WOc.js.gz +0 -0
  238. package/public/assets/flowGraphSetPropertyBlock-Cx0IyW-a.js +1 -0
  239. package/public/assets/flowGraphSetPropertyBlock-Cx0IyW-a.js.br +0 -0
  240. package/public/assets/flowGraphSetPropertyBlock-Cx0IyW-a.js.gz +0 -0
  241. package/public/assets/flowGraphSetVariableBlock-0dns_CH6.js +1 -0
  242. package/public/assets/flowGraphSetVariableBlock-0dns_CH6.js.br +0 -0
  243. package/public/assets/flowGraphSetVariableBlock-0dns_CH6.js.gz +0 -0
  244. package/public/assets/flowGraphStopAnimationBlock-z4ou311H.js +1 -0
  245. package/public/assets/flowGraphStopAnimationBlock-z4ou311H.js.br +0 -0
  246. package/public/assets/flowGraphStopAnimationBlock-z4ou311H.js.gz +0 -0
  247. package/public/assets/flowGraphSwitchBlock-E7meS39u.js +1 -0
  248. package/public/assets/flowGraphSwitchBlock-E7meS39u.js.br +0 -0
  249. package/public/assets/flowGraphSwitchBlock-E7meS39u.js.gz +0 -0
  250. package/public/assets/flowGraphThrottleBlock-CldHJDs6.js +1 -0
  251. package/public/assets/flowGraphThrottleBlock-CldHJDs6.js.br +0 -0
  252. package/public/assets/flowGraphThrottleBlock-CldHJDs6.js.gz +0 -0
  253. package/public/assets/flowGraphTransformCoordinatesSystemBlock-pYdpcwK7.js +1 -0
  254. package/public/assets/flowGraphTransformCoordinatesSystemBlock-pYdpcwK7.js.br +0 -0
  255. package/public/assets/flowGraphTransformCoordinatesSystemBlock-pYdpcwK7.js.gz +0 -0
  256. package/public/assets/flowGraphTypeToTypeBlocks-CYfvLPJ-.js +1 -0
  257. package/public/assets/flowGraphTypeToTypeBlocks-CYfvLPJ-.js.br +0 -0
  258. package/public/assets/flowGraphTypeToTypeBlocks-CYfvLPJ-.js.gz +0 -0
  259. package/public/assets/flowGraphUnaryOperationBlock-s-kJ99D8.js +1 -0
  260. package/public/assets/flowGraphUnaryOperationBlock-s-kJ99D8.js.br +0 -0
  261. package/public/assets/flowGraphUnaryOperationBlock-s-kJ99D8.js.gz +0 -0
  262. package/public/assets/flowGraphVectorMathBlocks-D7iofIoY.js +1 -0
  263. package/public/assets/flowGraphVectorMathBlocks-D7iofIoY.js.br +0 -0
  264. package/public/assets/flowGraphVectorMathBlocks-D7iofIoY.js.gz +0 -0
  265. package/public/assets/flowGraphWaitAllBlock-CAW7HgUP.js +1 -0
  266. package/public/assets/flowGraphWaitAllBlock-CAW7HgUP.js.br +0 -0
  267. package/public/assets/flowGraphWaitAllBlock-CAW7HgUP.js.gz +0 -0
  268. package/public/assets/flowGraphWhileLoopBlock-DRP9_Zd1.js +1 -0
  269. package/public/assets/flowGraphWhileLoopBlock-DRP9_Zd1.js.br +0 -0
  270. package/public/assets/flowGraphWhileLoopBlock-DRP9_Zd1.js.gz +0 -0
  271. package/public/assets/fogFragmentDeclaration-CzUy86ul.js +22 -0
  272. package/public/assets/fogFragmentDeclaration-CzUy86ul.js.br +0 -0
  273. package/public/assets/fogFragmentDeclaration-CzUy86ul.js.gz +0 -0
  274. package/public/assets/fogFragmentDeclaration-kfcrkpgB.js +23 -0
  275. package/public/assets/fogFragmentDeclaration-kfcrkpgB.js.br +0 -0
  276. package/public/assets/fogFragmentDeclaration-kfcrkpgB.js.gz +0 -0
  277. package/public/assets/glowBlurPostProcess.fragment-CS_rTtUL.js +7 -0
  278. package/public/assets/glowBlurPostProcess.fragment-CS_rTtUL.js.br +0 -0
  279. package/public/assets/glowBlurPostProcess.fragment-CS_rTtUL.js.gz +0 -0
  280. package/public/assets/glowBlurPostProcess.fragment-G_xfSiIr.js +7 -0
  281. package/public/assets/glowBlurPostProcess.fragment-G_xfSiIr.js.br +0 -0
  282. package/public/assets/glowBlurPostProcess.fragment-G_xfSiIr.js.gz +0 -0
  283. package/public/assets/glowMapGeneration.fragment-DwJ3bpr6.js +63 -0
  284. package/public/assets/glowMapGeneration.fragment-DwJ3bpr6.js.br +0 -0
  285. package/public/assets/glowMapGeneration.fragment-DwJ3bpr6.js.gz +0 -0
  286. package/public/assets/glowMapGeneration.fragment-mDEHNZRi.js +63 -0
  287. package/public/assets/glowMapGeneration.fragment-mDEHNZRi.js.br +0 -0
  288. package/public/assets/glowMapGeneration.fragment-mDEHNZRi.js.gz +0 -0
  289. package/public/assets/glowMapGeneration.vertex-BACa9-r4.js +75 -0
  290. package/public/assets/glowMapGeneration.vertex-BACa9-r4.js.br +0 -0
  291. package/public/assets/glowMapGeneration.vertex-BACa9-r4.js.gz +0 -0
  292. package/public/assets/glowMapGeneration.vertex-mAWUJxSB.js +75 -0
  293. package/public/assets/glowMapGeneration.vertex-mAWUJxSB.js.br +3 -0
  294. package/public/assets/glowMapGeneration.vertex-mAWUJxSB.js.gz +0 -0
  295. package/public/assets/glowMapMerge.fragment-0Im35OVD.js +23 -0
  296. package/public/assets/glowMapMerge.fragment-0Im35OVD.js.br +0 -0
  297. package/public/assets/glowMapMerge.fragment-0Im35OVD.js.gz +0 -0
  298. package/public/assets/glowMapMerge.fragment-BXHfrWgL.js +25 -0
  299. package/public/assets/glowMapMerge.fragment-BXHfrWgL.js.br +0 -0
  300. package/public/assets/glowMapMerge.fragment-BXHfrWgL.js.gz +0 -0
  301. package/public/assets/glowMapMerge.vertex-8A2ntYoS.js +7 -0
  302. package/public/assets/glowMapMerge.vertex-8A2ntYoS.js.br +0 -0
  303. package/public/assets/glowMapMerge.vertex-8A2ntYoS.js.gz +0 -0
  304. package/public/assets/glowMapMerge.vertex-Cnm-5WLT.js +8 -0
  305. package/public/assets/glowMapMerge.vertex-Cnm-5WLT.js.br +0 -0
  306. package/public/assets/glowMapMerge.vertex-Cnm-5WLT.js.gz +0 -0
  307. package/public/assets/grain.fragment-BMGi-Hgp.js +6 -0
  308. package/public/assets/grain.fragment-BMGi-Hgp.js.br +0 -0
  309. package/public/assets/grain.fragment-BMGi-Hgp.js.gz +0 -0
  310. package/public/assets/grain.fragment-CH9zg05c.js +5 -0
  311. package/public/assets/grain.fragment-CH9zg05c.js.br +0 -0
  312. package/public/assets/grain.fragment-CH9zg05c.js.gz +0 -0
  313. package/public/assets/harmonicsFunctions-BQTTvws3.js +192 -0
  314. package/public/assets/harmonicsFunctions-BQTTvws3.js.br +0 -0
  315. package/public/assets/harmonicsFunctions-BQTTvws3.js.gz +0 -0
  316. package/public/assets/harmonicsFunctions-DtIiYWL1.js +189 -0
  317. package/public/assets/harmonicsFunctions-DtIiYWL1.js.br +0 -0
  318. package/public/assets/harmonicsFunctions-DtIiYWL1.js.gz +0 -0
  319. package/public/assets/hdrTextureLoader-Dqvpv0kr.js +2 -0
  320. package/public/assets/hdrTextureLoader-Dqvpv0kr.js.br +0 -0
  321. package/public/assets/hdrTextureLoader-Dqvpv0kr.js.gz +0 -0
  322. package/public/assets/iesTextureLoader-B8AoKSG2.js +2 -0
  323. package/public/assets/iesTextureLoader-B8AoKSG2.js.br +0 -0
  324. package/public/assets/iesTextureLoader-B8AoKSG2.js.gz +0 -0
  325. package/public/assets/index-CiIoJ8v1.js +4 -0
  326. package/public/assets/index-CiIoJ8v1.js.br +0 -0
  327. package/public/assets/index-CiIoJ8v1.js.gz +0 -0
  328. package/public/assets/index-Dhf9rSmv.js +1 -0
  329. package/public/assets/index-Dhf9rSmv.js.br +0 -0
  330. package/public/assets/index-Dhf9rSmv.js.gz +0 -0
  331. package/public/assets/instancesDeclaration-B2a0VuuR.js +23 -0
  332. package/public/assets/instancesDeclaration-B2a0VuuR.js.br +0 -0
  333. package/public/assets/instancesDeclaration-B2a0VuuR.js.gz +0 -0
  334. package/public/assets/ktxTextureLoader-DTr7AKqG.js +1 -0
  335. package/public/assets/ktxTextureLoader-DTr7AKqG.js.br +0 -0
  336. package/public/assets/ktxTextureLoader-DTr7AKqG.js.gz +0 -0
  337. package/public/assets/lazy-Cj-01uhW.js +2 -0
  338. package/public/assets/lazy-Cj-01uhW.js.br +0 -0
  339. package/public/assets/lazy-Cj-01uhW.js.gz +0 -0
  340. package/public/assets/lod.fragment-BuvQbBhE.js +3 -0
  341. package/public/assets/lod.fragment-BuvQbBhE.js.br +0 -0
  342. package/public/assets/lod.fragment-BuvQbBhE.js.gz +0 -0
  343. package/public/assets/lod.fragment-Cp0eqGjl.js +3 -0
  344. package/public/assets/lod.fragment-Cp0eqGjl.js.br +3 -0
  345. package/public/assets/lod.fragment-Cp0eqGjl.js.gz +0 -0
  346. package/public/assets/lodCube.fragment-CI1eTppS.js +22 -0
  347. package/public/assets/lodCube.fragment-CI1eTppS.js.br +2 -0
  348. package/public/assets/lodCube.fragment-CI1eTppS.js.gz +0 -0
  349. package/public/assets/lodCube.fragment-yDzV1teg.js +22 -0
  350. package/public/assets/lodCube.fragment-yDzV1teg.js.br +0 -0
  351. package/public/assets/lodCube.fragment-yDzV1teg.js.gz +0 -0
  352. package/public/assets/logDepthDeclaration-CeLLOhuK.js +4 -0
  353. package/public/assets/logDepthDeclaration-XDsVKoT0.js +4 -0
  354. package/public/assets/logDepthFragment-BPP-rBiT.js +4 -0
  355. package/public/assets/logDepthFragment-BPP-rBiT.js.br +0 -0
  356. package/public/assets/logDepthFragment-BPP-rBiT.js.gz +0 -0
  357. package/public/assets/logDepthFragment-CDaMyvfH.js +4 -0
  358. package/public/assets/logDepthVertex-CkFa6uAf.js +4 -0
  359. package/public/assets/logDepthVertex-CkFa6uAf.js.br +0 -0
  360. package/public/assets/logDepthVertex-CkFa6uAf.js.gz +0 -0
  361. package/public/assets/logDepthVertex-H6E8NLz1.js +4 -0
  362. package/public/assets/logDepthVertex-H6E8NLz1.js.br +1 -0
  363. package/public/assets/logDepthVertex-H6E8NLz1.js.gz +0 -0
  364. package/public/assets/mainUVVaryingDeclaration-DdwP8xi_.js +4 -0
  365. package/public/assets/mainUVVaryingDeclaration-OBB3LR8s.js +4 -0
  366. package/public/assets/mesh.vertexData.functions-BXkNVxNr.js +1 -0
  367. package/public/assets/mesh.vertexData.functions-BXkNVxNr.js.br +0 -0
  368. package/public/assets/mesh.vertexData.functions-BXkNVxNr.js.gz +0 -0
  369. package/public/assets/meshUboDeclaration-Cr5YhBB1.js +13 -0
  370. package/public/assets/meshUboDeclaration-Cr5YhBB1.js.br +0 -0
  371. package/public/assets/meshUboDeclaration-Cr5YhBB1.js.gz +0 -0
  372. package/public/assets/meshUboDeclaration-Uj1CsoJP.js +13 -0
  373. package/public/assets/meshUboDeclaration-Uj1CsoJP.js.br +0 -0
  374. package/public/assets/meshUboDeclaration-Uj1CsoJP.js.gz +0 -0
  375. package/public/assets/morphTargetsVertex-B9xWvV_u.js +100 -0
  376. package/public/assets/morphTargetsVertex-B9xWvV_u.js.br +0 -0
  377. package/public/assets/morphTargetsVertex-B9xWvV_u.js.gz +0 -0
  378. package/public/assets/oitFinalSimpleBlend.fragment-4NtZHGOG.js +3 -0
  379. package/public/assets/oitFinalSimpleBlend.fragment-4NtZHGOG.js.br +0 -0
  380. package/public/assets/oitFinalSimpleBlend.fragment-4NtZHGOG.js.gz +0 -0
  381. package/public/assets/oitFinalSimpleBlend.fragment-D8T6jyS0.js +2 -0
  382. package/public/assets/oitFinalSimpleBlend.fragment-D8T6jyS0.js.br +3 -0
  383. package/public/assets/oitFinalSimpleBlend.fragment-D8T6jyS0.js.gz +0 -0
  384. package/public/assets/oitFragment-CK8Y-Z-q.js +1202 -0
  385. package/public/assets/oitFragment-CK8Y-Z-q.js.br +0 -0
  386. package/public/assets/oitFragment-CK8Y-Z-q.js.gz +0 -0
  387. package/public/assets/oitFragment-ZUHesxAg.js +1077 -0
  388. package/public/assets/oitFragment-ZUHesxAg.js.br +0 -0
  389. package/public/assets/oitFragment-ZUHesxAg.js.gz +0 -0
  390. package/public/assets/openpbrMaterial-Dc7VVRl6.js +2 -0
  391. package/public/assets/openpbrMaterial-Dc7VVRl6.js.br +0 -0
  392. package/public/assets/openpbrMaterial-Dc7VVRl6.js.gz +0 -0
  393. package/public/assets/outline.fragment-BK0vgcx7.js +21 -0
  394. package/public/assets/outline.fragment-BK0vgcx7.js.br +0 -0
  395. package/public/assets/outline.fragment-BK0vgcx7.js.gz +0 -0
  396. package/public/assets/outline.fragment-DQK2JikO.js +18 -0
  397. package/public/assets/outline.fragment-DQK2JikO.js.br +0 -0
  398. package/public/assets/outline.fragment-DQK2JikO.js.gz +0 -0
  399. package/public/assets/outline.vertex-CHR7GZYH.js +47 -0
  400. package/public/assets/outline.vertex-CHR7GZYH.js.br +0 -0
  401. package/public/assets/outline.vertex-CHR7GZYH.js.gz +0 -0
  402. package/public/assets/outline.vertex-CKcILDiL.js +47 -0
  403. package/public/assets/outline.vertex-CKcILDiL.js.br +0 -0
  404. package/public/assets/outline.vertex-CKcILDiL.js.gz +0 -0
  405. package/public/assets/passCube.fragment-Ch6aeybh.js +23 -0
  406. package/public/assets/passCube.fragment-Ch6aeybh.js.br +0 -0
  407. package/public/assets/passCube.fragment-Ch6aeybh.js.gz +0 -0
  408. package/public/assets/passCube.fragment-wvJ8mb6_.js +23 -0
  409. package/public/assets/passCube.fragment-wvJ8mb6_.js.br +0 -0
  410. package/public/assets/passCube.fragment-wvJ8mb6_.js.gz +0 -0
  411. package/public/assets/pbr.fragment-Bo4XM7Ct.js +3277 -0
  412. package/public/assets/pbr.fragment-Bo4XM7Ct.js.br +0 -0
  413. package/public/assets/pbr.fragment-Bo4XM7Ct.js.gz +0 -0
  414. package/public/assets/pbr.fragment-T2xKI2J0.js +3327 -0
  415. package/public/assets/pbr.fragment-T2xKI2J0.js.br +0 -0
  416. package/public/assets/pbr.fragment-T2xKI2J0.js.gz +0 -0
  417. package/public/assets/pbr.vertex-BezAbBHx.js +357 -0
  418. package/public/assets/pbr.vertex-BezAbBHx.js.br +0 -0
  419. package/public/assets/pbr.vertex-BezAbBHx.js.gz +0 -0
  420. package/public/assets/pbr.vertex-w2ZWBdHy.js +227 -0
  421. package/public/assets/pbr.vertex-w2ZWBdHy.js.br +0 -0
  422. package/public/assets/pbr.vertex-w2ZWBdHy.js.gz +0 -0
  423. package/public/assets/playable-sdk-zAYuBOLj.js +8 -0
  424. package/public/assets/playable-sdk-zAYuBOLj.js.br +0 -0
  425. package/public/assets/playable-sdk-zAYuBOLj.js.gz +0 -0
  426. package/public/assets/playable-standard-project-Brbyn9c4.js +5140 -0
  427. package/public/assets/playable-standard-project-Brbyn9c4.js.br +0 -0
  428. package/public/assets/playable-standard-project-Brbyn9c4.js.gz +0 -0
  429. package/public/assets/rgbdDecode.fragment-BQ16CsAv.js +5 -0
  430. package/public/assets/rgbdDecode.fragment-BQ16CsAv.js.br +4 -0
  431. package/public/assets/rgbdDecode.fragment-BQ16CsAv.js.gz +0 -0
  432. package/public/assets/rgbdDecode.fragment-D_2CJy2O.js +5 -0
  433. package/public/assets/rgbdDecode.fragment-D_2CJy2O.js.br +0 -0
  434. package/public/assets/rgbdDecode.fragment-D_2CJy2O.js.gz +0 -0
  435. package/public/assets/rgbdEncode.fragment-CmDv6yEZ.js +5 -0
  436. package/public/assets/rgbdEncode.fragment-CmDv6yEZ.js.br +3 -0
  437. package/public/assets/rgbdEncode.fragment-CmDv6yEZ.js.gz +0 -0
  438. package/public/assets/rgbdEncode.fragment-QRg2h8KC.js +5 -0
  439. package/public/assets/rgbdEncode.fragment-QRg2h8KC.js.br +1 -0
  440. package/public/assets/rgbdEncode.fragment-QRg2h8KC.js.gz +0 -0
  441. package/public/assets/sceneLoader-CDreObGG.js +1 -0
  442. package/public/assets/sceneLoader-CDreObGG.js.br +0 -0
  443. package/public/assets/sceneLoader-CDreObGG.js.gz +0 -0
  444. package/public/assets/screenSpaceCurvature.fragment-BWdr_4iW.js +15 -0
  445. package/public/assets/screenSpaceCurvature.fragment-BWdr_4iW.js.br +0 -0
  446. package/public/assets/screenSpaceCurvature.fragment-BWdr_4iW.js.gz +0 -0
  447. package/public/assets/selection.fragment-CVXAuXcC.js +35 -0
  448. package/public/assets/selection.fragment-CVXAuXcC.js.br +0 -0
  449. package/public/assets/selection.fragment-CVXAuXcC.js.gz +0 -0
  450. package/public/assets/selection.fragment-DobH4NRw.js +35 -0
  451. package/public/assets/selection.fragment-DobH4NRw.js.br +0 -0
  452. package/public/assets/selection.fragment-DobH4NRw.js.gz +0 -0
  453. package/public/assets/selection.vertex-BUBv8X1j.js +74 -0
  454. package/public/assets/selection.vertex-BUBv8X1j.js.br +0 -0
  455. package/public/assets/selection.vertex-BUBv8X1j.js.gz +0 -0
  456. package/public/assets/selection.vertex-DlADXBtf.js +73 -0
  457. package/public/assets/selection.vertex-DlADXBtf.js.br +0 -0
  458. package/public/assets/selection.vertex-DlADXBtf.js.gz +0 -0
  459. package/public/assets/selectionOutline.fragment-CWpNrg8m.js +47 -0
  460. package/public/assets/selectionOutline.fragment-CWpNrg8m.js.br +0 -0
  461. package/public/assets/selectionOutline.fragment-CWpNrg8m.js.gz +0 -0
  462. package/public/assets/selectionOutline.fragment-DoKuUf2L.js +48 -0
  463. package/public/assets/selectionOutline.fragment-DoKuUf2L.js.br +0 -0
  464. package/public/assets/selectionOutline.fragment-DoKuUf2L.js.gz +0 -0
  465. package/public/assets/shadowMap.fragment-BEwhnKOg.js +78 -0
  466. package/public/assets/shadowMap.fragment-BEwhnKOg.js.br +0 -0
  467. package/public/assets/shadowMap.fragment-BEwhnKOg.js.gz +0 -0
  468. package/public/assets/shadowMap.fragment-CVar4C4N.js +79 -0
  469. package/public/assets/shadowMap.fragment-CVar4C4N.js.br +0 -0
  470. package/public/assets/shadowMap.fragment-CVar4C4N.js.gz +0 -0
  471. package/public/assets/shadowMap.vertex-ImOoSjTb.js +109 -0
  472. package/public/assets/shadowMap.vertex-ImOoSjTb.js.br +0 -0
  473. package/public/assets/shadowMap.vertex-ImOoSjTb.js.gz +0 -0
  474. package/public/assets/shadowMap.vertex-Q2d15P5z.js +119 -0
  475. package/public/assets/shadowMap.vertex-Q2d15P5z.js.br +0 -0
  476. package/public/assets/shadowMap.vertex-Q2d15P5z.js.gz +0 -0
  477. package/public/assets/shadowMapFragmentSoftTransparentShadow-BmxybqRD.js +4 -0
  478. package/public/assets/shadowMapFragmentSoftTransparentShadow-BmxybqRD.js.br +0 -0
  479. package/public/assets/shadowMapFragmentSoftTransparentShadow-BmxybqRD.js.gz +0 -0
  480. package/public/assets/shadowMapFragmentSoftTransparentShadow-D6ZvWsNy.js +4 -0
  481. package/public/assets/shadowMapFragmentSoftTransparentShadow-D6ZvWsNy.js.br +0 -0
  482. package/public/assets/shadowMapFragmentSoftTransparentShadow-D6ZvWsNy.js.gz +0 -0
  483. package/public/assets/sharpen.fragment-CI40r28S.js +8 -0
  484. package/public/assets/sharpen.fragment-CI40r28S.js.br +0 -0
  485. package/public/assets/sharpen.fragment-CI40r28S.js.gz +0 -0
  486. package/public/assets/textureMerger.fragment-BGsvQGn5.js +84 -0
  487. package/public/assets/textureMerger.fragment-BGsvQGn5.js.br +0 -0
  488. package/public/assets/textureMerger.fragment-BGsvQGn5.js.gz +0 -0
  489. package/public/assets/textureMerger.fragment-Q7yPwkGt.js +76 -0
  490. package/public/assets/textureMerger.fragment-Q7yPwkGt.js.br +0 -0
  491. package/public/assets/textureMerger.fragment-Q7yPwkGt.js.gz +0 -0
  492. package/public/assets/tgaTextureLoader-D7Pjisvo.js +1 -0
  493. package/public/assets/tgaTextureLoader-D7Pjisvo.js.br +0 -0
  494. package/public/assets/tgaTextureLoader-D7Pjisvo.js.gz +0 -0
  495. package/public/assets/vertexColorMixing-CwuEx4gP.js +20 -0
  496. package/public/assets/vertexColorMixing-CwuEx4gP.js.br +0 -0
  497. package/public/assets/vertexColorMixing-CwuEx4gP.js.gz +0 -0
  498. package/public/assets/vertexColorMixing-DRlcGbEu.js +24 -0
  499. package/public/assets/vertexColorMixing-DRlcGbEu.js.br +2 -0
  500. package/public/assets/vertexColorMixing-DRlcGbEu.js.gz +0 -0
  501. package/public/assets/volumetricLightingBlendVolume.fragment-0VKaEyya.js +12 -0
  502. package/public/assets/volumetricLightingBlendVolume.fragment-0VKaEyya.js.br +0 -0
  503. package/public/assets/volumetricLightingBlendVolume.fragment-0VKaEyya.js.gz +0 -0
  504. package/public/assets/volumetricLightingBlendVolume.fragment-BZLjMggm.js +11 -0
  505. package/public/assets/volumetricLightingBlendVolume.fragment-BZLjMggm.js.br +0 -0
  506. package/public/assets/volumetricLightingBlendVolume.fragment-BZLjMggm.js.gz +0 -0
  507. package/public/assets/volumetricLightingRenderVolume.fragment-6GAsdyvE.js +15 -0
  508. package/public/assets/volumetricLightingRenderVolume.fragment-6GAsdyvE.js.br +0 -0
  509. package/public/assets/volumetricLightingRenderVolume.fragment-6GAsdyvE.js.gz +0 -0
  510. package/public/assets/volumetricLightingRenderVolume.fragment-Da_DpfG1.js +13 -0
  511. package/public/assets/volumetricLightingRenderVolume.fragment-Da_DpfG1.js.br +0 -0
  512. package/public/assets/volumetricLightingRenderVolume.fragment-Da_DpfG1.js.gz +0 -0
  513. package/public/assets/volumetricLightingRenderVolume.vertex-BdVFX-tC.js +4 -0
  514. package/public/assets/volumetricLightingRenderVolume.vertex-BdVFX-tC.js.br +0 -0
  515. package/public/assets/volumetricLightingRenderVolume.vertex-BdVFX-tC.js.gz +0 -0
  516. package/public/assets/volumetricLightingRenderVolume.vertex-DO-VIhJn.js +5 -0
  517. package/public/assets/volumetricLightingRenderVolume.vertex-DO-VIhJn.js.br +0 -0
  518. package/public/assets/volumetricLightingRenderVolume.vertex-DO-VIhJn.js.gz +0 -0
  519. package/public/assets/webAudioBus-BkMWEG1L.js +1 -0
  520. package/public/assets/webAudioBus-BkMWEG1L.js.br +0 -0
  521. package/public/assets/webAudioBus-BkMWEG1L.js.gz +0 -0
  522. package/public/assets/webAudioMainBus-DYcQXAkm.js +1 -0
  523. package/public/assets/webAudioMainBus-DYcQXAkm.js.br +0 -0
  524. package/public/assets/webAudioMainBus-DYcQXAkm.js.gz +0 -0
  525. package/public/assets/workerPool-H9Ji3mCo.js +1 -0
  526. package/public/assets/workerPool-H9Ji3mCo.js.br +2 -0
  527. package/public/assets/workerPool-H9Ji3mCo.js.gz +0 -0
  528. package/public/index.html +21 -0
  529. package/public/index.html.br +0 -0
  530. package/public/index.html.gz +0 -0
  531. package/runtime/editor-control-plane.mjs +5 -0
  532. package/runtime/runtime-debug-authoring-bridge.mjs +1 -0
  533. package/worker/editor-service-worker.mjs +27 -0
@@ -0,0 +1,3277 @@
1
+ import{fr as e}from"./dynamicTexture-Cuby-VOT.js";import"./oitFragment-ZUHesxAg.js";import"./harmonicsFunctions-BQTTvws3.js";import"./mainUVVaryingDeclaration-OBB3LR8s.js";import"./clipPlaneFragment-Bgl3Usc4.js";import"./logDepthDeclaration-XDsVKoT0.js";import"./fogFragmentDeclaration-CzUy86ul.js";import"./logDepthFragment-BPP-rBiT.js";import"./meshUboDeclaration-Uj1CsoJP.js";const r="pbrFragmentExtraDeclaration",y=`varying vPositionW: vec3f;
2
+ #if DEBUGMODE>0
3
+ varying vClipSpacePosition: vec4f;
4
+ #endif
5
+ #include<mainUVVaryingDeclaration>[1..7]
6
+ #ifdef NORMAL
7
+ varying vNormalW: vec3f;
8
+ #if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
9
+ varying vEnvironmentIrradiance: vec3f;
10
+ #endif
11
+ #endif
12
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
13
+ varying vColor: vec4f;
14
+ #endif
15
+ #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
16
+ varying vViewDepth: f32;
17
+ #endif
18
+ `;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=y);const a="samplerFragmentAlternateDeclaration",V=`#ifdef _DEFINENAME_
19
+ #if _DEFINENAME_DIRECTUV==1
20
+ #define v_VARYINGNAME_UV vMainUV1
21
+ #elif _DEFINENAME_DIRECTUV==2
22
+ #define v_VARYINGNAME_UV vMainUV2
23
+ #elif _DEFINENAME_DIRECTUV==3
24
+ #define v_VARYINGNAME_UV vMainUV3
25
+ #elif _DEFINENAME_DIRECTUV==4
26
+ #define v_VARYINGNAME_UV vMainUV4
27
+ #elif _DEFINENAME_DIRECTUV==5
28
+ #define v_VARYINGNAME_UV vMainUV5
29
+ #elif _DEFINENAME_DIRECTUV==6
30
+ #define v_VARYINGNAME_UV vMainUV6
31
+ #else
32
+ varying v_VARYINGNAME_UV: vec2f;
33
+ #endif
34
+ #endif
35
+ `;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=V);const n="pbrFragmentSamplersDeclaration",x=`#include<samplerFragmentDeclaration>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)
36
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)
37
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)
38
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
39
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
40
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
41
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
42
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)
43
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)
44
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)
45
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)
46
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
47
+ #ifdef CLEARCOAT
48
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)
49
+ #include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)
50
+ #if defined(CLEARCOAT_TEXTURE_ROUGHNESS)
51
+ var clearCoatRoughnessSamplerSampler: sampler;var clearCoatRoughnessSampler: texture_2d<f32>;
52
+ #endif
53
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)
54
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)
55
+ #endif
56
+ #ifdef IRIDESCENCE
57
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)
58
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)
59
+ #endif
60
+ #ifdef SHEEN
61
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)
62
+ #include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)
63
+ #if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS)
64
+ var sheenRoughnessSamplerSampler: sampler;var sheenRoughnessSampler: texture_2d<f32>;
65
+ #endif
66
+ #endif
67
+ #ifdef ANISOTROPIC
68
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)
69
+ #endif
70
+ #ifdef REFLECTION
71
+ #ifdef REFLECTIONMAP_3D
72
+ var reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube<f32>;
73
+ #ifdef LODBASEDMICROSFURACE
74
+ #else
75
+ var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube<f32>;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube<f32>;
76
+ #endif
77
+ #ifdef USEIRRADIANCEMAP
78
+ var irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube<f32>;
79
+ #endif
80
+ #else
81
+ var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d<f32>;
82
+ #ifdef LODBASEDMICROSFURACE
83
+ #else
84
+ var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d<f32>;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d<f32>;
85
+ #endif
86
+ #ifdef USEIRRADIANCEMAP
87
+ var irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d<f32>;
88
+ #endif
89
+ #endif
90
+ #ifdef REFLECTIONMAP_SKYBOX
91
+ varying vPositionUVW: vec3f;
92
+ #else
93
+ #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
94
+ varying vDirectionW: vec3f;
95
+ #endif
96
+ #endif
97
+ #endif
98
+ #ifdef ENVIRONMENTBRDF
99
+ var environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d<f32>;
100
+ #endif
101
+ #ifdef SUBSURFACE
102
+ #ifdef SS_REFRACTION
103
+ #ifdef SS_REFRACTIONMAP_3D
104
+ var refractionSamplerSampler: sampler;var refractionSampler: texture_cube<f32>;
105
+ #ifdef LODBASEDMICROSFURACE
106
+ #else
107
+ var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_cube<f32>;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_cube<f32>;
108
+ #endif
109
+ #else
110
+ var refractionSamplerSampler: sampler;var refractionSampler: texture_2d<f32>;
111
+ #ifdef LODBASEDMICROSFURACE
112
+ #else
113
+ var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_2d<f32>;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_2d<f32>;
114
+ #endif
115
+ #endif
116
+ #endif
117
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)
118
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)
119
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)
120
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor)
121
+ #endif
122
+ #ifdef IBL_CDF_FILTERING
123
+ var icdfSamplerSampler: sampler;var icdfSampler: texture_2d<f32>;
124
+ #endif
125
+ `;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=x);const f="subSurfaceScatteringFunctions",H=`fn testLightingForSSS(diffusionProfile: f32)->bool
126
+ {return diffusionProfile<1.;}`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=H);const t="importanceSampling",W=`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);}
127
+ 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);}
128
+ fn hemisphereImportanceSampleDggxAnisotropic(Xi: vec2f,alphaTangent: f32,alphaBitangent: f32)->vec3f
129
+ {let alphaT: f32=max(alphaTangent,0.0001);let alphaB: f32=max(alphaBitangent,0.0001);var phi: f32=atan(alphaB/alphaT*tan(2.0f*PI*Xi.x));if (Xi.x>0.5) {phi+=PI; }
130
+ let cosPhi: f32=cos(phi);let sinPhi: f32=sin(phi);let alpha2: f32=(cosPhi*cosPhi)/(alphaT*alphaT) +
131
+ (sinPhi*sinPhi)/(alphaB*alphaB);let tanTheta2: f32=Xi.y/(1.0f-Xi.y)/alpha2;let cosTheta: f32=1.0f/sqrt(1.0f+tanTheta2);let sinTheta: f32=sqrt(max(0.0f,1.0f-cosTheta*cosTheta));return vec3f(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);}
132
+ fn hemisphereImportanceSampleDCharlie(u: vec2f,a: f32)->vec3f {
133
+ 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);}`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=W);const o="pbrHelperFunctions",Y=`#define MINIMUMVARIANCE 0.0005
134
+ fn convertRoughnessToAverageSlope(roughness: f32)->f32
135
+ {return roughness*roughness+MINIMUMVARIANCE;}
136
+ fn fresnelGrazingReflectance(reflectance0: f32)->f32 {var reflectance90: f32=saturate(reflectance0*25.0);return reflectance90;}
137
+ fn getAARoughnessFactors(normalVector: vec3f)->vec2f {
138
+ #ifdef SPECULARAA
139
+ 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);
140
+ #else
141
+ return vec2f(0.);
142
+ #endif
143
+ }
144
+ #ifdef ANISOTROPIC
145
+ #ifdef ANISOTROPIC_LEGACY
146
+ 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);}
147
+ 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;}
148
+ #elif ANISOTROPIC_OPENPBR
149
+ fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(alphaG*alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy))),MINIMUMVARIANCE);var alphaB: f32=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}
150
+ #else
151
+ 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);}
152
+ 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;}
153
+ #endif
154
+ #endif
155
+ #if defined(CLEARCOAT) || defined(SS_REFRACTION)
156
+ fn cocaLambertVec3(alpha: vec3f,distance: f32)->vec3f {return exp(-alpha*distance);}
157
+ fn cocaLambert(NdotVRefract: f32,NdotLRefract: f32,alpha: vec3f,thickness: f32)->vec3f {return cocaLambertVec3(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
158
+ fn computeColorAtDistanceInMedia(color: vec3f,distance: f32)->vec3f {return -log(color)/distance;}
159
+ fn computeClearCoatAbsorption(NdotVRefract: f32,NdotLRefract: f32,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var clearCoatAbsorption: vec3f=mix( vec3f(1.0),
160
+ cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
161
+ clearCoatIntensity);return clearCoatAbsorption;}
162
+ #endif
163
+ #ifdef MICROSURFACEAUTOMATIC
164
+ fn computeDefaultMicroSurface(microSurface: f32,reflectivityColor: vec3f)->f32
165
+ {const kReflectivityNoAlphaWorkflow_SmoothnessMax: f32=0.95;var reflectivityLuminance: f32=getLuminance(reflectivityColor);var reflectivityLuma: f32=sqrt(reflectivityLuminance);var resultMicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return resultMicroSurface;}
166
+ #endif
167
+ `;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=Y);const c="pbrDirectLightingSetupFunctions",w=`struct preLightingInfo
168
+ {lightOffset: vec3f,
169
+ lightDistanceSquared: f32,
170
+ lightDistance: f32,
171
+ attenuation: f32,
172
+ L: vec3f,
173
+ H: vec3f,
174
+ NdotV: f32,
175
+ NdotLUnclamped: f32,
176
+ NdotL: f32,
177
+ VdotH: f32,
178
+ LdotV: f32,
179
+ roughness: f32,
180
+ diffuseRoughness: f32,
181
+ surfaceAlbedo: vec3f,
182
+ #ifdef IRIDESCENCE
183
+ iridescenceIntensity: f32
184
+ #endif
185
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
186
+ areaLightDiffuse: vec3f,
187
+ #ifdef SPECULARTERM
188
+ areaLightSpecular: vec3f,
189
+ areaLightFresnel: vec4f
190
+ #endif
191
+ #endif
192
+ };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;}
193
+ 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);result.LdotV=dot(result.L,V);return result;}
194
+ 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;
195
+ #ifdef SPECULARTERM
196
+ result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
197
+ #endif
198
+ return result;}
199
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
200
+ #include<ltcHelperFunctions>
201
+ var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d<f32>;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d<f32>;fn computeAreaPreLightingInfo(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightCenter:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->preLightingInfo {var result: preLightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightCenter,halfWidth,halfHeight,roughness);
202
+ #ifdef SPECULARTERM
203
+ result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
204
+ #endif
205
+ result.areaLightDiffuse+=data.Diffuse;return result;}
206
+ fn computeAreaPreLightingInfoWithTexture(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,emissionTexture:texture_2d<f32>,emissionTextureSampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightCenter:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->preLightingInfo {var result: preLightingInfo;result.lightOffset=lightCenter-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);var data: areaLightData=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc1Sampler,ltc2,ltc2Sampler,emissionTexture,emissionTextureSampler,viewDirectionW,vNormal,vPosition,lightCenter,halfWidth,halfHeight,roughness);
207
+ #ifdef SPECULARTERM
208
+ result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
209
+ #endif
210
+ result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3f(0.);return result;}
211
+ #endif
212
+ `;e.IncludesShadersStoreWGSL[c]||(e.IncludesShadersStoreWGSL[c]=w);const l="pbrDirectLightingFalloffFunctions",X=`fn computeDistanceLightFalloff_Standard(lightOffset: vec3f,range: f32)->f32
213
+ {return max(0.,1.0-length(lightOffset)/range);}
214
+ fn computeDistanceLightFalloff_Physical(lightDistanceSquared: f32)->f32
215
+ {return 1.0/maxEps(lightDistanceSquared);}
216
+ fn computeDistanceLightFalloff_GLTF(lightDistanceSquared: f32,inverseSquaredRange: f32)->f32
217
+ {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;}
218
+ fn computeDirectionalLightFalloff_IES(lightDirection: vec3f,directionToLightCenterW: vec3f,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->f32
219
+ {var cosAngle: f32=dot(-lightDirection,directionToLightCenterW);var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}
220
+ fn computeDistanceLightFalloff(lightOffset: vec3f,lightDistanceSquared: f32,range: f32,inverseSquaredRange: f32)->f32
221
+ {
222
+ #ifdef USEPHYSICALLIGHTFALLOFF
223
+ return computeDistanceLightFalloff_Physical(lightDistanceSquared);
224
+ #elif defined(USEGLTFLIGHTFALLOFF)
225
+ return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
226
+ #else
227
+ return computeDistanceLightFalloff_Standard(lightOffset,range);
228
+ #endif
229
+ }
230
+ fn computeDirectionalLightFalloff_Standard(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32)->f32
231
+ {var falloff: f32=0.0;var cosAngle: f32=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
232
+ {falloff=max(0.,pow(cosAngle,exponent));}
233
+ return falloff;}
234
+ fn computeDirectionalLightFalloff_Physical(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32)->f32
235
+ {const kMinusLog2ConeAngleIntensityRatio: f32=6.64385618977;
236
+ 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;}
237
+ fn computeDirectionalLightFalloff_GLTF(lightDirection: vec3f,directionToLightCenterW: vec3f,lightAngleScale: f32,lightAngleOffset: f32)->f32
238
+ {var cd: f32=dot(-lightDirection,directionToLightCenterW);var falloff: f32=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
239
+ fn computeDirectionalLightFalloff(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32,lightAngleScale: f32,lightAngleOffset: f32)->f32
240
+ {
241
+ #ifdef USEPHYSICALLIGHTFALLOFF
242
+ return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
243
+ #elif defined(USEGLTFLIGHTFALLOFF)
244
+ return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
245
+ #else
246
+ return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
247
+ #endif
248
+ }`;e.IncludesShadersStoreWGSL[l]||(e.IncludesShadersStoreWGSL[l]=X);const s="hdrFilteringFunctions",k=`#ifdef NUM_SAMPLES
249
+ #if NUM_SAMPLES>0
250
+ fn radicalInverse_VdC(value: u32)->f32
251
+ {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; }
252
+ fn hammersley(i: u32,N: u32)->vec2f
253
+ {return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}
254
+ fn log4(x: f32)->f32 {return log2(x)/2.;}
255
+ fn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}
256
+ const NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(
257
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
258
+ CUSTOM_IRRADIANCE_FILTERING_INPUT
259
+ #else
260
+ inputTexture: texture_cube<f32>,inputSampler: sampler,
261
+ #endif
262
+ inputN: vec3f,
263
+ filteringInfo: vec2f,
264
+ diffuseRoughness: f32,
265
+ surfaceAlbedo: vec3f,
266
+ inputV: vec3f
267
+ #ifdef IBL_CDF_FILTERING
268
+ ,icdfSampler: texture_2d<f32>,icdfSamplerSampler: sampler
269
+ #endif
270
+ )->vec3f
271
+ {var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0);
272
+ #ifndef IBL_CDF_FILTERING
273
+ 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 tbnInverse: mat3x3f=transpose(tbn);
274
+ #endif
275
+ var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));for(var i: u32=0u; i<NUM_SAMPLES; i++)
276
+ {var Xi: vec2f=hammersley(i,NUM_SAMPLES);
277
+ #ifdef IBL_CDF_FILTERING
278
+ var T: vec2f;T.x=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(Xi.x,0.0),0.0).x;T.y=textureSampleLevel(icdfSampler,icdfSamplerSampler,vec2(T.x,Xi.y),0.0).y;var Ls: vec3f=uv_to_normal(vec2f(1.0-fract(T.x+0.25),T.y));var NoL: f32=dot(n,Ls);var NoV: f32=dot(n,inputV);
279
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
280
+ var LoV: f32=dot(Ls,inputV);
281
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
282
+ var H: vec3f=(inputV+Ls)*0.5;var VoH: f32=dot(inputV,H);
283
+ #endif
284
+ #else
285
+ var Ls: vec3f=hemisphereCosSample(Xi);Ls=normalize(Ls);var Ns: vec3f= vec3f(0.,0.,1.);var NoL: f32=dot(Ns,Ls);var V: vec3f=tbnInverse*inputV;var NoV: f32=dot(Ns,V);
286
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
287
+ var LoV: f32=dot(Ls,V);
288
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
289
+ var H: vec3f=(V+Ls)*0.5;var VoH: f32=dot(V,H);
290
+ #endif
291
+ #endif
292
+ if (NoL>0.) {
293
+ #ifdef IBL_CDF_FILTERING
294
+ var pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb;
295
+ #else
296
+ 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);
297
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
298
+ CUSTOM_IRRADIANCE_FILTERING_FUNCTION
299
+ #else
300
+ var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;
301
+ #endif
302
+ #endif
303
+ #ifdef GAMMA_INPUT
304
+ c=toLinearSpaceVec3(c);
305
+ #endif
306
+ var diffuseRoughnessTerm: vec3f=vec3f(1.0);
307
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
308
+ diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;
309
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
310
+ diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
311
+ #endif
312
+ #ifdef IBL_CDF_FILTERING
313
+ var light: vec3f=vec3f(0.0);if (pdf>1e-6) {light=vec3f(1.0)/vec3f(pdf)*c;}
314
+ result+=NoL*diffuseRoughnessTerm*light;
315
+ #else
316
+ result+=c*diffuseRoughnessTerm;
317
+ #endif
318
+ }}
319
+ result=result*NUM_SAMPLES_FLOAT_INVERSED;
320
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
321
+ result=result/clampedAlbedo;
322
+ #endif
323
+ return result;}
324
+ fn radiance(alphaG: f32,inputTexture: texture_cube<f32>,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f
325
+ {var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb;
326
+ if (alphaG==0.) {
327
+ #ifdef GAMMA_INPUT
328
+ c=toLinearSpaceVec3(c);
329
+ #endif
330
+ 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++)
331
+ {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;
332
+ #ifdef GAMMA_INPUT
333
+ c=toLinearSpaceVec3(c);
334
+ #endif
335
+ result+=c*NoL;}}
336
+ result=result/weight;return result;}}
337
+ #ifdef ANISOTROPIC
338
+ fn radianceAnisotropic(
339
+ alphaTangent: f32,
340
+ alphaBitangent: f32,
341
+ inputTexture: texture_cube<f32>,
342
+ inputSampler: sampler,
343
+ inputView: vec3f,
344
+ inputTangent: vec3f,
345
+ inputBitangent: vec3f,
346
+ inputNormal: vec3f,
347
+ filteringInfo: vec2f,
348
+ noiseInput: vec2f,
349
+ isRefraction: bool,
350
+ ior: f32
351
+ )->vec3f {var V: vec3f=inputView;var N: vec3f=inputNormal;var T: vec3f=inputTangent;var B: vec3f=inputBitangent;var result: vec3f=vec3f(0.f);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;let clampedAlphaT: f32=max(alphaTangent,MINIMUMVARIANCE);let clampedAlphaB: f32=max(alphaBitangent,MINIMUMVARIANCE);var effectiveDim: f32=dim0*sqrt(clampedAlphaT*clampedAlphaB);var omegaP: f32=(4.f*PI)/(6.f*effectiveDim*effectiveDim);let noiseScale: f32=clamp(log2(f32(NUM_SAMPLES))/12.0f,0.0f,1.0f);var weight: f32=0.f;for(var i: u32=0u; i<NUM_SAMPLES; i++)
352
+ {var Xi: vec2f=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5f,0.015f,noiseScale));
353
+ var H_tangent: vec3f=hemisphereImportanceSampleDggxAnisotropic(Xi,clampedAlphaT,clampedAlphaB);var H: vec3f=normalize(H_tangent.x*T+H_tangent.y*B+H_tangent.z*N);var L: vec3f;if (isRefraction) {L=refract(-V,H,1.0/ior);} else {L=reflect(-V,H);}
354
+ var NoH: f32=max(dot(N,H),0.001f);var VoH: f32=max(dot(V,H),0.001f);var NoL: f32=max(dot(N,L),0.001f);if (NoL>0.f) {var pdf_inversed: f32=4./normalDistributionFunction_BurleyGGX_Anisotropic(
355
+ H_tangent.z,H_tangent.x,H_tangent.y,vec2f(clampedAlphaT,clampedAlphaB)
356
+ );var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0f,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,L,mipLevel).rgb;
357
+ #if GAMMA_INPUT
358
+ c=toLinearSpaceVec3(c);
359
+ #endif
360
+ result+=c*NoL;}}
361
+ result=result/weight;return result;}
362
+ #endif
363
+ #endif
364
+ #endif
365
+ `;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=k);const d="pbrBlockReflectance0",z=`var reflectanceF0: f32=reflectivityOut.reflectanceF0;var specularEnvironmentR0: vec3f=reflectivityOut.colorReflectanceF0;var specularEnvironmentR90: vec3f= reflectivityOut.reflectanceF90;
366
+ #ifdef ALPHAFRESNEL
367
+ var reflectance90: f32=fresnelGrazingReflectance(reflectanceF0);specularEnvironmentR90=specularEnvironmentR90*reflectance90;
368
+ #endif
369
+ `;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=z);const E="pbrDirectLightingFunctions",K=`#define CLEARCOATREFLECTANCE90 1.0
370
+ struct lightingInfo
371
+ {diffuse: vec3f,
372
+ #ifdef SS_TRANSLUCENCY
373
+ diffuseTransmission: vec3f,
374
+ #endif
375
+ #ifdef SPECULARTERM
376
+ specular: vec3f,
377
+ #endif
378
+ #ifdef CLEARCOAT
379
+ clearCoat: vec4f,
380
+ #endif
381
+ #ifdef SHEEN
382
+ sheen: vec3f
383
+ #endif
384
+ };fn adjustRoughnessFromLightProperties(roughness: f32,lightRadius: f32,lightDistance: f32)->f32 {
385
+ #if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
386
+ var lightRoughness: f32=lightRadius/lightDistance;var totalRoughness: f32=saturate(lightRoughness+roughness);return totalRoughness;
387
+ #else
388
+ return roughness;
389
+ #endif
390
+ }
391
+ fn computeHemisphericDiffuseLighting(info: preLightingInfo,lightColor: vec3f,groundColor: vec3f)->vec3f {return mix(groundColor,lightColor,info.NdotL);}
392
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
393
+ fn computeAreaDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {return info.areaLightDiffuse*lightColor;}
394
+ #endif
395
+ fn computeDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {var diffuseTerm: vec3f=vec3f(1.0/PI);
396
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
397
+ diffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
398
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
399
+ diffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
400
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
401
+ var clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
402
+ #endif
403
+ return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
404
+ 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);}
405
+ #ifdef SS_TRANSLUCENCY
406
+ fn computeDiffuseTransmittedLighting(info: preLightingInfo,lightColor: vec3f,transmittance: vec3f)->vec3f {var transmittanceNdotL=vec3f(0.0);var NdotL: f32=absEps(info.NdotLUnclamped);
407
+ #ifndef SS_TRANSLUCENCY_LEGACY
408
+ if (info.NdotLUnclamped<0.0) {
409
+ #endif
410
+ var wrapNdotL: f32=computeWrappedDiffuseNdotL(NdotL,0.02);var trAdapt: f32=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL, vec3f(wrapNdotL),trAdapt);
411
+ #ifndef SS_TRANSLUCENCY_LEGACY
412
+ }
413
+ var diffuseTerm : vec3f=vec3f(1.0/PI);
414
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
415
+ diffuseTerm=vec3f(diffuseBRDF_Burley(
416
+ info.NdotL,info.NdotV,info.VdotH,info.roughness));
417
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
418
+ diffuseTerm=vec3f(diffuseBRDF_Burley(
419
+ info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
420
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
421
+ var clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,
422
+ info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
423
+ #endif
424
+ return (transmittanceNdotL*diffuseTerm)*info.attenuation*lightColor;
425
+ #else
426
+ let diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;
427
+ #endif
428
+ }
429
+ #endif
430
+ #ifdef SPECULARTERM
431
+ fn computeSpecularLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,fresnel: 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 modifiedFresnel: vec3f=fresnel;
432
+ #ifdef IRIDESCENCE
433
+ modifiedFresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
434
+ #endif
435
+ var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
436
+ #ifdef BRDF_V_HEIGHT_CORRELATED
437
+ var smithVisibility: f32=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
438
+ #else
439
+ var smithVisibility: f32=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
440
+ #endif
441
+ var specTerm: vec3f=modifiedFresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
442
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
443
+ fn computeAreaSpecularLighting(info: preLightingInfo,specularColor: vec3f,reflectance0: vec3f,reflectance90: vec3f)->vec3f {var fresnel:vec3f =reflectance0*specularColor*info.areaLightFresnel.x+( vec3f( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}
444
+ #endif
445
+ #endif
446
+ #ifdef FUZZ
447
+ fn evalFuzz(L: vec3f,NdotL: f32,NdotV: f32,T: vec3f,B: vec3f,ltcLut: vec3f)->f32
448
+ {if (NdotL<=0.0f || NdotV<=0.0f) {return 0.0f;}
449
+ let M=mat3x3f(
450
+ vec3f(ltcLut.r,0.0f,0.0f),
451
+ vec3f(ltcLut.g,1.0f,0.0f),
452
+ vec3f(0.0f,0.0f,1.0f)
453
+ );let Llocal: vec3f=vec3f(dot(L,T),dot(L,B),NdotL);let Lwarp: vec3f=normalize(M*Llocal);let cosThetaWarp: f32=max(Lwarp.z,0.0f);return cosThetaWarp*NdotL;}
454
+ #endif
455
+ #if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)
456
+ fn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,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);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=vec3f(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}
457
+ #elif defined(ANISOTROPIC)
458
+ 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);
459
+ #ifdef IRIDESCENCE
460
+ fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
461
+ #endif
462
+ 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;}
463
+ #endif
464
+ #ifdef CLEARCOAT
465
+ 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(
466
+ clearCoatTerm*info.attenuation*NccdotL*lightColor,
467
+ 1.0-fresnel
468
+ );}
469
+ 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;}
470
+ #endif
471
+ #ifdef SHEEN
472
+ 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
473
+ var visibility: f32=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
474
+ #else */
475
+ var visibility: f32=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
476
+ var sheenTerm: f32=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
477
+ #endif
478
+ #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
479
+ #include<clusteredLightingFunctions>
480
+ fn computeClusteredLighting(
481
+ lightDataTexture: texture_2d<f32>,
482
+ tileMaskBuffer: ptr<storage,array<u32>>,
483
+ lightData: vec4f,
484
+ sliceRange: vec2u,
485
+ V: vec3f,
486
+ N: vec3f,
487
+ posW: vec3f,
488
+ surfaceAlbedo: vec3f,
489
+ reflectivityOut: reflectivityOutParams,
490
+ #ifdef IRIDESCENCE
491
+ iridescenceIntensity: f32,
492
+ #endif
493
+ #ifdef SS_TRANSLUCENCY
494
+ subSurfaceOut: subSurfaceOutParams,
495
+ #endif
496
+ #ifdef SPECULARTERM
497
+ AARoughnessFactor: f32,
498
+ #endif
499
+ #ifdef ANISOTROPIC
500
+ anisotropicOut: anisotropicOutParams,
501
+ #endif
502
+ #ifdef SHEEN
503
+ sheenOut: sheenOutParams,
504
+ #endif
505
+ #ifdef CLEARCOAT
506
+ clearcoatOut: clearcoatOutParams,
507
+ #endif
508
+ )->lightingInfo {let NdotV=absEps(dot(N,V));
509
+ #include<pbrBlockReflectance0>
510
+ #ifdef CLEARCOAT
511
+ specularEnvironmentR0=clearcoatOut.specularEnvironmentR0;
512
+ #endif
513
+ var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset;
514
+ let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<<trailing;let light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+trailing);var preInfo=computePointAndSpotPreLightingInfo(light.vLightData,V,N,posW);preInfo.NdotV=NdotV;preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light.vLightFalloff.x,light.vLightFalloff.y);if light.vLightDirection.w>=0.0 {preInfo.attenuation*=computeDirectionalLightFalloff(light.vLightDirection.xyz,preInfo.L,light.vLightDirection.w,light.vLightData.w,light.vLightFalloff.z,light.vLightFalloff.w);}
515
+ preInfo.roughness=adjustRoughnessFromLightProperties(reflectivityOut.roughness,light.vLightSpecular.a,preInfo.lightDistance);preInfo.diffuseRoughness=reflectivityOut.diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo;
516
+ #ifdef IRIDESCENCE
517
+ preInfo.iridescenceIntensity=iridescenceIntensity;
518
+ #endif
519
+ var info: lightingInfo;
520
+ #ifdef SS_TRANSLUCENCY
521
+ #ifdef SS_TRANSLUCENCY_LEGACY
522
+ info.diffuse=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);info.diffuseTransmission=vec3(0);
523
+ #else
524
+ info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);
525
+ #endif
526
+ #else
527
+ info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb);
528
+ #endif
529
+ #ifdef SPECULARTERM
530
+ #if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR
531
+ let metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);let coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);
532
+ #else
533
+ let coloredFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90);
534
+ #endif
535
+ #ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION
536
+ let NdotH=dot(N,preInfo.H);let fresnel=fresnelSchlickGGXVec3(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel);
537
+ #endif
538
+ #ifdef ANISOTROPIC
539
+ info.specular=computeAnisotropicSpecularLighting(preInfo,V,N,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb);
540
+ #else
541
+ info.specular=computeSpecularLighting(preInfo,N,specularEnvironmentR0,coloredFresnel,AARoughnessFactor,light.vLightDiffuse.rgb);
542
+ #endif
543
+ #endif
544
+ #ifdef SHEEN
545
+ #ifdef SHEEN_LINKWITHALBEDO
546
+ preInfo.roughness=sheenOut.sheenIntensity;
547
+ #else
548
+ preInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light.vLightSpecular.a,preInfo.lightDistance);
549
+ #endif
550
+ info.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb);
551
+ #endif
552
+ #ifdef CLEARCOAT
553
+ preInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light.vLightSpecular.a,preInfo.lightDistance);info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light.vLightDiffuse.rgb);
554
+ #ifdef CLEARCOAT_TINT
555
+ let absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;
556
+ #ifdef SS_TRANSLUCENCY
557
+ info.diffuseTransmission*=absorption;
558
+ #endif
559
+ #ifdef SPECULARTERM
560
+ info.specular*=absorption;
561
+ #endif
562
+ #endif
563
+ info.diffuse*=info.clearCoat.w;
564
+ #ifdef SS_TRANSLUCENCY
565
+ info.diffuseTransmission*=info.clearCoat.w;
566
+ #endif
567
+ #ifdef SPECULARTERM
568
+ info.specular*=info.clearCoat.w;
569
+ #endif
570
+ #ifdef SHEEN
571
+ info.sheen*=info.clearCoat.w;
572
+ #endif
573
+ #endif
574
+ result.diffuse+=info.diffuse;
575
+ #ifdef SS_TRANSLUCENCY
576
+ result.diffuseTransmission+=info.diffuseTransmission;
577
+ #endif
578
+ #ifdef SPECULARTERM
579
+ result.specular+=info.specular;
580
+ #endif
581
+ #ifdef CLEARCOAT
582
+ result.clearCoat+=info.clearCoat;
583
+ #endif
584
+ #ifdef SHEEN
585
+ result.sheen+=info.sheen;
586
+ #endif
587
+ }
588
+ batchOffset+=CLUSTLIGHT_BATCH;}
589
+ return result;}
590
+ #endif
591
+ `;e.IncludesShadersStoreWGSL[E]||(e.IncludesShadersStoreWGSL[E]=K);const u="pbrIBLFunctions",$=`#if defined(REFLECTION) || defined(SS_REFRACTION)
592
+ fn getLodFromAlphaG(cubeMapDimensionPixels: f32,microsurfaceAverageSlope: f32)->f32 {var microsurfaceAverageSlopeTexels: f32=cubeMapDimensionPixels*microsurfaceAverageSlope;var lod: f32=log2(microsurfaceAverageSlopeTexels);return lod;}
593
+ fn getLinearLodFromRoughness(cubeMapDimensionPixels: f32,roughness: f32)->f32 {var lod: f32=log2(cubeMapDimensionPixels)*roughness;return lod;}
594
+ #endif
595
+ #if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
596
+ fn environmentRadianceOcclusion(ambientOcclusion: f32,NdotVUnclamped: f32)->f32 {var temp: f32=NdotVUnclamped+ambientOcclusion;return saturate(temp*temp-1.0+ambientOcclusion);}
597
+ #endif
598
+ #if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
599
+ 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;}
600
+ #endif
601
+ #if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
602
+ fn UNPACK_LOD(x: f32)->f32 {return (1.0-x)*255.0;}
603
+ fn getLodFromAlphaGNdotV(cubeMapDimensionPixels: f32,alphaG: f32,NdotV: f32)->f32 {var microsurfaceAverageSlope: f32=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
604
+ #endif
605
+ `;e.IncludesShadersStoreWGSL[u]||(e.IncludesShadersStoreWGSL[u]=$);const m="pbrBlockAlbedoOpacity",q=`struct albedoOpacityOutParams
606
+ {surfaceAlbedo: vec3f,
607
+ alpha: f32};
608
+ #define pbr_inline
609
+ fn albedoOpacityBlock(
610
+ vAlbedoColor: vec4f
611
+ #ifdef ALBEDO
612
+ ,albedoTexture: vec4f
613
+ ,albedoInfos: vec2f
614
+ #endif
615
+ ,baseWeight: f32
616
+ #ifdef BASE_WEIGHT
617
+ ,baseWeightTexture: vec4f
618
+ ,vBaseWeightInfos: vec2f
619
+ #endif
620
+ #ifdef OPACITY
621
+ ,opacityMap: vec4f
622
+ ,vOpacityInfos: vec2f
623
+ #endif
624
+ #ifdef DETAIL
625
+ ,detailColor: vec4f
626
+ ,vDetailInfos: vec4f
627
+ #endif
628
+ #ifdef DECAL
629
+ ,decalColor: vec4f
630
+ ,vDecalInfos: vec4f
631
+ #endif
632
+ )->albedoOpacityOutParams
633
+ {var outParams: albedoOpacityOutParams;var surfaceAlbedo: vec3f=vAlbedoColor.rgb;var alpha: f32=vAlbedoColor.a;
634
+ #ifdef ALBEDO
635
+ #if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)
636
+ alpha*=albedoTexture.a;
637
+ #endif
638
+ #ifdef GAMMAALBEDO
639
+ surfaceAlbedo*=toLinearSpaceVec3(albedoTexture.rgb);
640
+ #else
641
+ surfaceAlbedo*=albedoTexture.rgb;
642
+ #endif
643
+ surfaceAlbedo*=albedoInfos.y;
644
+ #endif
645
+ #ifndef DECAL_AFTER_DETAIL
646
+ #include<decalFragment>
647
+ #endif
648
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
649
+ surfaceAlbedo*=fragmentInputs.vColor.rgb;
650
+ #endif
651
+ #ifdef DETAIL
652
+ var detailAlbedo: f32=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;
653
+ #endif
654
+ #ifdef DECAL_AFTER_DETAIL
655
+ #include<decalFragment>
656
+ #endif
657
+ #define CUSTOM_FRAGMENT_UPDATE_ALBEDO
658
+ surfaceAlbedo*=baseWeight;
659
+ #ifdef BASE_WEIGHT
660
+ surfaceAlbedo*=baseWeightTexture.r;
661
+ #endif
662
+ #ifdef OPACITY
663
+ #ifdef OPACITYRGB
664
+ alpha=getLuminance(opacityMap.rgb);
665
+ #else
666
+ alpha*=opacityMap.a;
667
+ #endif
668
+ alpha*=vOpacityInfos.y;
669
+ #endif
670
+ #if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
671
+ alpha*=fragmentInputs.vColor.a;
672
+ #endif
673
+ #if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)
674
+ #ifdef ALPHATEST
675
+ #if DEBUGMODE != 88
676
+ if (alpha<ALPHATESTVALUE) {discard;}
677
+ #endif
678
+ #ifndef ALPHABLEND
679
+ alpha=1.0;
680
+ #endif
681
+ #endif
682
+ #endif
683
+ outParams.surfaceAlbedo=surfaceAlbedo;outParams.alpha=alpha;return outParams;}
684
+ `;e.IncludesShadersStoreWGSL[m]||(e.IncludesShadersStoreWGSL[m]=q);const S="pbrBlockReflectivity",Z=`struct reflectivityOutParams
685
+ {microSurface: f32,
686
+ roughness: f32,
687
+ diffuseRoughness: f32,
688
+ reflectanceF0: f32,
689
+ reflectanceF90: vec3f,
690
+ colorReflectanceF0: vec3f,
691
+ colorReflectanceF90: vec3f,
692
+ #ifdef METALLICWORKFLOW
693
+ surfaceAlbedo: vec3f,
694
+ metallic: f32,
695
+ specularWeight: f32,
696
+ dielectricColorF0: vec3f,
697
+ #endif
698
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
699
+ ambientOcclusionColor: vec3f,
700
+ #endif
701
+ #if DEBUGMODE>0
702
+ #ifdef METALLICWORKFLOW
703
+ #ifdef REFLECTIVITY
704
+ surfaceMetallicColorMap: vec4f,
705
+ #endif
706
+ metallicF0: vec3f,
707
+ #else
708
+ #ifdef REFLECTIVITY
709
+ surfaceReflectivityColorMap: vec4f,
710
+ #endif
711
+ #endif
712
+ #endif
713
+ };
714
+ #define pbr_inline
715
+ fn reflectivityBlock(
716
+ reflectivityColor: vec4f
717
+ #ifdef METALLICWORKFLOW
718
+ ,surfaceAlbedo: vec3f
719
+ ,metallicReflectanceFactors: vec4f
720
+ #endif
721
+ ,baseDiffuseRoughness: f32
722
+ #ifdef BASE_DIFFUSE_ROUGHNESS
723
+ ,baseDiffuseRoughnessTexture: f32
724
+ ,baseDiffuseRoughnessInfos: vec2f
725
+ #endif
726
+ #ifdef REFLECTIVITY
727
+ ,reflectivityInfos: vec3f
728
+ ,surfaceMetallicOrReflectivityColorMap: vec4f
729
+ #endif
730
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
731
+ ,ambientOcclusionColorIn: vec3f
732
+ #endif
733
+ #ifdef MICROSURFACEMAP
734
+ ,microSurfaceTexel: vec4f
735
+ #endif
736
+ #ifdef DETAIL
737
+ ,detailColor: vec4f
738
+ ,vDetailInfos: vec4f
739
+ #endif
740
+ )->reflectivityOutParams
741
+ {var outParams: reflectivityOutParams;var microSurface: f32=reflectivityColor.a;var surfaceReflectivityColor: vec3f=reflectivityColor.rgb;
742
+ #ifdef METALLICWORKFLOW
743
+ var metallicRoughness: vec2f=surfaceReflectivityColor.rg;var ior: f32=surfaceReflectivityColor.b;
744
+ #ifdef REFLECTIVITY
745
+ #if DEBUGMODE>0
746
+ outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;
747
+ #endif
748
+ #ifdef AOSTOREINMETALMAPRED
749
+ var aoStoreInMetalMap: vec3f= vec3f(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);
750
+ #endif
751
+ #ifdef METALLNESSSTOREINMETALMAPBLUE
752
+ metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;
753
+ #else
754
+ metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;
755
+ #endif
756
+ #ifdef ROUGHNESSSTOREINMETALMAPALPHA
757
+ metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;
758
+ #else
759
+ #ifdef ROUGHNESSSTOREINMETALMAPGREEN
760
+ metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;
761
+ #endif
762
+ #endif
763
+ #endif
764
+ #ifdef DETAIL
765
+ 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));
766
+ #endif
767
+ #ifdef MICROSURFACEMAP
768
+ metallicRoughness.g*=microSurfaceTexel.r;
769
+ #endif
770
+ #define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS
771
+ microSurface=1.0-metallicRoughness.g;var baseColor: vec3f=surfaceAlbedo;outParams.metallic=metallicRoughness.r;outParams.specularWeight=metallicReflectanceFactors.a;var dielectricF0 : f32=reflectivityColor.a*outParams.specularWeight;surfaceReflectivityColor=metallicReflectanceFactors.rgb;
772
+ #if DEBUGMODE>0
773
+ outParams.metallicF0=dielectricF0*surfaceReflectivityColor;
774
+ #endif
775
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
776
+ outParams.surfaceAlbedo=baseColor.rgb*(vec3f(1.0)-vec3f(dielectricF0)*surfaceReflectivityColor)*(1.0-outParams.metallic);
777
+ #else
778
+ outParams.surfaceAlbedo=baseColor.rgb;
779
+ #endif
780
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
781
+ {let reflectivityColor: vec3f=mix(dielectricF0*surfaceReflectivityColor,baseColor.rgb,outParams.metallic);outParams.reflectanceF0=max(reflectivityColor.r,max(reflectivityColor.g,reflectivityColor.b));}
782
+ #else
783
+ #if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF
784
+ let maxF0: f32=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF0=mix(dielectricF0*maxF0,1.0f,outParams.metallic);
785
+ #else
786
+ outParams.reflectanceF0=mix(dielectricF0,1.0,outParams.metallic);
787
+ #endif
788
+ #endif
789
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
790
+ outParams.reflectanceF90=vec3(outParams.specularWeight);var f90Scale: f32=1.0;
791
+ #else
792
+ var f90Scale: f32=clamp(2.0*(ior-1.0),0.0,1.0);outParams.reflectanceF90=vec3(mix(
793
+ outParams.specularWeight*f90Scale,1.0,outParams.metallic));
794
+ #endif
795
+ outParams.dielectricColorF0=vec3f(dielectricF0*surfaceReflectivityColor);var metallicColorF0: vec3f=baseColor.rgb;outParams.colorReflectanceF0=mix(outParams.dielectricColorF0,metallicColorF0,outParams.metallic);
796
+ #if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)
797
+ let dielectricColorF90
798
+ : vec3f=surfaceReflectivityColor *
799
+ vec3f(outParams.specularWeight*f90Scale);
800
+ #else
801
+ let dielectricColorF90
802
+ : vec3f=vec3f(outParams.specularWeight*f90Scale);
803
+ #endif
804
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
805
+ let conductorColorF90: vec3f=surfaceReflectivityColor;
806
+ #else
807
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
808
+ let conductorColorF90: vec3f=outParams.reflectanceF90;
809
+ #else
810
+ let conductorColorF90: vec3f=vec3f(1.0f);
811
+ #endif
812
+ #endif
813
+ outParams.colorReflectanceF90=mix(dielectricColorF90,conductorColorF90,outParams.metallic);
814
+ #else
815
+ #ifdef REFLECTIVITY
816
+ surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;
817
+ #if DEBUGMODE>0
818
+ outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;
819
+ #endif
820
+ #ifdef MICROSURFACEFROMREFLECTIVITYMAP
821
+ microSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z;
822
+ #else
823
+ #ifdef MICROSURFACEAUTOMATIC
824
+ microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
825
+ #endif
826
+ #ifdef MICROSURFACEMAP
827
+ microSurface*=microSurfaceTexel.r;
828
+ #endif
829
+ #define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE
830
+ #endif
831
+ #endif
832
+ outParams.colorReflectanceF0=surfaceReflectivityColor;outParams.reflectanceF0=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF90=vec3f(1.0);
833
+ #if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)
834
+ outParams.colorReflectanceF90=surfaceReflectivityColor;
835
+ #else
836
+ outParams.colorReflectanceF90=vec3(1.0);
837
+ #endif
838
+ #endif
839
+ microSurface=saturate(microSurface);var roughness: f32=1.-microSurface;var diffuseRoughness: f32=baseDiffuseRoughness;
840
+ #ifdef BASE_DIFFUSE_ROUGHNESS
841
+ diffuseRoughness*=baseDiffuseRoughnessTexture*baseDiffuseRoughnessInfos.y;
842
+ #endif
843
+ outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.diffuseRoughness=diffuseRoughness;return outParams;}
844
+ `;e.IncludesShadersStoreWGSL[S]||(e.IncludesShadersStoreWGSL[S]=Z);const v="pbrBlockAmbientOcclusion",j=`struct ambientOcclusionOutParams
845
+ {ambientOcclusionColor: vec3f,
846
+ #if DEBUGMODE>0 && defined(AMBIENT)
847
+ ambientOcclusionColorMap: vec3f
848
+ #endif
849
+ };
850
+ #define pbr_inline
851
+ fn ambientOcclusionBlock(
852
+ #ifdef AMBIENT
853
+ ambientOcclusionColorMap_: vec3f,
854
+ vAmbientInfos: vec4f
855
+ #endif
856
+ )->ambientOcclusionOutParams
857
+ {
858
+ var outParams: ambientOcclusionOutParams;var ambientOcclusionColor: vec3f= vec3f(1.,1.,1.);
859
+ #ifdef AMBIENT
860
+ var ambientOcclusionColorMap: vec3f=ambientOcclusionColorMap_*vAmbientInfos.y;
861
+ #ifdef AMBIENTINGRAYSCALE
862
+ ambientOcclusionColorMap= vec3f(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);
863
+ #endif
864
+ ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);
865
+ #if DEBUGMODE>0
866
+ outParams.ambientOcclusionColorMap=ambientOcclusionColorMap;
867
+ #endif
868
+ #endif
869
+ outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;}
870
+ `;e.IncludesShadersStoreWGSL[v]||(e.IncludesShadersStoreWGSL[v]=j);const R="pbrBlockAlphaFresnel",J=`#ifdef ALPHAFRESNEL
871
+ #if defined(ALPHATEST) || defined(ALPHABLEND)
872
+ struct alphaFresnelOutParams
873
+ {alpha: f32};fn faceforward(N: vec3<f32>,I: vec3<f32>,Nref: vec3<f32>)->vec3<f32> {return select(N,-N,dot(Nref,I)>0.0);}
874
+ #define pbr_inline
875
+ fn alphaFresnelBlock(
876
+ normalW: vec3f,
877
+ viewDirectionW: vec3f,
878
+ alpha: f32,
879
+ microSurface: f32
880
+ )->alphaFresnelOutParams
881
+ {var outParams: alphaFresnelOutParams;var opacityPerceptual: f32=alpha;
882
+ #ifdef LINEARALPHAFRESNEL
883
+ var opacity0: f32=opacityPerceptual;
884
+ #else
885
+ var opacity0: f32=opacityPerceptual*opacityPerceptual;
886
+ #endif
887
+ 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;
888
+ #ifdef ALPHATEST
889
+ if (outParams.alpha<ALPHATESTVALUE) {discard;}
890
+ #ifndef ALPHABLEND
891
+ outParams.alpha=1.0;
892
+ #endif
893
+ #endif
894
+ return outParams;}
895
+ #endif
896
+ #endif
897
+ `;e.IncludesShadersStoreWGSL[R]||(e.IncludesShadersStoreWGSL[R]=J);const p="pbrBlockAnisotropic",Q=`#ifdef ANISOTROPIC
898
+ struct anisotropicOutParams
899
+ {anisotropy: f32,
900
+ anisotropicTangent: vec3f,
901
+ anisotropicBitangent: vec3f,
902
+ anisotropicNormal: vec3f,
903
+ #if DEBUGMODE>0 && defined(ANISOTROPIC_TEXTURE)
904
+ anisotropyMapData: vec3f
905
+ #endif
906
+ };
907
+ #define pbr_inline
908
+ fn anisotropicBlock(
909
+ vAnisotropy: vec3f,
910
+ roughness: f32,
911
+ #ifdef ANISOTROPIC_TEXTURE
912
+ anisotropyMapData: vec3f,
913
+ #endif
914
+ TBN: mat3x3f,
915
+ normalW: vec3f,
916
+ viewDirectionW: vec3f
917
+ )->anisotropicOutParams
918
+ {
919
+ var outParams: anisotropicOutParams;var anisotropy: f32=vAnisotropy.b;var anisotropyDirection: vec3f= vec3f(vAnisotropy.xy,0.);
920
+ #ifdef ANISOTROPIC_TEXTURE
921
+ var amd=anisotropyMapData.rg;anisotropy*=anisotropyMapData.b;
922
+ #if DEBUGMODE>0
923
+ outParams.anisotropyMapData=anisotropyMapData;
924
+ #endif
925
+ amd=amd*2.0-1.0;
926
+ #ifdef ANISOTROPIC_LEGACY
927
+ anisotropyDirection=vec3f(anisotropyDirection.xy*amd,anisotropyDirection.z);
928
+ #else
929
+ anisotropyDirection=vec3f(mat2x2f(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(amd),anisotropyDirection.z);
930
+ #endif
931
+ #endif
932
+ 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;}
933
+ #endif
934
+ `;e.IncludesShadersStoreWGSL[p]||(e.IncludesShadersStoreWGSL[p]=Q);const C="pbrBlockReflection",ee=`#ifdef REFLECTION
935
+ struct reflectionOutParams
936
+ {environmentRadiance: vec4f
937
+ ,environmentIrradiance: vec3f
938
+ #ifdef REFLECTIONMAP_3D
939
+ ,reflectionCoords: vec3f
940
+ #else
941
+ ,reflectionCoords: vec2f
942
+ #endif
943
+ #ifdef SS_TRANSLUCENCY
944
+ #ifdef USESPHERICALFROMREFLECTIONMAP
945
+ #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
946
+ ,irradianceVector: vec3f
947
+ #endif
948
+ #endif
949
+ #endif
950
+ };
951
+ #define pbr_inline
952
+ #ifdef REFLECTIONMAP_3D
953
+ fn createReflectionCoords(
954
+ vPositionW: vec3f,
955
+ normalW: vec3f,
956
+ #ifdef ANISOTROPIC
957
+ anisotropicOut: anisotropicOutParams,
958
+ #endif
959
+ )->vec3f
960
+ {var reflectionCoords: vec3f;
961
+ #else
962
+ fn createReflectionCoords(
963
+ vPositionW: vec3f,
964
+ normalW: vec3f,
965
+ #ifdef ANISOTROPIC
966
+ anisotropicOut: anisotropicOutParams,
967
+ #endif
968
+ )->vec2f
969
+ {
970
+ var reflectionCoords: vec2f;
971
+ #endif
972
+ #ifdef ANISOTROPIC
973
+ var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),anisotropicOut.anisotropicNormal);
974
+ #else
975
+ var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),normalW);
976
+ #endif
977
+ #ifdef REFLECTIONMAP_OPPOSITEZ
978
+ reflectionVector.z*=-1.0;
979
+ #endif
980
+ #ifdef REFLECTIONMAP_3D
981
+ reflectionCoords=reflectionVector;
982
+ #else
983
+ reflectionCoords=reflectionVector.xy;
984
+ #ifdef REFLECTIONMAP_PROJECTION
985
+ reflectionCoords/=reflectionVector.z;
986
+ #endif
987
+ reflectionCoords.y=1.0-reflectionCoords.y;
988
+ #endif
989
+ return reflectionCoords;}
990
+ #define pbr_inline
991
+ fn sampleReflectionTexture(
992
+ alphaG: f32
993
+ ,vReflectionMicrosurfaceInfos: vec3f
994
+ ,vReflectionInfos: vec2f
995
+ ,vReflectionColor: vec3f
996
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
997
+ ,NdotVUnclamped: f32
998
+ #endif
999
+ #ifdef LINEARSPECULARREFLECTION
1000
+ ,roughness: f32
1001
+ #endif
1002
+ #ifdef REFLECTIONMAP_3D
1003
+ ,reflectionSampler: texture_cube<f32>
1004
+ ,reflectionSamplerSampler: sampler
1005
+ ,reflectionCoords: vec3f
1006
+ #else
1007
+ ,reflectionSampler: texture_2d<f32>
1008
+ ,reflectionSamplerSampler: sampler
1009
+ ,reflectionCoords: vec2f
1010
+ #endif
1011
+ #ifndef LODBASEDMICROSFURACE
1012
+ #ifdef REFLECTIONMAP_3D
1013
+ ,reflectionLowSampler: texture_cube<f32>
1014
+ ,reflectionLowSamplerSampler: sampler
1015
+ ,reflectionHighSampler: texture_cube<f32>
1016
+ ,reflectionHighSamplerSampler: sampler
1017
+ #else
1018
+ ,reflectionLowSampler: texture_2d<f32>
1019
+ ,reflectionLowSamplerSampler: sampler
1020
+ ,reflectionHighSampler: texture_2d<f32>
1021
+ ,reflectionHighSamplerSampler: sampler
1022
+ #endif
1023
+ #endif
1024
+ #ifdef REALTIME_FILTERING
1025
+ ,vReflectionFilteringInfo: vec2f
1026
+ #endif
1027
+ )->vec4f
1028
+ {var environmentRadiance: vec4f;
1029
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1030
+ var reflectionLOD: f32=getLodFromAlphaGNdotV(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);
1031
+ #elif defined(LINEARSPECULARREFLECTION)
1032
+ var reflectionLOD: f32=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
1033
+ #else
1034
+ var reflectionLOD: f32=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
1035
+ #endif
1036
+ #ifdef LODBASEDMICROSFURACE
1037
+ reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
1038
+ #ifdef LODINREFLECTIONALPHA
1039
+ var automaticReflectionLOD: f32=UNPACK_LOD(textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords).a);var requestedReflectionLOD: f32=max(automaticReflectionLOD,reflectionLOD);
1040
+ #else
1041
+ var requestedReflectionLOD: f32=reflectionLOD;
1042
+ #endif
1043
+ #ifdef REALTIME_FILTERING
1044
+ environmentRadiance= vec4f(radiance(alphaG,reflectionSampler,reflectionSamplerSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
1045
+ #else
1046
+ environmentRadiance=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD);
1047
+ #endif
1048
+ #else
1049
+ 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(
1050
+ textureSample(reflectionHighSampler,reflectionHighSamplerSampler,reflectionCoords),
1051
+ environmentMid,
1052
+ lodReflectionNormalizedDoubled
1053
+ );} else {environmentRadiance=mix(
1054
+ environmentMid,
1055
+ textureSample(reflectionLowSampler,reflectionLowSamplerSampler,reflectionCoords),
1056
+ lodReflectionNormalizedDoubled-1.0
1057
+ );}
1058
+ #endif
1059
+ var envRadiance=environmentRadiance.rgb;
1060
+ #ifdef RGBDREFLECTION
1061
+ envRadiance=fromRGBD(environmentRadiance);
1062
+ #endif
1063
+ #ifdef GAMMAREFLECTION
1064
+ envRadiance=toLinearSpaceVec3(environmentRadiance.rgb);
1065
+ #endif
1066
+ envRadiance*=vReflectionInfos.x;envRadiance*=vReflectionColor.rgb;return vec4f(envRadiance,environmentRadiance.a);}
1067
+ #define pbr_inline
1068
+ fn reflectionBlock(
1069
+ vPositionW: vec3f
1070
+ ,normalW: vec3f
1071
+ ,alphaG: f32
1072
+ ,vReflectionMicrosurfaceInfos: vec3f
1073
+ ,vReflectionInfos: vec2f
1074
+ ,vReflectionColor: vec3f
1075
+ #ifdef ANISOTROPIC
1076
+ ,anisotropicOut: anisotropicOutParams
1077
+ #endif
1078
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1079
+ ,NdotVUnclamped: f32
1080
+ #endif
1081
+ #ifdef LINEARSPECULARREFLECTION
1082
+ ,roughness: f32
1083
+ #endif
1084
+ #ifdef REFLECTIONMAP_3D
1085
+ ,reflectionSampler: texture_cube<f32>
1086
+ ,reflectionSamplerSampler: sampler
1087
+ #else
1088
+ ,reflectionSampler: texture_2d<f32>
1089
+ ,reflectionSamplerSampler: sampler
1090
+ #endif
1091
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
1092
+ ,vEnvironmentIrradiance: vec3f
1093
+ #endif
1094
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
1095
+ ,reflectionMatrix: mat4x4f
1096
+ #endif
1097
+ #ifdef USEIRRADIANCEMAP
1098
+ #ifdef REFLECTIONMAP_3D
1099
+ ,irradianceSampler: texture_cube<f32>
1100
+ ,irradianceSamplerSampler: sampler
1101
+ #else
1102
+ ,irradianceSampler: texture_2d<f32>
1103
+ ,irradianceSamplerSampler: sampler
1104
+ #endif
1105
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
1106
+ ,reflectionDominantDirection: vec3f
1107
+ #endif
1108
+ #endif
1109
+ #ifndef LODBASEDMICROSFURACE
1110
+ #ifdef REFLECTIONMAP_3D
1111
+ ,reflectionLowSampler: texture_cube<f32>
1112
+ ,reflectionLowSamplerSampler: sampler
1113
+ ,reflectionHighSampler: texture_cube<f32>
1114
+ ,reflectionHighSamplerSampler: sampler
1115
+ #else
1116
+ ,reflectionLowSampler: texture_2d<f32>
1117
+ ,reflectionLowSamplerSampler: sampler
1118
+ ,reflectionHighSampler: texture_2d<f32>
1119
+ ,reflectionHighSamplerSampler: sampler
1120
+ #endif
1121
+ #endif
1122
+ #ifdef REALTIME_FILTERING
1123
+ ,vReflectionFilteringInfo: vec2f
1124
+ #ifdef IBL_CDF_FILTERING
1125
+ ,icdfSampler: texture_2d<f32>
1126
+ ,icdfSamplerSampler: sampler
1127
+ #endif
1128
+ #endif
1129
+ ,viewDirectionW: vec3f
1130
+ ,diffuseRoughness: f32
1131
+ ,surfaceAlbedo: vec3f
1132
+ )->reflectionOutParams
1133
+ {var outParams: reflectionOutParams;var environmentRadiance: vec4f= vec4f(0.,0.,0.,0.);
1134
+ #ifdef REFLECTIONMAP_3D
1135
+ var reflectionCoords: vec3f= vec3f(0.);
1136
+ #else
1137
+ var reflectionCoords: vec2f= vec2f(0.);
1138
+ #endif
1139
+ reflectionCoords=createReflectionCoords(
1140
+ vPositionW,
1141
+ normalW,
1142
+ #ifdef ANISOTROPIC
1143
+ anisotropicOut,
1144
+ #endif
1145
+ );environmentRadiance=sampleReflectionTexture(
1146
+ alphaG
1147
+ ,vReflectionMicrosurfaceInfos
1148
+ ,vReflectionInfos
1149
+ ,vReflectionColor
1150
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1151
+ ,NdotVUnclamped
1152
+ #endif
1153
+ #ifdef LINEARSPECULARREFLECTION
1154
+ ,roughness
1155
+ #endif
1156
+ #ifdef REFLECTIONMAP_3D
1157
+ ,reflectionSampler
1158
+ ,reflectionSamplerSampler
1159
+ ,reflectionCoords
1160
+ #else
1161
+ ,reflectionSampler
1162
+ ,reflectionSamplerSampler
1163
+ ,reflectionCoords
1164
+ #endif
1165
+ #ifndef LODBASEDMICROSFURACE
1166
+ ,reflectionLowSampler
1167
+ ,reflectionLowSamplerSampler
1168
+ ,reflectionHighSampler
1169
+ ,reflectionHighSamplerSampler
1170
+ #endif
1171
+ #ifdef REALTIME_FILTERING
1172
+ ,vReflectionFilteringInfo
1173
+ #endif
1174
+ );var environmentIrradiance: vec3f= vec3f(0.,0.,0.);
1175
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
1176
+ #ifdef ANISOTROPIC
1177
+ var irradianceVector: vec3f= (reflectionMatrix* vec4f(anisotropicOut.anisotropicNormal,0)).xyz;
1178
+ #else
1179
+ var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz;
1180
+ #endif
1181
+ var irradianceView: vec3f= (reflectionMatrix* vec4f(viewDirectionW,0)).xyz;
1182
+ #if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)
1183
+ #if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY
1184
+ var NdotV: f32=max(dot(normalW,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);
1185
+ #endif
1186
+ #endif
1187
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1188
+ irradianceVector.z*=-1.0;
1189
+ #endif
1190
+ #ifdef INVERTCUBICMAP
1191
+ irradianceVector.y*=-1.0;
1192
+ #endif
1193
+ #endif
1194
+ #ifdef USESPHERICALFROMREFLECTIONMAP
1195
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
1196
+ environmentIrradiance=vEnvironmentIrradiance;
1197
+ #else
1198
+ #if defined(REALTIME_FILTERING)
1199
+ environmentIrradiance=irradiance(reflectionSampler,reflectionSamplerSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView
1200
+ #ifdef IBL_CDF_FILTERING
1201
+ ,icdfSampler
1202
+ ,icdfSamplerSampler
1203
+ #endif
1204
+ );
1205
+ #else
1206
+ environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
1207
+ #endif
1208
+ #ifdef SS_TRANSLUCENCY
1209
+ outParams.irradianceVector=irradianceVector;
1210
+ #endif
1211
+ #endif
1212
+ #elif defined(USEIRRADIANCEMAP)
1213
+ #ifdef REFLECTIONMAP_3D
1214
+ var environmentIrradiance4: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,irradianceVector);
1215
+ #else
1216
+ var environmentIrradiance4: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,reflectionCoords);
1217
+ #endif
1218
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
1219
+ var Ls: vec3f=normalize(reflectionDominantDirection);var NoL: f32=dot(irradianceVector,Ls);var NoV: f32=dot(irradianceVector,irradianceView);var diffuseRoughnessTerm: vec3f=vec3f(1.0);
1220
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1221
+ var LoV: f32=dot(Ls,irradianceView);var mag: f32=length(reflectionDominantDirection)*2.0f;var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3f(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0f)));
1222
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
1223
+ var H: vec3f=(irradianceView+Ls)*0.5f;var VoH: f32=dot(irradianceView,H);diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
1224
+ #endif
1225
+ environmentIrradiance=environmentIrradiance4.rgb*diffuseRoughnessTerm;
1226
+ #else
1227
+ environmentIrradiance=environmentIrradiance4.rgb;
1228
+ #endif
1229
+ #ifdef RGBDREFLECTION
1230
+ environmentIrradiance=fromRGBD(environmentIrradiance4);
1231
+ #endif
1232
+ #ifdef GAMMAREFLECTION
1233
+ environmentIrradiance=toLinearSpaceVec3(environmentIrradiance.rgb);
1234
+ #endif
1235
+ #endif
1236
+ environmentIrradiance*=vReflectionColor.rgb*vReflectionInfos.x;
1237
+ #ifdef MIX_IBL_RADIANCE_WITH_IRRADIANCE
1238
+ outParams.environmentRadiance=vec4f(mix(environmentRadiance.rgb,environmentIrradiance,alphaG),environmentRadiance.a);
1239
+ #else
1240
+ outParams.environmentRadiance=environmentRadiance;
1241
+ #endif
1242
+ outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;return outParams;}
1243
+ #endif
1244
+ `;e.IncludesShadersStoreWGSL[C]||(e.IncludesShadersStoreWGSL[C]=ee);const A="pbrBlockSheen",ie=`#ifdef SHEEN
1245
+ struct sheenOutParams
1246
+ {sheenIntensity: f32
1247
+ ,sheenColor: vec3f
1248
+ ,sheenRoughness: f32
1249
+ #ifdef SHEEN_LINKWITHALBEDO
1250
+ ,surfaceAlbedo: vec3f
1251
+ #endif
1252
+ #if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
1253
+ ,sheenAlbedoScaling: f32
1254
+ #endif
1255
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1256
+ ,finalSheenRadianceScaled: vec3f
1257
+ #endif
1258
+ #if DEBUGMODE>0
1259
+ #ifdef SHEEN_TEXTURE
1260
+ ,sheenMapData: vec4f
1261
+ #endif
1262
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1263
+ ,sheenEnvironmentReflectance: vec3f
1264
+ #endif
1265
+ #endif
1266
+ };
1267
+ #define pbr_inline
1268
+ fn sheenBlock(
1269
+ vSheenColor: vec4f
1270
+ #ifdef SHEEN_ROUGHNESS
1271
+ ,vSheenRoughness: f32
1272
+ #if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
1273
+ ,sheenMapRoughnessData: vec4f
1274
+ #endif
1275
+ #endif
1276
+ ,roughness: f32
1277
+ #ifdef SHEEN_TEXTURE
1278
+ ,sheenMapData: vec4f
1279
+ ,sheenMapLevel: f32
1280
+ #endif
1281
+ ,reflectance: f32
1282
+ #ifdef SHEEN_LINKWITHALBEDO
1283
+ ,baseColor: vec3f
1284
+ ,surfaceAlbedo: vec3f
1285
+ #endif
1286
+ #ifdef ENVIRONMENTBRDF
1287
+ ,NdotV: f32
1288
+ ,environmentBrdf: vec3f
1289
+ #endif
1290
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1291
+ ,AARoughnessFactors: vec2f
1292
+ ,vReflectionMicrosurfaceInfos: vec3f
1293
+ ,vReflectionInfos: vec2f
1294
+ ,vReflectionColor: vec3f
1295
+ ,vLightingIntensity: vec4f
1296
+ #ifdef REFLECTIONMAP_3D
1297
+ ,reflectionSampler: texture_cube<f32>
1298
+ ,reflectionSamplerSampler: sampler
1299
+ ,reflectionCoords: vec3f
1300
+ #else
1301
+ ,reflectionSampler: texture_2d<f32>
1302
+ ,reflectionSamplerSampler: sampler
1303
+ ,reflectionCoords: vec2f
1304
+ #endif
1305
+ ,NdotVUnclamped: f32
1306
+ #ifndef LODBASEDMICROSFURACE
1307
+ #ifdef REFLECTIONMAP_3D
1308
+ ,reflectionLowSampler: texture_cube<f32>
1309
+ ,reflectionLowSamplerSampler: sampler
1310
+ ,reflectionHighSampler: texture_cube<f32>
1311
+ ,reflectionHighSamplerSampler: sampler
1312
+ #else
1313
+ ,reflectionLowSampler: texture_2d<f32>
1314
+ ,reflectionLowSamplerSampler: sampler
1315
+ ,reflectionHighSampler: texture_2d<f32>
1316
+ ,reflectionHighSamplerSampler: sampler
1317
+ #endif
1318
+ #endif
1319
+ #ifdef REALTIME_FILTERING
1320
+ ,vReflectionFilteringInfo: vec2f
1321
+ #endif
1322
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
1323
+ ,seo: f32
1324
+ #endif
1325
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
1326
+ ,eho: f32
1327
+ #endif
1328
+ #endif
1329
+ )->sheenOutParams
1330
+ {var outParams: sheenOutParams;var sheenIntensity: f32=vSheenColor.a;
1331
+ #ifdef SHEEN_TEXTURE
1332
+ #if DEBUGMODE>0
1333
+ outParams.sheenMapData=sheenMapData;
1334
+ #endif
1335
+ #endif
1336
+ #ifdef SHEEN_LINKWITHALBEDO
1337
+ var sheenFactor: f32=pow5(1.0-sheenIntensity);var sheenColor: vec3f=baseColor.rgb*(1.0-sheenFactor);var sheenRoughness: f32=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;
1338
+ #ifdef SHEEN_TEXTURE
1339
+ sheenIntensity*=sheenMapData.a;
1340
+ #endif
1341
+ #else
1342
+ var sheenColor: vec3f=vSheenColor.rgb;
1343
+ #ifdef SHEEN_TEXTURE
1344
+ #ifdef SHEEN_GAMMATEXTURE
1345
+ sheenColor*=toLinearSpaceVec3(sheenMapData.rgb);
1346
+ #else
1347
+ sheenColor*=sheenMapData.rgb;
1348
+ #endif
1349
+ sheenColor*=sheenMapLevel;
1350
+ #endif
1351
+ #ifdef SHEEN_ROUGHNESS
1352
+ var sheenRoughness: f32=vSheenRoughness;
1353
+ #ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE
1354
+ #if defined(SHEEN_TEXTURE)
1355
+ sheenRoughness*=sheenMapData.a;
1356
+ #endif
1357
+ #elif defined(SHEEN_TEXTURE_ROUGHNESS)
1358
+ sheenRoughness*=sheenMapRoughnessData.a;
1359
+ #endif
1360
+ #else
1361
+ var sheenRoughness: f32=roughness;
1362
+ #ifdef SHEEN_TEXTURE
1363
+ sheenIntensity*=sheenMapData.a;
1364
+ #endif
1365
+ #endif
1366
+ #if !defined(SHEEN_ALBEDOSCALING)
1367
+ sheenIntensity*=(1.-reflectance);
1368
+ #endif
1369
+ sheenColor*=sheenIntensity;
1370
+ #endif
1371
+ #ifdef ENVIRONMENTBRDF
1372
+ /*#ifdef SHEEN_SOFTER
1373
+ var environmentSheenBrdf: vec3f= vec3f(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));
1374
+ #else*/
1375
+ #ifdef SHEEN_ROUGHNESS
1376
+ var environmentSheenBrdf: vec3f=getBRDFLookup(NdotV,sheenRoughness);
1377
+ #else
1378
+ var environmentSheenBrdf: vec3f=environmentBrdf;
1379
+ #endif
1380
+ /*#endif*/
1381
+ #endif
1382
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
1383
+ var sheenAlphaG: f32=convertRoughnessToAverageSlope(sheenRoughness);
1384
+ #ifdef SPECULARAA
1385
+ sheenAlphaG+=AARoughnessFactors.y;
1386
+ #endif
1387
+ var environmentSheenRadiance: vec4f= vec4f(0.,0.,0.,0.);environmentSheenRadiance=sampleReflectionTexture(
1388
+ sheenAlphaG
1389
+ ,vReflectionMicrosurfaceInfos
1390
+ ,vReflectionInfos
1391
+ ,vReflectionColor
1392
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1393
+ ,NdotVUnclamped
1394
+ #endif
1395
+ #ifdef LINEARSPECULARREFLECTION
1396
+ ,sheenRoughness
1397
+ #endif
1398
+ ,reflectionSampler
1399
+ ,reflectionSamplerSampler
1400
+ ,reflectionCoords
1401
+ #ifndef LODBASEDMICROSFURACE
1402
+ ,reflectionLowSampler
1403
+ ,reflectionLowSamplerSampler
1404
+ ,reflectionHighSampler
1405
+ ,reflectionHighSamplerSampler
1406
+ #endif
1407
+ #ifdef REALTIME_FILTERING
1408
+ ,vReflectionFilteringInfo
1409
+ #endif
1410
+ );var sheenEnvironmentReflectance: vec3f=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);
1411
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
1412
+ sheenEnvironmentReflectance*=seo;
1413
+ #endif
1414
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
1415
+ sheenEnvironmentReflectance*=eho;
1416
+ #endif
1417
+ #if DEBUGMODE>0
1418
+ outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;
1419
+ #endif
1420
+ outParams.finalSheenRadianceScaled=
1421
+ environmentSheenRadiance.rgb *
1422
+ sheenEnvironmentReflectance *
1423
+ vLightingIntensity.z;
1424
+ #endif
1425
+ #if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
1426
+ outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;
1427
+ #endif
1428
+ outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;}
1429
+ #endif
1430
+ `;e.IncludesShadersStoreWGSL[A]||(e.IncludesShadersStoreWGSL[A]=ie);const I="pbrBlockClearcoat",re=`struct clearcoatOutParams
1431
+ {specularEnvironmentR0: vec3f,
1432
+ conservationFactor: f32,
1433
+ clearCoatNormalW: vec3f,
1434
+ clearCoatAARoughnessFactors: vec2f,
1435
+ clearCoatIntensity: f32,
1436
+ clearCoatRoughness: f32,
1437
+ #ifdef REFLECTION
1438
+ finalClearCoatRadianceScaled: vec3f,
1439
+ #endif
1440
+ #ifdef CLEARCOAT_TINT
1441
+ absorption: vec3f,
1442
+ clearCoatNdotVRefract: f32,
1443
+ clearCoatColor: vec3f,
1444
+ clearCoatThickness: f32,
1445
+ #endif
1446
+ #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
1447
+ energyConservationFactorClearCoat: vec3f,
1448
+ #endif
1449
+ #if DEBUGMODE>0
1450
+ #ifdef CLEARCOAT_BUMP
1451
+ TBNClearCoat: mat3x3f,
1452
+ #endif
1453
+ #ifdef CLEARCOAT_TEXTURE
1454
+ clearCoatMapData: vec2f,
1455
+ #endif
1456
+ #if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
1457
+ clearCoatTintMapData: vec4f,
1458
+ #endif
1459
+ #ifdef REFLECTION
1460
+ environmentClearCoatRadiance: vec4f,
1461
+ clearCoatEnvironmentReflectance: vec3f,
1462
+ #endif
1463
+ clearCoatNdotV: f32
1464
+ #endif
1465
+ };
1466
+ #ifdef CLEARCOAT
1467
+ #define pbr_inline
1468
+ fn clearcoatBlock(
1469
+ vPositionW: vec3f
1470
+ ,geometricNormalW: vec3f
1471
+ ,viewDirectionW: vec3f
1472
+ ,vClearCoatParams: vec2f
1473
+ #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
1474
+ ,clearCoatMapRoughnessData: vec4f
1475
+ #endif
1476
+ ,specularEnvironmentR0: vec3f
1477
+ #ifdef CLEARCOAT_TEXTURE
1478
+ ,clearCoatMapData: vec2f
1479
+ #endif
1480
+ #ifdef CLEARCOAT_TINT
1481
+ ,vClearCoatTintParams: vec4f
1482
+ ,clearCoatColorAtDistance: f32
1483
+ ,vClearCoatRefractionParams: vec4f
1484
+ #ifdef CLEARCOAT_TINT_TEXTURE
1485
+ ,clearCoatTintMapData: vec4f
1486
+ #endif
1487
+ #endif
1488
+ #ifdef CLEARCOAT_BUMP
1489
+ ,vClearCoatBumpInfos: vec2f
1490
+ ,clearCoatBumpMapData: vec4f
1491
+ ,vClearCoatBumpUV: vec2f
1492
+ #if defined(TANGENT) && defined(NORMAL)
1493
+ ,vTBN: mat3x3f
1494
+ #else
1495
+ ,vClearCoatTangentSpaceParams: vec2f
1496
+ #endif
1497
+ #ifdef OBJECTSPACE_NORMALMAP
1498
+ ,normalMatrix: mat4x4f
1499
+ #endif
1500
+ #endif
1501
+ #if defined(FORCENORMALFORWARD) && defined(NORMAL)
1502
+ ,faceNormal: vec3f
1503
+ #endif
1504
+ #ifdef REFLECTION
1505
+ ,vReflectionMicrosurfaceInfos: vec3f
1506
+ ,vReflectionInfos: vec2f
1507
+ ,vReflectionColor: vec3f
1508
+ ,vLightingIntensity: vec4f
1509
+ #ifdef REFLECTIONMAP_3D
1510
+ ,reflectionSampler: texture_cube<f32>
1511
+ ,reflectionSamplerSampler: sampler
1512
+ #else
1513
+ ,reflectionSampler: texture_2d<f32>
1514
+ ,reflectionSamplerSampler: sampler
1515
+ #endif
1516
+ #ifndef LODBASEDMICROSFURACE
1517
+ #ifdef REFLECTIONMAP_3D
1518
+ ,reflectionLowSampler: texture_cube<f32>
1519
+ ,reflectionLowSamplerSampler: sampler
1520
+ ,reflectionHighSampler: texture_cube<f32>
1521
+ ,reflectionHighSamplerSampler: sampler
1522
+ #else
1523
+ ,reflectionLowSampler: texture_2d<f32>
1524
+ ,reflectionLowSamplerSampler: sampler
1525
+ ,reflectionHighSampler: texture_2d<f32>
1526
+ ,reflectionHighSamplerSampler: sampler
1527
+ #endif
1528
+ #endif
1529
+ #ifdef REALTIME_FILTERING
1530
+ ,vReflectionFilteringInfo: vec2f
1531
+ #endif
1532
+ #endif
1533
+ #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
1534
+ ,frontFacingMultiplier: f32
1535
+ #endif
1536
+ )->clearcoatOutParams
1537
+ {var outParams: clearcoatOutParams;var clearCoatIntensity: f32=vClearCoatParams.x;var clearCoatRoughness: f32=vClearCoatParams.y;
1538
+ #ifdef CLEARCOAT_TEXTURE
1539
+ clearCoatIntensity*=clearCoatMapData.x;
1540
+ #ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE
1541
+ clearCoatRoughness*=clearCoatMapData.y;
1542
+ #endif
1543
+ #if DEBUGMODE>0
1544
+ outParams.clearCoatMapData=clearCoatMapData;
1545
+ #endif
1546
+ #endif
1547
+ #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
1548
+ clearCoatRoughness*=clearCoatMapRoughnessData.y;
1549
+ #endif
1550
+ outParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness;
1551
+ #ifdef CLEARCOAT_TINT
1552
+ var clearCoatColor: vec3f=vClearCoatTintParams.rgb;var clearCoatThickness: f32=vClearCoatTintParams.a;
1553
+ #ifdef CLEARCOAT_TINT_TEXTURE
1554
+ #ifdef CLEARCOAT_TINT_GAMMATEXTURE
1555
+ clearCoatColor*=toLinearSpaceVec3(clearCoatTintMapData.rgb);
1556
+ #else
1557
+ clearCoatColor*=clearCoatTintMapData.rgb;
1558
+ #endif
1559
+ clearCoatThickness*=clearCoatTintMapData.a;
1560
+ #if DEBUGMODE>0
1561
+ outParams.clearCoatTintMapData=clearCoatTintMapData;
1562
+ #endif
1563
+ #endif
1564
+ outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness;
1565
+ #endif
1566
+ #ifdef CLEARCOAT_REMAP_F0
1567
+ var specularEnvironmentR0Updated: vec3f=getR0RemappedForClearCoat(specularEnvironmentR0);
1568
+ #else
1569
+ var specularEnvironmentR0Updated: vec3f=specularEnvironmentR0;
1570
+ #endif
1571
+ outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);var clearCoatNormalW: vec3f=geometricNormalW;
1572
+ #ifdef CLEARCOAT_BUMP
1573
+ #ifdef NORMALXYSCALE
1574
+ var clearCoatNormalScale: f32=1.0;
1575
+ #else
1576
+ var clearCoatNormalScale: f32=vClearCoatBumpInfos.y;
1577
+ #endif
1578
+ #if defined(TANGENT) && defined(NORMAL)
1579
+ var TBNClearCoat: mat3x3f=vTBN;
1580
+ #else
1581
+ var TBNClearCoatUV: vec2f=vClearCoatBumpUV*frontFacingMultiplier;var TBNClearCoat: mat3x3f=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);
1582
+ #endif
1583
+ #if DEBUGMODE>0
1584
+ outParams.TBNClearCoat=TBNClearCoat;
1585
+ #endif
1586
+ #ifdef OBJECTSPACE_NORMALMAP
1587
+ clearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize( mat3x3f(normalMatrix[0].xyz,normalMatrix[1].xyz,normalMatrix[2].xyz)*clearCoatNormalW);
1588
+ #else
1589
+ clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);
1590
+ #endif
1591
+ #endif
1592
+ #if defined(FORCENORMALFORWARD) && defined(NORMAL)
1593
+ clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));
1594
+ #endif
1595
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
1596
+ clearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;
1597
+ #endif
1598
+ outParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);var clearCoatNdotVUnclamped: f32=dot(clearCoatNormalW,viewDirectionW);var clearCoatNdotV: f32=absEps(clearCoatNdotVUnclamped);
1599
+ #if DEBUGMODE>0
1600
+ outParams.clearCoatNdotV=clearCoatNdotV;
1601
+ #endif
1602
+ #ifdef CLEARCOAT_TINT
1603
+ var clearCoatVRefract: vec3f=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));
1604
+ #endif
1605
+ #if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))
1606
+ var environmentClearCoatBrdf: vec3f=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);
1607
+ #endif
1608
+ #if defined(REFLECTION)
1609
+ var clearCoatAlphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness);
1610
+ #ifdef SPECULARAA
1611
+ clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;
1612
+ #endif
1613
+ var environmentClearCoatRadiance: vec4f= vec4f(0.,0.,0.,0.);var clearCoatReflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),clearCoatNormalW);
1614
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1615
+ clearCoatReflectionVector.z*=-1.0;
1616
+ #endif
1617
+ #ifdef REFLECTIONMAP_3D
1618
+ var clearCoatReflectionCoords: vec3f=clearCoatReflectionVector;
1619
+ #else
1620
+ var clearCoatReflectionCoords: vec2f=clearCoatReflectionVector.xy;
1621
+ #ifdef REFLECTIONMAP_PROJECTION
1622
+ clearCoatReflectionCoords/=clearCoatReflectionVector.z;
1623
+ #endif
1624
+ clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;
1625
+ #endif
1626
+ environmentClearCoatRadiance=sampleReflectionTexture(
1627
+ clearCoatAlphaG
1628
+ ,vReflectionMicrosurfaceInfos
1629
+ ,vReflectionInfos
1630
+ ,vReflectionColor
1631
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1632
+ ,clearCoatNdotVUnclamped
1633
+ #endif
1634
+ #ifdef LINEARSPECULARREFLECTION
1635
+ ,clearCoatRoughness
1636
+ #endif
1637
+ ,reflectionSampler
1638
+ ,reflectionSamplerSampler
1639
+ ,clearCoatReflectionCoords
1640
+ #ifndef LODBASEDMICROSFURACE
1641
+ ,reflectionLowSampler
1642
+ ,reflectionLowSamplerSampler
1643
+ ,reflectionHighSampler
1644
+ ,reflectionHighSamplerSampler
1645
+ #endif
1646
+ #ifdef REALTIME_FILTERING
1647
+ ,vReflectionFilteringInfo
1648
+ #endif
1649
+ );
1650
+ #if DEBUGMODE>0
1651
+ outParams.environmentClearCoatRadiance=environmentClearCoatRadiance;
1652
+ #endif
1653
+ #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1654
+ var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromBRDFLookup(vec3f(uniforms.vClearCoatRefractionParams.x),environmentClearCoatBrdf);
1655
+ #ifdef HORIZONOCCLUSION
1656
+ #ifdef BUMP
1657
+ #ifdef REFLECTIONMAP_3D
1658
+ var clearCoatEho: f32=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho;
1659
+ #endif
1660
+ #endif
1661
+ #endif
1662
+ #else
1663
+ var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV, vec3f(1.), vec3f(1.),sqrt(1.-clearCoatRoughness));
1664
+ #endif
1665
+ clearCoatEnvironmentReflectance*=clearCoatIntensity;
1666
+ #if DEBUGMODE>0
1667
+ outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;
1668
+ #endif
1669
+ outParams.finalClearCoatRadianceScaled=
1670
+ environmentClearCoatRadiance.rgb *
1671
+ clearCoatEnvironmentReflectance *
1672
+ vLightingIntensity.z;
1673
+ #endif
1674
+ #if defined(CLEARCOAT_TINT)
1675
+ outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);
1676
+ #endif
1677
+ var fresnelIBLClearCoat: f32=fresnelSchlickGGX(clearCoatNdotV,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat);
1678
+ #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
1679
+ outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);
1680
+ #endif
1681
+ return outParams;}
1682
+ #endif
1683
+ `;e.IncludesShadersStoreWGSL[I]||(e.IncludesShadersStoreWGSL[I]=re);const N="pbrBlockIridescence",ae=`struct iridescenceOutParams
1684
+ {iridescenceIntensity: f32,
1685
+ iridescenceIOR: f32,
1686
+ iridescenceThickness: f32,
1687
+ specularEnvironmentR0: vec3f};
1688
+ #ifdef IRIDESCENCE
1689
+ fn iridescenceBlock(
1690
+ vIridescenceParams: vec4f
1691
+ ,viewAngle_: f32
1692
+ ,specularEnvironmentR0: vec3f
1693
+ #ifdef IRIDESCENCE_TEXTURE
1694
+ ,iridescenceMapData: vec2f
1695
+ #endif
1696
+ #ifdef IRIDESCENCE_THICKNESS_TEXTURE
1697
+ ,iridescenceThicknessMapData: vec2f
1698
+ #endif
1699
+ #ifdef CLEARCOAT
1700
+ ,NdotVUnclamped: f32
1701
+ ,vClearCoatParams: vec2f
1702
+ #ifdef CLEARCOAT_TEXTURE
1703
+ ,clearCoatMapData: vec2f
1704
+ #endif
1705
+ #endif
1706
+ )->iridescenceOutParams
1707
+ {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.;var viewAngle=viewAngle_;
1708
+ #ifdef IRIDESCENCE_TEXTURE
1709
+ iridescenceIntensity*=iridescenceMapData.x;
1710
+ #endif
1711
+ #if defined(IRIDESCENCE_THICKNESS_TEXTURE)
1712
+ iridescenceThicknessWeight=iridescenceThicknessMapData.g;
1713
+ #endif
1714
+ var iridescenceThickness: f32=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);var topIor: f32=1.;
1715
+ #ifdef CLEARCOAT
1716
+ var clearCoatIntensity: f32=vClearCoatParams.x;
1717
+ #ifdef CLEARCOAT_TEXTURE
1718
+ clearCoatIntensity*=clearCoatMapData.x;
1719
+ #endif
1720
+ topIor=mix(1.0,uniforms.vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+((1.0/topIor)*(1.0/topIor))*((NdotVUnclamped*NdotVUnclamped)-1.0));
1721
+ #endif
1722
+ 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;}
1723
+ #endif
1724
+ `;e.IncludesShadersStoreWGSL[N]||(e.IncludesShadersStoreWGSL[N]=ae);const L="pbrBlockSubSurface",ne=`struct subSurfaceOutParams
1725
+ {specularEnvironmentReflectance: vec3f,
1726
+ #ifdef SS_REFRACTION
1727
+ finalRefraction: vec3f,
1728
+ surfaceAlbedo: vec3f,
1729
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1730
+ alpha: f32,
1731
+ #endif
1732
+ refractionOpacity: f32,
1733
+ #endif
1734
+ #ifdef SS_TRANSLUCENCY
1735
+ transmittance: vec3f,
1736
+ translucencyIntensity: f32,
1737
+ #ifdef REFLECTION
1738
+ refractionIrradiance: vec3f,
1739
+ #endif
1740
+ #endif
1741
+ #if DEBUGMODE>0
1742
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
1743
+ thicknessMap: vec4f,
1744
+ #endif
1745
+ #ifdef SS_REFRACTION
1746
+ environmentRefraction: vec4f,
1747
+ refractionTransmittance: vec3f
1748
+ #endif
1749
+ #endif
1750
+ };
1751
+ #ifdef SUBSURFACE
1752
+ #ifdef SS_REFRACTION
1753
+ #define pbr_inline
1754
+ fn sampleEnvironmentRefraction(
1755
+ ior: f32
1756
+ ,thickness: f32
1757
+ ,refractionLOD: f32
1758
+ ,normalW: vec3f
1759
+ ,vPositionW: vec3f
1760
+ ,viewDirectionW: vec3f
1761
+ ,view: mat4x4f
1762
+ ,vRefractionInfos: vec4f
1763
+ ,refractionMatrix: mat4x4f
1764
+ ,vRefractionMicrosurfaceInfos: vec4f
1765
+ ,alphaG: f32
1766
+ #ifdef SS_REFRACTIONMAP_3D
1767
+ ,refractionSampler: texture_cube<f32>
1768
+ ,refractionSamplerSampler: sampler
1769
+ #ifndef LODBASEDMICROSFURACE
1770
+ ,refractionLowSampler: texture_cube<f32>
1771
+ ,refractionLowSamplerSampler: sampler
1772
+ ,refractionHighSampler: texture_cube<f32>
1773
+ ,refractionHighSamplerSampler: sampler
1774
+ #endif
1775
+ #else
1776
+ ,refractionSampler: texture_2d<f32>
1777
+ ,refractionSamplerSampler: sampler
1778
+ #ifndef LODBASEDMICROSFURACE
1779
+ ,refractionLowSampler: texture_2d<f32>
1780
+ ,refractionLowSamplerSampler: sampler
1781
+ ,refractionHighSampler: texture_2d<f32>
1782
+ ,refractionHighSamplerSampler: sampler
1783
+ #endif
1784
+ #endif
1785
+ #ifdef ANISOTROPIC
1786
+ ,anisotropicOut: anisotropicOutParams
1787
+ #endif
1788
+ #ifdef REALTIME_FILTERING
1789
+ ,vRefractionFilteringInfo: vec2f
1790
+ #endif
1791
+ #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1792
+ ,refractionPosition: vec3f
1793
+ ,refractionSize: vec3f
1794
+ #endif
1795
+ )->vec4f {var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.);
1796
+ #ifdef ANISOTROPIC
1797
+ var refractionVector: vec3f=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior);
1798
+ #else
1799
+ var refractionVector: vec3f=refract(-viewDirectionW,normalW,ior);
1800
+ #endif
1801
+ #ifdef SS_REFRACTIONMAP_OPPOSITEZ
1802
+ refractionVector.z*=-1.0;
1803
+ #endif
1804
+ #ifdef SS_REFRACTIONMAP_3D
1805
+ #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1806
+ refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);
1807
+ #endif
1808
+ refractionVector.y=refractionVector.y*vRefractionInfos.w;var refractionCoords: vec3f=refractionVector;refractionCoords= (refractionMatrix* vec4f(refractionCoords,0)).xyz;
1809
+ #else
1810
+ #ifdef SS_USE_THICKNESS_AS_DEPTH
1811
+ var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*thickness,1.0))).xyz;
1812
+ #else
1813
+ var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*vRefractionInfos.z,1.0))).xyz;
1814
+ #endif
1815
+ var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;
1816
+ #endif
1817
+ #ifdef LODBASEDMICROSFURACE
1818
+ var lod=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;
1819
+ #ifdef SS_LODINREFRACTIONALPHA
1820
+ var automaticRefractionLOD: f32=UNPACK_LOD(textureSample(refractionSampler,refractionSamplerSampler,refractionCoords).a);var requestedRefractionLOD: f32=max(automaticRefractionLOD,lod);
1821
+ #else
1822
+ var requestedRefractionLOD: f32=lod;
1823
+ #endif
1824
+ #if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)
1825
+ environmentRefraction= vec4f(radiance(alphaG,refractionSampler,refractionSamplerSampler,refractionCoords,vRefractionFilteringInfo),1.0);
1826
+ #else
1827
+ environmentRefraction=textureSampleLevel(refractionSampler,refractionSamplerSampler,refractionCoords,requestedRefractionLOD);
1828
+ #endif
1829
+ #else
1830
+ 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(
1831
+ textureSample(refractionHighSampler,refractionHighSamplerSampler,refractionCoords),
1832
+ environmentRefractionMid,
1833
+ lodRefractionNormalizedDoubled
1834
+ );} else {environmentRefraction=mix(
1835
+ environmentRefractionMid,
1836
+ textureSample(refractionLowSampler,refractionLowSamplerSampler,refractionCoords),
1837
+ lodRefractionNormalizedDoubled-1.0
1838
+ );}
1839
+ #endif
1840
+ var refraction=environmentRefraction.rgb;
1841
+ #ifdef SS_RGBDREFRACTION
1842
+ refraction=fromRGBD(environmentRefraction);
1843
+ #endif
1844
+ #ifdef SS_GAMMAREFRACTION
1845
+ refraction=toLinearSpaceVec3(environmentRefraction.rgb);
1846
+ #endif
1847
+ return vec4f(refraction,environmentRefraction.a);}
1848
+ #endif
1849
+ #define pbr_inline
1850
+ fn subSurfaceBlock(
1851
+ vSubSurfaceIntensity: vec3f
1852
+ ,vThicknessParam: vec2f
1853
+ ,vTintColor: vec4f
1854
+ ,normalW: vec3f
1855
+ ,specularEnvironmentReflectance: vec3f
1856
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
1857
+ ,thicknessMap: vec4f
1858
+ #endif
1859
+ #ifdef SS_REFRACTIONINTENSITY_TEXTURE
1860
+ ,refractionIntensityMap: vec4f
1861
+ #endif
1862
+ #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
1863
+ ,translucencyIntensityMap: vec4f
1864
+ #endif
1865
+ #ifdef REFLECTION
1866
+ #ifdef SS_TRANSLUCENCY
1867
+ ,reflectionMatrix: mat4x4f
1868
+ #ifdef USESPHERICALFROMREFLECTIONMAP
1869
+ #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
1870
+ ,irradianceVector_: vec3f
1871
+ #endif
1872
+ #if defined(REALTIME_FILTERING)
1873
+ ,reflectionSampler: texture_cube<f32>
1874
+ ,reflectionSamplerSampler: sampler
1875
+ ,vReflectionFilteringInfo: vec2f
1876
+ #ifdef IBL_CDF_FILTERING
1877
+ ,icdfSampler: texture_2d<f32>
1878
+ ,icdfSamplerSampler: sampler
1879
+ #endif
1880
+ #endif
1881
+ #endif
1882
+ #ifdef USEIRRADIANCEMAP
1883
+ #ifdef REFLECTIONMAP_3D
1884
+ ,irradianceSampler: texture_cube<f32>
1885
+ ,irradianceSamplerSampler: sampler
1886
+ #else
1887
+ ,irradianceSampler: texture_2d<f32>
1888
+ ,irradianceSamplerSampler: sampler
1889
+ #endif
1890
+ #endif
1891
+ #endif
1892
+ #endif
1893
+ #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
1894
+ ,surfaceAlbedo: vec3f
1895
+ #endif
1896
+ #ifdef SS_REFRACTION
1897
+ ,vPositionW: vec3f
1898
+ ,viewDirectionW: vec3f
1899
+ ,view: mat4x4f
1900
+ ,vRefractionInfos: vec4f
1901
+ ,refractionMatrix: mat4x4f
1902
+ ,vRefractionMicrosurfaceInfos: vec4f
1903
+ ,vLightingIntensity: vec4f
1904
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1905
+ ,alpha: f32
1906
+ #endif
1907
+ #ifdef SS_LODINREFRACTIONALPHA
1908
+ ,NdotVUnclamped: f32
1909
+ #endif
1910
+ #ifdef SS_LINEARSPECULARREFRACTION
1911
+ ,roughness: f32
1912
+ #endif
1913
+ ,alphaG: f32
1914
+ #ifdef SS_REFRACTIONMAP_3D
1915
+ ,refractionSampler: texture_cube<f32>
1916
+ ,refractionSamplerSampler: sampler
1917
+ #ifndef LODBASEDMICROSFURACE
1918
+ ,refractionLowSampler: texture_cube<f32>
1919
+ ,refractionLowSamplerSampler: sampler
1920
+ ,refractionHighSampler: texture_cube<f32>
1921
+ ,refractionHighSamplerSampler: sampler
1922
+ #endif
1923
+ #else
1924
+ ,refractionSampler: texture_2d<f32>
1925
+ ,refractionSamplerSampler: sampler
1926
+ #ifndef LODBASEDMICROSFURACE
1927
+ ,refractionLowSampler: texture_2d<f32>
1928
+ ,refractionLowSamplerSampler: sampler
1929
+ ,refractionHighSampler: texture_2d<f32>
1930
+ ,refractionHighSamplerSampler: sampler
1931
+ #endif
1932
+ #endif
1933
+ #ifdef ANISOTROPIC
1934
+ ,anisotropicOut: anisotropicOutParams
1935
+ #endif
1936
+ #ifdef REALTIME_FILTERING
1937
+ ,vRefractionFilteringInfo: vec2f
1938
+ #endif
1939
+ #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
1940
+ ,refractionPosition: vec3f
1941
+ ,refractionSize: vec3f
1942
+ #endif
1943
+ #ifdef SS_DISPERSION
1944
+ ,dispersion: f32
1945
+ #endif
1946
+ #endif
1947
+ #ifdef SS_TRANSLUCENCY
1948
+ ,vDiffusionDistance: vec3f
1949
+ ,vTranslucencyColor: vec4f
1950
+ #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
1951
+ ,translucencyColorMap: vec4f
1952
+ #endif
1953
+ #endif
1954
+ )->subSurfaceOutParams
1955
+ {var outParams: subSurfaceOutParams;outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;
1956
+ #ifdef SS_REFRACTION
1957
+ var refractionIntensity: f32=vSubSurfaceIntensity.x;
1958
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
1959
+ refractionIntensity*=(1.0-alpha);outParams.alpha=1.0;
1960
+ #endif
1961
+ #endif
1962
+ #ifdef SS_TRANSLUCENCY
1963
+ var translucencyIntensity: f32=vSubSurfaceIntensity.y;
1964
+ #endif
1965
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
1966
+ #ifdef SS_USE_GLTF_TEXTURES
1967
+ var thickness: f32=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;
1968
+ #else
1969
+ var thickness: f32=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;
1970
+ #endif
1971
+ #if DEBUGMODE>0
1972
+ outParams.thicknessMap=thicknessMap;
1973
+ #endif
1974
+ #if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS)
1975
+ #ifdef SS_USE_GLTF_TEXTURES
1976
+ refractionIntensity*=thicknessMap.r;
1977
+ #else
1978
+ refractionIntensity*=thicknessMap.g;
1979
+ #endif
1980
+ #endif
1981
+ #if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS)
1982
+ #ifdef SS_USE_GLTF_TEXTURES
1983
+ translucencyIntensity*=thicknessMap.a;
1984
+ #else
1985
+ translucencyIntensity*=thicknessMap.b;
1986
+ #endif
1987
+ #endif
1988
+ #else
1989
+ var thickness: f32=vThicknessParam.y;
1990
+ #endif
1991
+ #if defined(SS_REFRACTION) && defined(SS_REFRACTIONINTENSITY_TEXTURE)
1992
+ #ifdef SS_USE_GLTF_TEXTURES
1993
+ refractionIntensity*=refractionIntensityMap.r;
1994
+ #else
1995
+ refractionIntensity*=refractionIntensityMap.g;
1996
+ #endif
1997
+ #endif
1998
+ #if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCYINTENSITY_TEXTURE)
1999
+ #ifdef SS_USE_GLTF_TEXTURES
2000
+ translucencyIntensity*=translucencyIntensityMap.a;
2001
+ #else
2002
+ translucencyIntensity*=translucencyIntensityMap.b;
2003
+ #endif
2004
+ #endif
2005
+ #ifdef SS_TRANSLUCENCY
2006
+ thickness=maxEps(thickness);var translucencyColor: vec4f=vTranslucencyColor;
2007
+ #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
2008
+ translucencyColor*=translucencyColorMap;
2009
+ #endif
2010
+ var transmittance: vec3f=transmittanceBRDF_Burley(translucencyColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;
2011
+ #endif
2012
+ #ifdef SS_REFRACTION
2013
+ var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.);
2014
+ #ifdef SS_HAS_THICKNESS
2015
+ var ior: f32=vRefractionInfos.y;
2016
+ #else
2017
+ var ior: f32=vRefractionMicrosurfaceInfos.w;
2018
+ #endif
2019
+ #ifdef SS_LODINREFRACTIONALPHA
2020
+ 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);
2021
+ #elif defined(SS_LINEARSPECULARREFRACTION)
2022
+ 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);
2023
+ #else
2024
+ 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);
2025
+ #endif
2026
+ var refraction_ior: f32=vRefractionInfos.y;
2027
+ #ifdef SS_DISPERSION
2028
+ 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];
2029
+ #endif
2030
+ var envSample: vec4f=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG
2031
+ #ifdef SS_REFRACTIONMAP_3D
2032
+ ,refractionSampler
2033
+ ,refractionSamplerSampler
2034
+ #ifndef LODBASEDMICROSFURACE
2035
+ ,refractionLowSampler
2036
+ ,refractionLowSamplerSampler
2037
+ ,refractionHighSampler
2038
+ ,refractionHighSamplerSampler
2039
+ #endif
2040
+ #else
2041
+ ,refractionSampler
2042
+ ,refractionSamplerSampler
2043
+ #ifndef LODBASEDMICROSFURACE
2044
+ ,refractionLowSampler
2045
+ ,refractionLowSamplerSampler
2046
+ ,refractionHighSampler
2047
+ ,refractionHighSamplerSampler
2048
+ #endif
2049
+ #endif
2050
+ #ifdef ANISOTROPIC
2051
+ ,anisotropicOut
2052
+ #endif
2053
+ #ifdef REALTIME_FILTERING
2054
+ ,vRefractionFilteringInfo
2055
+ #endif
2056
+ #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
2057
+ ,refractionPosition
2058
+ ,refractionSize
2059
+ #endif
2060
+ );
2061
+ #ifdef SS_DISPERSION
2062
+ environmentRefraction[i]=envSample[i];}
2063
+ #else
2064
+ environmentRefraction=envSample;
2065
+ #endif
2066
+ environmentRefraction=vec4f(environmentRefraction.rgb*vRefractionInfos.x,environmentRefraction.a);
2067
+ #endif
2068
+ #ifdef SS_REFRACTION
2069
+ var refractionTransmittance: vec3f= vec3f(refractionIntensity);
2070
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
2071
+ var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,thickness);
2072
+ #elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)
2073
+ var maxChannel: f32=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);var volumeAlbedo: vec3f=saturateVec3(maxChannel*surfaceAlbedo);environmentRefraction=vec4f(environmentRefraction.rgb*volumeAlbedo,environmentRefraction.a);
2074
+ #else
2075
+ var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,vThicknessParam.y);
2076
+ #endif
2077
+ #ifdef SS_ALBEDOFORREFRACTIONTINT
2078
+ environmentRefraction=vec4f(environmentRefraction.rgb*surfaceAlbedo.rgb,environmentRefraction.a);
2079
+ #endif
2080
+ outParams.surfaceAlbedo=surfaceAlbedo;outParams.refractionOpacity=1.-refractionIntensity;
2081
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
2082
+ outParams.surfaceAlbedo*=outParams.refractionOpacity;
2083
+ #endif
2084
+ #ifdef UNUSED_MULTIPLEBOUNCES
2085
+ var bounceSpecularEnvironmentReflectance: vec3f=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);
2086
+ #endif
2087
+ #if DEBUGMODE>0
2088
+ outParams.refractionTransmittance=refractionTransmittance;
2089
+ #endif
2090
+ outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;outParams.finalRefraction*=vec3f(1.0)-specularEnvironmentReflectance;
2091
+ #if DEBUGMODE>0
2092
+ outParams.environmentRefraction=environmentRefraction;
2093
+ #endif
2094
+ #endif
2095
+ #if defined(REFLECTION) && defined(SS_TRANSLUCENCY)
2096
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)
2097
+ var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz;
2098
+ #ifdef REFLECTIONMAP_OPPOSITEZ
2099
+ irradianceVector.z*=-1.0;
2100
+ #endif
2101
+ #ifdef INVERTCUBICMAP
2102
+ irradianceVector.y*=-1.0;
2103
+ #endif
2104
+ #else
2105
+ var irradianceVector: vec3f=irradianceVector_;
2106
+ #endif
2107
+ #if defined(USESPHERICALFROMREFLECTIONMAP)
2108
+ #if defined(REALTIME_FILTERING)
2109
+ var refractionIrradiance: vec3f=irradiance(reflectionSampler,reflectionSamplerSampler,-irradianceVector,vReflectionFilteringInfo,0.0,surfaceAlbedo,irradianceVector
2110
+ #ifdef IBL_CDF_FILTERING
2111
+ ,icdfSampler
2112
+ ,icdfSamplerSampler
2113
+ #endif
2114
+ );
2115
+ #else
2116
+ var refractionIrradiance: vec3f=computeEnvironmentIrradiance(-irradianceVector);
2117
+ #endif
2118
+ #elif defined(USEIRRADIANCEMAP)
2119
+ #ifdef REFLECTIONMAP_3D
2120
+ var irradianceCoords: vec3f=irradianceVector;
2121
+ #else
2122
+ var irradianceCoords: vec2f=irradianceVector.xy;
2123
+ #ifdef REFLECTIONMAP_PROJECTION
2124
+ irradianceCoords/=irradianceVector.z;
2125
+ #endif
2126
+ irradianceCoords.y=1.0-irradianceCoords.y;
2127
+ #endif
2128
+ var temp: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,-irradianceCoords);var refractionIrradiance=temp.rgb;
2129
+ #ifdef RGBDREFLECTION
2130
+ refractionIrradiance=fromRGBD(temp).rgb;
2131
+ #endif
2132
+ #ifdef GAMMAREFLECTION
2133
+ refractionIrradiance=toLinearSpaceVec3(refractionIrradiance);
2134
+ #endif
2135
+ #else
2136
+ var refractionIrradiance: vec3f= vec3f(0.);
2137
+ #endif
2138
+ refractionIrradiance*=transmittance;
2139
+ #ifdef SS_ALBEDOFORTRANSLUCENCYTINT
2140
+ refractionIrradiance*=surfaceAlbedo.rgb;
2141
+ #endif
2142
+ outParams.refractionIrradiance=refractionIrradiance;
2143
+ #endif
2144
+ return outParams;}
2145
+ #endif
2146
+ `;e.IncludesShadersStoreWGSL[L]||(e.IncludesShadersStoreWGSL[L]=ne);const O="pbrBlockNormalGeometric",fe=`var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW);
2147
+ #ifdef NORMAL
2148
+ var normalW: vec3f=normalize(input.vNormalW);
2149
+ #else
2150
+ var normalW: vec3f=normalize(cross(dpdx(input.vPositionW),dpdy(input.vPositionW)))*scene.vEyePosition.w;
2151
+ #endif
2152
+ var geometricNormalW: vec3f=normalW;
2153
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
2154
+ geometricNormalW=select(-geometricNormalW,geometricNormalW,fragmentInputs.frontFacing);
2155
+ #endif
2156
+ `;e.IncludesShadersStoreWGSL[O]||(e.IncludesShadersStoreWGSL[O]=fe);const T="pbrBlockNormalFinal",te=`#if defined(FORCENORMALFORWARD) && defined(NORMAL)
2157
+ var faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w;
2158
+ #if defined(TWOSIDEDLIGHTING)
2159
+ faceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing);
2160
+ #endif
2161
+ normalW*=sign(dot(normalW,faceNormal));
2162
+ #endif
2163
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
2164
+ #if defined(MIRRORED)
2165
+ normalW=select(normalW,-normalW,fragmentInputs.frontFacing);
2166
+ #else
2167
+ normalW=select(-normalW,normalW,fragmentInputs.frontFacing);
2168
+ #endif
2169
+ #endif
2170
+ `;e.IncludesShadersStoreWGSL[T]||(e.IncludesShadersStoreWGSL[T]=te);const g="pbrBlockLightmapInit",oe=`#ifdef LIGHTMAP
2171
+ var lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset);
2172
+ #ifdef RGBDLIGHTMAP
2173
+ lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a);
2174
+ #endif
2175
+ #ifdef GAMMALIGHTMAP
2176
+ lightmapColor=vec4f(toLinearSpaceVec3(lightmapColor.rgb),lightmapColor.a);
2177
+ #endif
2178
+ lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a);
2179
+ #endif
2180
+ `;e.IncludesShadersStoreWGSL[g]||(e.IncludesShadersStoreWGSL[g]=oe);const h="pbrBlockGeometryInfo",ce=`var NdotVUnclamped: f32=dot(normalW,viewDirectionW);var NdotV: f32=absEps(NdotVUnclamped);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var AARoughnessFactors: vec2f=getAARoughnessFactors(normalW.xyz);
2181
+ #ifdef SPECULARAA
2182
+ alphaG+=AARoughnessFactors.y;
2183
+ #endif
2184
+ #if defined(ENVIRONMENTBRDF)
2185
+ var environmentBrdf: vec3f=getBRDFLookup(NdotV,roughness);
2186
+ #endif
2187
+ #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2188
+ #ifdef RADIANCEOCCLUSION
2189
+ #ifdef AMBIENTINGRAYSCALE
2190
+ var ambientMonochrome: f32=aoOut.ambientOcclusionColor.r;
2191
+ #else
2192
+ var ambientMonochrome: f32=getLuminance(aoOut.ambientOcclusionColor);
2193
+ #endif
2194
+ var seo: f32=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);
2195
+ #endif
2196
+ #ifdef HORIZONOCCLUSION
2197
+ #ifdef BUMP
2198
+ #ifdef REFLECTIONMAP_3D
2199
+ var eho: f32=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
2200
+ #endif
2201
+ #endif
2202
+ #endif
2203
+ #endif
2204
+ `;e.IncludesShadersStoreWGSL[h]||(e.IncludesShadersStoreWGSL[h]=ce);const _="pbrBlockReflectance",le=`#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2205
+ var baseSpecularEnvironmentReflectance: vec3f=getReflectanceFromBRDFWithEnvLookup(vec3f(reflectanceF0),vec3f(reflectivityOut.reflectanceF90),environmentBrdf);
2206
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
2207
+ let metalEnvironmentReflectance: vec3f=vec3f(reflectivityOut.specularWeight)*getF82Specular(NdotV,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricEnvironmentReflectance=getReflectanceFromBRDFWithEnvLookup(reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90,environmentBrdf);var colorSpecularEnvironmentReflectance: vec3f=mix(dielectricEnvironmentReflectance,metalEnvironmentReflectance,reflectivityOut.metallic);
2208
+ #else
2209
+ var colorSpecularEnvironmentReflectance=getReflectanceFromBRDFWithEnvLookup(clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,environmentBrdf);
2210
+ #endif
2211
+ #ifdef RADIANCEOCCLUSION
2212
+ colorSpecularEnvironmentReflectance*=seo;
2213
+ #endif
2214
+ #ifdef HORIZONOCCLUSION
2215
+ #ifdef BUMP
2216
+ #ifdef REFLECTIONMAP_3D
2217
+ colorSpecularEnvironmentReflectance*=eho;
2218
+ #endif
2219
+ #endif
2220
+ #endif
2221
+ #else
2222
+ var colorSpecularEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));var baseSpecularEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,vec3f(reflectanceF0),vec3f(reflectivityOut.reflectanceF90),sqrt(microSurface));
2223
+ #endif
2224
+ #ifdef CLEARCOAT
2225
+ colorSpecularEnvironmentReflectance*=clearcoatOut.conservationFactor;
2226
+ #if defined(CLEARCOAT_TINT)
2227
+ colorSpecularEnvironmentReflectance*=clearcoatOut.absorption;
2228
+ #endif
2229
+ #endif
2230
+ `;e.IncludesShadersStoreWGSL[_]||(e.IncludesShadersStoreWGSL[_]=le);const D="pbrBlockDirectLighting",se=`var diffuseBase: vec3f=vec3f(0.,0.,0.);
2231
+ #ifdef SS_TRANSLUCENCY
2232
+ var diffuseTransmissionBase: vec3f=vec3f(0.,0.,0.);
2233
+ #endif
2234
+ #ifdef SPECULARTERM
2235
+ var specularBase: vec3f=vec3f(0.,0.,0.);
2236
+ #endif
2237
+ #ifdef CLEARCOAT
2238
+ var clearCoatBase: vec3f=vec3f(0.,0.,0.);
2239
+ #endif
2240
+ #ifdef SHEEN
2241
+ var sheenBase: vec3f=vec3f(0.,0.,0.);
2242
+ #endif
2243
+ #if defined(SPECULARTERM) && defined(LIGHT0)
2244
+ var coloredFresnel: vec3f=vec3f(0.,0.,0.);
2245
+ #endif
2246
+ var preInfo: preLightingInfo;var info: lightingInfo;var shadow: f32=1.;
2247
+ var aggShadow: f32=0.;var numLights: f32=0.;
2248
+ #if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
2249
+ var absorption: vec3f=vec3f(0.);
2250
+ #endif
2251
+ `;e.IncludesShadersStoreWGSL[D]||(e.IncludesShadersStoreWGSL[D]=se);const M="pbrBlockFinalLitComponents",de=`aggShadow=aggShadow/numLights;
2252
+ #if defined(ENVIRONMENTBRDF)
2253
+ #ifdef MS_BRDF_ENERGY_CONSERVATION
2254
+ var baseSpecularEnergyConservationFactor: vec3f=getEnergyConservationFactor(vec3f(reflectanceF0),environmentBrdf);var coloredEnergyConservationFactor: vec3f=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);
2255
+ #endif
2256
+ #endif
2257
+ #if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)
2258
+ surfaceAlbedo=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;
2259
+ #endif
2260
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
2261
+ #ifndef METALLICWORKFLOW
2262
+ #ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION
2263
+ surfaceAlbedo=vec3f(1.-reflectanceF0)*surfaceAlbedo.rgb;
2264
+ #endif
2265
+ #endif
2266
+ #endif
2267
+ #ifdef REFLECTION
2268
+ var finalIrradiance: vec3f=reflectionOut.environmentIrradiance;
2269
+ #ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION
2270
+ #if defined(METALLICWORKFLOW) || defined(SPECULAR_GLOSSINESS_ENERGY_CONSERVATION)
2271
+ var baseSpecularEnergy: vec3f=vec3f(baseSpecularEnvironmentReflectance);
2272
+ #if defined(ENVIRONMENTBRDF)
2273
+ #ifdef MS_BRDF_ENERGY_CONSERVATION
2274
+ baseSpecularEnergy*=baseSpecularEnergyConservationFactor;
2275
+ #endif
2276
+ #endif
2277
+ finalIrradiance*=clamp(vec3f(1.0)-baseSpecularEnergy,vec3f(0.0),vec3f(1.0));
2278
+ #endif
2279
+ #endif
2280
+ #if defined(CLEARCOAT)
2281
+ finalIrradiance*=clearcoatOut.conservationFactor;
2282
+ #if defined(CLEARCOAT_TINT)
2283
+ finalIrradiance*=clearcoatOut.absorption;
2284
+ #endif
2285
+ #endif
2286
+ #ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE
2287
+ finalIrradiance*=surfaceAlbedo.rgb;
2288
+ #endif
2289
+ #if defined(SS_REFRACTION)
2290
+ finalIrradiance*=subSurfaceOut.refractionOpacity;
2291
+ #endif
2292
+ #if defined(SS_TRANSLUCENCY)
2293
+ finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;
2294
+ #endif
2295
+ #ifdef SS_APPLY_ALBEDO_AFTER_SUBSURFACE
2296
+ finalIrradiance*=surfaceAlbedo.rgb;
2297
+ #endif
2298
+ finalIrradiance*=uniforms.vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;
2299
+ #endif
2300
+ #ifdef SPECULARTERM
2301
+ var finalSpecular: vec3f=specularBase;finalSpecular=max(finalSpecular,vec3f(0.0));var finalSpecularScaled: vec3f=finalSpecular*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2302
+ #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2303
+ finalSpecularScaled*=coloredEnergyConservationFactor;
2304
+ #endif
2305
+ #if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
2306
+ finalSpecularScaled*=sheenOut.sheenAlbedoScaling;
2307
+ #endif
2308
+ #endif
2309
+ #ifdef REFLECTION
2310
+ var finalRadiance: vec3f=reflectionOut.environmentRadiance.rgb;finalRadiance*=colorSpecularEnvironmentReflectance;;var finalRadianceScaled: vec3f=finalRadiance*uniforms.vLightingIntensity.z;
2311
+ #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2312
+ finalRadianceScaled*=coloredEnergyConservationFactor;
2313
+ #endif
2314
+ #if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
2315
+ finalRadianceScaled*=sheenOut.sheenAlbedoScaling;
2316
+ #endif
2317
+ #endif
2318
+ #ifdef SHEEN
2319
+ var finalSheen: vec3f=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,vec3f(0.0));var finalSheenScaled: vec3f=finalSheen*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2320
+ #if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)
2321
+ sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;
2322
+ #if defined(CLEARCOAT_TINT)
2323
+ sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;
2324
+ #endif
2325
+ #endif
2326
+ #endif
2327
+ #ifdef CLEARCOAT
2328
+ var finalClearCoat: vec3f=clearCoatBase;finalClearCoat=max(finalClearCoat,vec3f(0.0));var finalClearCoatScaled: vec3f=finalClearCoat*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w;
2329
+ #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
2330
+ finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;
2331
+ #endif
2332
+ #ifdef SS_REFRACTION
2333
+ subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;
2334
+ #ifdef CLEARCOAT_TINT
2335
+ subSurfaceOut.finalRefraction*=clearcoatOut.absorption;
2336
+ #endif
2337
+ #endif
2338
+ #endif
2339
+ #ifdef ALPHABLEND
2340
+ var luminanceOverAlpha: f32=0.0;
2341
+ #if defined(REFLECTION) && defined(RADIANCEOVERALPHA)
2342
+ luminanceOverAlpha+=getLuminance(finalRadianceScaled);
2343
+ #if defined(CLEARCOAT)
2344
+ luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);
2345
+ #endif
2346
+ #endif
2347
+ #if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)
2348
+ luminanceOverAlpha+=getLuminance(finalSpecularScaled);
2349
+ #endif
2350
+ #if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)
2351
+ luminanceOverAlpha+=getLuminance(finalClearCoatScaled);
2352
+ #endif
2353
+ #if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)
2354
+ alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);
2355
+ #endif
2356
+ #endif
2357
+ `;e.IncludesShadersStoreWGSL[M]||(e.IncludesShadersStoreWGSL[M]=de);const F="pbrBlockFinalUnlitComponents",Ee=`var finalDiffuse: vec3f=diffuseBase;finalDiffuse*=surfaceAlbedo;
2358
+ #if defined(SS_REFRACTION) && !defined(UNLIT) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION)
2359
+ finalDiffuse*=subSurfaceOut.refractionOpacity;
2360
+ #endif
2361
+ #if defined(SS_TRANSLUCENCY) && !defined(UNLIT)
2362
+ finalDiffuse+=diffuseTransmissionBase;
2363
+ #endif
2364
+ finalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient=finalAmbient*surfaceAlbedo.rgb;var finalEmissive: vec3f=uniforms.vEmissiveColor;
2365
+ #ifdef EMISSIVE
2366
+ var emissiveColorTex: vec3f=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb;
2367
+ #ifdef GAMMAEMISSIVE
2368
+ finalEmissive*=toLinearSpaceVec3(emissiveColorTex.rgb);
2369
+ #else
2370
+ finalEmissive*=emissiveColorTex.rgb;
2371
+ #endif
2372
+ finalEmissive*= uniforms.vEmissiveInfos.y;
2373
+ #endif
2374
+ finalEmissive*=uniforms.vLightingIntensity.y;
2375
+ #ifdef AMBIENT
2376
+ var ambientOcclusionForDirectDiffuse: vec3f=mix( vec3f(1.),aoOut.ambientOcclusionColor,uniforms.vAmbientInfos.w);
2377
+ #else
2378
+ var ambientOcclusionForDirectDiffuse: vec3f=aoOut.ambientOcclusionColor;
2379
+ #endif
2380
+ finalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse;
2381
+ `;e.IncludesShadersStoreWGSL[F]||(e.IncludesShadersStoreWGSL[F]=Ee);const P="pbrBlockFinalColorComposition",ue=`var finalColor: vec4f= vec4f(
2382
+ #ifndef UNLIT
2383
+ #ifdef REFLECTION
2384
+ finalIrradiance +
2385
+ #endif
2386
+ #ifdef SPECULARTERM
2387
+ finalSpecularScaled +
2388
+ #endif
2389
+ #ifdef SHEEN
2390
+ finalSheenScaled +
2391
+ #endif
2392
+ #ifdef CLEARCOAT
2393
+ finalClearCoatScaled +
2394
+ #endif
2395
+ #ifdef REFLECTION
2396
+ finalRadianceScaled +
2397
+ #if defined(SHEEN) && defined(ENVIRONMENTBRDF)
2398
+ sheenOut.finalSheenRadianceScaled +
2399
+ #endif
2400
+ #ifdef CLEARCOAT
2401
+ clearcoatOut.finalClearCoatRadianceScaled +
2402
+ #endif
2403
+ #endif
2404
+ #ifdef SS_REFRACTION
2405
+ subSurfaceOut.finalRefraction +
2406
+ #endif
2407
+ #endif
2408
+ finalAmbient +
2409
+ finalDiffuse,
2410
+ alpha);
2411
+ #ifdef LIGHTMAP
2412
+ #ifndef LIGHTMAPEXCLUDED
2413
+ #ifdef USELIGHTMAPASSHADOWMAP
2414
+ finalColor=vec4f(finalColor.rgb*lightmapColor.rgb,finalColor.a);
2415
+ #else
2416
+ finalColor=vec4f(finalColor.rgb+lightmapColor.rgb,finalColor.a);
2417
+ #endif
2418
+ #endif
2419
+ #endif
2420
+ finalColor=vec4f(finalColor.rgb+finalEmissive,finalColor.a);
2421
+ #define CUSTOM_FRAGMENT_BEFORE_FOG
2422
+ finalColor=max(finalColor,vec4f(0.0));
2423
+ `;e.IncludesShadersStoreWGSL[P]||(e.IncludesShadersStoreWGSL[P]=ue);const U="pbrBlockImageProcessing",me=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
2424
+ #if !defined(SKIPFINALCOLORCLAMP)
2425
+ finalColor=vec4f(clamp(finalColor.rgb,vec3f(0.),vec3f(30.0)),finalColor.a);
2426
+ #endif
2427
+ #else
2428
+ finalColor=applyImageProcessing(finalColor);
2429
+ #endif
2430
+ finalColor=vec4f(finalColor.rgb,finalColor.a*mesh.visibility);
2431
+ #ifdef PREMULTIPLYALPHA
2432
+ finalColor=vec4f(finalColor.rgb*finalColor.a,finalColor.a);;
2433
+ #endif
2434
+ `;e.IncludesShadersStoreWGSL[U]||(e.IncludesShadersStoreWGSL[U]=me);const b="pbrBlockPrePass",Se=`#if SCENE_MRT_COUNT>0
2435
+ var writeGeometryInfo: f32=select(0.0,1.0,finalColor.a>ALPHATESTVALUE);var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
2436
+ #ifdef PREPASS_POSITION
2437
+ fragData[PREPASS_POSITION_INDEX]= vec4f(fragmentInputs.vPositionW,writeGeometryInfo);
2438
+ #endif
2439
+ #ifdef PREPASS_LOCAL_POSITION
2440
+ fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);
2441
+ #endif
2442
+ #ifdef PREPASS_VELOCITY
2443
+ 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);
2444
+ #elif defined(PREPASS_VELOCITY_LINEAR)
2445
+ var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -
2446
+ (fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);
2447
+ #endif
2448
+ #ifdef PREPASS_ALBEDO
2449
+ fragData[PREPASS_ALBEDO_INDEX]=vec4f(surfaceAlbedo,writeGeometryInfo);
2450
+ #endif
2451
+ #ifdef PREPASS_ALBEDO_SQRT
2452
+ var sqAlbedo : vec3f=sqrt(surfaceAlbedo);
2453
+ #endif
2454
+ #ifdef PREPASS_IRRADIANCE
2455
+ var irradiance : vec3f=finalDiffuse;
2456
+ #ifndef UNLIT
2457
+ #ifdef REFLECTION
2458
+ irradiance+=finalIrradiance;
2459
+ #endif
2460
+ #endif
2461
+ #ifdef SS_SCATTERING
2462
+ #ifdef PREPASS_COLOR
2463
+ fragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb-irradiance,finalColor.a);
2464
+ #endif
2465
+ irradiance/=sqAlbedo;fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo*uniforms.scatteringDiffusionProfile/255.);
2466
+ #else
2467
+ #ifdef PREPASS_COLOR
2468
+ fragData[PREPASS_COLOR_INDEX]=finalColor;
2469
+ #endif
2470
+ fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo);
2471
+ #endif
2472
+ #elif defined(PREPASS_COLOR)
2473
+ fragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb,finalColor.a);
2474
+ #endif
2475
+ #ifdef PREPASS_DEPTH
2476
+ fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo);
2477
+ #endif
2478
+ #ifdef PREPASS_SCREENSPACE_DEPTH
2479
+ fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);
2480
+ #endif
2481
+ #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
2482
+ fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);
2483
+ #endif
2484
+ #ifdef PREPASS_NORMAL
2485
+ #ifdef PREPASS_NORMAL_WORLDSPACE
2486
+ fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);
2487
+ #else
2488
+ fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);
2489
+ #endif
2490
+ #endif
2491
+ #ifdef PREPASS_WORLD_NORMAL
2492
+ fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);
2493
+ #endif
2494
+ #ifdef PREPASS_ALBEDO_SQRT
2495
+ fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqAlbedo,writeGeometryInfo);
2496
+ #endif
2497
+ #ifdef PREPASS_REFLECTIVITY
2498
+ #ifndef UNLIT
2499
+ fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(specularEnvironmentR0,microSurface)*writeGeometryInfo;
2500
+ #else
2501
+ fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(0.0,0.0,0.0,1.0)*writeGeometryInfo;
2502
+ #endif
2503
+ #endif
2504
+ #if SCENE_MRT_COUNT>0
2505
+ fragmentOutputs.fragData0=fragData[0];
2506
+ #endif
2507
+ #if SCENE_MRT_COUNT>1
2508
+ fragmentOutputs.fragData1=fragData[1];
2509
+ #endif
2510
+ #if SCENE_MRT_COUNT>2
2511
+ fragmentOutputs.fragData2=fragData[2];
2512
+ #endif
2513
+ #if SCENE_MRT_COUNT>3
2514
+ fragmentOutputs.fragData3=fragData[3];
2515
+ #endif
2516
+ #if SCENE_MRT_COUNT>4
2517
+ fragmentOutputs.fragData4=fragData[4];
2518
+ #endif
2519
+ #if SCENE_MRT_COUNT>5
2520
+ fragmentOutputs.fragData5=fragData[5];
2521
+ #endif
2522
+ #if SCENE_MRT_COUNT>6
2523
+ fragmentOutputs.fragData6=fragData[6];
2524
+ #endif
2525
+ #if SCENE_MRT_COUNT>7
2526
+ fragmentOutputs.fragData7=fragData[7];
2527
+ #endif
2528
+ #endif
2529
+ `;e.IncludesShadersStoreWGSL[b]||(e.IncludesShadersStoreWGSL[b]=Se);const B="pbrDebug",ve=`#if DEBUGMODE>0
2530
+ if (input.vClipSpacePosition.x/input.vClipSpacePosition.w>=uniforms.vDebugMode.x) {var color: vec3f;
2531
+ #if DEBUGMODE==1
2532
+ color=fragmentInputs.vPositionW.rgb;
2533
+ #define DEBUGMODE_NORMALIZE
2534
+ #elif DEBUGMODE==2 && defined(NORMAL)
2535
+ color=fragmentInputs.vNormalW.rgb;
2536
+ #define DEBUGMODE_NORMALIZE
2537
+ #elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
2538
+ color=TBN[0];
2539
+ #define DEBUGMODE_NORMALIZE
2540
+ #elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
2541
+ color=TBN[1];
2542
+ #define DEBUGMODE_NORMALIZE
2543
+ #elif DEBUGMODE==5
2544
+ color=normalW;
2545
+ #define DEBUGMODE_NORMALIZE
2546
+ #elif DEBUGMODE==6 && defined(MAINUV1)
2547
+ color= vec3f(input.vMainUV1,0.0);
2548
+ #elif DEBUGMODE==7 && defined(MAINUV2)
2549
+ color= vec3f(input.vMainUV2,0.0);
2550
+ #elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
2551
+ color=clearcoatOut.TBNClearCoat[0];
2552
+ #define DEBUGMODE_NORMALIZE
2553
+ #elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
2554
+ color=clearcoatOut.TBNClearCoat[1];
2555
+ #define DEBUGMODE_NORMALIZE
2556
+ #elif DEBUGMODE==10 && defined(CLEARCOAT)
2557
+ color=clearcoatOut.clearCoatNormalW;
2558
+ #define DEBUGMODE_NORMALIZE
2559
+ #elif DEBUGMODE==11 && defined(ANISOTROPIC)
2560
+ color=anisotropicOut.anisotropicNormal;
2561
+ #define DEBUGMODE_NORMALIZE
2562
+ #elif DEBUGMODE==12 && defined(ANISOTROPIC)
2563
+ color=anisotropicOut.anisotropicTangent;
2564
+ #define DEBUGMODE_NORMALIZE
2565
+ #elif DEBUGMODE==13 && defined(ANISOTROPIC)
2566
+ color=anisotropicOut.anisotropicBitangent;
2567
+ #define DEBUGMODE_NORMALIZE
2568
+ #elif DEBUGMODE==20 && defined(ALBEDO)
2569
+ color=albedoTexture.rgb;
2570
+ #ifndef GAMMAALBEDO
2571
+ #define DEBUGMODE_GAMMA
2572
+ #endif
2573
+ #elif DEBUGMODE==21 && defined(AMBIENT)
2574
+ color=aoOut.ambientOcclusionColorMap.rgb;
2575
+ #elif DEBUGMODE==22 && defined(OPACITY)
2576
+ color=opacityMap.rgb;
2577
+ #elif DEBUGMODE==23 && defined(EMISSIVE)
2578
+ color=emissiveColorTex.rgb;
2579
+ #ifndef GAMMAEMISSIVE
2580
+ #define DEBUGMODE_GAMMA
2581
+ #endif
2582
+ #elif DEBUGMODE==24 && defined(LIGHTMAP)
2583
+ color=lightmapColor;
2584
+ #ifndef GAMMALIGHTMAP
2585
+ #define DEBUGMODE_GAMMA
2586
+ #endif
2587
+ #elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
2588
+ color=reflectivityOut.surfaceMetallicColorMap.rgb;
2589
+ #elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
2590
+ color=reflectivityOut.surfaceReflectivityColorMap.rgb;
2591
+ #define DEBUGMODE_GAMMA
2592
+ #elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
2593
+ color= vec3f(clearcoatOut.clearCoatMapData.rg,0.0);
2594
+ #elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
2595
+ color=clearcoatOut.clearCoatTintMapData.rgb;
2596
+ #elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
2597
+ color=sheenOut.sheenMapData.rgb;
2598
+ #elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
2599
+ color=anisotropicOut.anisotropyMapData.rgb;
2600
+ #elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
2601
+ color=subSurfaceOut.thicknessMap.rgb;
2602
+ #elif DEBUGMODE==32 && defined(BUMP)
2603
+ color=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).rgb;
2604
+ #elif DEBUGMODE==40 && defined(SS_REFRACTION)
2605
+ color=subSurfaceOut.environmentRefraction.rgb;
2606
+ #define DEBUGMODE_GAMMA
2607
+ #elif DEBUGMODE==41 && defined(REFLECTION)
2608
+ color=reflectionOut.environmentRadiance.rgb;
2609
+ #ifndef GAMMAREFLECTION
2610
+ #define DEBUGMODE_GAMMA
2611
+ #endif
2612
+ #elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
2613
+ color=clearcoatOut.environmentClearCoatRadiance.rgb;
2614
+ #define DEBUGMODE_GAMMA
2615
+ #elif DEBUGMODE==50
2616
+ color=diffuseBase.rgb;
2617
+ #define DEBUGMODE_GAMMA
2618
+ #elif DEBUGMODE==51 && defined(SPECULARTERM)
2619
+ color=specularBase.rgb;
2620
+ #define DEBUGMODE_GAMMA
2621
+ #elif DEBUGMODE==52 && defined(CLEARCOAT)
2622
+ color=clearCoatBase.rgb;
2623
+ #define DEBUGMODE_GAMMA
2624
+ #elif DEBUGMODE==53 && defined(SHEEN)
2625
+ color=sheenBase.rgb;
2626
+ #define DEBUGMODE_GAMMA
2627
+ #elif DEBUGMODE==54 && defined(REFLECTION)
2628
+ color=reflectionOut.environmentIrradiance.rgb;
2629
+ #ifndef GAMMAREFLECTION
2630
+ #define DEBUGMODE_GAMMA
2631
+ #endif
2632
+ #elif DEBUGMODE==60
2633
+ color=surfaceAlbedo.rgb;
2634
+ #define DEBUGMODE_GAMMA
2635
+ #elif DEBUGMODE==61
2636
+ color=clearcoatOut.specularEnvironmentR0;
2637
+ #define DEBUGMODE_GAMMA
2638
+ #elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
2639
+ color= vec3f(reflectivityOut.metallic);
2640
+ #elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
2641
+ color=reflectivityOut.metallicF0;
2642
+ #elif DEBUGMODE==63
2643
+ color= vec3f(roughness);
2644
+ #elif DEBUGMODE==64
2645
+ color= vec3f(alphaG);
2646
+ #elif DEBUGMODE==65
2647
+ color= vec3f(NdotV);
2648
+ #elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
2649
+ color=clearcoatOut.clearCoatColor;
2650
+ #define DEBUGMODE_GAMMA
2651
+ #elif DEBUGMODE==67 && defined(CLEARCOAT)
2652
+ color= vec3f(clearcoatOut.clearCoatRoughness);
2653
+ #elif DEBUGMODE==68 && defined(CLEARCOAT)
2654
+ color= vec3f(clearcoatOut.clearCoatNdotV);
2655
+ #elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
2656
+ color=subSurfaceOut.transmittance;
2657
+ #elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
2658
+ color=subSurfaceOut.refractionTransmittance;
2659
+ #elif DEBUGMODE==72
2660
+ color= vec3f(microSurface);
2661
+ #elif DEBUGMODE==73
2662
+ color=uniforms.vAlbedoColor.rgb;
2663
+ #define DEBUGMODE_GAMMA
2664
+ #elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
2665
+ color=uniforms.vReflectivityColor.rgb;
2666
+ #define DEBUGMODE_GAMMA
2667
+ #elif DEBUGMODE==75
2668
+ color=uniforms.vEmissiveColor;
2669
+ #define DEBUGMODE_GAMMA
2670
+ #elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
2671
+ color= vec3f(seo);
2672
+ #elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
2673
+ color= vec3f(eho);
2674
+ #elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
2675
+ color= vec3f(energyConservationFactor);
2676
+ #elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2677
+ color=baseSpecularEnvironmentReflectance;
2678
+ #define DEBUGMODE_GAMMA
2679
+ #elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
2680
+ color=clearcoatOut.clearCoatEnvironmentReflectance;
2681
+ #define DEBUGMODE_GAMMA
2682
+ #elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
2683
+ color=sheenOut.sheenEnvironmentReflectance;
2684
+ #define DEBUGMODE_GAMMA
2685
+ #elif DEBUGMODE==86 && defined(ALPHABLEND)
2686
+ color= vec3f(luminanceOverAlpha);
2687
+ #elif DEBUGMODE==87
2688
+ color= vec3f(alpha);
2689
+ #elif DEBUGMODE==88 && defined(ALBEDO)
2690
+ color= vec3f(albedoTexture.a);
2691
+ #elif DEBUGMODE==89
2692
+ color=aoOut.ambientOcclusionColor;
2693
+ #else
2694
+ 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);
2695
+ #endif
2696
+ color*=uniforms.vDebugMode.y;
2697
+ #ifdef DEBUGMODE_NORMALIZE
2698
+ color=normalize(color)*0.5+0.5;
2699
+ #endif
2700
+ #ifdef DEBUGMODE_GAMMA
2701
+ color=toGammaSpaceVec3(color);
2702
+ #endif
2703
+ fragmentOutputs.color=vec4f(color,1.0);
2704
+ #ifdef PREPASS
2705
+ fragmentOutputs.fragData0=toLinearSpaceVec3(color);
2706
+ fragmentOutputs.fragData1=vec4f(0.,0.,0.,0.);
2707
+ #endif
2708
+ #ifdef DEBUGMODE_FORCERETURN
2709
+ return fragmentOutputs;
2710
+ #endif
2711
+ }
2712
+ #endif
2713
+ `;e.IncludesShadersStoreWGSL[B]||(e.IncludesShadersStoreWGSL[B]=ve);const i="pbrPixelShader",G=`#define PBR_FRAGMENT_SHADER
2714
+ #define CUSTOM_FRAGMENT_BEGIN
2715
+ #include<prePassDeclaration>[SCENE_MRT_COUNT]
2716
+ #include<oitDeclaration>
2717
+ #ifndef FROMLINEARSPACE
2718
+ #define FROMLINEARSPACE
2719
+ #endif
2720
+ #include<pbrUboDeclaration>
2721
+ #include<pbrFragmentExtraDeclaration>
2722
+ #include<lightUboDeclaration>[0..maxSimultaneousLights]
2723
+ #include<pbrFragmentSamplersDeclaration>
2724
+ #include<imageProcessingDeclaration>
2725
+ #include<clipPlaneFragmentDeclaration>
2726
+ #include<logDepthDeclaration>
2727
+ #include<fogFragmentDeclaration>
2728
+ #include<helperFunctions>
2729
+ #include<subSurfaceScatteringFunctions>
2730
+ #include<importanceSampling>
2731
+ #include<pbrHelperFunctions>
2732
+ #include<imageProcessingFunctions>
2733
+ #include<shadowsFragmentFunctions>
2734
+ #include<harmonicsFunctions>
2735
+ #include<pbrDirectLightingSetupFunctions>
2736
+ #include<pbrDirectLightingFalloffFunctions>
2737
+ #include<pbrBRDFFunctions>
2738
+ #include<hdrFilteringFunctions>
2739
+ #include<pbrDirectLightingFunctions>
2740
+ #include<pbrIBLFunctions>
2741
+ #include<bumpFragmentMainFunctions>
2742
+ #include<bumpFragmentFunctions>
2743
+ #ifdef REFLECTION
2744
+ #include<reflectionFunction>
2745
+ #endif
2746
+ #define CUSTOM_FRAGMENT_DEFINITIONS
2747
+ #include<pbrBlockAlbedoOpacity>
2748
+ #include<pbrBlockReflectivity>
2749
+ #include<pbrBlockAmbientOcclusion>
2750
+ #include<pbrBlockAlphaFresnel>
2751
+ #include<pbrBlockAnisotropic>
2752
+ #include<pbrBlockReflection>
2753
+ #include<pbrBlockSheen>
2754
+ #include<pbrBlockClearcoat>
2755
+ #include<pbrBlockIridescence>
2756
+ #include<pbrBlockSubSurface>
2757
+ @fragment
2758
+ fn main(input: FragmentInputs)->FragmentOutputs {
2759
+ #define CUSTOM_FRAGMENT_MAIN_BEGIN
2760
+ #include<clipPlaneFragment>
2761
+ #include<pbrBlockNormalGeometric>
2762
+ #include<bumpFragment>
2763
+ #include<pbrBlockNormalFinal>
2764
+ var albedoOpacityOut: albedoOpacityOutParams;
2765
+ #ifdef ALBEDO
2766
+ var albedoTexture: vec4f=textureSample(albedoSampler,albedoSamplerSampler,fragmentInputs.vAlbedoUV+uvOffset);
2767
+ #endif
2768
+ #ifdef BASE_WEIGHT
2769
+ var baseWeightTexture: vec4f=textureSample(baseWeightSampler,baseWeightSamplerSampler,fragmentInputs.vBaseWeightUV+uvOffset);
2770
+ #endif
2771
+ #ifdef OPACITY
2772
+ var opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);
2773
+ #endif
2774
+ #ifdef DECAL
2775
+ var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
2776
+ #endif
2777
+ albedoOpacityOut=albedoOpacityBlock(
2778
+ uniforms.vAlbedoColor
2779
+ #ifdef ALBEDO
2780
+ ,albedoTexture
2781
+ ,uniforms.vAlbedoInfos
2782
+ #endif
2783
+ ,uniforms.baseWeight
2784
+ #ifdef BASE_WEIGHT
2785
+ ,baseWeightTexture
2786
+ ,uniforms.vBaseWeightInfos
2787
+ #endif
2788
+ #ifdef OPACITY
2789
+ ,opacityMap
2790
+ ,uniforms.vOpacityInfos
2791
+ #endif
2792
+ #ifdef DETAIL
2793
+ ,detailColor
2794
+ ,uniforms.vDetailInfos
2795
+ #endif
2796
+ #ifdef DECAL
2797
+ ,decalColor
2798
+ ,uniforms.vDecalInfos
2799
+ #endif
2800
+ );var surfaceAlbedo: vec3f=albedoOpacityOut.surfaceAlbedo;var alpha: f32=albedoOpacityOut.alpha;
2801
+ #define CUSTOM_FRAGMENT_UPDATE_ALPHA
2802
+ #include<depthPrePass>
2803
+ #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
2804
+ var aoOut: ambientOcclusionOutParams;
2805
+ #ifdef AMBIENT
2806
+ var ambientOcclusionColorMap: vec3f=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb;
2807
+ #endif
2808
+ aoOut=ambientOcclusionBlock(
2809
+ #ifdef AMBIENT
2810
+ ambientOcclusionColorMap,
2811
+ uniforms.vAmbientInfos
2812
+ #endif
2813
+ );
2814
+ #include<pbrBlockLightmapInit>
2815
+ #ifdef UNLIT
2816
+ var diffuseBase: vec3f= vec3f(1.,1.,1.);
2817
+ #else
2818
+ var baseColor: vec3f=surfaceAlbedo;var reflectivityOut: reflectivityOutParams;
2819
+ #if defined(REFLECTIVITY)
2820
+ var surfaceMetallicOrReflectivityColorMap: vec4f=textureSample(reflectivitySampler,reflectivitySamplerSampler,fragmentInputs.vReflectivityUV+uvOffset);var baseReflectivity: vec4f=surfaceMetallicOrReflectivityColorMap;
2821
+ #ifndef METALLICWORKFLOW
2822
+ #ifdef REFLECTIVITY_GAMMA
2823
+ surfaceMetallicOrReflectivityColorMap=toLinearSpaceVec4(surfaceMetallicOrReflectivityColorMap);
2824
+ #endif
2825
+ surfaceMetallicOrReflectivityColorMap=vec4f(surfaceMetallicOrReflectivityColorMap.rgb*uniforms.vReflectivityInfos.y,surfaceMetallicOrReflectivityColorMap.a);
2826
+ #endif
2827
+ #endif
2828
+ #if defined(MICROSURFACEMAP)
2829
+ var microSurfaceTexel: vec4f=textureSample(microSurfaceSampler,microSurfaceSamplerSampler,fragmentInputs.vMicroSurfaceSamplerUV+uvOffset)*uniforms.vMicroSurfaceSamplerInfos.y;
2830
+ #endif
2831
+ #ifdef BASE_DIFFUSE_ROUGHNESS
2832
+ var baseDiffuseRoughnessTexture: f32=textureSample(baseDiffuseRoughnessSampler,baseDiffuseRoughnessSamplerSampler,fragmentInputs.vBaseDiffuseRoughnessUV+uvOffset).x;
2833
+ #endif
2834
+ #ifdef METALLICWORKFLOW
2835
+ var metallicReflectanceFactors: vec4f=uniforms.vMetallicReflectanceFactors;
2836
+ #ifdef REFLECTANCE
2837
+ var reflectanceFactorsMap: vec4f=textureSample(reflectanceSampler,reflectanceSamplerSampler,fragmentInputs.vReflectanceUV+uvOffset);
2838
+ #ifdef REFLECTANCE_GAMMA
2839
+ reflectanceFactorsMap=toLinearSpaceVec4(reflectanceFactorsMap);
2840
+ #endif
2841
+ metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*reflectanceFactorsMap.rgb,metallicReflectanceFactors.a);
2842
+ #endif
2843
+ #ifdef METALLIC_REFLECTANCE
2844
+ var metallicReflectanceFactorsMap: vec4f=textureSample(metallicReflectanceSampler,metallicReflectanceSamplerSampler,fragmentInputs.vMetallicReflectanceUV+uvOffset);
2845
+ #ifdef METALLIC_REFLECTANCE_GAMMA
2846
+ metallicReflectanceFactorsMap=toLinearSpaceVec4(metallicReflectanceFactorsMap);
2847
+ #endif
2848
+ #ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY
2849
+ metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*metallicReflectanceFactorsMap.rgb,metallicReflectanceFactors.a);
2850
+ #endif
2851
+ metallicReflectanceFactors.a*=metallicReflectanceFactorsMap.a;
2852
+ #endif
2853
+ #endif
2854
+ reflectivityOut=reflectivityBlock(
2855
+ uniforms.vReflectivityColor
2856
+ #ifdef METALLICWORKFLOW
2857
+ ,surfaceAlbedo
2858
+ ,metallicReflectanceFactors
2859
+ #endif
2860
+ ,uniforms.baseDiffuseRoughness
2861
+ #ifdef BASE_DIFFUSE_ROUGHNESS
2862
+ ,baseDiffuseRoughnessTexture
2863
+ ,uniforms.vBaseDiffuseRoughnessInfos
2864
+ #endif
2865
+ #ifdef REFLECTIVITY
2866
+ ,uniforms.vReflectivityInfos
2867
+ ,surfaceMetallicOrReflectivityColorMap
2868
+ #endif
2869
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
2870
+ ,aoOut.ambientOcclusionColor
2871
+ #endif
2872
+ #ifdef MICROSURFACEMAP
2873
+ ,microSurfaceTexel
2874
+ #endif
2875
+ #ifdef DETAIL
2876
+ ,detailColor
2877
+ ,uniforms.vDetailInfos
2878
+ #endif
2879
+ );var microSurface: f32=reflectivityOut.microSurface;var roughness: f32=reflectivityOut.roughness;var diffuseRoughness: f32=reflectivityOut.diffuseRoughness;
2880
+ #ifdef METALLICWORKFLOW
2881
+ surfaceAlbedo=reflectivityOut.surfaceAlbedo;
2882
+ #endif
2883
+ #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
2884
+ aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;
2885
+ #endif
2886
+ #ifdef ALPHAFRESNEL
2887
+ #if defined(ALPHATEST) || defined(ALPHABLEND)
2888
+ var alphaFresnelOut: alphaFresnelOutParams;alphaFresnelOut=alphaFresnelBlock(
2889
+ normalW,
2890
+ viewDirectionW,
2891
+ alpha,
2892
+ microSurface
2893
+ );alpha=alphaFresnelOut.alpha;
2894
+ #endif
2895
+ #endif
2896
+ #include<pbrBlockGeometryInfo>
2897
+ #ifdef ANISOTROPIC
2898
+ var anisotropicOut: anisotropicOutParams;
2899
+ #ifdef ANISOTROPIC_TEXTURE
2900
+ var anisotropyMapData: vec3f=textureSample(anisotropySampler,anisotropySamplerSampler,fragmentInputs.vAnisotropyUV+uvOffset).rgb*uniforms.vAnisotropyInfos.y;
2901
+ #endif
2902
+ anisotropicOut=anisotropicBlock(
2903
+ uniforms.vAnisotropy,
2904
+ roughness,
2905
+ #ifdef ANISOTROPIC_TEXTURE
2906
+ anisotropyMapData,
2907
+ #endif
2908
+ TBN,
2909
+ normalW,
2910
+ viewDirectionW
2911
+ );
2912
+ #endif
2913
+ #ifdef REFLECTION
2914
+ var reflectionOut: reflectionOutParams;
2915
+ #ifndef USE_CUSTOM_REFLECTION
2916
+ reflectionOut=reflectionBlock(
2917
+ fragmentInputs.vPositionW
2918
+ ,normalW
2919
+ ,alphaG
2920
+ ,uniforms.vReflectionMicrosurfaceInfos
2921
+ ,uniforms.vReflectionInfos
2922
+ ,uniforms.vReflectionColor
2923
+ #ifdef ANISOTROPIC
2924
+ ,anisotropicOut
2925
+ #endif
2926
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
2927
+ ,NdotVUnclamped
2928
+ #endif
2929
+ #ifdef LINEARSPECULARREFLECTION
2930
+ ,roughness
2931
+ #endif
2932
+ ,reflectionSampler
2933
+ ,reflectionSamplerSampler
2934
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
2935
+ ,fragmentInputs.vEnvironmentIrradiance
2936
+ #endif
2937
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
2938
+ ,uniforms.reflectionMatrix
2939
+ #endif
2940
+ #ifdef USEIRRADIANCEMAP
2941
+ ,irradianceSampler
2942
+ ,irradianceSamplerSampler
2943
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
2944
+ ,uniforms.vReflectionDominantDirection
2945
+ #endif
2946
+ #endif
2947
+ #ifndef LODBASEDMICROSFURACE
2948
+ ,reflectionLowSampler
2949
+ ,reflectionLowSamplerSampler
2950
+ ,reflectionHighSampler
2951
+ ,reflectionHighSamplerSampler
2952
+ #endif
2953
+ #ifdef REALTIME_FILTERING
2954
+ ,uniforms.vReflectionFilteringInfo
2955
+ #ifdef IBL_CDF_FILTERING
2956
+ ,icdfSampler
2957
+ ,icdfSamplerSampler
2958
+ #endif
2959
+ #endif
2960
+ ,viewDirectionW
2961
+ ,diffuseRoughness
2962
+ ,surfaceAlbedo
2963
+ );
2964
+ #else
2965
+ #define CUSTOM_REFLECTION
2966
+ #endif
2967
+ #endif
2968
+ #include<pbrBlockReflectance0>
2969
+ #ifdef SHEEN
2970
+ var sheenOut: sheenOutParams;
2971
+ #ifdef SHEEN_TEXTURE
2972
+ var sheenMapData: vec4f=textureSample(sheenSampler,sheenSamplerSampler,fragmentInputs.vSheenUV+uvOffset);
2973
+ #endif
2974
+ #if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
2975
+ var sheenMapRoughnessData: vec4f=textureSample(sheenRoughnessSampler,sheenRoughnessSamplerSampler,fragmentInputs.vSheenRoughnessUV+uvOffset)*uniforms.vSheenInfos.w;
2976
+ #endif
2977
+ sheenOut=sheenBlock(
2978
+ uniforms.vSheenColor
2979
+ #ifdef SHEEN_ROUGHNESS
2980
+ ,uniforms.vSheenRoughness
2981
+ #if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
2982
+ ,sheenMapRoughnessData
2983
+ #endif
2984
+ #endif
2985
+ ,roughness
2986
+ #ifdef SHEEN_TEXTURE
2987
+ ,sheenMapData
2988
+ ,uniforms.vSheenInfos.y
2989
+ #endif
2990
+ ,reflectanceF0
2991
+ #ifdef SHEEN_LINKWITHALBEDO
2992
+ ,baseColor
2993
+ ,surfaceAlbedo
2994
+ #endif
2995
+ #ifdef ENVIRONMENTBRDF
2996
+ ,NdotV
2997
+ ,environmentBrdf
2998
+ #endif
2999
+ #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
3000
+ ,AARoughnessFactors
3001
+ ,uniforms.vReflectionMicrosurfaceInfos
3002
+ ,uniforms.vReflectionInfos
3003
+ ,uniforms.vReflectionColor
3004
+ ,uniforms.vLightingIntensity
3005
+ ,reflectionSampler
3006
+ ,reflectionSamplerSampler
3007
+ ,reflectionOut.reflectionCoords
3008
+ ,NdotVUnclamped
3009
+ #ifndef LODBASEDMICROSFURACE
3010
+ ,reflectionLowSampler
3011
+ ,reflectionLowSamplerSampler
3012
+ ,reflectionHighSampler
3013
+ ,reflectionHighSamplerSampler
3014
+ #endif
3015
+ #ifdef REALTIME_FILTERING
3016
+ ,uniforms.vReflectionFilteringInfo
3017
+ #endif
3018
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
3019
+ ,seo
3020
+ #endif
3021
+ #if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
3022
+ ,eho
3023
+ #endif
3024
+ #endif
3025
+ );
3026
+ #ifdef SHEEN_LINKWITHALBEDO
3027
+ surfaceAlbedo=sheenOut.surfaceAlbedo;
3028
+ #endif
3029
+ #endif
3030
+ #ifdef CLEARCOAT
3031
+ #ifdef CLEARCOAT_TEXTURE
3032
+ var clearCoatMapData: vec2f=textureSample(clearCoatSampler,clearCoatSamplerSampler,fragmentInputs.vClearCoatUV+uvOffset).rg*uniforms.vClearCoatInfos.y;
3033
+ #endif
3034
+ #endif
3035
+ #ifdef IRIDESCENCE
3036
+ var iridescenceOut: iridescenceOutParams;
3037
+ #ifdef IRIDESCENCE_TEXTURE
3038
+ var iridescenceMapData: vec2f=textureSample(iridescenceSampler,iridescenceSamplerSampler,fragmentInputs.vIridescenceUV+uvOffset).rg*uniforms.vIridescenceInfos.y;
3039
+ #endif
3040
+ #ifdef IRIDESCENCE_THICKNESS_TEXTURE
3041
+ var iridescenceThicknessMapData: vec2f=textureSample(iridescenceThicknessSampler,iridescenceThicknessSamplerSampler,fragmentInputs.vIridescenceThicknessUV+uvOffset).rg*uniforms.vIridescenceInfos.w;
3042
+ #endif
3043
+ iridescenceOut=iridescenceBlock(
3044
+ uniforms.vIridescenceParams
3045
+ ,NdotV
3046
+ ,specularEnvironmentR0
3047
+ #ifdef IRIDESCENCE_TEXTURE
3048
+ ,iridescenceMapData
3049
+ #endif
3050
+ #ifdef IRIDESCENCE_THICKNESS_TEXTURE
3051
+ ,iridescenceThicknessMapData
3052
+ #endif
3053
+ #ifdef CLEARCOAT
3054
+ ,NdotVUnclamped
3055
+ ,uniforms.vClearCoatParams
3056
+ #ifdef CLEARCOAT_TEXTURE
3057
+ ,clearCoatMapData
3058
+ #endif
3059
+ #endif
3060
+ );var iridescenceIntensity: f32=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0;
3061
+ #endif
3062
+ var clearcoatOut: clearcoatOutParams;
3063
+ #ifdef CLEARCOAT
3064
+ #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
3065
+ var clearCoatMapRoughnessData: vec4f=textureSample(clearCoatRoughnessSampler,clearCoatRoughnessSamplerSampler,fragmentInputs.vClearCoatRoughnessUV+uvOffset)*uniforms.vClearCoatInfos.w;
3066
+ #endif
3067
+ #if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
3068
+ var clearCoatTintMapData: vec4f=textureSample(clearCoatTintSampler,clearCoatTintSamplerSampler,fragmentInputs.vClearCoatTintUV+uvOffset);
3069
+ #endif
3070
+ #ifdef CLEARCOAT_BUMP
3071
+ var clearCoatBumpMapData: vec4f=textureSample(clearCoatBumpSampler,clearCoatBumpSamplerSampler,fragmentInputs.vClearCoatBumpUV+uvOffset);
3072
+ #endif
3073
+ clearcoatOut=clearcoatBlock(
3074
+ fragmentInputs.vPositionW
3075
+ ,geometricNormalW
3076
+ ,viewDirectionW
3077
+ ,uniforms.vClearCoatParams
3078
+ #if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
3079
+ ,clearCoatMapRoughnessData
3080
+ #endif
3081
+ ,specularEnvironmentR0
3082
+ #ifdef CLEARCOAT_TEXTURE
3083
+ ,clearCoatMapData
3084
+ #endif
3085
+ #ifdef CLEARCOAT_TINT
3086
+ ,uniforms.vClearCoatTintParams
3087
+ ,uniforms.clearCoatColorAtDistance
3088
+ ,uniforms.vClearCoatRefractionParams
3089
+ #ifdef CLEARCOAT_TINT_TEXTURE
3090
+ ,clearCoatTintMapData
3091
+ #endif
3092
+ #endif
3093
+ #ifdef CLEARCOAT_BUMP
3094
+ ,uniforms.vClearCoatBumpInfos
3095
+ ,clearCoatBumpMapData
3096
+ ,fragmentInputs.vClearCoatBumpUV
3097
+ #if defined(TANGENT) && defined(NORMAL)
3098
+ ,mat3x3<f32>(input.vTBN0,input.vTBN1,input.vTBN2)
3099
+ #else
3100
+ ,uniforms.vClearCoatTangentSpaceParams
3101
+ #endif
3102
+ #ifdef OBJECTSPACE_NORMALMAP
3103
+ ,uniforms.normalMatrix
3104
+ #endif
3105
+ #endif
3106
+ #if defined(FORCENORMALFORWARD) && defined(NORMAL)
3107
+ ,faceNormal
3108
+ #endif
3109
+ #ifdef REFLECTION
3110
+ ,uniforms.vReflectionMicrosurfaceInfos
3111
+ ,uniforms.vReflectionInfos
3112
+ ,uniforms.vReflectionColor
3113
+ ,uniforms.vLightingIntensity
3114
+ ,reflectionSampler
3115
+ ,reflectionSamplerSampler
3116
+ #ifndef LODBASEDMICROSFURACE
3117
+ ,reflectionLowSampler
3118
+ ,reflectionLowSamplerSampler
3119
+ ,reflectionHighSampler
3120
+ ,reflectionHighSamplerSampler
3121
+ #endif
3122
+ #ifdef REALTIME_FILTERING
3123
+ ,uniforms.vReflectionFilteringInfo
3124
+ #endif
3125
+ #endif
3126
+ #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
3127
+ ,select(-1.,1.,fragmentInputs.frontFacing)
3128
+ #endif
3129
+ );
3130
+ #else
3131
+ clearcoatOut.specularEnvironmentR0=specularEnvironmentR0;
3132
+ #endif
3133
+ #include<pbrBlockReflectance>
3134
+ var subSurfaceOut: subSurfaceOutParams;
3135
+ #ifdef SUBSURFACE
3136
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
3137
+ var thicknessMap: vec4f=textureSample(thicknessSampler,thicknessSamplerSampler,fragmentInputs.vThicknessUV+uvOffset);
3138
+ #endif
3139
+ #ifdef SS_REFRACTIONINTENSITY_TEXTURE
3140
+ var refractionIntensityMap: vec4f=textureSample(refractionIntensitySampler,refractionIntensitySamplerSampler,fragmentInputs.vRefractionIntensityUV+uvOffset);
3141
+ #endif
3142
+ #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
3143
+ var translucencyIntensityMap: vec4f=textureSample(translucencyIntensitySampler,translucencyIntensitySamplerSampler,fragmentInputs.vTranslucencyIntensityUV+uvOffset);
3144
+ #endif
3145
+ #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
3146
+ var translucencyColorMap: vec4f=textureSample(translucencyColorSampler,translucencyColorSamplerSampler,fragmentInputs.vTranslucencyColorUV+uvOffset);
3147
+ #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA
3148
+ translucencyColorMap=toLinearSpaceVec4(translucencyColorMap);
3149
+ #endif
3150
+ #endif
3151
+ subSurfaceOut=subSurfaceBlock(
3152
+ uniforms.vSubSurfaceIntensity
3153
+ ,uniforms.vThicknessParam
3154
+ ,uniforms.vTintColor
3155
+ ,normalW
3156
+ #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION
3157
+ ,vec3f(max(colorSpecularEnvironmentReflectance.r,max(colorSpecularEnvironmentReflectance.g,colorSpecularEnvironmentReflectance.b)))
3158
+ #else
3159
+ ,baseSpecularEnvironmentReflectance
3160
+ #endif
3161
+ #ifdef SS_THICKNESSANDMASK_TEXTURE
3162
+ ,thicknessMap
3163
+ #endif
3164
+ #ifdef SS_REFRACTIONINTENSITY_TEXTURE
3165
+ ,refractionIntensityMap
3166
+ #endif
3167
+ #ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
3168
+ ,translucencyIntensityMap
3169
+ #endif
3170
+ #ifdef REFLECTION
3171
+ #ifdef SS_TRANSLUCENCY
3172
+ ,uniforms.reflectionMatrix
3173
+ #ifdef USESPHERICALFROMREFLECTIONMAP
3174
+ #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
3175
+ ,reflectionOut.irradianceVector
3176
+ #endif
3177
+ #if defined(REALTIME_FILTERING)
3178
+ ,reflectionSampler
3179
+ ,reflectionSamplerSampler
3180
+ ,uniforms.vReflectionFilteringInfo
3181
+ #ifdef IBL_CDF_FILTERING
3182
+ ,icdfSampler
3183
+ ,icdfSamplerSampler
3184
+ #endif
3185
+ #endif
3186
+ #endif
3187
+ #ifdef USEIRRADIANCEMAP
3188
+ ,irradianceSampler
3189
+ ,irradianceSamplerSampler
3190
+ #endif
3191
+ #endif
3192
+ #endif
3193
+ #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
3194
+ ,surfaceAlbedo
3195
+ #endif
3196
+ #ifdef SS_REFRACTION
3197
+ ,fragmentInputs.vPositionW
3198
+ ,viewDirectionW
3199
+ ,scene.view
3200
+ ,uniforms.vRefractionInfos
3201
+ ,uniforms.refractionMatrix
3202
+ ,uniforms.vRefractionMicrosurfaceInfos
3203
+ ,uniforms.vLightingIntensity
3204
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
3205
+ ,alpha
3206
+ #endif
3207
+ #ifdef SS_LODINREFRACTIONALPHA
3208
+ ,NdotVUnclamped
3209
+ #endif
3210
+ #ifdef SS_LINEARSPECULARREFRACTION
3211
+ ,roughness
3212
+ #endif
3213
+ ,alphaG
3214
+ ,refractionSampler
3215
+ ,refractionSamplerSampler
3216
+ #ifndef LODBASEDMICROSFURACE
3217
+ ,refractionLowSampler
3218
+ ,refractionLowSamplerSampler
3219
+ ,refractionHighSampler
3220
+ ,refractionHighSamplerSampler
3221
+ #endif
3222
+ #ifdef ANISOTROPIC
3223
+ ,anisotropicOut
3224
+ #endif
3225
+ #ifdef REALTIME_FILTERING
3226
+ ,uniforms.vRefractionFilteringInfo
3227
+ #endif
3228
+ #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
3229
+ ,uniforms.vRefractionPosition
3230
+ ,uniforms.vRefractionSize
3231
+ #endif
3232
+ #ifdef SS_DISPERSION
3233
+ ,uniforms.dispersion
3234
+ #endif
3235
+ #endif
3236
+ #ifdef SS_TRANSLUCENCY
3237
+ ,uniforms.vDiffusionDistance
3238
+ ,uniforms.vTranslucencyColor
3239
+ #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
3240
+ ,translucencyColorMap
3241
+ #endif
3242
+ #endif
3243
+ );
3244
+ #ifdef SS_REFRACTION
3245
+ surfaceAlbedo=subSurfaceOut.surfaceAlbedo;
3246
+ #ifdef SS_LINKREFRACTIONTOTRANSPARENCY
3247
+ alpha=subSurfaceOut.alpha;
3248
+ #endif
3249
+ #endif
3250
+ #else
3251
+ subSurfaceOut.specularEnvironmentReflectance=colorSpecularEnvironmentReflectance;
3252
+ #endif
3253
+ #include<pbrBlockDirectLighting>
3254
+ #include<lightFragment>[0..maxSimultaneousLights]
3255
+ #include<pbrBlockFinalLitComponents>
3256
+ #endif
3257
+ #include<pbrBlockFinalUnlitComponents>
3258
+ #define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION
3259
+ #include<pbrBlockFinalColorComposition>
3260
+ #include<logDepthFragment>
3261
+ #include<fogFragment>(color,finalColor)
3262
+ #include<pbrBlockImageProcessing>
3263
+ #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
3264
+ #ifdef PREPASS
3265
+ #include<pbrBlockPrePass>
3266
+ #endif
3267
+ #if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
3268
+ fragmentOutputs.color=finalColor;
3269
+ #endif
3270
+ #include<oitFragment>
3271
+ #if ORDER_INDEPENDENT_TRANSPARENCY
3272
+ 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;}
3273
+ #endif
3274
+ #include<pbrDebug>
3275
+ #define CUSTOM_FRAGMENT_MAIN_END
3276
+ }
3277
+ `;e.ShadersStoreWGSL[i]||(e.ShadersStoreWGSL[i]=G);const ge={name:i,shader:G};export{ge as pbrPixelShaderWGSL};