@uptimizr/dashboard 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +4 -4
  3. package/out/__next._full.txt +11 -11
  4. package/out/__next._head.txt +4 -4
  5. package/out/__next._index.txt +4 -4
  6. package/out/__next._tree.txt +2 -2
  7. package/out/_next/static/chunks/002cjeoit6-up.js +1 -0
  8. package/out/_next/static/chunks/02n1uiltexy3w.js +1 -0
  9. package/out/_next/static/chunks/03ab2khhe8-x5.js +1 -0
  10. package/out/_next/static/chunks/04_yytpc2paxy.js +1 -0
  11. package/out/_next/static/chunks/06qot1qvlsqaz.js +1 -0
  12. package/out/_next/static/chunks/07eeopuufsqp-.js +1501 -0
  13. package/out/_next/static/chunks/08a5xek662n8n.js +1 -0
  14. package/out/_next/static/chunks/08wuc9--s8zn_.js +1 -0
  15. package/out/_next/static/chunks/0927l-ygd5c8d.js +1 -0
  16. package/out/_next/static/chunks/09510356f0lad.js +1 -0
  17. package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
  18. package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
  19. package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
  20. package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
  21. package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
  22. package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
  23. package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
  24. package/out/_next/static/chunks/0g_v2zswo4l6f.js +1 -0
  25. package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
  26. package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
  27. package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
  28. package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
  29. package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
  30. package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
  31. package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
  32. package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
  33. package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
  34. package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
  35. package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
  36. package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
  37. package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
  38. package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
  39. package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
  40. package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
  41. package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
  42. package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
  43. package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
  44. package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
  45. package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
  46. package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
  47. package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
  48. package/out/_next/static/chunks/137xbvd4nd41j.js +3 -0
  49. package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
  50. package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
  51. package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
  52. package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
  53. package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
  54. package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
  55. package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
  56. package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
  57. package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
  58. package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
  59. package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
  60. package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
  61. package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
  62. package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
  63. package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
  64. package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
  65. package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
  66. package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
  67. package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
  68. package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
  69. package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
  70. package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
  71. package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
  72. package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
  73. package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
  74. package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
  75. package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
  76. package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
  77. package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
  78. package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
  79. package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
  80. package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
  81. package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
  82. package/out/_next/static/chunks/1tta1a064979p.js +1 -0
  83. package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
  84. package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
  85. package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
  86. package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
  87. package/out/_next/static/chunks/{1flb8adpj6_2o.js → 1xpwp4m1tqugp.js} +1 -1
  88. package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
  89. package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
  90. package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
  91. package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
  92. package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
  93. package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
  94. package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
  95. package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
  96. package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
  97. package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
  98. package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
  99. package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
  100. package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
  101. package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
  102. package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
  103. package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
  104. package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
  105. package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
  106. package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
  107. package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
  108. package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
  109. package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
  110. package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
  111. package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
  112. package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
  113. package/out/_next/static/chunks/2mdbvf1b5h00_.css +3 -0
  114. package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
  115. package/out/_next/static/chunks/2our10fwtj87e.js +1 -0
  116. package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
  117. package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
  118. package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
  119. package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
  120. package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
  121. package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
  122. package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
  123. package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
  124. package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
  125. package/out/_next/static/chunks/2x-00glogc485.js +1 -0
  126. package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
  127. package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
  128. package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
  129. package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
  130. package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
  131. package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
  132. package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
  133. package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
  134. package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
  135. package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
  136. package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
  137. package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
  138. package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
  139. package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
  140. package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
  141. package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
  142. package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
  143. package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
  144. package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
  145. package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
  146. package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
  147. package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
  148. package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
  149. package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
  150. package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
  151. package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
  152. package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
  153. package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
  154. package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
  155. package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
  156. package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
  157. package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
  158. package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
  159. package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
  160. package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
  161. package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
  162. package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
  163. package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
  164. package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
  165. package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
  166. package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
  167. package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
  168. package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
  169. package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
  170. package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
  171. package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
  172. package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
  173. package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
  174. package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
  175. package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
  176. package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
  177. package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
  178. package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
  179. package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
  180. package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
  181. package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
  182. package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
  183. package/out/_not-found/__next._full.txt +9 -9
  184. package/out/_not-found/__next._head.txt +4 -4
  185. package/out/_not-found/__next._index.txt +4 -4
  186. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  187. package/out/_not-found/__next._not-found.txt +3 -3
  188. package/out/_not-found/__next._tree.txt +2 -2
  189. package/out/_not-found.html +1 -1
  190. package/out/_not-found.txt +9 -9
  191. package/out/index.html +1 -1
  192. package/out/index.txt +11 -11
  193. package/package.json +5 -4
  194. package/out/_next/static/chunks/068j6934u8j16.js +0 -1
  195. package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
  196. package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
  197. package/out/_next/static/chunks/0aznt7717miff.js +0 -1
  198. package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
  199. package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
  200. package/out/_next/static/chunks/0gg-ii7i6d_p6.js +0 -1
  201. package/out/_next/static/chunks/0tx1j_ghpz7rc.css +0 -3
  202. package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
  203. package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
  204. package/out/_next/static/chunks/0wwkrsvxwi57d.js +0 -1
  205. package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
  206. package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
  207. package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
  208. package/out/_next/static/chunks/123xxske5c9na.js +0 -1
  209. package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
  210. package/out/_next/static/chunks/157d9euci08yu.js +0 -1
  211. package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
  212. package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
  213. package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
  214. package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
  215. package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
  216. package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
  217. package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
  218. package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
  219. package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
  220. package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
  221. package/out/_next/static/chunks/2clzipqap01hp.js +0 -1
  222. package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
  223. package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
  224. package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
  225. package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
  226. package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
  227. package/out/_next/static/chunks/2z5eqx5do5std.js +0 -1
  228. package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
  229. package/out/_next/static/chunks/3aqbf_wkg2sih.js +0 -3
  230. package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
  231. package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
  232. package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
  233. package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
  234. package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
  235. package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
  236. package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
  237. package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
  238. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_buildManifest.js +0 -0
  239. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_clientMiddlewareManifest.js +0 -0
  240. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_ssgManifest.js +0 -0
@@ -0,0 +1,1352 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,84673,e=>{"use strict";var r=e.i(12423),t=e.i(19640),a=e.i(22548),i=e.i(60106),o=e.i(50008),n=e.i(40664),f=e.i(39780),s=e.i(6320),l=e.i(14640),c=e.i(67367),_=e.i(90780);let m="openpbrFragmentSamplersDeclaration",d=`#include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor)
2
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)
3
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)
4
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness)
5
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight)
6
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor)
7
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness)
8
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy)
9
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_WEIGHT,_VARYINGNAME_,TransmissionWeight,_SAMPLERNAME_,transmissionWeight)
10
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_COLOR,_VARYINGNAME_,TransmissionColor,_SAMPLERNAME_,transmissionColor)
11
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_DEPTH,_VARYINGNAME_,TransmissionDepth,_SAMPLERNAME_,transmissionDepth)
12
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_SCATTER,_VARYINGNAME_,TransmissionScatter,_SAMPLERNAME_,transmissionScatter)
13
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_DISPERSION_SCALE,_VARYINGNAME_,TransmissionDispersionScale,_SAMPLERNAME_,transmissionDispersionScale)
14
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_WEIGHT,_VARYINGNAME_,SubsurfaceWeight,_SAMPLERNAME_,subsurfaceWeight)
15
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_COLOR,_VARYINGNAME_,SubsurfaceColor,_SAMPLERNAME_,subsurfaceColor)
16
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_RADIUS_SCALE,_VARYINGNAME_,SubsurfaceRadiusScale,_SAMPLERNAME_,subsurfaceRadiusScale)
17
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight)
18
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor)
19
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness)
20
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy)
21
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening)
22
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight)
23
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor)
24
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness)
25
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity)
26
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent)
27
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent)
28
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_THICKNESS,_VARYINGNAME_,GeometryThickness,_SAMPLERNAME_,geometryThickness)
29
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor)
30
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight)
31
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness)
32
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion)
33
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
34
+ #include<pbrFragmentReflectionDeclaration>
35
+ #ifdef ENVIRONMENTBRDF
36
+ var environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d<f32>;
37
+ #endif
38
+ #ifdef FUZZENVIRONMENTBRDF
39
+ var environmentFuzzBrdfSamplerSampler: sampler;var environmentFuzzBrdfSampler: texture_2d<f32>;
40
+ #endif
41
+ #ifdef REFRACTED_BACKGROUND
42
+ var backgroundRefractionSamplerSampler: sampler;var backgroundRefractionSampler: texture_2d<f32>;
43
+ #endif
44
+ #ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING
45
+ var sceneIrradianceSampler: texture_2d<f32>;var sceneDepthSampler: texture_2d<f32>;
46
+ #endif
47
+ #if defined(ANISOTROPIC) || defined(FUZZ) || defined(REFRACTED_BACKGROUND) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)
48
+ var blueNoiseSamplerSampler: sampler;var blueNoiseSampler: texture_2d<f32>;
49
+ #endif
50
+ #ifdef IBL_CDF_FILTERING
51
+ var icdfSamplerSampler: sampler;var icdfSampler: texture_2d<f32>;
52
+ #endif
53
+ `;r.ShaderStore.IncludesShadersStoreWGSL[m]||(r.ShaderStore.IncludesShadersStoreWGSL[m]=d);var u=e.i(61059),g=e.i(35182),p=e.i(54758),v=e.i(25626),S=e.i(69488),E=e.i(4357),h=e.i(95538),I=e.i(90507),R=e.i(62424),b=e.i(30733),T=e.i(60315),N=e.i(99452),A=e.i(42420),L=e.i(42221),F=e.i(48373),D=e.i(61202),O=e.i(69075),C=e.i(87850),P=e.i(62026),G=e.i(28285),x=e.i(82518);let M="openpbrNormalMapFragmentMainFunctions",y=`#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL)
54
+ #if defined(TANGENT) && defined(NORMAL)
55
+ varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f;
56
+ #endif
57
+ #ifdef OBJECTSPACE_NORMALMAP
58
+ uniform normalMatrix: mat4x4f;fn toNormalMatrix(m: mat4x4f)->mat4x4f
59
+ {var a00=m[0][0];var a01=m[0][1];var a02=m[0][2];var a03=m[0][3];var a10=m[1][0];var a11=m[1][1];var a12=m[1][2];var a13=m[1][3];var a20=m[2][0];
60
+ var a21=m[2][1];var a22=m[2][2];var a23=m[2][3];var a30=m[3][0];
61
+ var a31=m[3][1];var a32=m[3][2];var a33=m[3][3];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;var mi=mat4x4<f32>(
62
+ (a11*b11-a12*b10+a13*b09)/det,
63
+ (a02*b10-a01*b11-a03*b09)/det,
64
+ (a31*b05-a32*b04+a33*b03)/det,
65
+ (a22*b04-a21*b05-a23*b03)/det,
66
+ (a12*b08-a10*b11-a13*b07)/det,
67
+ (a00*b11-a02*b08+a03*b07)/det,
68
+ (a32*b02-a30*b05-a33*b01)/det,
69
+ (a20*b05-a22*b02+a23*b01)/det,
70
+ (a10*b10-a11*b08+a13*b06)/det,
71
+ (a01*b08-a00*b10-a03*b06)/det,
72
+ (a30*b04-a31*b02+a33*b00)/det,
73
+ (a21*b02-a20*b04-a23*b00)/det,
74
+ (a11*b07-a10*b09-a12*b06)/det,
75
+ (a00*b09-a01*b07+a02*b06)/det,
76
+ (a31*b01-a30*b03-a32*b00)/det,
77
+ (a20*b03-a21*b01+a22*b00)/det);return mat4x4<f32>(mi[0][0],mi[1][0],mi[2][0],mi[3][0],
78
+ mi[0][1],mi[1][1],mi[2][1],mi[3][1],
79
+ mi[0][2],mi[1][2],mi[2][2],mi[3][2],
80
+ mi[0][3],mi[1][3],mi[2][3],mi[3][3]);}
81
+ #endif
82
+ fn perturbNormalBase(cotangentFrame: mat3x3f,normal: vec3f,scale: f32)->vec3f
83
+ {var output=normal;
84
+ #ifdef NORMALXYSCALE
85
+ output=normalize(output* vec3f(scale,scale,1.0));
86
+ #endif
87
+ return normalize(cotangentFrame*output);}
88
+ fn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f
89
+ {return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}
90
+ fn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f
91
+ {var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);}
92
+ #endif
93
+ `;r.ShaderStore.IncludesShadersStoreWGSL[M]||(r.ShaderStore.IncludesShadersStoreWGSL[M]=y);let W="openpbrNormalMapFragmentFunctions",z=`#if defined(GEOMETRY_NORMAL)
94
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal)
95
+ #endif
96
+ #if defined(GEOMETRY_COAT_NORMAL)
97
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal)
98
+ #endif
99
+ #if defined(DETAIL)
100
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)
101
+ #endif
102
+ #if defined(GEOMETRY_NORMAL) && defined(PARALLAX)
103
+ const minSamples: f32=4.;const maxSamples: f32=15.;const iMaxSamples: i32=15;fn parallaxOcclusion(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32)->vec2f {var parallaxLimit: f32=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;var vOffsetDir: vec2f=normalize(vViewDirCoT.xy);var vMaxOffset: vec2f=vOffsetDir*parallaxLimit;var numSamples: f32=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));var stepSize: f32=1.0/numSamples;var currRayHeight: f32=1.0;var vCurrOffset: vec2f= vec2f(0,0);var vLastOffset: vec2f= vec2f(0,0);var lastSampledHeight: f32=1.0;var currSampledHeight: f32=1.0;var keepWorking: bool=true;for (var i: i32=0; i<iMaxSamples; i++)
104
+ {currSampledHeight=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,texCoord+vCurrOffset).w;if (!keepWorking)
105
+ {}
106
+ else if (currSampledHeight>currRayHeight)
107
+ {var delta1: f32=currSampledHeight-currRayHeight;var delta2: f32=(currRayHeight+stepSize)-lastSampledHeight;var ratio: f32=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}
108
+ else
109
+ {currRayHeight-=stepSize;vLastOffset=vCurrOffset;
110
+ #ifdef PARALLAX_RHS
111
+ vCurrOffset-=stepSize*vMaxOffset;
112
+ #else
113
+ vCurrOffset+=stepSize*vMaxOffset;
114
+ #endif
115
+ lastSampledHeight=currSampledHeight;}}
116
+ return vCurrOffset;}
117
+ fn parallaxOffset(viewDir: vec3f,heightScale: f32)->vec2f
118
+ {var height: f32=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).w;var texCoordOffset: vec2f=heightScale*viewDir.xy*height;
119
+ #ifdef PARALLAX_RHS
120
+ return texCoordOffset;
121
+ #else
122
+ return -texCoordOffset;
123
+ #endif
124
+ }
125
+ #endif
126
+ `;r.ShaderStore.IncludesShadersStoreWGSL[W]||(r.ShaderStore.IncludesShadersStoreWGSL[W]=z);var w=e.i(23356),U=e.i(30420);let X="openpbrConductorReflectance",H=`#define pbr_inline
127
+ fn conductorReflectance(baseColor: vec3f,specularColor: vec3f,specularWeight: f32)->ReflectanceParams
128
+ {var outParams: ReflectanceParams;
129
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
130
+ outParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight;
131
+ #else
132
+ outParams.coloredF0=baseColor;outParams.coloredF90=vec3f(1.0f);
133
+ #endif
134
+ outParams.F0=1.0f;outParams.F90=1.0f;return outParams;}`;r.ShaderStore.IncludesShadersStoreWGSL[X]||(r.ShaderStore.IncludesShadersStoreWGSL[X]=H);let V="openpbrAmbientOcclusionFunctions",B=`fn compute_specular_occlusion(n_dot_v: f32,metallic: f32,ambient_occlusion: f32,roughness: f32)->f32
135
+ {let specular_occlusion: f32=saturate(pow(n_dot_v+ambient_occlusion,exp2(-16.0*roughness-1.0))-1.0+ambient_occlusion);return mix(specular_occlusion,1.0,metallic*square(1.0-roughness));}
136
+ `;r.ShaderStore.IncludesShadersStoreWGSL[V]||(r.ShaderStore.IncludesShadersStoreWGSL[V]=B);var k=e.i(22389),Y=e.i(63189);let Z="openpbrVolumeFunctions",j=`struct OpenPBRHomogeneousVolume {extinction_coeff: vec3f,
137
+ ss_albedo: vec3f,
138
+ multi_scatter_color: vec3f,
139
+ absorption_coeff: vec3f,
140
+ scatter_coeff: vec3f,
141
+ anisotropy: f32, };fn computeOpenPBRTransmissionVolume(
142
+ transmission_color: vec3f,
143
+ transmission_depth: f32,
144
+ transmission_scatter: vec3f,
145
+ anisotropy: f32
146
+ )->OpenPBRHomogeneousVolume
147
+ {var volumeParams: OpenPBRHomogeneousVolume;volumeParams.absorption_coeff=vec3f(0.0f);volumeParams.scatter_coeff=vec3f(0.0f);volumeParams.anisotropy=anisotropy;
148
+ #ifdef GEOMETRY_THIN_WALLED
149
+ volumeParams.scatter_coeff=vec3f(1.0f);volumeParams.anisotropy=1.0f;
150
+ volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=vec3f(1.0f);
151
+ #else
152
+ if (transmission_depth>0.0f) {let invDepth: vec3f=vec3f(1.f/maxEps(transmission_depth));volumeParams.extinction_coeff=-log(maxEpsVec3(transmission_color.rgb))*invDepth;volumeParams.scatter_coeff=transmission_scatter.rgb*invDepth;volumeParams.absorption_coeff=volumeParams.extinction_coeff-volumeParams.scatter_coeff.rgb;let minCoeff: f32=min3(volumeParams.absorption_coeff);if (minCoeff<0.0f) {volumeParams.absorption_coeff-=vec3f(minCoeff);}
153
+ volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=volumeParams.scatter_coeff/(volumeParams.extinction_coeff);} else {volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=vec3f(0.0f);}
154
+ #endif
155
+ return volumeParams;}
156
+ fn computeOpenPBRSubsurfaceVolume(
157
+ subsurface_color: vec3f,
158
+ subsurface_radius: f32,
159
+ subsurface_radius_scale: vec3f,
160
+ anisotropy: f32
161
+ )->OpenPBRHomogeneousVolume
162
+ {var volumeParams: OpenPBRHomogeneousVolume;volumeParams.absorption_coeff=vec3f(0.0f);volumeParams.scatter_coeff=vec3f(0.0f);volumeParams.anisotropy=anisotropy;volumeParams.multi_scatter_color=subsurface_color;let mfp: vec3f=subsurface_radius_scale*vec3f(subsurface_radius);volumeParams.extinction_coeff=vec3f(1.0f)/maxEpsVec3(mfp);volumeParams.ss_albedo=multiScatterToSingleScatterAlbedoWithAniso(subsurface_color,anisotropy);volumeParams.scatter_coeff=volumeParams.ss_albedo*volumeParams.extinction_coeff;volumeParams.absorption_coeff=volumeParams.extinction_coeff-volumeParams.scatter_coeff.rgb;let minCoeff: f32=min3(volumeParams.absorption_coeff);if (minCoeff<0.0f) {volumeParams.absorption_coeff-=vec3f(minCoeff);}
163
+ volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;return volumeParams;}
164
+ fn sss_pdf(r: f32,d: vec3f)->vec3f
165
+ {let d_clamped=max(vec3f(1e-4f),d);return (exp(-r/d_clamped)+exp(-r/(3.0f*d_clamped)))/max(vec3f(1e-5f),8.0f*PI*d_clamped*r);}
166
+ fn sss_samples_pdf(r: f32,d: f32)->f32
167
+ {let d_clamped=max(1e-4f,d);return exp(-r/(3.0f*d_clamped))/(6.0f*PI*d_clamped*r);}
168
+ fn sss_samples_icdf(x: f32,d: f32)->f32
169
+ {let d_clamped=max(1e-4f,d);let x_clamped=max(1e-4f,x);return -3.0f*log(x_clamped)*d_clamped;}
170
+ fn samples_scale(x: f32,d: f32)->f32
171
+ {return 1.0f-exp(-x/(3.0f*d));}
172
+ fn sss_get_position(depth_texture: texture_2d<f32>,tex_coord: vec2f,render_resolution: vec2f,inv_proj: mat4x4f)->vec3f
173
+ {var P: vec4f=vec4f(tex_coord,textureLoad(depth_texture,vec2i(tex_coord*render_resolution),0).x,1.0f);P.x=2.0f*P.x-1.0f;P.y=2.0f*P.y-1.0f;P=inv_proj*P;return P.xyz/P.w;}
174
+ fn sss_filter_scale(currZ: f32,proj: mat4x4f)->f32
175
+ {return 1.0f/dot(vec2f(proj[2].w,proj[3].w),vec2f(currZ,1.0f));}
176
+ fn projective_to_pixels(proj_dist: f32,proj: mat4x4f,resolution: vec2f)->f32
177
+ {return proj_dist*proj[1][1]*resolution.y;}
178
+ fn pixels_to_projective(pixel_dist: f32,proj: mat4x4f,resolution: vec2f)->f32
179
+ {return pixel_dist/(proj[1][1]*resolution.y);}
180
+ fn sss_convolve(sss_irradiance_texture: texture_2d<f32>,depth_texture: texture_2d<f32>,render_resolution: vec2f,d: vec3f,proj: mat4x4f,inv_proj: mat4x4f,sample_count: i32,noise: vec2f)->vec3f
181
+ {let tex_coord: vec2f=fragmentInputs.position.xy/render_resolution;let unconvolved_irradiance: vec3f=textureLoad(sss_irradiance_texture,vec2i(fragmentInputs.position.xy),0).rgb;let curr_pos: vec3f=sss_get_position(depth_texture,tex_coord,render_resolution,inv_proj);var dmax: f32=max3(d);let max_dmax: f32=0.1*f32(sample_count);var d_adjusted=d;if (dmax>max_dmax)
182
+ {d_adjusted*=max_dmax/dmax;dmax=max_dmax;}
183
+ var dz: f32=dmax*sss_filter_scale(curr_pos.z,proj);let projMat2d: mat2x2f=mat2x2f(proj[0].xy,proj[1].xy);if (determinant(projMat2d)*dz<1e-4f) {return unconvolved_irradiance;}
184
+ let overscan_size_in_pixels: f32=max(render_resolution.x,render_resolution.y)*0.1;let filter_crop_ratio: f32=0.8f;
185
+ let crop_radius: f32=projective_to_pixels(sss_samples_icdf(1.0f-filter_crop_ratio,dz),proj,render_resolution);if (crop_radius>overscan_size_in_pixels)
186
+ {d_adjusted*=overscan_size_in_pixels/crop_radius;dz*=overscan_size_in_pixels/crop_radius;}
187
+ let filter_samples_scale: f32=samples_scale(pixels_to_projective(overscan_size_in_pixels,proj,render_resolution),dz);var irradiance_sum: vec3f=vec3f(0.0f);var weight_sum: vec3f=vec3f(0.0f);for (var i: i32=0; i<sample_count; i++)
188
+ {var r: vec2f=fract(plasticSequence(u32(i))+noise);r.x*=TWO_PI;r.y*=filter_samples_scale;let icdf: f32=sss_samples_icdf(1.0-r.y,dz);let sample_uv: vec2f=tex_coord+icdf*projMat2d*vec2f(cos(r.x),sin(r.x));let sss_irradiance: vec4f=textureLoad(sss_irradiance_texture,vec2i(sample_uv*render_resolution),0);let dist: f32=distance(curr_pos,sss_get_position(depth_texture,sample_uv,render_resolution,inv_proj));if (dist>0.0f)
189
+ {let weights: vec3f=sss_irradiance.a/sss_samples_pdf(icdf,dz)*sss_pdf(dist,d_adjusted);irradiance_sum+=weights*sss_irradiance.rgb;weight_sum+=weights;}}
190
+ return vec3f(select(unconvolved_irradiance.r,irradiance_sum.r/weight_sum.r,weight_sum.r>=1e-5f),
191
+ select(unconvolved_irradiance.g,irradiance_sum.g/weight_sum.g,weight_sum.g>=1e-5f),
192
+ select(unconvolved_irradiance.b,irradiance_sum.b/weight_sum.b,weight_sum.b>=1e-5f));}
193
+ `;r.ShaderStore.IncludesShadersStoreWGSL[Z]||(r.ShaderStore.IncludesShadersStoreWGSL[Z]=j);var q=e.i(63406),K=e.i(74698);let Q="openpbrNormalMapFragment",J=`var uvOffset: vec2f= vec2f(0.0,0.0);
194
+ #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL)
195
+ #ifdef NORMALXYSCALE
196
+ var normalScale: f32=1.0;
197
+ #elif defined(GEOMETRY_NORMAL)
198
+ var normalScale: f32=uniforms.vGeometryNormalInfos.y;
199
+ #else
200
+ var normalScale: f32=1.0;
201
+ #endif
202
+ #if defined(TANGENT) && defined(NORMAL)
203
+ var TBN: mat3x3f=mat3x3<f32>(input.vTBN0,input.vTBN1,input.vTBN2);
204
+ #elif defined(GEOMETRY_NORMAL)
205
+ var TBNUV: vec2f=select(-fragmentInputs.vGeometryNormalUV,fragmentInputs.vGeometryNormalUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams);
206
+ #elif defined(GEOMETRY_COAT_NORMAL)
207
+ var TBNUV: vec2f=select(-fragmentInputs.vGeometryCoatNormalUV,fragmentInputs.vGeometryCoatNormalUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams);
208
+ #else
209
+ var TBNUV: vec2f=select(-fragmentInputs.vDetailUV,fragmentInputs.vDetailUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV, vec2f(1.,1.));
210
+ #endif
211
+ #elif defined(ANISOTROPIC) || defined(FUZZ)
212
+ #if defined(TANGENT) && defined(NORMAL)
213
+ var TBN: mat3x3f=mat3x3<f32>(input.vTBN0,input.vTBN1,input.vTBN2);
214
+ #else
215
+ var TBNUV: vec2f=select( -fragmentInputs.vMainUV1,fragmentInputs.vMainUV1,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW,input.vPositionW,TBNUV, vec2f(1.,1.));
216
+ #endif
217
+ #endif
218
+ #ifdef PARALLAX
219
+ var invTBN: mat3x3f=transposeMat3(TBN);
220
+ #ifdef PARALLAXOCCLUSION
221
+ #else
222
+ #endif
223
+ #endif
224
+ #ifdef DETAIL
225
+ var detailColor: vec4f=textureSample(detailSampler,detailSamplerSampler,fragmentInputs.vDetailUV+uvOffset);var detailNormalRG: vec2f=detailColor.wy*2.0-1.0;var detailNormalB: f32=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));var detailNormal: vec3f= vec3f(detailNormalRG,detailNormalB);
226
+ #endif
227
+ #ifdef GEOMETRY_COAT_NORMAL
228
+ coatNormalW=perturbNormal(TBN,TEXRD(geometryCoatNormalSampler,geometryCoatNormalSamplerSampler,fragmentInputs.vGeometryCoatNormalUV+uvOffset).xyz,uniforms.vGeometryCoatNormalInfos.y);
229
+ #endif
230
+ #ifdef GEOMETRY_NORMAL
231
+ #ifdef OBJECTSPACE_NORMALMAP
232
+ #define CUSTOM_FRAGMENT_BUMP_FRAGMENT
233
+ normalW=normalize(TEXRD(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3x3f(uniforms.normalMatrix[0].xyz,uniforms.normalMatrix[1].xyz,uniforms.normalMatrix[2].xyz)*normalW);
234
+ #elif !defined(DETAIL)
235
+ normalW=perturbNormal(TBN,TEXRD(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz,uniforms.vGeometryNormalInfos.y);
236
+ #else
237
+ var sampledNormal: vec3f=TEXRD(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz*2.0-1.0;
238
+ #if DETAIL_NORMALBLENDMETHOD==0
239
+ detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);var blendedNormal: vec3f=normalize( vec3f(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z));
240
+ #elif DETAIL_NORMALBLENDMETHOD==1
241
+ detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);sampledNormal+= vec3f(0.0,0.0,1.0);detailNormal*= vec3f(-1.0,-1.0,1.0);var blendedNormal: vec3f=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal;
242
+ #endif
243
+ normalW=perturbNormalBase(TBN,blendedNormal,uniforms.vGeometryNormalInfos.y);
244
+ #endif
245
+ #elif defined(DETAIL)
246
+ detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z);
247
+ #endif
248
+ `;r.ShaderStore.IncludesShadersStoreWGSL[Q]||(r.ShaderStore.IncludesShadersStoreWGSL[Q]=J);let $="openpbrBlockNormalFinal",ee=`#if defined(FORCENORMALFORWARD) && defined(NORMAL)
249
+ var faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w;
250
+ #if defined(TWOSIDEDLIGHTING)
251
+ faceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing);
252
+ #endif
253
+ normalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal));
254
+ #endif
255
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
256
+ #if defined(MIRRORED)
257
+ normalW=select(normalW,-normalW,fragmentInputs.frontFacing);coatNormalW=select(coatNormalW,-coatNormalW,fragmentInputs.frontFacing);
258
+ #else
259
+ normalW=select(-normalW,normalW,fragmentInputs.frontFacing);coatNormalW=select(-coatNormalW,coatNormalW,fragmentInputs.frontFacing);
260
+ #endif
261
+ #endif
262
+ `;r.ShaderStore.IncludesShadersStoreWGSL[$]||(r.ShaderStore.IncludesShadersStoreWGSL[$]=ee);let er="openpbrBaseLayerData",et=`var base_color=vec3f(0.8);var base_metalness: f32=0.0;var base_diffuse_roughness: f32=0.0;var specular_weight: f32=1.0;var specular_roughness: f32=0.3;var specular_color: vec3f=vec3f(1.0);var specular_roughness_anisotropy: f32=0.0;var specular_ior: f32=1.5;var alpha: f32=1.0;var geometry_tangent: vec2f=vec2f(1.0,0.0);var geometry_thickness: f32=0.0;
263
+ #ifdef BASE_WEIGHT
264
+ let baseWeightFromTexture: vec4f=TEXRD(baseWeightSampler,baseWeightSamplerSampler,fragmentInputs.vBaseWeightUV+uvOffset);
265
+ #endif
266
+ #ifdef BASE_COLOR
267
+ let baseColorFromTexture: vec4f=TEXRD(baseColorSampler,baseColorSamplerSampler,fragmentInputs.vBaseColorUV+uvOffset);
268
+ #endif
269
+ #ifdef BASE_METALNESS
270
+ let metallicFromTexture: vec4f=TEXRD(baseMetalnessSampler,baseMetalnessSamplerSampler,fragmentInputs.vBaseMetalnessUV+uvOffset);
271
+ #endif
272
+ #ifdef BASE_DIFFUSE_ROUGHNESS
273
+ let baseDiffuseRoughnessFromTexture: f32=TEXRD(baseDiffuseRoughnessSampler,baseDiffuseRoughnessSamplerSampler,fragmentInputs.vBaseDiffuseRoughnessUV+uvOffset).r;
274
+ #endif
275
+ #ifdef GEOMETRY_TANGENT
276
+ let geometryTangentFromTexture: vec3f=TEXRD(geometryTangentSampler,geometryTangentSamplerSampler,fragmentInputs.vGeometryTangentUV+uvOffset).rgb;
277
+ #endif
278
+ #ifdef SPECULAR_ROUGHNESS_ANISOTROPY
279
+ let anisotropyFromTexture: f32=TEXRD(specularRoughnessAnisotropySampler,specularRoughnessAnisotropySamplerSampler,fragmentInputs.vSpecularRoughnessAnisotropyUV+uvOffset).r*uniforms.vSpecularRoughnessAnisotropyInfos.y;
280
+ #endif
281
+ #ifdef GEOMETRY_OPACITY
282
+ let opacityFromTexture: vec4f=TEXRD(geometryOpacitySampler,geometryOpacitySamplerSampler,fragmentInputs.vGeometryOpacityUV+uvOffset);
283
+ #endif
284
+ #ifdef GEOMETRY_THICKNESS
285
+ let thicknessFromTexture: vec4f=TEXRD(geometryThicknessSampler,geometryThicknessSamplerSampler,fragmentInputs.vGeometryThicknessUV+uvOffset);
286
+ #endif
287
+ #ifdef DECAL
288
+ let decalFromTexture: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
289
+ #endif
290
+ #ifdef SPECULAR_COLOR
291
+ let specularColorFromTexture: vec4f=TEXRD(specularColorSampler,specularColorSamplerSampler,fragmentInputs.vSpecularColorUV+uvOffset);
292
+ #endif
293
+ #if defined(SPECULAR_WEIGHT)
294
+ #ifdef SPECULAR_WEIGHT_IN_ALPHA
295
+ let specularWeightFromTexture: f32=TEXRD(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).a;
296
+ #else
297
+ let specularWeightFromTexture: f32=TEXRD(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).r;
298
+ #endif
299
+ #endif
300
+ #if defined(ANISOTROPIC) || defined(FUZZ) || defined(REFRACTED_BACKGROUND) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)
301
+ let noise=vec3f(2.0)*textureSample(blueNoiseSampler,blueNoiseSamplerSampler,fragmentInputs.position.xy/256.0).xyz-vec3f(1.0);
302
+ #endif
303
+ #if defined(SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN) && defined(BASE_METALNESS)
304
+ let roughnessFromTexture: f32=metallicFromTexture.g;
305
+ #elif defined(SPECULAR_ROUGHNESS)
306
+ let roughnessFromTexture: f32=TEXRD(specularRoughnessSampler,specularRoughnessSamplerSampler,fragmentInputs.vSpecularRoughnessUV+uvOffset).r;
307
+ #endif
308
+ base_color=uniforms.vBaseColor.rgb;
309
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
310
+ base_color*=fragmentInputs.vColor.rgb;
311
+ #endif
312
+ #if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
313
+ alpha*=fragmentInputs.vColor.a;
314
+ #endif
315
+ base_color*=vec3(uniforms.vBaseWeight);alpha=uniforms.vBaseColor.a;base_metalness=uniforms.vReflectanceInfo.x;base_diffuse_roughness=uniforms.vBaseDiffuseRoughness;specular_roughness=uniforms.vReflectanceInfo.y;specular_color=uniforms.vSpecularColor.rgb;specular_weight=uniforms.vReflectanceInfo.a;specular_ior=uniforms.vReflectanceInfo.z;specular_roughness_anisotropy=uniforms.vSpecularAnisotropy.b;geometry_tangent=uniforms.vSpecularAnisotropy.rg;geometry_thickness=uniforms.vGeometryThickness;
316
+ #ifdef BASE_COLOR
317
+ #ifdef BASE_COLOR_GAMMA
318
+ base_color*=toLinearSpaceVec3(baseColorFromTexture.rgb);
319
+ #else
320
+ base_color*=baseColorFromTexture.rgb;
321
+ #endif
322
+ base_color*=uniforms.vBaseColorInfos.y;
323
+ #endif
324
+ #ifdef BASE_WEIGHT
325
+ base_color*=baseWeightFromTexture.r;
326
+ #endif
327
+ #if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE)
328
+ alpha*=baseColorFromTexture.a;
329
+ #elif defined(GEOMETRY_OPACITY)
330
+ alpha*=opacityFromTexture.r;alpha*=uniforms.vGeometryOpacityInfos.y;
331
+ #endif
332
+ #ifdef GEOMETRY_THICKNESS
333
+ #ifdef GEOMETRY_THICKNESS_FROM_GREEN_CHANNEL
334
+ geometry_thickness*=thicknessFromTexture.g;
335
+ #else
336
+ geometry_thickness*=thicknessFromTexture.r;
337
+ #endif
338
+ geometry_thickness*=uniforms.vGeometryThicknessInfos.y;
339
+ #endif
340
+ #ifdef ALPHATEST
341
+ #if DEBUGMODE != 88
342
+ if (alpha<ALPHATESTVALUE) {discard;}
343
+ #endif
344
+ #ifndef ALPHABLEND
345
+ alpha=1.0;
346
+ #endif
347
+ #endif
348
+ #ifdef BASE_METALNESS
349
+ #ifdef BASE_METALNESS_FROM_METALNESS_TEXTURE_BLUE
350
+ base_metalness*=metallicFromTexture.b;
351
+ #else
352
+ base_metalness*=metallicFromTexture.r;
353
+ #endif
354
+ #endif
355
+ #ifdef BASE_DIFFUSE_ROUGHNESS
356
+ base_diffuse_roughness*=baseDiffuseRoughnessFromTexture*uniforms.vBaseDiffuseRoughnessInfos.y;
357
+ #endif
358
+ #ifdef SPECULAR_COLOR
359
+ #ifdef SPECULAR_COLOR_GAMMA
360
+ specular_color*=toLinearSpaceVec3(specularColorFromTexture.rgb);
361
+ #else
362
+ specular_color*=specularColorFromTexture.rgb;
363
+ #endif
364
+ #ifdef SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE
365
+ specular_weight*=specularColorFromTexture.a;
366
+ #elif defined(SPECULAR_WEIGHT)
367
+ specular_weight*=specularWeightFromTexture;
368
+ #endif
369
+ #endif
370
+ #if defined(SPECULAR_ROUGHNESS) || (defined(SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN) && defined(BASE_METALNESS))
371
+ specular_roughness*=roughnessFromTexture;
372
+ #endif
373
+ #ifdef GEOMETRY_TANGENT
374
+ {let tangentFromTexture: vec2f=normalize(geometryTangentFromTexture.xy*vec2f(2.0f)-vec2f(1.0f));let tangent_angle_texture: f32=atan2(tangentFromTexture.y,tangentFromTexture.x);let tangent_angle_uniform: f32=atan2(geometry_tangent.y,geometry_tangent.x);let tangent_angle: f32=tangent_angle_texture+tangent_angle_uniform;geometry_tangent=vec2f(cos(tangent_angle),sin(tangent_angle));}
375
+ #endif
376
+ #if defined(GEOMETRY_TANGENT) && defined(SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE)
377
+ specular_roughness_anisotropy*=geometryTangentFromTexture.b;
378
+ #elif defined(SPECULAR_ROUGHNESS_ANISOTROPY)
379
+ specular_roughness_anisotropy*=anisotropyFromTexture;
380
+ #endif
381
+ #ifdef DETAIL
382
+ let detailRoughness: f32=mix(0.5f,detailColor.b,vDetailInfos.w);let loLerp: f32=mix(0.f,specular_roughness,detailRoughness*2.f);let hiLerp: f32=mix(specular_roughness,1.f,(detailRoughness-0.5f)*2.f);specular_roughness=mix(loLerp,hiLerp,step(detailRoughness,0.5f));
383
+ #endif
384
+ #ifdef USE_GLTF_STYLE_ANISOTROPY
385
+ let baseAlpha: f32=specular_roughness*specular_roughness;let roughnessT: f32=mix(baseAlpha,1.0f,specular_roughness_anisotropy*specular_roughness_anisotropy);let roughnessB: f32=baseAlpha;specular_roughness_anisotropy=1.0f-roughnessB/max(roughnessT,0.00001f);specular_roughness=sqrt(roughnessT/sqrt(2.0f/(1.0f+(1.0f-specular_roughness_anisotropy)*(1.0f-specular_roughness_anisotropy))));
386
+ #endif
387
+ `;r.ShaderStore.IncludesShadersStoreWGSL[er]||(r.ShaderStore.IncludesShadersStoreWGSL[er]=et);var ea=e.i(4558),ei=e.i(80899);let eo="openpbrCoatLayerData",en=`var coat_weight: f32=0.0f;var coat_color: vec3f=vec3f(1.0f);var coat_roughness: f32=0.0f;var coat_roughness_anisotropy: f32=0.0f;var coat_ior: f32=1.6f;var coat_darkening: f32=1.0f;var geometry_coat_tangent: vec2f=vec2f(1.0f,0.0f);
388
+ #ifdef COAT_WEIGHT
389
+ var coatWeightFromTexture: vec4f=TEXRD(coatWeightSampler,coatWeightSamplerSampler,fragmentInputs.vCoatWeightUV+uvOffset);
390
+ #endif
391
+ #ifdef COAT_COLOR
392
+ var coatColorFromTexture: vec4f=TEXRD(coatColorSampler,coatColorSamplerSampler,fragmentInputs.vCoatColorUV+uvOffset);
393
+ #endif
394
+ #ifdef COAT_ROUGHNESS
395
+ var coatRoughnessFromTexture: vec4f=TEXRD(coatRoughnessSampler,coatRoughnessSamplerSampler,fragmentInputs.vCoatRoughnessUV+uvOffset);
396
+ #endif
397
+ #ifdef COAT_ROUGHNESS_ANISOTROPY
398
+ var coatRoughnessAnisotropyFromTexture: f32=TEXRD(coatRoughnessAnisotropySampler,coatRoughnessAnisotropySamplerSampler,fragmentInputs.vCoatRoughnessAnisotropyUV+uvOffset).r;
399
+ #endif
400
+ #ifdef COAT_DARKENING
401
+ var coatDarkeningFromTexture: vec4f=TEXRD(coatDarkeningSampler,coatDarkeningSamplerSampler,fragmentInputs.vCoatDarkeningUV+uvOffset);
402
+ #endif
403
+ #ifdef GEOMETRY_COAT_TANGENT
404
+ var geometryCoatTangentFromTexture: vec3f=TEXRD(geometryCoatTangentSampler,geometryCoatTangentSamplerSampler,fragmentInputs.vGeometryCoatTangentUV+uvOffset).rgb;
405
+ #endif
406
+ coat_color=uniforms.vCoatColor.rgb;coat_weight=uniforms.vCoatWeight;coat_roughness=uniforms.vCoatRoughness;coat_roughness_anisotropy=uniforms.vCoatRoughnessAnisotropy;coat_ior=uniforms.vCoatIor;coat_darkening=uniforms.vCoatDarkening;geometry_coat_tangent=uniforms.vGeometryCoatTangent.rg;
407
+ #ifdef COAT_WEIGHT
408
+ coat_weight*=coatWeightFromTexture.r;
409
+ #endif
410
+ #ifdef COAT_COLOR
411
+ #ifdef COAT_COLOR_GAMMA
412
+ coat_color*=toLinearSpaceVec3(coatColorFromTexture.rgb);
413
+ #else
414
+ coat_color*=coatColorFromTexture.rgb;
415
+ #endif
416
+ coat_color*=uniforms.vCoatColorInfos.y;
417
+ #endif
418
+ #ifdef COAT_ROUGHNESS
419
+ #ifdef COAT_ROUGHNESS_FROM_GREEN_CHANNEL
420
+ coat_roughness*=coatRoughnessFromTexture.g;
421
+ #else
422
+ coat_roughness*=coatRoughnessFromTexture.r;
423
+ #endif
424
+ #endif
425
+ #if defined(GEOMETRY_COAT_TANGENT) && defined(COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE)
426
+ coat_roughness_anisotropy*=geometryCoatTangentFromTexture.b;
427
+ #elif defined(COAT_ROUGHNESS_ANISOTROPY)
428
+ coat_roughness_anisotropy*=coatRoughnessAnisotropyFromTexture;
429
+ #endif
430
+ #ifdef COAT_DARKENING
431
+ coat_darkening*=coatDarkeningFromTexture.r;
432
+ #endif
433
+ #ifdef GEOMETRY_COAT_TANGENT
434
+ {let tangentFromTexture: vec2f=normalize(geometryCoatTangentFromTexture.xy*vec2f(2.0f)-vec2f(1.0f));let tangent_angle_texture: f32=atan2(tangentFromTexture.y,tangentFromTexture.x);let tangent_angle_uniform: f32=atan2(geometry_coat_tangent.y,geometry_coat_tangent.x);let tangent_angle: f32=tangent_angle_texture+tangent_angle_uniform;geometry_coat_tangent=vec2f(cos(tangent_angle),sin(tangent_angle));}
435
+ #endif
436
+ #ifdef USE_GLTF_STYLE_ANISOTROPY
437
+ let coatAlpha: f32=coat_roughness*coat_roughness;let coatRoughnessT: f32=mix(coatAlpha,1.0f,coat_roughness_anisotropy*coat_roughness_anisotropy);let coatRoughnessB: f32=coatAlpha;coat_roughness_anisotropy=1.0f-coatRoughnessB/max(coatRoughnessT,0.00001f);coat_roughness=sqrt(coatRoughnessT/sqrt(2.0f/(1.0f+(1.0f-coat_roughness_anisotropy)*(1.0f-coat_roughness_anisotropy))));
438
+ #endif
439
+ `;r.ShaderStore.IncludesShadersStoreWGSL[eo]||(r.ShaderStore.IncludesShadersStoreWGSL[eo]=en);let ef="openpbrThinFilmLayerData",es=`#ifdef THIN_FILM
440
+ var thin_film_weight: f32=uniforms.vThinFilmWeight;var thin_film_thickness: f32=uniforms.vThinFilmThickness.r*1000.0f;
441
+ var thin_film_ior: f32=uniforms.vThinFilmIor;
442
+ #ifdef THIN_FILM_WEIGHT
443
+ var thinFilmWeightFromTexture: f32=TEXRD(thinFilmWeightSampler,thinFilmWeightSamplerSampler,fragmentInputs.vThinFilmWeightUV+uvOffset).r*uniforms.vThinFilmWeightInfos.y;
444
+ #endif
445
+ #ifdef THIN_FILM_THICKNESS
446
+ var thinFilmThicknessFromTexture: f32=TEXRD(thinFilmThicknessSampler,thinFilmThicknessSamplerSampler,fragmentInputs.vThinFilmThicknessUV+uvOffset).g*uniforms.vThinFilmThicknessInfos.y;
447
+ #endif
448
+ #ifdef THIN_FILM_WEIGHT
449
+ thin_film_weight*=thinFilmWeightFromTexture;
450
+ #endif
451
+ #ifdef THIN_FILM_THICKNESS
452
+ thin_film_thickness*=thinFilmThicknessFromTexture;
453
+ #endif
454
+ let thin_film_ior_scale: f32=clamp(2.0f*abs(thin_film_ior-1.0f),0.0f,1.0f);
455
+ #endif
456
+ `;r.ShaderStore.IncludesShadersStoreWGSL[ef]||(r.ShaderStore.IncludesShadersStoreWGSL[ef]=es);let el="openpbrFuzzLayerData",ec=`var fuzz_weight: f32=0.0f;var fuzz_color: vec3f=vec3f(1.0f);var fuzz_roughness: f32=0.0f;
457
+ #ifdef FUZZ
458
+ #ifdef FUZZ_WEIGHT
459
+ let fuzzWeightFromTexture: vec4f=TEXRD(fuzzWeightSampler,fuzzWeightSamplerSampler,fragmentInputs.vFuzzWeightUV+uvOffset);
460
+ #endif
461
+ #ifdef FUZZ_COLOR
462
+ var fuzzColorFromTexture: vec4f=TEXRD(fuzzColorSampler,fuzzColorSamplerSampler,fragmentInputs.vFuzzColorUV+uvOffset);
463
+ #endif
464
+ #ifdef FUZZ_ROUGHNESS
465
+ let fuzzRoughnessFromTexture: vec4f=TEXRD(fuzzRoughnessSampler,fuzzRoughnessSamplerSampler,fragmentInputs.vFuzzRoughnessUV+uvOffset);
466
+ #endif
467
+ fuzz_color=uniforms.vFuzzColor.rgb;fuzz_weight=uniforms.vFuzzWeight;fuzz_roughness=uniforms.vFuzzRoughness;
468
+ #ifdef FUZZ_WEIGHT
469
+ fuzz_weight*=fuzzWeightFromTexture.r;
470
+ #endif
471
+ #ifdef FUZZ_COLOR
472
+ #ifdef FUZZ_COLOR_GAMMA
473
+ fuzz_color*=toLinearSpaceVec3(fuzzColorFromTexture.rgb);
474
+ #else
475
+ fuzz_color*=fuzzColorFromTexture.rgb;
476
+ #endif
477
+ fuzz_color*=uniforms.vFuzzColorInfos.y;
478
+ #endif
479
+ #if defined(FUZZ_ROUGHNESS) && defined(FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA)
480
+ fuzz_roughness*=fuzzRoughnessFromTexture.a;
481
+ #elif defined(FUZZ_ROUGHNESS)
482
+ fuzz_roughness*=fuzzRoughnessFromTexture.r;
483
+ #endif
484
+ #endif
485
+ `;r.ShaderStore.IncludesShadersStoreWGSL[el]||(r.ShaderStore.IncludesShadersStoreWGSL[el]=ec);let e_="openpbrAmbientOcclusionData",em=`var ambient_occlusion: vec3f=vec3f(1.0f,1.0f,1.0f);var specular_ambient_occlusion: f32=1.0f;var coat_specular_ambient_occlusion: f32=1.0f;
486
+ #ifdef AMBIENT_OCCLUSION
487
+ var ambientOcclusionFromTexture: vec3f=TEXRD(ambientOcclusionSampler,ambientOcclusionSamplerSampler,fragmentInputs.vAmbientOcclusionUV+uvOffset).rgb;ambient_occlusion=vec3f(ambientOcclusionFromTexture.r*uniforms.vAmbientOcclusionInfos.y+(1.0f-uniforms.vAmbientOcclusionInfos.y));
488
+ #endif
489
+ `;r.ShaderStore.IncludesShadersStoreWGSL[e_]||(r.ShaderStore.IncludesShadersStoreWGSL[e_]=em);var ed=e.i(31329);let eu="openpbrBackgroundTransmission",eg=`var slab_translucent_background: vec4f=vec4f(0.,0.,0.,1.);
490
+ #ifdef REFRACTED_BACKGROUND
491
+ {let refractionLOD: f32=min(transmission_roughness,0.8)*uniforms.vBackgroundRefractionInfos.x;let lodTexelSize: f32=pow(2.0f,refractionLOD-uniforms.vBackgroundRefractionInfos.x);
492
+ #ifdef DISPERSION
493
+ {
494
+ #ifdef REFRACTION_HIGH_QUALITY_BLUR
495
+ {var dispResult: vec3f=vec3f(0.0);var dispWeight: vec3f=vec3f(0.0);let noiseOffset: vec2f=noise.xy*select(0.0f,lodTexelSize,refractionLOD>0.0f);for (var k: i32=0; k<6; k++) {let t: f32=(f32(k)+noise.y)/6.0f;let t_rg: f32=clamp(t*2.0f,0.0f,1.0f);let t_gb: f32=clamp((t-0.5f)*2.0f,0.0f,1.0f);let refVec: vec3f=mix(mix(refractedViewVectors[0],refractedViewVectors[1],t_rg),refractedViewVectors[2],t_gb);let uvw: vec3f=vec3f((uniforms.backgroundRefractionMatrix*(scene.view*vec4f(fragmentInputs.vPositionW+refVec*geometry_thickness,1.0f))).xyz);var coords: vec2f=uvw.xy/uvw.z;coords.y=1.0f-coords.y;let s: vec4f=textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,coords+noiseOffset,refractionLOD);let rw: f32=max(0.0f,1.0f-2.0f*t);let gw: f32=max(0.0f,1.0f-abs(2.0f*t-1.0f));let bw: f32=max(0.0f,2.0f*t-1.0f);let w: vec3f=vec3f(rw,gw,bw);dispResult+=s.rgb*w;dispWeight+=w;}
496
+ slab_translucent_background=vec4f(dispResult/max(dispWeight,vec3f(1e-6)),1.0f);}
497
+ #else
498
+ for (var i: i32=0; i<3; i++) {let refractedViewVector: vec3f=refractedViewVectors[i];let uvw: vec3f=vec3f((uniforms.backgroundRefractionMatrix*(scene.view*vec4f(fragmentInputs.vPositionW+refractedViewVector*geometry_thickness,1.0f))).xyz);var coords: vec2f=uvw.xy/uvw.z;coords.y=1.0f-coords.y;if (refractionLOD>0.0f) {let noiseOffset: vec2f=noise.xy*lodTexelSize;slab_translucent_background[i]=textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,coords+noiseOffset,refractionLOD)[i];} else {slab_translucent_background[i]=textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,coords,0.0f)[i];}}
499
+ #endif
500
+ }
501
+ #else
502
+ {let refractionUVW: vec3f=vec3f((uniforms.backgroundRefractionMatrix*(scene.view*vec4f(fragmentInputs.vPositionW+refractedViewVector*geometry_thickness,1.0f))).xyz);var refractionCoords: vec2f=refractionUVW.xy/refractionUVW.z;refractionCoords.y=1.0f-refractionCoords.y;if (refractionLOD>0.0f) {
503
+ #ifdef REFRACTION_HIGH_QUALITY_BLUR
504
+ let cosA: f32=cos(noise.x*PI);let sinA: f32=sin(noise.x*PI);let u: vec2f=vec2f( cosA,sinA)*(0.5f*lodTexelSize);let v: vec2f=vec2f(-sinA,cosA)*(0.5f*lodTexelSize);slab_translucent_background=0.25f*(
505
+ textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords+u+v,refractionLOD) +
506
+ textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords-u+v,refractionLOD) +
507
+ textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords+u-v,refractionLOD) +
508
+ textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords-u-v,refractionLOD)
509
+ );
510
+ #else
511
+ let noiseOffset: vec2f=noise.xy*lodTexelSize;slab_translucent_background=textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords+noiseOffset,refractionLOD);
512
+ #endif
513
+ } else {slab_translucent_background=textureSampleLevel(backgroundRefractionSampler,backgroundRefractionSamplerSampler,refractionCoords,0.0f);}}
514
+ #endif
515
+ }
516
+ #endif
517
+ `;r.ShaderStore.IncludesShadersStoreWGSL[eu]||(r.ShaderStore.IncludesShadersStoreWGSL[eu]=eg);let ep="openpbrEnvironmentLighting",ev=`#if defined(REFLECTION) || defined(REFRACTED_BACKGROUND)
518
+ var coatAbsorption=vec3f(1.0f);var coatIblFresnel: f32=0.0;if (coat_weight>0.0) {coatIblFresnel=computeDielectricIblFresnel(coatReflectance,coatGeoInfo.environmentBrdf);let hemisphere_avg_fresnel: f32=coatReflectance.F0+0.5f*(1.0f-coatReflectance.F0);var averageReflectance: f32=(coatIblFresnel+hemisphere_avg_fresnel)*0.5f;let roughnessFactor=1.0f-coat_roughness*0.5f;averageReflectance*=roughnessFactor;var darkened_transmission: f32=(1.0f-averageReflectance)*(1.0f-averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);var sin2: f32=1.0f-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior)*coat_weight;let cos_t: f32=sqrt(1.0f-sin2);let coatPathLength=1.0f/cos_t;let effectivePathLength=coatPathLength*coat_weight;let colored_transmission: vec3f=pow(coat_color,vec3f(effectivePathLength));coatAbsorption=colored_transmission*mix(1.0f,darkened_transmission,coat_weight);}
519
+ #endif
520
+ #ifdef REFLECTION
521
+ #ifdef FUZZ
522
+ let environmentFuzzBrdf: vec3f=getFuzzBRDFLookup(fuzzGeoInfo.NdotV,sqrt(fuzz_roughness));
523
+ #endif
524
+ var baseDiffuseEnvironmentLight: vec3f=sampleIrradiance(
525
+ normalW
526
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
527
+ ,vEnvironmentIrradiance
528
+ #endif
529
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
530
+ ,uniforms.reflectionMatrix
531
+ #endif
532
+ #ifdef USEIRRADIANCEMAP
533
+ ,irradianceSampler
534
+ ,irradianceSamplerSampler
535
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
536
+ ,uniforms.vReflectionDominantDirection
537
+ #endif
538
+ #endif
539
+ #ifdef REALTIME_FILTERING
540
+ ,uniforms.vReflectionFilteringInfo
541
+ #ifdef IBL_CDF_FILTERING
542
+ ,icdfSampler
543
+ ,icdfSamplerSampler
544
+ #endif
545
+ #endif
546
+ ,uniforms.vReflectionInfos
547
+ ,viewDirectionW
548
+ ,base_diffuse_roughness
549
+ ,base_color
550
+ );
551
+ #ifdef REFLECTIONMAP_3D
552
+ var reflectionCoords: vec3f=vec3f(0.f,0.f,0.f);
553
+ #else
554
+ var reflectionCoords: vec2f=vec2f(0.f,0.f);
555
+ #endif
556
+ let specularAlphaG: f32=specular_roughness*specular_roughness;
557
+ #ifdef ANISOTROPIC_BASE
558
+ var baseSpecularEnvironmentLight: vec3f=sampleRadianceAnisotropic(specularAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
559
+ ,baseGeoInfo
560
+ ,normalW
561
+ ,viewDirectionW
562
+ ,fragmentInputs.vPositionW
563
+ ,noise
564
+ ,false
565
+ ,1.0
566
+ ,reflectionSampler
567
+ ,reflectionSamplerSampler
568
+ #ifdef REALTIME_FILTERING
569
+ ,uniforms.vReflectionFilteringInfo
570
+ #endif
571
+ );
572
+ #else
573
+ reflectionCoords=createReflectionCoords(fragmentInputs.vPositionW,normalW);var baseSpecularEnvironmentLight: vec3f=sampleRadiance(specularAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
574
+ ,baseGeoInfo
575
+ ,reflectionSampler
576
+ ,reflectionSamplerSampler
577
+ ,reflectionCoords
578
+ #ifdef REALTIME_FILTERING
579
+ ,uniforms.vReflectionFilteringInfo
580
+ #endif
581
+ );
582
+ #endif
583
+ #ifdef ANISOTROPIC_BASE
584
+ baseSpecularEnvironmentLight=mix(baseSpecularEnvironmentLight.rgb,baseDiffuseEnvironmentLight,specularAlphaG*specularAlphaG *max(1.0f-baseGeoInfo.anisotropy,0.3f));
585
+ #else
586
+ baseSpecularEnvironmentLight=mix(baseSpecularEnvironmentLight.rgb,baseDiffuseEnvironmentLight,specularAlphaG);
587
+ #endif
588
+ var coatEnvironmentLight: vec3f=vec3f(0.f,0.f,0.f);if (coat_weight>0.0) {
589
+ #ifdef REFLECTIONMAP_3D
590
+ var reflectionCoords: vec3f=vec3f(0.f,0.f,0.f);
591
+ #else
592
+ var reflectionCoords: vec2f=vec2f(0.f,0.f);
593
+ #endif
594
+ reflectionCoords=createReflectionCoords(fragmentInputs.vPositionW,coatNormalW);var coatAlphaG: f32=coat_roughness*coat_roughness;
595
+ #ifdef ANISOTROPIC_COAT
596
+ coatEnvironmentLight=sampleRadianceAnisotropic(coatAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
597
+ ,coatGeoInfo
598
+ ,coatNormalW
599
+ ,viewDirectionW
600
+ ,fragmentInputs.vPositionW
601
+ ,noise
602
+ ,false
603
+ ,1.0
604
+ ,reflectionSampler
605
+ ,reflectionSamplerSampler
606
+ #ifdef REALTIME_FILTERING
607
+ ,uniforms.vReflectionFilteringInfo
608
+ #endif
609
+ );
610
+ #else
611
+ coatEnvironmentLight=sampleRadiance(coatAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
612
+ ,coatGeoInfo
613
+ ,reflectionSampler
614
+ ,reflectionSamplerSampler
615
+ ,reflectionCoords
616
+ #ifdef REALTIME_FILTERING
617
+ ,uniforms.vReflectionFilteringInfo
618
+ #endif
619
+ );
620
+ #endif
621
+ }
622
+ #ifdef FUZZ
623
+ let modifiedFuzzRoughness: f32=clamp(fuzz_roughness*(1.0f-0.5f*environmentFuzzBrdf.y),0.0f,1.0f);var fuzzEnvironmentLight=vec3f(0.0f,0.0f,0.0f);var totalWeight=0.0f;let fuzzIblFresnel: f32=sqrt(environmentFuzzBrdf.z);for (var i: i32=0; i<i32(FUZZ_IBL_SAMPLES); i++) {var angle: f32=(f32(i)+noise.x)*(3.141592f*2.0f/f32(FUZZ_IBL_SAMPLES));var fiberCylinderNormal: vec3f=normalize(cos(angle)*fuzzTangent+sin(angle)*fuzzBitangent);let fiberBend=min(environmentFuzzBrdf.x*environmentFuzzBrdf.x*modifiedFuzzRoughness,1.0f);fiberCylinderNormal=normalize(mix(fiberCylinderNormal,fuzzNormalW,fiberBend));let sampleWeight=max(dot(viewDirectionW,fiberCylinderNormal),0.0f);var fuzzReflectionCoords=createReflectionCoords(fragmentInputs.vPositionW,fiberCylinderNormal);let radianceSample: vec3f=sampleRadiance(modifiedFuzzRoughness,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
624
+ ,fuzzGeoInfo
625
+ ,reflectionSampler
626
+ ,reflectionSamplerSampler
627
+ ,fuzzReflectionCoords
628
+ #ifdef REALTIME_FILTERING
629
+ ,uniforms.vReflectionFilteringInfo
630
+ #endif
631
+ );fuzzEnvironmentLight+=sampleWeight*mix(radianceSample,baseDiffuseEnvironmentLight,fiberBend);totalWeight+=sampleWeight;}
632
+ fuzzEnvironmentLight/=totalWeight;
633
+ #endif
634
+ var dielectricIblFresnel: f32=computeDielectricIblFresnel(baseDielectricReflectance,baseGeoInfo.environmentBrdf);var dielectricIblColoredFresnel: vec3f=dielectricIblFresnel*specular_color;
635
+ #ifdef THIN_FILM
636
+ let thin_film_cos_theta: f32=max(baseGeoInfo.NdotV,specularAlphaG);let thin_film_desaturation_scale=(thin_film_ior-1.0)*sqrt(thin_film_thickness*0.001f*thin_film_cos_theta);let tf_brdf_x: f32=baseGeoInfo.environmentBrdf.x;let tf_E_ss: f32 =baseGeoInfo.environmentBrdf.y;var thinFilmDielectricF0: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,1.0,thin_film_thickness,vec3f(baseDielectricReflectance.F0));thinFilmDielectricF0=mix(thinFilmDielectricF0,vec3(dot(thinFilmDielectricF0,vec3f(0.3333f))),thin_film_desaturation_scale);var thinFilmDielectricDir: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,thin_film_cos_theta,thin_film_thickness,vec3f(baseDielectricReflectance.F0));thinFilmDielectricDir=mix(thinFilmDielectricDir,vec3(dot(thinFilmDielectricDir,vec3f(0.3333f))),thin_film_desaturation_scale);let tf_f0d_avg: f32 =dot(thinFilmDielectricF0, vec3f(0.3333f));let tf_dird_avg: f32=dot(thinFilmDielectricDir,vec3f(0.3333f));var thin_film_dielectric: vec3f=thinFilmDielectricDir*(tf_f0d_avg/max(tf_dird_avg,1e-5));let tf_E_dielectric: vec3f=(vec3f(1.0)-thin_film_dielectric)*vec3f(tf_brdf_x)+thin_film_dielectric*vec3f(tf_E_ss);let tf_F_avg_dielectric: vec3f=thin_film_dielectric+(vec3f(1.0)-thin_film_dielectric)/21.0;let tf_ECF_dielectric: vec3f=vec3f(1.0)+tf_F_avg_dielectric*(vec3f(1.0)/vec3f(tf_E_ss)-vec3f(1.0));thin_film_dielectric=clamp(tf_E_dielectric*tf_ECF_dielectric,vec3f(0.0),vec3f(1.0));dielectricIblColoredFresnel=mix(dielectricIblColoredFresnel,thin_film_dielectric*specular_color,thin_film_weight*thin_film_ior_scale);dielectricIblFresnel=max(dielectricIblColoredFresnel.r,max(dielectricIblColoredFresnel.g,dielectricIblColoredFresnel.b));
637
+ #endif
638
+ var conductorIblFresnel: vec3f=computeConductorIblFresnel(baseConductorReflectance,baseGeoInfo.environmentBrdf);
639
+ #ifdef THIN_FILM
640
+ var thinFilmConductorF0: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,1.0,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorF0=mix(thinFilmConductorF0,vec3(dot(thinFilmConductorF0,vec3f(0.3333f))),thin_film_desaturation_scale);var thinFilmConductorDir: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,thin_film_cos_theta,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorDir=mix(thinFilmConductorDir,vec3(dot(thinFilmConductorDir,vec3f(0.3333f))),thin_film_desaturation_scale);let tf_f0c_avg: f32 =dot(thinFilmConductorF0, vec3f(0.3333f));let tf_dirc_avg: f32=dot(thinFilmConductorDir,vec3f(0.3333f));var thinFilmConductorRaw: vec3f=thinFilmConductorDir*(tf_f0c_avg/max(tf_dirc_avg,1e-5));
641
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) && defined(ENVIRONMENTBRDF)
642
+ let tf_b: vec3f=getF82B(baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90);let tf_brdf_z: f32=baseGeoInfo.environmentBrdf.z/BRDF_Z_SCALE;let tf_E_conductor: vec3f=(vec3f(1.0)-thinFilmConductorRaw)*vec3f(tf_brdf_x)+thinFilmConductorRaw*vec3f(tf_E_ss)-tf_b*vec3f(tf_brdf_z);let tf_F_avg_conductor: vec3f=thinFilmConductorRaw+(vec3f(1.0)-thinFilmConductorRaw)/21.0-tf_b/126.0;
643
+ #else
644
+ let tf_E_conductor: vec3f=(vec3f(1.0)-thinFilmConductorRaw)*vec3f(tf_brdf_x)+thinFilmConductorRaw*vec3f(tf_E_ss);let tf_F_avg_conductor: vec3f=thinFilmConductorRaw+(vec3f(1.0)-thinFilmConductorRaw)/21.0;
645
+ #endif
646
+ let tf_ECF_conductor: vec3f=vec3f(1.0)+tf_F_avg_conductor*(vec3f(1.0)/vec3f(tf_E_ss)-vec3f(1.0));var thinFilmConductorFresnel: vec3f=specular_weight*clamp(tf_E_conductor*tf_ECF_conductor,vec3f(0.0),vec3f(1.0));conductorIblFresnel=mix(conductorIblFresnel,thinFilmConductorFresnel,thin_film_weight*thin_film_ior_scale);
647
+ #endif
648
+ var slab_diffuse_ibl: vec3f=vec3f(0.,0.,0.);var slab_glossy_ibl: vec3f=vec3f(0.,0.,0.);var slab_metal_ibl: vec3f=vec3f(0.,0.,0.);var slab_coat_ibl: vec3f=vec3f(0.,0.,0.);slab_diffuse_ibl=baseDiffuseEnvironmentLight*uniforms.vLightingIntensity.z;
649
+ #ifdef AMBIENT_OCCLUSION
650
+ specular_ambient_occlusion=compute_specular_occlusion(baseGeoInfo.NdotV,base_metalness,ambient_occlusion.x,specular_roughness);
651
+ #endif
652
+ slab_glossy_ibl=baseSpecularEnvironmentLight*uniforms.vLightingIntensity.z;slab_metal_ibl=baseSpecularEnvironmentLight*conductorIblFresnel*uniforms.vLightingIntensity.z;if (coat_weight>0.0) {slab_coat_ibl=coatEnvironmentLight*uniforms.vLightingIntensity.z;
653
+ #ifdef AMBIENT_OCCLUSION
654
+ coat_specular_ambient_occlusion=compute_specular_occlusion(coatGeoInfo.NdotV,0.0,ambient_occlusion.x,coat_roughness);
655
+ #endif
656
+ }
657
+ #ifdef FUZZ
658
+ var slab_fuzz_ibl=fuzzEnvironmentLight*uniforms.vLightingIntensity.z;
659
+ #endif
660
+ var slab_translucent_base_ibl: vec3f=vec3f(0.0f,0.0f,0.0f);
661
+ #ifdef REFRACTED_ENVIRONMENT
662
+ #ifdef ANISOTROPIC_BASE
663
+ var forwardScatteredEnvironmentLight: vec3f=sampleRadianceAnisotropic(transmission_roughness_alpha,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
664
+ ,baseGeoInfo
665
+ #ifdef GEOMETRY_THIN_WALLED
666
+ ,viewDirectionW
667
+ #else
668
+ ,normalW
669
+ #endif
670
+ ,viewDirectionW
671
+ ,fragmentInputs.vPositionW
672
+ ,noise
673
+ ,true
674
+ #ifdef GEOMETRY_THIN_WALLED
675
+ ,1.05f
676
+ #else
677
+ ,specular_ior
678
+ #endif
679
+ ,reflectionSampler
680
+ ,reflectionSamplerSampler
681
+ #ifdef REALTIME_FILTERING
682
+ ,uniforms.vReflectionFilteringInfo
683
+ #endif
684
+ );
685
+ #else
686
+ var forwardScatteredEnvironmentLight: vec3f=vec3f(0.,0.,0.);
687
+ #ifdef DISPERSION
688
+ for (var i: i32=0; i<3; i++) {var iblRefractionCoords: vec3f=refractedViewVectors[i];
689
+ #else
690
+ var iblRefractionCoords: vec3f=refractedViewVector;
691
+ #endif
692
+ #ifdef REFRACTED_ENVIRONMENT_OPPOSITEZ
693
+ iblRefractionCoords.z*=-1.0f;
694
+ #endif
695
+ #ifdef REFRACTED_ENVIRONMENT_LOCAL_CUBE
696
+ iblRefractionCoords=parallaxCorrectNormal(fragmentInputs.vPositionW,refractedViewVector,uniforms.refractionSize,uniforms.refractionPosition);
697
+ #endif
698
+ iblRefractionCoords=(uniforms.reflectionMatrix*vec4f(iblRefractionCoords,0.0f)).xyz;
699
+ #ifdef DISPERSION
700
+ forwardScatteredEnvironmentLight[i]=sampleRadiance(transmission_roughness_alpha,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
701
+ ,baseGeoInfo
702
+ ,reflectionSampler
703
+ ,reflectionSamplerSampler
704
+ ,iblRefractionCoords
705
+ #ifdef REALTIME_FILTERING
706
+ ,uniforms.vReflectionFilteringInfo
707
+ #endif
708
+ )[i];
709
+ #else
710
+ forwardScatteredEnvironmentLight=sampleRadiance(transmission_roughness_alpha,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos
711
+ ,baseGeoInfo
712
+ ,reflectionSampler
713
+ ,reflectionSamplerSampler
714
+ ,iblRefractionCoords
715
+ #ifdef REALTIME_FILTERING
716
+ ,uniforms.vReflectionFilteringInfo
717
+ #endif
718
+ );
719
+ #endif
720
+ #ifdef DISPERSION
721
+ }
722
+ #endif
723
+ #endif
724
+ #ifdef REFRACTED_BACKGROUND
725
+ #ifdef GEOMETRY_THIN_WALLED
726
+ forwardScatteredEnvironmentLight=mix(slab_translucent_background.rgb,forwardScatteredEnvironmentLight.rgb,0.2*transmission_roughness_alpha);
727
+ #else
728
+ forwardScatteredEnvironmentLight=max(slab_translucent_background.rgb,mix(slab_translucent_background.rgb,forwardScatteredEnvironmentLight,transmission_roughness_alpha));
729
+ #endif
730
+ #endif
731
+ #ifdef SCATTERING
732
+ #ifdef GEOMETRY_THIN_WALLED
733
+ var scatterVector: vec3f=normalW;
734
+ #else
735
+ #if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION)
736
+ var scatterVector: vec3f=mix(uniforms.vReflectionDominantDirection,normalW,max3(iso_scatter_density));
737
+ #else
738
+ var scatterVector: vec3f=normalW;
739
+ #endif
740
+ scatterVector=mix(viewDirectionW,scatterVector,back_to_iso_scattering_blend);
741
+ #endif
742
+ #if defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) && !defined(GEOMETRY_THIN_WALLED)
743
+ var scatteredEnvironmentLight: vec3f=scattered_light_from_irradiance_texture;
744
+ #else
745
+ var scatteredEnvironmentLight: vec3f=sampleIrradiance(
746
+ scatterVector
747
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
748
+ ,vEnvironmentIrradiance
749
+ #endif
750
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
751
+ ,uniforms.reflectionMatrix
752
+ #endif
753
+ #ifdef USEIRRADIANCEMAP
754
+ ,irradianceSampler
755
+ ,irradianceSamplerSampler
756
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
757
+ ,uniforms.vReflectionDominantDirection
758
+ #endif
759
+ #endif
760
+ #ifdef REALTIME_FILTERING
761
+ ,uniforms.vReflectionFilteringInfo
762
+ #ifdef IBL_CDF_FILTERING
763
+ ,icdfSampler
764
+ ,icdfSamplerSampler
765
+ #endif
766
+ #endif
767
+ ,uniforms.vReflectionInfos
768
+ ,viewDirectionW
769
+ #if defined(GEOMETRY_THIN_WALLED)
770
+ ,base_diffuse_roughness
771
+ ,subsurface_color.rgb
772
+ #else
773
+ ,1.0f
774
+ ,volumeParams.multi_scatter_color
775
+ #endif
776
+ );
777
+ #endif
778
+ #ifdef GEOMETRY_THIN_WALLED
779
+ let forward_scattered_light: vec3f=forwardScatteredEnvironmentLight*transmission_tint*volumeParams.multi_scatter_color;let back_scattered_light: vec3f=scatteredEnvironmentLight*volumeParams.multi_scatter_color;slab_translucent_base_ibl=mix(back_scattered_light,forward_scattered_light,0.5f+0.5f*volumeParams.anisotropy);
780
+ #else
781
+ let forward_scattered_light: vec3f=forwardScatteredEnvironmentLight*volume_absorption;let back_scattered_light: vec3f=mix(forward_scattered_light,scatteredEnvironmentLight*backscatter_color,iso_scatter_density);let iso_scattered_light: vec3f=mix(forward_scattered_light,scatteredEnvironmentLight*volumeParams.multi_scatter_color,iso_scatter_density);slab_translucent_base_ibl=mix(back_scattered_light,iso_scattered_light,back_to_iso_scattering_blend);slab_translucent_base_ibl=mix(slab_translucent_base_ibl,forward_scattered_light,iso_to_forward_scattering_blend)*transmission_tint;
782
+ #endif
783
+ #else
784
+ slab_translucent_base_ibl+=forwardScatteredEnvironmentLight*transmission_tint*volume_absorption;
785
+ #endif
786
+ #endif
787
+ #define CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION
788
+ slab_diffuse_ibl*=ambient_occlusion;slab_metal_ibl*=specular_ambient_occlusion;slab_glossy_ibl*=specular_ambient_occlusion;slab_coat_ibl*=coat_specular_ambient_occlusion;let material_dielectric_base_ibl: vec3f=mix(slab_diffuse_ibl*base_color.rgb,slab_translucent_base_ibl,surface_translucency_weight);let material_dielectric_gloss_ibl: vec3f=material_dielectric_base_ibl*(1.0-dielectricIblFresnel)+slab_glossy_ibl*dielectricIblColoredFresnel;let material_base_substrate_ibl: vec3f=mix(material_dielectric_gloss_ibl,slab_metal_ibl,base_metalness);let material_coated_base_ibl: vec3f=layer(material_base_substrate_ibl,slab_coat_ibl,coatIblFresnel,coatAbsorption,vec3f(1.0f));
789
+ #ifdef FUZZ
790
+ slab_fuzz_ibl*=min(vec3(specular_ambient_occlusion),ambient_occlusion);material_surface_ibl=layer(material_coated_base_ibl,slab_fuzz_ibl,fuzzIblFresnel*fuzz_weight,vec3f(1.0f),fuzz_color);
791
+ #else
792
+ material_surface_ibl=material_coated_base_ibl;
793
+ #endif
794
+ #elif defined(REFRACTED_BACKGROUND)
795
+ let black=vec3f(0.0f);var slab_translucent_base_ibl: vec3f=vec3f(0.0f);
796
+ #ifdef GEOMETRY_THIN_WALLED
797
+ #ifdef SCATTERING
798
+ let forward_scattered_light: vec3f=slab_translucent_background.rgb*transmission_tint*volumeParams.multi_scatter_color;slab_translucent_base_ibl=mix(black,forward_scattered_light,0.5f+0.5f*volumeParams.anisotropy);
799
+ #else
800
+ slab_translucent_base_ibl=slab_translucent_background.rgb*transmission_tint;
801
+ #endif
802
+ #else
803
+ #ifdef SCATTERING
804
+ let forward_scattered_light: vec3f=slab_translucent_background.rgb*volume_absorption;let iso_scattered_light: vec3f=(1.0f-iso_scatter_density)*forward_scattered_light;slab_translucent_base_ibl=mix(black,iso_scattered_light,back_to_iso_scattering_blend);slab_translucent_base_ibl=mix(slab_translucent_base_ibl,forward_scattered_light,iso_to_forward_scattering_blend)*transmission_tint;
805
+ #else
806
+ slab_translucent_base_ibl=slab_translucent_background.rgb*volume_absorption*transmission_tint;
807
+ #endif
808
+ #endif
809
+ let material_dielectric_base_ibl: vec3f=mix(black,slab_translucent_base_ibl.rgb,surface_translucency_weight);let material_dielectric_gloss_ibl: vec3f=material_dielectric_base_ibl*(baseGeoInfo.NdotV);let material_base_substrate_ibl: vec3f=mix(material_dielectric_gloss_ibl,black,base_metalness);let material_coated_base_ibl: vec3f=layer(material_base_substrate_ibl,black,coatIblFresnel,coatAbsorption,vec3f(1.0f));material_surface_ibl=material_coated_base_ibl;
810
+ #endif
811
+ `;r.ShaderStore.IncludesShadersStoreWGSL[ep]||(r.ShaderStore.IncludesShadersStoreWGSL[ep]=ev);let eS="openpbrDirectLightingInit",eE=`#ifdef LIGHT{X}
812
+ var preInfo{X}: preLightingInfo;var preInfoCoat{X}: preLightingInfo;let lightColor{X}: vec4f=light{X}.vLightDiffuse;var shadow{X}: f32=1.0f;
813
+ #if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})
814
+ #else
815
+ #define CUSTOM_LIGHT{X}_COLOR
816
+ #ifdef SPOTLIGHT{X}
817
+ preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,fragmentInputs.vPositionW);
818
+ #elif defined(POINTLIGHT{X})
819
+ preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,fragmentInputs.vPositionW);
820
+ #elif defined(HEMILIGHT{X})
821
+ preInfo{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW);
822
+ #elif defined(DIRLIGHT{X})
823
+ preInfo{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW);
824
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
825
+ preInfo{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,fragmentInputs.vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,specular_roughness);preInfoCoat{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,coatNormalW,fragmentInputs.vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,coat_roughness);
826
+ #endif
827
+ preInfo{X}.NdotV=baseGeoInfo.NdotV;preInfoCoat{X}.NdotV=coatGeoInfo.NdotV;
828
+ #ifdef SPOTLIGHT{X}
829
+ #ifdef LIGHT_FALLOFF_GLTF{X}
830
+ preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y);
831
+ #ifdef IESLIGHTTEXTURE{X}
832
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
833
+ #else
834
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);
835
+ #endif
836
+ #elif defined(LIGHT_FALLOFF_PHYSICAL{X})
837
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared);
838
+ #ifdef IESLIGHTTEXTURE{X}
839
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
840
+ #else
841
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w);
842
+ #endif
843
+ #elif defined(LIGHT_FALLOFF_STANDARD{X})
844
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x);
845
+ #ifdef IESLIGHTTEXTURE{X}
846
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
847
+ #else
848
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w);
849
+ #endif
850
+ #else
851
+ preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);
852
+ #ifdef IESLIGHTTEXTURE{X}
853
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
854
+ #else
855
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);
856
+ #endif
857
+ #endif
858
+ #elif defined(POINTLIGHT{X})
859
+ #ifdef LIGHT_FALLOFF_GLTF{X}
860
+ preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y);
861
+ #elif defined(LIGHT_FALLOFF_PHYSICAL{X})
862
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared);
863
+ #elif defined(LIGHT_FALLOFF_STANDARD{X})
864
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x);
865
+ #else
866
+ preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);
867
+ #endif
868
+ #else
869
+ preInfo{X}.attenuation=1.0f;
870
+ #endif
871
+ preInfoCoat{X}.attenuation=preInfo{X}.attenuation;
872
+ #if defined(HEMILIGHT{X})
873
+ preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness;
874
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
875
+ preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness;
876
+ #else
877
+ preInfo{X}.roughness=adjustRoughnessFromLightProperties(specular_roughness,light{X}.vLightSpecular.a,preInfo{X}.lightDistance);preInfoCoat{X}.roughness=adjustRoughnessFromLightProperties(coat_roughness,light{X}.vLightSpecular.a,preInfoCoat{X}.lightDistance);
878
+ #endif
879
+ preInfo{X}.diffuseRoughness=base_diffuse_roughness;preInfo{X}.surfaceAlbedo=base_color.rgb;
880
+ #endif
881
+ #endif
882
+ `;r.ShaderStore.IncludesShadersStoreWGSL[eS]||(r.ShaderStore.IncludesShadersStoreWGSL[eS]=eE);let eh="openpbrDirectLighting",eI=`#ifdef LIGHT{X}
883
+ {var slab_diffuse: vec3f=vec3f(0.f,0.f,0.f);var slab_translucent: vec3f=vec3f(0.f,0.f,0.f);var slab_glossy: vec3f=vec3f(0.f,0.f,0.f);var specularFresnel: f32=0.0f;var specularColoredFresnel: vec3f=vec3f(0.f,0.f,0.f);var slab_metal: vec3f=vec3f(0.f,0.f,0.f);var slab_coat: vec3f=vec3f(0.f,0.f,0.f);var coatFresnel: f32=0.0f;var slab_fuzz: vec3f=vec3f(0.f,0.f,0.f);var fuzzFresnel: f32=0.0f;
884
+ #ifdef HEMILIGHT{X}
885
+ slab_diffuse=computeHemisphericDiffuseLighting(preInfo{X},lightColor{X}.rgb,light{X}.vLightGround);
886
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
887
+ slab_diffuse=computeAreaDiffuseLighting(preInfo{X},lightColor{X}.rgb);
888
+ #else
889
+ slab_diffuse=computeDiffuseLighting(preInfo{X},lightColor{X}.rgb);
890
+ #endif
891
+ #ifdef PROJECTEDLIGHTTEXTURE{X}
892
+ slab_diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},fragmentInputs.vPositionW);
893
+ #endif
894
+ #ifdef FUZZ
895
+ let fuzzNdotH: f32=max(dot(fuzzNormalW,preInfo{X}.H),0.0f);let fuzzBrdf: vec3f=getFuzzBRDFLookup(fuzzNdotH,sqrt(fuzz_roughness));
896
+ #endif
897
+ #ifdef THIN_FILM
898
+ let thin_film_desaturation_scale: f32=(thin_film_ior-1.0f)*sqrt(thin_film_thickness*0.001f);
899
+ #endif
900
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
901
+ slab_glossy=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90);
902
+ #else
903
+ {
904
+ #ifdef ANISOTROPIC_BASE
905
+ slab_glossy=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,
906
+ baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,
907
+ 0.0f,lightColor{X}.rgb);
908
+ #else
909
+ slab_glossy=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),vec3(1.0),specular_roughness,lightColor{X}.rgb);
910
+ #endif
911
+ specularFresnel=fresnelSchlickGGX(preInfo{X}.VdotH,baseDielectricReflectance.F0,baseDielectricReflectance.F90);specularColoredFresnel=specularFresnel*specular_color;
912
+ #ifdef THIN_FILM
913
+ var thinFilmDielectricFresnel: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,vec3f(baseDielectricReflectance.F0));thinFilmDielectricFresnel=mix(thinFilmDielectricFresnel,vec3f(dot(thinFilmDielectricFresnel,vec3f(0.3333f))),thin_film_desaturation_scale);specularColoredFresnel=mix(specularColoredFresnel,thinFilmDielectricFresnel*specular_color,thin_film_weight*thin_film_ior_scale);
914
+ #endif
915
+ }
916
+ #endif
917
+ #ifdef REFRACTED_LIGHTS
918
+ var forwardScatteredLight: vec3f=vec3f(0.0f);
919
+ #if AREALIGHT{X}
920
+ #else
921
+ {var preInfoTrans=preInfo{X};
922
+ #ifdef SCATTERING
923
+ preInfoTrans.roughness=sqrt(sqrt(max(transmission_roughness_alpha,0.05f)));
924
+ #else
925
+ preInfoTrans.roughness=transmission_roughness;
926
+ #endif
927
+ if (preInfoTrans.NdotLUnclamped<=0.0) {specularFresnel=0.0;specularColoredFresnel=specularFresnel*specular_color;}
928
+ #ifdef GEOMETRY_THIN_WALLED
929
+ let refractNormalW: vec3f=viewDirectionW;
930
+ #else
931
+ let refractNormalW: vec3f=normalW;
932
+ #endif
933
+ preInfoTrans.NdotL=0.5f*max(dot(-refractNormalW,preInfoTrans.L),0.0f)+0.5f;
934
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
935
+ var dispersion_iors_local: vec3f=dispersion_iors;let diff: f32=min(dispersion_iors_local[2]-dispersion_iors_local[0],max(dispersion_iors_local[0]-1.0f,1.0f));dispersion_iors_local[2]+=diff;dispersion_iors_local[0]-=diff;for (var i: i32=0; i<3; i++) {let eta: f32=1.0f/dispersion_iors_local[i];
936
+ #elif defined(GEOMETRY_THIN_WALLED)
937
+ let eta: f32=1.0f;
938
+ #else
939
+ let eta: f32=1.0f/specular_ior;
940
+ #endif
941
+ preInfoTrans.H=preInfoTrans.L+min(eta,0.95f)*viewDirectionW;let len2: f32=dot(preInfoTrans.H,preInfoTrans.H);if (len2<1e-6f) {preInfoTrans.H=preInfoTrans.L;} else {preInfoTrans.H=preInfoTrans.H*inverseSqrt(len2);}
942
+ #ifdef ANISOTROPIC_BASE
943
+ preInfoTrans.H=-preInfoTrans.H;
944
+ #endif
945
+ preInfoTrans.VdotH=dot(viewDirectionW,preInfoTrans.H);
946
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
947
+ forwardScatteredLight[i]+=
948
+ #else
949
+ forwardScatteredLight+=
950
+ #endif
951
+ #if defined(ANISOTROPIC_BASE)
952
+ computeAnisotropicSpecularLighting(preInfoTrans,viewDirectionW,refractNormalW,
953
+ baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,
954
+ transmission_roughness_alpha,lightColor{X}.rgb
955
+ #else
956
+ computeSpecularLighting(preInfoTrans,-refractNormalW,vec3f(1.0f),vec3f(1.0f),transmission_roughness_alpha,lightColor{X}.rgb
957
+ #endif
958
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
959
+ )[i];}
960
+ #else
961
+ );
962
+ #endif
963
+ #if !defined(GEOMETRY_THIN_WALLED)
964
+ forwardScatteredLight=mix(forwardScatteredLight,0.25f*preInfoTrans.attenuation*lightColor{X}.rgb,clamp(1.0f-pow(baseGeoInfo.NdotV,transmission_roughness_alpha),0.0f,1.0f));
965
+ #endif
966
+ #ifdef REFRACTED_BACKGROUND
967
+ #ifdef GEOMETRY_THIN_WALLED
968
+ forwardScatteredLight=mix(vec3f(0.0f),forwardScatteredLight.rgb,0.2*transmission_roughness_alpha);
969
+ #else
970
+ forwardScatteredLight=max(vec3f(0.0f),mix(vec3f(0.0f),forwardScatteredLight,transmission_roughness_alpha));
971
+ #endif
972
+ #endif
973
+ #ifdef SCATTERING
974
+ #if !defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER)
975
+ preInfoTrans.roughness=1.0f;let diffused_forward_scattered_light: vec3f=computeSpecularLighting(preInfoTrans,normalW,vec3f(1.0f),vec3f(1.0f),1.0f,lightColor{X}.rgb)*volume_absorption;
976
+ #endif
977
+ #ifdef GEOMETRY_THIN_WALLED
978
+ let forward_scattered_light: vec3f=forwardScatteredLight*transmission_tint*volumeParams.multi_scatter_color;let back_scattered_light: vec3f=slab_diffuse*volumeParams.multi_scatter_color;slab_translucent=mix(back_scattered_light,forward_scattered_light,0.5f+0.5f*volumeParams.anisotropy);
979
+ #else
980
+ let back_scattered_normal: vec3f=normalize(normalW+viewDirectionW);preInfoTrans.NdotL=max(dot(back_scattered_normal,preInfoTrans.L),0.0f);preInfoTrans.NdotV=dot(back_scattered_normal,viewDirectionW);preInfoTrans.H=normalize(viewDirectionW+preInfoTrans.L);preInfoTrans.VdotH=clamp(dot(viewDirectionW,preInfoTrans.H),0.0f,1.0f);preInfoTrans.roughness=0.2f;let back_scattered_light: vec3f=computeSpecularLighting(preInfoTrans,viewDirectionW,vec3f(1.0f),vec3f(0.08f),0.0f,lightColor{X}.rgb);let forward_scattered_light: vec3f=(forwardScatteredLight*volume_absorption);let iso_scattered_light: vec3f=slab_diffuse;let back_scattering: vec3f=mix(forward_scattered_light,forward_scattered_light+back_scattered_light*backscatter_color,iso_scatter_density);
981
+ #if defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) && !defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER)
982
+ let iso_scattering: vec3f=mix(forward_scattered_light,scattered_light_from_irradiance_texture*volumeParams.multi_scatter_color,iso_scatter_density);
983
+ #else
984
+ let iso_scattering: vec3f=mix(forward_scattered_light,(diffused_forward_scattered_light+iso_scattered_light)*volumeParams.multi_scatter_color,iso_scatter_density);
985
+ #endif
986
+ slab_translucent=mix(back_scattering,iso_scattering,back_to_iso_scattering_blend);slab_translucent=mix(slab_translucent,forward_scattered_light,iso_to_forward_scattering_blend)*transmission_tint;
987
+ #endif
988
+ #else
989
+ slab_translucent=forwardScatteredLight*transmission_tint*volume_absorption;
990
+ #endif
991
+ }
992
+ #endif
993
+ #endif
994
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
995
+ slab_metal=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90);
996
+ #else
997
+ {
998
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
999
+ var coloredFresnel: vec3f=getF82Specular(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90,specular_roughness);
1000
+ #else
1001
+ var coloredFresnel: vec3f=fresnelSchlickGGX(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90);
1002
+ #endif
1003
+ #ifdef THIN_FILM
1004
+ let thinFilmConductorAngle: f32=max(preInfo{X}.VdotH,specular_roughness);var thinFilmConductorFresnel: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,thinFilmConductorAngle,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorFresnel=mix(thinFilmConductorFresnel,vec3f(dot(thinFilmConductorFresnel,vec3f(0.3333f))),thin_film_desaturation_scale);coloredFresnel=mix(coloredFresnel,specular_weight*thinFilmConductorFresnel,thin_film_weight*thin_film_ior_scale);
1005
+ #endif
1006
+ #ifdef ANISOTROPIC_BASE
1007
+ slab_metal=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,0.0,lightColor{X}.rgb);
1008
+ #else
1009
+ slab_metal=computeSpecularLighting(preInfo{X},normalW,vec3f(baseConductorReflectance.coloredF0),coloredFresnel,specular_roughness,lightColor{X}.rgb);
1010
+ #endif
1011
+ }
1012
+ #endif
1013
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1014
+ slab_coat=computeAreaSpecularLighting(preInfoCoat{X},light{X}.vLightSpecular.rgb,coatReflectance.F0,coatReflectance.F90);
1015
+ #else
1016
+ {
1017
+ #ifdef ANISOTROPIC_COAT
1018
+ slab_coat=computeAnisotropicSpecularLighting(preInfoCoat{X},viewDirectionW,coatNormalW,
1019
+ coatGeoInfo.anisotropicTangent,coatGeoInfo.anisotropicBitangent,coatGeoInfo.anisotropy,0.0,
1020
+ lightColor{X}.rgb);
1021
+ #else
1022
+ slab_coat=computeSpecularLighting(preInfoCoat{X},coatNormalW,vec3f(coatReflectance.F0),vec3f(1.0f),coat_roughness,lightColor{X}.rgb);
1023
+ #endif
1024
+ let NdotH: f32=saturateEps(dot(coatNormalW,preInfoCoat{X}.H));coatFresnel=fresnelSchlickGGX(NdotH,coatReflectance.F0,coatReflectance.F90);}
1025
+ #endif
1026
+ var coatAbsorption=vec3f(1.0f);if (coat_weight>0.0) {let cosTheta_view: f32=max(preInfoCoat{X}.NdotV,0.001f);let cosTheta_light: f32=max(preInfoCoat{X}.NdotL,0.001f);let fresnel_view: f32=coatReflectance.F0+(1.0f-coatReflectance.F0)*pow(1.0f-cosTheta_view,5.0);let fresnel_light: f32=coatReflectance.F0+(1.0f-coatReflectance.F0)*pow(1.0f-cosTheta_light,5.0);let averageReflectance: f32=(fresnel_view+fresnel_light)*0.5;var darkened_transmission: f32=(1.0f-averageReflectance)/(1.0f+averageReflectance);darkened_transmission=mix(1.0f,darkened_transmission,coat_darkening);var sin2: f32=1.0f-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior)*coat_weight;let cos_t: f32=sqrt(1.0f-sin2);let coatPathLength=1.0f/cos_t;let effectivePathLength=coatPathLength*coat_weight;let colored_transmission: vec3f=pow(coat_color,vec3f(effectivePathLength));coatAbsorption=colored_transmission*mix(1.0f,darkened_transmission,coat_weight);}
1027
+ #ifdef FUZZ
1028
+ fuzzFresnel=fuzzBrdf.z;let fuzzNormalW=mix(normalW,coatNormalW,coat_weight);let fuzzNdotV: f32=max(dot(fuzzNormalW,viewDirectionW.xyz),0.0f);let fuzzNdotL: f32=max(dot(fuzzNormalW,preInfo{X}.L),0.0);slab_fuzz=lightColor{X}.rgb*preInfo{X}.attenuation*evalFuzz(preInfo{X}.L,fuzzNdotL,fuzzNdotV,fuzzTangent,fuzzBitangent,fuzzBrdf);
1029
+ #else
1030
+ let fuzz_color=vec3f(0.0);
1031
+ #endif
1032
+ #ifdef PREPASS_IRRADIANCE
1033
+ total_direct_diffuse+=slab_diffuse;
1034
+ #endif
1035
+ let material_dielectric_base: vec3f=mix(slab_diffuse*base_color.rgb,slab_translucent,surface_translucency_weight);let material_dielectric_gloss: vec3f=material_dielectric_base*(1.0f-specularFresnel)+slab_glossy*specularColoredFresnel;let material_base_substrate: vec3f=mix(material_dielectric_gloss,slab_metal,base_metalness);let material_coated_base: vec3f=layer(material_base_substrate,slab_coat,coatFresnel,coatAbsorption,vec3f(1.0f));material_surface_direct+=layer(material_coated_base,slab_fuzz,fuzzFresnel*fuzz_weight,vec3f(1.0f),fuzz_color);}
1036
+ #endif
1037
+ `;r.ShaderStore.IncludesShadersStoreWGSL[eh]||(r.ShaderStore.IncludesShadersStoreWGSL[eh]=eI);var eR=e.i(23009),eb=e.i(31213),eT=e.i(52640);let eN="openpbrBlockPrePass",eA=`#if SCENE_MRT_COUNT>0
1038
+ var writeGeometryInfo: f32=select(0.0,1.0,finalColor.a>ALPHATESTVALUE);var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
1039
+ #ifdef PREPASS_POSITION
1040
+ fragData[PREPASS_POSITION_INDEX]= vec4f(fragmentInputs.vPositionW,writeGeometryInfo);
1041
+ #endif
1042
+ #ifdef PREPASS_LOCAL_POSITION
1043
+ fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);
1044
+ #endif
1045
+ #ifdef PREPASS_VELOCITY
1046
+ 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);
1047
+ #elif defined(PREPASS_VELOCITY_LINEAR)
1048
+ var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -
1049
+ (fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);
1050
+ #endif
1051
+ #ifdef PREPASS_ALBEDO
1052
+ fragData[PREPASS_ALBEDO_INDEX]=vec4f(surfaceAlbedo,writeGeometryInfo);
1053
+ #endif
1054
+ #ifdef PREPASS_ALBEDO_SQRT
1055
+ var sqAlbedo : vec3f=sqrt(surfaceAlbedo);
1056
+ #endif
1057
+ #ifdef PREPASS_IRRADIANCE
1058
+ var irradiance : vec3f=total_direct_diffuse;
1059
+ #ifndef UNLIT
1060
+ #ifdef REFLECTION
1061
+ irradiance+=slab_diffuse_ibl;
1062
+ #endif
1063
+ #endif
1064
+ #ifdef SCATTERING
1065
+ let scatter_mask: f32=min(subsurface_weight+transmission_weight,1.0);
1066
+ #else
1067
+ let scatter_mask: f32=0.0;
1068
+ #endif
1069
+ fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(irradiance,writeGeometryInfo*scatter_mask);
1070
+ #elif defined(PREPASS_COLOR)
1071
+ fragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb,finalColor.a);
1072
+ #endif
1073
+ #ifdef PREPASS_DEPTH
1074
+ fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo);
1075
+ #endif
1076
+ #ifdef PREPASS_SCREENSPACE_DEPTH
1077
+ fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);
1078
+ #endif
1079
+ #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
1080
+ fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);
1081
+ #endif
1082
+ #ifdef PREPASS_NORMAL
1083
+ #ifdef PREPASS_NORMAL_WORLDSPACE
1084
+ fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);
1085
+ #else
1086
+ fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);
1087
+ #endif
1088
+ #endif
1089
+ #ifdef PREPASS_WORLD_NORMAL
1090
+ fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);
1091
+ #endif
1092
+ #ifdef PREPASS_ALBEDO_SQRT
1093
+ fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqAlbedo,writeGeometryInfo);
1094
+ #endif
1095
+ #ifdef PREPASS_REFLECTIVITY
1096
+ #ifndef UNLIT
1097
+ fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(specularEnvironmentR0,microSurface)*writeGeometryInfo;
1098
+ #else
1099
+ fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(0.0,0.0,0.0,1.0)*writeGeometryInfo;
1100
+ #endif
1101
+ #endif
1102
+ #if SCENE_MRT_COUNT>0
1103
+ fragmentOutputs.fragData0=fragData[0];
1104
+ #endif
1105
+ #if SCENE_MRT_COUNT>1
1106
+ fragmentOutputs.fragData1=fragData[1];
1107
+ #endif
1108
+ #if SCENE_MRT_COUNT>2
1109
+ fragmentOutputs.fragData2=fragData[2];
1110
+ #endif
1111
+ #if SCENE_MRT_COUNT>3
1112
+ fragmentOutputs.fragData3=fragData[3];
1113
+ #endif
1114
+ #if SCENE_MRT_COUNT>4
1115
+ fragmentOutputs.fragData4=fragData[4];
1116
+ #endif
1117
+ #if SCENE_MRT_COUNT>5
1118
+ fragmentOutputs.fragData5=fragData[5];
1119
+ #endif
1120
+ #if SCENE_MRT_COUNT>6
1121
+ fragmentOutputs.fragData6=fragData[6];
1122
+ #endif
1123
+ #if SCENE_MRT_COUNT>7
1124
+ fragmentOutputs.fragData7=fragData[7];
1125
+ #endif
1126
+ #endif
1127
+ `;r.ShaderStore.IncludesShadersStoreWGSL[eN]||(r.ShaderStore.IncludesShadersStoreWGSL[eN]=eA);var eL=e.i(4818),eF=e.i(87693);let eD="openpbrPixelShader",eO=`#define OPENPBR_FRAGMENT_SHADER
1128
+ #define CUSTOM_FRAGMENT_BEGIN
1129
+ #include<prePassDeclaration>[SCENE_MRT_COUNT]
1130
+ #include<oitDeclaration>
1131
+ #ifndef FROMLINEARSPACE
1132
+ #define FROMLINEARSPACE
1133
+ #endif
1134
+ #include<openpbrUboDeclaration>
1135
+ #include<pbrFragmentExtraDeclaration>
1136
+ #include<lightUboDeclaration>[0..maxSimultaneousLights]
1137
+ #include<openpbrFragmentSamplersDeclaration>
1138
+ #include<imageProcessingDeclaration>
1139
+ #include<clipPlaneFragmentDeclaration>
1140
+ #include<logDepthDeclaration>
1141
+ #include<fogFragmentDeclaration>
1142
+ #include<textureRepetitionFunctions>
1143
+ #include<helperFunctions>
1144
+ #include<subSurfaceScatteringFunctions>
1145
+ #include<importanceSampling>
1146
+ #include<pbrHelperFunctions>
1147
+ #include<imageProcessingFunctions>
1148
+ #include<shadowsFragmentFunctions>
1149
+ #include<harmonicsFunctions>
1150
+ #include<pbrDirectLightingSetupFunctions>
1151
+ #include<pbrDirectLightingFalloffFunctions>
1152
+ #include<pbrBRDFFunctions>
1153
+ #include<hdrFilteringFunctions>
1154
+ #include<pbrDirectLightingFunctions>
1155
+ #include<pbrIBLFunctions>
1156
+ #include<openpbrNormalMapFragmentMainFunctions>
1157
+ #include<openpbrNormalMapFragmentFunctions>
1158
+ #ifdef REFLECTION
1159
+ #include<reflectionFunction>
1160
+ #endif
1161
+ #define CUSTOM_FRAGMENT_DEFINITIONS
1162
+ #include<openpbrDielectricReflectance>
1163
+ #include<openpbrConductorReflectance>
1164
+ #include<openpbrAmbientOcclusionFunctions>
1165
+ #include<openpbrGeometryInfo>
1166
+ #include<openpbrIblFunctions>
1167
+ #include<openpbrVolumeFunctions>
1168
+ fn layer(slab_bottom: vec3f,slab_top: vec3f,lerp_factor: f32,bottom_multiplier: vec3f,top_multiplier: vec3f)->vec3f {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);}
1169
+ @fragment
1170
+ fn main(input: FragmentInputs)->FragmentOutputs {
1171
+ #ifdef PREPASS_IRRADIANCE
1172
+ var total_direct_diffuse: vec3f=vec3f(0.0f);
1173
+ #endif
1174
+ #define CUSTOM_FRAGMENT_MAIN_BEGIN
1175
+ #include<clipPlaneFragment>
1176
+ #include<pbrBlockNormalGeometric>
1177
+ var coatNormalW: vec3f=normalW;
1178
+ #include<openpbrNormalMapFragment>
1179
+ #include<openpbrBlockNormalFinal>
1180
+ #include<openpbrBaseLayerData>
1181
+ #include<openpbrTransmissionLayerData>
1182
+ #include<openpbrSubsurfaceLayerData>
1183
+ #include<openpbrCoatLayerData>
1184
+ #include<openpbrThinFilmLayerData>
1185
+ #include<openpbrFuzzLayerData>
1186
+ #include<openpbrAmbientOcclusionData>
1187
+ #define CUSTOM_FRAGMENT_UPDATE_ALPHA
1188
+ #include<depthPrePass>
1189
+ #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
1190
+ #ifdef ANISOTROPIC_COAT
1191
+ let coatGeoInfo: geometryInfoAnisoOutParams=geometryInfoAniso(
1192
+ coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
1193
+ ,vec3f(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN
1194
+ );
1195
+ #else
1196
+ let coatGeoInfo: geometryInfoOutParams=geometryInfo(
1197
+ coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
1198
+ );
1199
+ #endif
1200
+ specular_roughness=mix(specular_roughness,pow(min(1.0f,pow(specular_roughness,4.0f)+2.0f*pow(coat_roughness,4.0f)),0.25f),coat_weight);
1201
+ #ifdef ANISOTROPIC_BASE
1202
+ let baseGeoInfo: geometryInfoAnisoOutParams=geometryInfoAniso(
1203
+ normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
1204
+ ,vec3f(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN
1205
+ );
1206
+ #else
1207
+ let baseGeoInfo: geometryInfoOutParams=geometryInfo(
1208
+ normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
1209
+ );
1210
+ #endif
1211
+ #ifdef FUZZ
1212
+ let fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));var fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);let fuzzBitangent=cross(fuzzNormalW,fuzzTangent);let fuzzGeoInfo: geometryInfoOutParams=geometryInfo(
1213
+ fuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW
1214
+ );
1215
+ #endif
1216
+ let coatReflectance: ReflectanceParams=dielectricReflectance(
1217
+ coat_ior
1218
+ ,1.0f
1219
+ ,vec3f(1.0f)
1220
+ ,coat_weight
1221
+ );
1222
+ #ifdef THIN_FILM
1223
+ let thin_film_outside_ior: f32=mix(1.0f,coat_ior,coat_weight);
1224
+ #endif
1225
+ let baseDielectricReflectance: ReflectanceParams=dielectricReflectance(
1226
+ specular_ior
1227
+ ,mix(1.0f,coat_ior,coat_weight)
1228
+ ,specular_color
1229
+ ,specular_weight
1230
+ );let baseConductorReflectance: ReflectanceParams=conductorReflectance(base_color,specular_color,specular_weight);var volume_absorption: vec3f=vec3f(1.0f);var transmission_tint: vec3f=vec3f(1.0f);var surface_translucency_weight: f32=0.0f;
1231
+ #if defined(REFRACTED_BACKGROUND) || defined(REFRACTED_ENVIRONMENT) || defined(REFRACTED_LIGHTS)
1232
+ #if defined(GEOMETRY_THIN_WALLED)
1233
+ let refractedViewVector: vec3f=-viewDirectionW;
1234
+ #else
1235
+ #ifdef DISPERSION
1236
+ var refractedViewVectors: array<vec3f,3>;let iorDispersionSpread: f32=transmission_dispersion_scale/transmission_dispersion_abbe_number*(specular_ior-1.0f);let dispersion_iors: vec3f=vec3f(specular_ior-iorDispersionSpread,specular_ior,specular_ior+iorDispersionSpread);for (var i: i32=0; i<3; i++) {refractedViewVectors[i]=double_refract(-viewDirectionW,normalW,dispersion_iors[i]); }
1237
+ #else
1238
+ let refractedViewVector: vec3f=double_refract(-viewDirectionW,normalW,specular_ior);
1239
+ #endif
1240
+ #endif
1241
+ #ifdef GEOMETRY_THIN_WALLED
1242
+ var transmission_roughness: f32=specular_roughness;
1243
+ #else
1244
+ var transmission_roughness: f32=specular_roughness*clamp(4.0f*(specular_ior-1.0f),0.001f,1.0f);
1245
+ #endif
1246
+ #if (defined(TRANSMISSION_SLAB) || defined(SUBSURFACE_SLAB))
1247
+ var volumeParams: OpenPBRHomogeneousVolume;{
1248
+ #if defined(TRANSMISSION_SLAB)
1249
+ let transmissionVolumeParams: OpenPBRHomogeneousVolume=computeOpenPBRTransmissionVolume(
1250
+ transmission_color.rgb,
1251
+ transmission_depth,
1252
+ transmission_scatter.rgb,
1253
+ transmission_scatter_anisotropy
1254
+ );
1255
+ #endif
1256
+ #if defined(SUBSURFACE_SLAB)
1257
+ let subsurfaceVolumeParams: OpenPBRHomogeneousVolume=computeOpenPBRSubsurfaceVolume(
1258
+ subsurface_color.rgb,
1259
+ subsurface_radius,
1260
+ subsurface_radius_scale.rgb,
1261
+ subsurface_scatter_anisotropy
1262
+ );
1263
+ #endif
1264
+ #if !defined(TRANSMISSION_SLAB)
1265
+ volumeParams=subsurfaceVolumeParams;surface_translucency_weight=subsurface_weight;
1266
+ #elif !defined(SUBSURFACE_SLAB)
1267
+ volumeParams=transmissionVolumeParams;
1268
+ #ifdef TRANSMISSION_SLAB_VOLUME
1269
+ volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);
1270
+ #endif
1271
+ surface_translucency_weight=transmission_weight;
1272
+ #else
1273
+ let subsurface_fraction_of_dielectric: f32=(1.0f-transmission_weight)*subsurface_weight;let subsurface_and_transmission_fraction_of_dielectric: f32=subsurface_fraction_of_dielectric+transmission_weight;let reciprocal_of_subsurface_and_transmission_fraction_of_dielectric: f32 =
1274
+ 1.0f/maxEps(subsurface_and_transmission_fraction_of_dielectric);let trans_weight: f32=transmission_weight*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;let subsurf_weight: f32=subsurface_fraction_of_dielectric*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;volumeParams.scatter_coeff=transmissionVolumeParams.scatter_coeff*trans_weight+subsurfaceVolumeParams.scatter_coeff*subsurf_weight;volumeParams.absorption_coeff=transmissionVolumeParams.absorption_coeff*trans_weight+subsurfaceVolumeParams.absorption_coeff*subsurf_weight;volumeParams.anisotropy=(transmissionVolumeParams.anisotropy*trans_weight+subsurfaceVolumeParams.anisotropy*subsurf_weight)/maxEps(trans_weight+subsurf_weight);volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=volumeParams.scatter_coeff/maxEpsVec3(volumeParams.extinction_coeff);volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);surface_translucency_weight=subsurface_and_transmission_fraction_of_dielectric;
1275
+ #endif
1276
+ }
1277
+ volume_absorption=exp(-volumeParams.absorption_coeff*geometry_thickness);var backscatter_color: vec3f=vec3f(1.0f);{let reduced_scatter: vec3f=volumeParams.scatter_coeff*vec3f(1.0f-volumeParams.anisotropy);let reduced_albedo: vec3f=reduced_scatter/(volumeParams.absorption_coeff+reduced_scatter);let sqrt_term: vec3f=max(sqrt(vec3f(1.0f)-reduced_albedo),vec3f(0.0001f));backscatter_color=(vec3f(1.0f)-sqrt_term)/(vec3f(1.0f)+sqrt_term);}
1278
+ #elif defined(TRANSMISSION_SLAB)
1279
+ surface_translucency_weight=transmission_weight;
1280
+ #endif
1281
+ #ifdef SCATTERING
1282
+ #ifdef GEOMETRY_THIN_WALLED
1283
+ var iso_scatter_density: vec3f=vec3f(1.0f);
1284
+ #else
1285
+ #ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING
1286
+ let mfp: vec3f=vec3f(100.0f)/volumeParams.extinction_coeff;var scattered_light_from_irradiance_texture: vec3f=sss_convolve(sceneIrradianceSampler,sceneDepthSampler,uniforms.renderTargetSize,mfp,scene.projection,scene.inverseProjection,SSS_SAMPLE_COUNT,noise.xy);var numLights=f32(LIGHTCOUNT);
1287
+ #ifdef REFLECTION
1288
+ numLights+=1.0f;
1289
+ #endif
1290
+ scattered_light_from_irradiance_texture/=vec3f(numLights);
1291
+ #else
1292
+ let scattered_light_from_irradiance_texture: vec3f=vec3f(0.0f);
1293
+ #endif
1294
+ let back_to_iso_scattering_blend: f32=min(1.0f+volumeParams.anisotropy,1.0f);let iso_to_forward_scattering_blend: f32=max(volumeParams.anisotropy,0.0f);let iso_scatter_transmittance: vec3f=pow(exp(-volumeParams.scatter_coeff*geometry_thickness),vec3f(0.2f));var iso_scatter_density: vec3f=clamp(vec3f(1.0f)-iso_scatter_transmittance,vec3f(0.0f),vec3f(1.0f));transmission_roughness=min(transmission_roughness+pow((1.0f-abs(volumeParams.anisotropy))*max3(iso_scatter_density*iso_scatter_density),3.0f),1.0f);
1295
+ #endif
1296
+ volumeParams.multi_scatter_color=mix(volumeParams.ss_albedo,volumeParams.multi_scatter_color,max3(iso_scatter_density));
1297
+ #endif
1298
+ #if defined(TRANSMISSION_SLAB) && (!defined(TRANSMISSION_SLAB_VOLUME) || defined(GEOMETRY_THIN_WALLED))
1299
+ transmission_tint*=transmission_color.rgb;
1300
+ #ifdef GEOMETRY_THIN_WALLED
1301
+ var sin2: f32=1.0f-baseGeoInfo.NdotV*baseGeoInfo.NdotV;sin2=sin2/(specular_ior*specular_ior);let cos_t: f32=sqrt(1.0f-sin2);let pathLength: f32=1.0f/cos_t;transmission_tint=pow(transmission_tint,vec3f(pathLength));
1302
+ #else
1303
+ transmission_tint*=transmission_color.rgb;
1304
+ #endif
1305
+ #endif
1306
+ #if defined(SUBSURFACE_SLAB) && defined(GEOMETRY_THIN_WALLED)
1307
+ let unweighted_translucency: f32=max(mix(subsurface_weight,1.0f,transmission_weight),0.0001f);transmission_tint=mix(vec3f(1.0f),transmission_tint,transmission_weight/unweighted_translucency);transmission_roughness=mix(1.0f,transmission_roughness,transmission_weight/unweighted_translucency);
1308
+ #endif
1309
+ let transmission_roughness_alpha: f32=transmission_roughness*transmission_roughness;
1310
+ #endif
1311
+ #include<openpbrBackgroundTransmission>
1312
+ var material_surface_ibl: vec3f=vec3f(0.f,0.f,0.f);
1313
+ #include<openpbrEnvironmentLighting>
1314
+ var material_surface_direct: vec3f=vec3f(0.f,0.f,0.f);
1315
+ #if defined(LIGHT0)
1316
+ var aggShadow: f32=0.f;
1317
+ #include<openpbrDirectLightingInit>[0..maxSimultaneousLights]
1318
+ #include<openpbrDirectLighting>[0..maxSimultaneousLights]
1319
+ #endif
1320
+ var material_surface_emission: vec3f=uniforms.vEmissionColor;
1321
+ #ifdef EMISSION_COLOR
1322
+ let emissionColorTex: vec3f=textureSample(emissionColorSampler,emissionColorSamplerSampler,fragmentInputs.vEmissionColorUV+uvOffset).rgb;
1323
+ #ifdef EMISSION_COLOR_GAMMA
1324
+ material_surface_emission*=toLinearSpaceVec3(emissionColorTex.rgb);
1325
+ #else
1326
+ material_surface_emission*=emissionColorTex.rgb;
1327
+ #endif
1328
+ material_surface_emission*= uniforms.vEmissionColorInfos.y;
1329
+ #endif
1330
+ material_surface_emission*=uniforms.vLightingIntensity.y;
1331
+ #define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION
1332
+ var finalColor: vec4f=vec4f(material_surface_ibl+material_surface_direct+material_surface_emission,alpha);
1333
+ #define CUSTOM_FRAGMENT_BEFORE_FOG
1334
+ finalColor=max(finalColor,vec4f(0.0));
1335
+ #include<logDepthFragment>
1336
+ #include<fogFragment>(color,finalColor)
1337
+ #include<pbrBlockImageProcessing>
1338
+ #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
1339
+ #ifdef PREPASS
1340
+ #include<openpbrBlockPrePass>
1341
+ #endif
1342
+ #if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
1343
+ fragmentOutputs.color=finalColor;
1344
+ #endif
1345
+ #include<oitFragment>
1346
+ #if ORDER_INDEPENDENT_TRANSPARENCY
1347
+ 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;}
1348
+ #endif
1349
+ #include<pbrDebug>
1350
+ #define CUSTOM_FRAGMENT_MAIN_END
1351
+ }
1352
+ `;for(let e of(r.ShaderStore.ShadersStoreWGSL[eD]||(r.ShaderStore.ShadersStoreWGSL[eD]=eO),[t.prePassDeclarationWGSL,a.oitDeclarationWGSL,i.sceneUboDeclarationWGSL,o.meshUboDeclarationWGSL,n.openpbrUboDeclarationWGSL,f.mainUVVaryingDeclarationWGSL,s.pbrFragmentExtraDeclarationWGSL,l.lightUboDeclarationWGSL,c.samplerFragmentDeclarationWGSL,_.pbrFragmentReflectionDeclarationWGSL,{name:m,shader:d},u.imageProcessingDeclarationWGSL,g.clipPlaneFragmentDeclarationWGSL,p.logDepthDeclarationWGSL,v.fogFragmentDeclarationWGSL,S.textureRepetitionFunctionsWGSL,E.helperFunctionsWGSL,h.subSurfaceScatteringFunctionsWGSL,I.importanceSamplingWGSL,R.pbrHelperFunctionsWGSL,b.imageProcessingFunctionsWGSL,T.shadowsFragmentFunctionsWGSL,N.harmonicsFunctionsWGSL,A.ltcHelperFunctionsWGSL,L.pbrDirectLightingSetupFunctionsWGSL,F.pbrDirectLightingFalloffFunctionsWGSL,D.pbrBRDFFunctionsWGSL,O.hdrFilteringFunctionsWGSL,C.clusteredLightingFunctionsWGSL,P.pbrBlockReflectance0WGSL,G.pbrDirectLightingFunctionsWGSL,x.pbrIBLFunctionsWGSL,{name:M,shader:y},{name:W,shader:z},w.reflectionFunctionWGSL,U.openpbrDielectricReflectanceWGSL,{name:X,shader:H},{name:V,shader:B},k.openpbrGeometryInfoWGSL,Y.openpbrIblFunctionsWGSL,{name:Z,shader:j},q.clipPlaneFragmentWGSL,K.pbrBlockNormalGeometricWGSL,{name:Q,shader:J},{name:$,shader:ee},{name:er,shader:et},ea.openpbrTransmissionLayerDataWGSL,ei.openpbrSubsurfaceLayerDataWGSL,{name:eo,shader:en},{name:ef,shader:es},{name:el,shader:ec},{name:e_,shader:em},ed.depthPrePassWGSL,{name:eu,shader:eg},{name:ep,shader:ev},{name:eS,shader:eE},{name:eh,shader:eI},eR.logDepthFragmentWGSL,eb.fogFragmentWGSL,eT.pbrBlockImageProcessingWGSL,{name:eN,shader:eA},eL.oitFragmentWGSL,eF.pbrDebugWGSL]))r.ShaderStore.IncludesShadersStoreWGSL[e.name]||(r.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);e.s(["openpbrPixelShaderWGSL",0,{name:eD,shader:eO}],84673)}]);