@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,1501 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1013,e=>{"use strict";var i=e.i(12423),o=e.i(55587),r=e.i(52195),t=e.i(28189),a=e.i(1935);let n="openpbrFragmentDeclaration",s=`uniform float vBaseWeight;uniform vec4 vBaseColor;uniform float vBaseDiffuseRoughness;uniform vec4 vReflectanceInfo;uniform vec4 vSpecularColor;uniform vec3 vSpecularAnisotropy;uniform float vTransmissionWeight;uniform vec3 vTransmissionColor;uniform float vTransmissionDepth;uniform vec3 vTransmissionScatter;uniform float vTransmissionScatterAnisotropy;uniform float vTransmissionDispersionScale;uniform float vTransmissionDispersionAbbeNumber;uniform float vSubsurfaceWeight;uniform vec3 vSubsurfaceColor;uniform float vSubsurfaceRadius;uniform vec3 vSubsurfaceRadiusScale;uniform float vSubsurfaceScatterAnisotropy;uniform float vCoatWeight;uniform vec3 vCoatColor;uniform float vCoatRoughness;uniform float vCoatRoughnessAnisotropy;uniform float vCoatIor;uniform float vCoatDarkening;uniform float vFuzzWeight;uniform vec3 vFuzzColor;uniform float vFuzzRoughness;uniform vec2 vGeometryCoatTangent;uniform float vGeometryThickness;uniform vec3 vEmissionColor;uniform float vThinFilmWeight;uniform vec2 vThinFilmThickness;uniform float vThinFilmIor;uniform float vGeometryThinWalled;uniform vec4 vLightingIntensity;uniform float visibility;uniform vec2 renderTargetSize;
2
+ #ifdef BASE_COLOR
3
+ uniform vec2 vBaseColorInfos;
4
+ #endif
5
+ #ifdef BASE_WEIGHT
6
+ uniform vec2 vBaseWeightInfos;
7
+ #endif
8
+ #ifdef BASE_METALNESS
9
+ uniform vec2 vBaseMetalnessInfos;
10
+ #endif
11
+ #ifdef BASE_DIFFUSE_ROUGHNESS
12
+ uniform vec2 vBaseDiffuseRoughnessInfos;
13
+ #endif
14
+ #ifdef SPECULAR_WEIGHT
15
+ uniform vec2 vSpecularWeightInfos;
16
+ #endif
17
+ #ifdef SPECULAR_COLOR
18
+ uniform vec2 vSpecularColorInfos;
19
+ #endif
20
+ #ifdef SPECULAR_ROUGHNESS
21
+ uniform vec2 vSpecularRoughnessInfos;
22
+ #endif
23
+ #ifdef SPECULAR_ROUGHNESS_ANISOTROPY
24
+ uniform vec2 vSpecularRoughnessAnisotropyInfos;
25
+ #endif
26
+ #ifdef SPECULAR_IOR
27
+ uniform vec2 vSpecularIorInfos;
28
+ #endif
29
+ #ifdef AMBIENT_OCCLUSION
30
+ uniform vec2 vAmbientOcclusionInfos;
31
+ #endif
32
+ #ifdef GEOMETRY_NORMAL
33
+ uniform vec2 vGeometryNormalInfos;
34
+ #endif
35
+ #ifdef GEOMETRY_TANGENT
36
+ uniform vec2 vGeometryTangentInfos;
37
+ #endif
38
+ #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)
39
+ uniform vec2 vTangentSpaceParams;
40
+ #endif
41
+ #ifdef GEOMETRY_COAT_NORMAL
42
+ uniform vec2 vGeometryCoatNormalInfos;
43
+ #endif
44
+ #ifdef GEOMETRY_OPACITY
45
+ uniform vec2 vGeometryOpacityInfos;
46
+ #endif
47
+ #ifdef GEOMETRY_THICKNESS
48
+ uniform vec2 vGeometryThicknessInfos;
49
+ #endif
50
+ #ifdef EMISSION_COLOR
51
+ uniform vec2 vEmissionColorInfos;
52
+ #endif
53
+ #ifdef TRANSMISSION_WEIGHT
54
+ uniform vec2 vTransmissionWeightInfos;
55
+ #endif
56
+ #ifdef TRANSMISSION_COLOR
57
+ uniform vec2 vTransmissionColorInfos;
58
+ #endif
59
+ #ifdef TRANSMISSION_DEPTH
60
+ uniform vec2 vTransmissionDepthInfos;
61
+ #endif
62
+ #ifdef TRANSMISSION_SCATTER
63
+ uniform vec2 vTransmissionScatterInfos;
64
+ #endif
65
+ #ifdef TRANSMISSION_DISPERSION_SCALE
66
+ uniform vec2 vTransmissionDispersionScaleInfos;
67
+ #endif
68
+ #ifdef SUBSURFACE_WEIGHT
69
+ uniform vec2 vSubsurfaceWeightInfos;
70
+ #endif
71
+ #ifdef SUBSURFACE_COLOR
72
+ uniform vec2 vSubsurfaceColorInfos;
73
+ #endif
74
+ #ifdef SUBSURFACE_RADIUS_SCALE
75
+ uniform vec2 vSubsurfaceRadiusScaleInfos;
76
+ #endif
77
+ #ifdef COAT_WEIGHT
78
+ uniform vec2 vCoatWeightInfos;
79
+ #endif
80
+ #ifdef COAT_COLOR
81
+ uniform vec2 vCoatColorInfos;
82
+ #endif
83
+ #ifdef COAT_ROUGHNESS
84
+ uniform vec2 vCoatRoughnessInfos;
85
+ #endif
86
+ #ifdef COAT_ROUGHNESS_ANISOTROPY
87
+ uniform vec2 vCoatRoughnessAnisotropyInfos;
88
+ #endif
89
+ #ifdef COAT_IOR
90
+ uniform vec2 vCoatIorInfos;
91
+ #endif
92
+ #ifdef COAT_DARKENING
93
+ uniform vec2 vCoatDarkeningInfos;
94
+ #endif
95
+ #ifdef FUZZ_WEIGHT
96
+ uniform vec2 vFuzzWeightInfos;
97
+ #endif
98
+ #ifdef FUZZ_COLOR
99
+ uniform vec2 vFuzzColorInfos;
100
+ #endif
101
+ #ifdef FUZZ_ROUGHNESS
102
+ uniform vec2 vFuzzRoughnessInfos;
103
+ #endif
104
+ #ifdef GEOMETRY_COAT_TANGENT
105
+ uniform vec2 vGeometryCoatTangentInfos;
106
+ #endif
107
+ #ifdef THIN_FILM_WEIGHT
108
+ uniform vec2 vThinFilmWeightInfos;
109
+ #endif
110
+ #ifdef THIN_FILM_THICKNESS
111
+ uniform vec2 vThinFilmThicknessInfos;
112
+ #endif
113
+ #include<sceneFragmentDeclaration>
114
+ #ifdef REFLECTION
115
+ uniform vec2 vReflectionInfos;
116
+ #ifdef REALTIME_FILTERING
117
+ uniform vec2 vReflectionFilteringInfo;
118
+ #endif
119
+ uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;
120
+ #if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION)
121
+ uniform vec3 vReflectionDominantDirection;
122
+ #endif
123
+ #if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
124
+ uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
125
+ #endif
126
+ #endif
127
+ #ifdef PREPASS
128
+ #ifdef SS_SCATTERING
129
+ uniform float scatteringDiffusionProfile;
130
+ #endif
131
+ #endif
132
+ #if DEBUGMODE>0
133
+ uniform vec2 vDebugMode;
134
+ #endif
135
+ #ifdef DETAIL
136
+ uniform vec4 vDetailInfos;
137
+ #endif
138
+ #include<decalFragmentDeclaration>
139
+ #ifdef USESPHERICALFROMREFLECTIONMAP
140
+ #ifdef SPHERICAL_HARMONICS
141
+ uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;
142
+ #else
143
+ uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;
144
+ #endif
145
+ #endif
146
+ #ifdef REFRACTED_BACKGROUND
147
+ uniform mat4 backgroundRefractionMatrix;uniform vec3 vBackgroundRefractionInfos;
148
+ #endif
149
+ #if TEXTURE_REPETITION_MODE>0
150
+ uniform vec4 vTextureRepetitionHexTilingParams;
151
+ #endif
152
+ #define ADDITIONAL_FRAGMENT_DECLARATION
153
+ `;i.ShaderStore.IncludesShadersStore[n]||(i.ShaderStore.IncludesShadersStore[n]=s);var l=e.i(85668),c=e.i(6232),f=e.i(14469),_=e.i(92692),d=e.i(84449),m=e.i(2097),u=e.i(98351),g=e.i(80825),v=e.i(66437);let E="openpbrFragmentSamplersDeclaration",p=`#include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor)
154
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)
155
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)
156
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness)
157
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight)
158
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor)
159
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness)
160
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy)
161
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_WEIGHT,_VARYINGNAME_,TransmissionWeight,_SAMPLERNAME_,transmissionWeight)
162
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_COLOR,_VARYINGNAME_,TransmissionColor,_SAMPLERNAME_,transmissionColor)
163
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_DEPTH,_VARYINGNAME_,TransmissionDepth,_SAMPLERNAME_,transmissionDepth)
164
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_SCATTER,_VARYINGNAME_,TransmissionScatter,_SAMPLERNAME_,transmissionScatter)
165
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,TRANSMISSION_DISPERSION_SCALE,_VARYINGNAME_,TransmissionDispersionScale,_SAMPLERNAME_,transmissionDispersionScale)
166
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_WEIGHT,_VARYINGNAME_,SubsurfaceWeight,_SAMPLERNAME_,subsurfaceWeight)
167
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_COLOR,_VARYINGNAME_,SubsurfaceColor,_SAMPLERNAME_,subsurfaceColor)
168
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,SUBSURFACE_RADIUS_SCALE,_VARYINGNAME_,SubsurfaceRadiusScale,_SAMPLERNAME_,subsurfaceRadiusScale)
169
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight)
170
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor)
171
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness)
172
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy)
173
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening)
174
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight)
175
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor)
176
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness)
177
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity)
178
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent)
179
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent)
180
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_THICKNESS,_VARYINGNAME_,GeometryThickness,_SAMPLERNAME_,geometryThickness)
181
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor)
182
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight)
183
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness)
184
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion)
185
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
186
+ #include<pbrFragmentReflectionDeclaration>
187
+ #ifdef ENVIRONMENTBRDF
188
+ uniform sampler2D environmentBrdfSampler;
189
+ #endif
190
+ #ifdef FUZZENVIRONMENTBRDF
191
+ uniform sampler2D environmentFuzzBrdfSampler;
192
+ #endif
193
+ #ifdef REFRACTED_BACKGROUND
194
+ uniform sampler2D backgroundRefractionSampler;
195
+ #endif
196
+ #ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING
197
+ uniform sampler2D sceneIrradianceSampler;uniform sampler2D sceneDepthSampler;
198
+ #endif
199
+ #if defined(ANISOTROPIC) || defined(FUZZ) || defined(REFRACTED_BACKGROUND) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)
200
+ uniform sampler2D blueNoiseSampler;
201
+ #endif
202
+ #ifdef IBL_CDF_FILTERING
203
+ uniform sampler2D icdfSampler;
204
+ #endif
205
+ `;i.ShaderStore.IncludesShadersStore[E]||(i.ShaderStore.IncludesShadersStore[E]=p);var h=e.i(53843),S=e.i(29981),R=e.i(97226),I=e.i(56770),T=e.i(71209),A=e.i(65296),N=e.i(60070),b=e.i(43249),F=e.i(69100),L=e.i(54994),O=e.i(40234),C=e.i(50438),D=e.i(41932),P=e.i(98333),M=e.i(74239),G=e.i(60990),x=e.i(3921),y=e.i(56072),z=e.i(93263);let U="openpbrNormalMapFragmentMainFunctions",W=`#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL)
206
+ #if defined(TANGENT) && defined(NORMAL)
207
+ varying mat3 vTBN;
208
+ #endif
209
+ #ifdef OBJECTSPACE_NORMALMAP
210
+ uniform mat4 normalMatrix;
211
+ #if defined(WEBGL2) || defined(WEBGPU)
212
+ mat4 toNormalMatrix(mat4 wMatrix)
213
+ {mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;}
214
+ #else
215
+ mat4 toNormalMatrix(mat4 m)
216
+ {float
217
+ a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],
218
+ a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],
219
+ a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],
220
+ a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],
221
+ b00=a00*a11-a01*a10,
222
+ b01=a00*a12-a02*a10,
223
+ b02=a00*a13-a03*a10,
224
+ b03=a01*a12-a02*a11,
225
+ b04=a01*a13-a03*a11,
226
+ b05=a02*a13-a03*a12,
227
+ b06=a20*a31-a21*a30,
228
+ b07=a20*a32-a22*a30,
229
+ b08=a20*a33-a23*a30,
230
+ b09=a21*a32-a22*a31,
231
+ b10=a21*a33-a23*a31,
232
+ b11=a22*a33-a23*a32,
233
+ det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4(
234
+ a11*b11-a12*b10+a13*b09,
235
+ a02*b10-a01*b11-a03*b09,
236
+ a31*b05-a32*b04+a33*b03,
237
+ a22*b04-a21*b05-a23*b03,
238
+ a12*b08-a10*b11-a13*b07,
239
+ a00*b11-a02*b08+a03*b07,
240
+ a32*b02-a30*b05-a33*b01,
241
+ a20*b05-a22*b02+a23*b01,
242
+ a10*b10-a11*b08+a13*b06,
243
+ a01*b08-a00*b10-a03*b06,
244
+ a30*b04-a31*b02+a33*b00,
245
+ a21*b02-a20*b04-a23*b00,
246
+ a11*b07-a10*b09-a12*b06,
247
+ a00*b09-a01*b07+a02*b06,
248
+ a31*b01-a30*b03-a32*b00,
249
+ a20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],
250
+ mi[0][1],mi[1][1],mi[2][1],mi[3][1],
251
+ mi[0][2],mi[1][2],mi[2][2],mi[3][2],
252
+ mi[0][3],mi[1][3],mi[2][3],mi[3][3]);}
253
+ #endif
254
+ #endif
255
+ vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)
256
+ {
257
+ #ifdef NORMALXYSCALE
258
+ normal=normalize(normal*vec3(scale,scale,1.0));
259
+ #endif
260
+ return normalize(cotangentFrame*normal);}
261
+ vec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)
262
+ {return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}
263
+ mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)
264
+ {vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);}
265
+ #endif
266
+ `;i.ShaderStore.IncludesShadersStore[U]||(i.ShaderStore.IncludesShadersStore[U]=W);let X="openpbrNormalMapFragmentFunctions",w=`#if defined(GEOMETRY_NORMAL)
267
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal)
268
+ #endif
269
+ #if defined(GEOMETRY_COAT_NORMAL)
270
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal)
271
+ #endif
272
+ #if defined(DETAIL)
273
+ #include<samplerFragmentDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)
274
+ #endif
275
+ #if defined(GEOMETRY_NORMAL) && defined(PARALLAX)
276
+ const float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; i<iMaxSamples; i++)
277
+ {currSampledHeight=texture2D(geometryNormalSampler,texCoord+vCurrOffset).w;if (!keepWorking)
278
+ {}
279
+ else if (currSampledHeight>currRayHeight)
280
+ {float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}
281
+ else
282
+ {currRayHeight-=stepSize;vLastOffset=vCurrOffset;
283
+ #ifdef PARALLAX_RHS
284
+ vCurrOffset-=stepSize*vMaxOffset;
285
+ #else
286
+ vCurrOffset+=stepSize*vMaxOffset;
287
+ #endif
288
+ lastSampledHeight=currSampledHeight;}}
289
+ return vCurrOffset;}
290
+ vec2 parallaxOffset(vec3 viewDir,float heightScale)
291
+ {float height=texture2D(geometryNormalSampler,vGeometryNormalUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height;
292
+ #ifdef PARALLAX_RHS
293
+ return texCoordOffset;
294
+ #else
295
+ return -texCoordOffset;
296
+ #endif
297
+ }
298
+ #endif
299
+ `;i.ShaderStore.IncludesShadersStore[X]||(i.ShaderStore.IncludesShadersStore[X]=w);var H=e.i(9275),B=e.i(74545);let V="openpbrConductorReflectance",k=`#define pbr_inline
300
+ ReflectanceParams conductorReflectance(in vec3 baseColor,in vec3 specularColor,in float specularWeight)
301
+ {ReflectanceParams outParams;
302
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
303
+ outParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight;
304
+ #else
305
+ outParams.coloredF0=baseColor;outParams.coloredF90=vec3(1.0);
306
+ #endif
307
+ outParams.F0=1.0;outParams.F90=1.0;return outParams;}`;i.ShaderStore.IncludesShadersStore[V]||(i.ShaderStore.IncludesShadersStore[V]=k);let Y="openpbrAmbientOcclusionFunctions",Z=`float compute_specular_occlusion(const float n_dot_v,const float metallic,const float ambient_occlusion,const float roughness)
308
+ {float specular_occlusion=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));}
309
+ `;i.ShaderStore.IncludesShadersStore[Y]||(i.ShaderStore.IncludesShadersStore[Y]=Z);var j=e.i(22633),q=e.i(50898);let K="openpbrVolumeFunctions",Q=`struct OpenPBRHomogeneousVolume {vec3 extinction_coeff;
310
+ vec3 ss_albedo;
311
+ vec3 multi_scatter_color;
312
+ vec3 absorption_coeff;
313
+ vec3 scatter_coeff;
314
+ float anisotropy; };OpenPBRHomogeneousVolume computeOpenPBRTransmissionVolume(
315
+ in vec3 transmission_color,
316
+ in float transmission_depth,
317
+ in vec3 transmission_scatter,
318
+ in float anisotropy
319
+ )
320
+ {OpenPBRHomogeneousVolume volumeParams;volumeParams.absorption_coeff=vec3(0.0);volumeParams.scatter_coeff=vec3(0.0);volumeParams.anisotropy=anisotropy;
321
+ #ifdef GEOMETRY_THIN_WALLED
322
+ volumeParams.scatter_coeff=vec3(1.0);volumeParams.anisotropy=1.0;
323
+ volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;volumeParams.ss_albedo=vec3(1.0);
324
+ #else
325
+ if (transmission_depth>0.0) {vec3 invDepth=vec3(1./maxEps(transmission_depth));volumeParams.extinction_coeff=-log(maxEps(transmission_color.rgb))*invDepth;volumeParams.scatter_coeff=transmission_scatter.rgb*invDepth;volumeParams.absorption_coeff=volumeParams.extinction_coeff-volumeParams.scatter_coeff.rgb;float minCoeff=min3(volumeParams.absorption_coeff);if (minCoeff<0.0) {volumeParams.absorption_coeff-=vec3(minCoeff);}
326
+ 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=vec3(0.0);}
327
+ #endif
328
+ return volumeParams;}
329
+ OpenPBRHomogeneousVolume computeOpenPBRSubsurfaceVolume(
330
+ in vec3 subsurface_color,
331
+ in float subsurface_radius,
332
+ in vec3 subsurface_radius_scale,
333
+ in float anisotropy
334
+ )
335
+ {OpenPBRHomogeneousVolume volumeParams;volumeParams.absorption_coeff=vec3(0.0);volumeParams.scatter_coeff=vec3(0.0);volumeParams.anisotropy=anisotropy;volumeParams.multi_scatter_color=subsurface_color;vec3 mfp=subsurface_radius_scale*vec3(subsurface_radius);volumeParams.extinction_coeff=vec3(1.0)/maxEps(mfp);volumeParams.ss_albedo=multiScatterToSingleScatterAlbedo(subsurface_color,anisotropy);volumeParams.scatter_coeff=volumeParams.ss_albedo*volumeParams.extinction_coeff;volumeParams.absorption_coeff=volumeParams.extinction_coeff-volumeParams.scatter_coeff.rgb;float minCoeff=min3(volumeParams.absorption_coeff);if (minCoeff<0.0) {volumeParams.absorption_coeff-=vec3(minCoeff);}
336
+ volumeParams.extinction_coeff=volumeParams.absorption_coeff+volumeParams.scatter_coeff;return volumeParams;}
337
+ vec3 sss_pdf(float r,vec3 d)
338
+ {d=max(vec3(1e-4f),d);return (exp(-r/d)+exp(-r/(3.0f*d)))/max(vec3(1e-5f),8.0f*PI*d*r);}
339
+ float sss_samples_pdf(float r,float d)
340
+ {d=max(1e-4f,d);return exp(-r/(3.0f*d))/(6.0f*PI*d*r);}
341
+ float sss_samples_icdf(float x,float d)
342
+ {d=max(1e-4f,d);x=max(1e-4f,x);return -3.0f*log(x)*d;}
343
+ float samples_scale(float x,float d)
344
+ {return 1.0f-exp(-x/(3.0f*d));}
345
+ vec3 sss_get_position(sampler2D depth_texture,vec2 tex_coord,vec2 render_resolution,mat4 inv_proj)
346
+ {vec4 P=vec4(tex_coord,texelFetch(depth_texture,ivec2(tex_coord*render_resolution),0).x,1.0f);P.xy=2.0f*P.xy-1.0f;P=inv_proj*P;return P.xyz/P.w;}
347
+ float sss_filter_scale(float currZ,mat4 proj)
348
+ {return 1.0f/dot(vec2(proj[2].w,proj[3].w),vec2(currZ,1.0f));}
349
+ float projective_to_pixels(float proj_dist,mat4 proj,vec2 resolution)
350
+ {return proj_dist*proj[1][1]*resolution.y;}
351
+ float pixels_to_projective(float pixel_dist,mat4 proj,vec2 resolution)
352
+ {return pixel_dist/(proj[1][1]*resolution.y);}
353
+ vec3 sss_convolve(sampler2D sss_irradiance_texture,sampler2D depth_texture,vec2 render_resolution,vec3 d,mat4 proj,mat4 inv_proj,int sample_count,vec2 noise)
354
+ {vec2 tex_coord=gl_FragCoord.xy/render_resolution;vec3 unconvolved_irradiance=texelFetch(sss_irradiance_texture,ivec2(gl_FragCoord.xy),0).rgb;vec3 curr_pos=sss_get_position(depth_texture,tex_coord,render_resolution,inv_proj);float dmax=max3(d);float max_dmax=0.1*float(sample_count);if (dmax>max_dmax)
355
+ {d.rgb*=max_dmax/dmax;dmax=max_dmax;}
356
+ float dz=dmax*sss_filter_scale(curr_pos.z,proj);mat2 projMat2d=mat2(proj);if (determinant(projMat2d)*dz<1e-4f)
357
+ return unconvolved_irradiance;float overscan_size_in_pixels=max(render_resolution.x,render_resolution.y)*0.1;const float filter_crop_ratio=0.8f;
358
+ float crop_radius=projective_to_pixels(sss_samples_icdf(1.0f-filter_crop_ratio,dz),proj,render_resolution);if (crop_radius>overscan_size_in_pixels)
359
+ {d.rgb*=overscan_size_in_pixels/crop_radius;dz*=overscan_size_in_pixels/crop_radius;}
360
+ float filter_samples_scale=samples_scale(pixels_to_projective(overscan_size_in_pixels,proj,render_resolution),dz);vec3 irradiance_sum=vec3(0.0f);vec3 weight_sum=vec3(0.0f);for (int i=0; i<sample_count; i++)
361
+ {vec2 r=fract(plasticSequence(uint(i))+noise);r.x*=TWO_PI;r.y*=filter_samples_scale;float icdf=sss_samples_icdf(1.0-r.y,dz);vec2 sample_uv=tex_coord+icdf*projMat2d*vec2(cos(r.x),sin(r.x));vec4 sss_irradiance=texelFetch(sss_irradiance_texture,ivec2(sample_uv*render_resolution),0);float dist=distance(curr_pos,sss_get_position(depth_texture,sample_uv,render_resolution,inv_proj));if (dist>0.0f)
362
+ {vec3 weights=sss_irradiance.a/sss_samples_pdf(icdf,dz)*sss_pdf(dist,d.rgb);irradiance_sum+=weights*sss_irradiance.rgb;weight_sum+=weights;}}
363
+ return vec3(weight_sum.r<1e-5f ? unconvolved_irradiance.r : irradiance_sum.r/weight_sum.r,
364
+ weight_sum.g<1e-5f ? unconvolved_irradiance.g : irradiance_sum.g/weight_sum.g,
365
+ weight_sum.b<1e-5f ? unconvolved_irradiance.b : irradiance_sum.b/weight_sum.b);}`;i.ShaderStore.IncludesShadersStore[K]||(i.ShaderStore.IncludesShadersStore[K]=Q);var J=e.i(69838),$=e.i(26873);let ee="openpbrNormalMapFragment",ei=`vec2 uvOffset=vec2(0.0,0.0);
366
+ #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL)
367
+ #ifdef NORMALXYSCALE
368
+ float normalScale=1.0;
369
+ #elif defined(GEOMETRY_NORMAL)
370
+ float normalScale=vGeometryNormalInfos.y;
371
+ #else
372
+ float normalScale=1.0;
373
+ #endif
374
+ #if defined(TANGENT) && defined(NORMAL)
375
+ mat3 TBN=vTBN;
376
+ #elif defined(GEOMETRY_NORMAL)
377
+ vec2 TBNUV=gl_FrontFacing ? vGeometryNormalUV : -vGeometryNormalUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);
378
+ #elif defined(GEOMETRY_COAT_NORMAL)
379
+ vec2 TBNUV=gl_FrontFacing ? vGeometryCoatNormalUV : -vGeometryCoatNormalUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);
380
+ #else
381
+ vec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));
382
+ #endif
383
+ #elif defined(ANISOTROPIC) || defined(FUZZ)
384
+ #if defined(TANGENT) && defined(NORMAL)
385
+ mat3 TBN=vTBN;
386
+ #else
387
+ vec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));
388
+ #endif
389
+ #endif
390
+ #ifdef PARALLAX
391
+ mat3 invTBN=transposeMat3(TBN);
392
+ #ifdef PARALLAXOCCLUSION
393
+ #else
394
+ #endif
395
+ #endif
396
+ #ifdef DETAIL
397
+ vec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB);
398
+ #endif
399
+ #ifdef GEOMETRY_COAT_NORMAL
400
+ coatNormalW=perturbNormal(TBN,TEXRD(geometryCoatNormalSampler,vGeometryCoatNormalUV+uvOffset).xyz,vGeometryCoatNormalInfos.y);
401
+ #endif
402
+ #ifdef GEOMETRY_NORMAL
403
+ #ifdef OBJECTSPACE_NORMALMAP
404
+ #define CUSTOM_FRAGMENT_BUMP_FRAGMENT
405
+ normalW=normalize(TEXRD(geometryNormalSampler,vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW);
406
+ #elif !defined(DETAIL)
407
+ normalW=perturbNormal(TBN,TEXRD(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz,vGeometryNormalInfos.y);
408
+ #else
409
+ vec3 sampledNormal=TEXRD(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz*2.0-1.0;
410
+ #if DETAIL_NORMALBLENDMETHOD==0
411
+ detailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z));
412
+ #elif DETAIL_NORMALBLENDMETHOD==1
413
+ detailNormal.xy*=vDetailInfos.z;sampledNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal;
414
+ #endif
415
+ normalW=perturbNormalBase(TBN,blendedNormal,vGeometryNormalInfos.y);
416
+ #endif
417
+ #elif defined(DETAIL)
418
+ detailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);
419
+ #endif
420
+ `;i.ShaderStore.IncludesShadersStore[ee]||(i.ShaderStore.IncludesShadersStore[ee]=ei);let eo="openpbrBlockNormalFinal",er=`#if defined(FORCENORMALFORWARD) && defined(NORMAL)
421
+ vec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
422
+ #if defined(TWOSIDEDLIGHTING)
423
+ faceNormal=gl_FrontFacing ? faceNormal : -faceNormal;
424
+ #endif
425
+ normalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal));
426
+ #endif
427
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
428
+ #if defined(MIRRORED)
429
+ normalW=gl_FrontFacing ? -normalW : normalW;coatNormalW=gl_FrontFacing ? -coatNormalW : coatNormalW;
430
+ #else
431
+ normalW=gl_FrontFacing ? normalW : -normalW;coatNormalW=gl_FrontFacing ? coatNormalW : -coatNormalW;
432
+ #endif
433
+ #endif
434
+ `;i.ShaderStore.IncludesShadersStore[eo]||(i.ShaderStore.IncludesShadersStore[eo]=er);let et="openpbrBaseLayerData",ea=`vec3 base_color=vec3(0.8);float base_metalness=0.0;float base_diffuse_roughness=0.0;float specular_weight=1.0;float specular_roughness=0.3;vec3 specular_color=vec3(1.0);float specular_roughness_anisotropy=0.0;float specular_ior=1.5;float alpha=1.0;vec2 geometry_tangent=vec2(1.0,0.0);float geometry_thickness=0.0;
435
+ #ifdef BASE_WEIGHT
436
+ vec4 baseWeightFromTexture=TEXRD(baseWeightSampler,vBaseWeightUV+uvOffset);
437
+ #endif
438
+ #ifdef BASE_COLOR
439
+ vec4 baseColorFromTexture=TEXRD(baseColorSampler,vBaseColorUV+uvOffset);
440
+ #endif
441
+ #ifdef BASE_METALNESS
442
+ vec4 metallicFromTexture=TEXRD(baseMetalnessSampler,vBaseMetalnessUV+uvOffset);
443
+ #endif
444
+ #if defined(SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN) && defined(BASE_METALNESS)
445
+ float roughnessFromTexture=metallicFromTexture.g;
446
+ #elif defined(SPECULAR_ROUGHNESS)
447
+ float roughnessFromTexture=TEXRD(specularRoughnessSampler,vSpecularRoughnessUV+uvOffset).r;
448
+ #endif
449
+ #ifdef GEOMETRY_TANGENT
450
+ vec3 geometryTangentFromTexture=TEXRD(geometryTangentSampler,vGeometryTangentUV+uvOffset).rgb;
451
+ #endif
452
+ #ifdef SPECULAR_ROUGHNESS_ANISOTROPY
453
+ float anisotropyFromTexture=TEXRD(specularRoughnessAnisotropySampler,vSpecularRoughnessAnisotropyUV+uvOffset).r*vSpecularRoughnessAnisotropyInfos.y;
454
+ #endif
455
+ #ifdef BASE_DIFFUSE_ROUGHNESS
456
+ float baseDiffuseRoughnessFromTexture=TEXRD(baseDiffuseRoughnessSampler,vBaseDiffuseRoughnessUV+uvOffset).r;
457
+ #endif
458
+ #ifdef GEOMETRY_OPACITY
459
+ vec4 opacityFromTexture=TEXRD(geometryOpacitySampler,vGeometryOpacityUV+uvOffset);
460
+ #endif
461
+ #ifdef GEOMETRY_THICKNESS
462
+ vec4 thicknessFromTexture=TEXRD(geometryThicknessSampler,vGeometryThicknessUV+uvOffset);
463
+ #endif
464
+ #ifdef DECAL
465
+ vec4 decalFromTexture=texture2D(decalSampler,vDecalUV+uvOffset);
466
+ #endif
467
+ #ifdef SPECULAR_COLOR
468
+ vec4 specularColorFromTexture=TEXRD(specularColorSampler,vSpecularColorUV+uvOffset);
469
+ #endif
470
+ #ifdef SPECULAR_WEIGHT
471
+ #ifdef SPECULAR_WEIGHT_IN_ALPHA
472
+ float specularWeightFromTexture=TEXRD(specularWeightSampler,vSpecularWeightUV+uvOffset).a;
473
+ #else
474
+ float specularWeightFromTexture=TEXRD(specularWeightSampler,vSpecularWeightUV+uvOffset).r;
475
+ #endif
476
+ #endif
477
+ #if defined(ANISOTROPIC) || defined(FUZZ) || defined(REFRACTED_BACKGROUND) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)
478
+ vec3 noise=vec3(2.0)*TEXRD(blueNoiseSampler,gl_FragCoord.xy/256.0).xyz-vec3(1.0);
479
+ #endif
480
+ base_color=vBaseColor.rgb;
481
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
482
+ base_color*=vColor.rgb;
483
+ #endif
484
+ #if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
485
+ alpha*=vColor.a;
486
+ #endif
487
+ base_color*=vec3(vBaseWeight);alpha=vBaseColor.a;base_metalness=vReflectanceInfo.x;base_diffuse_roughness=vBaseDiffuseRoughness;specular_roughness=vReflectanceInfo.y;specular_color=vSpecularColor.rgb;specular_weight=vReflectanceInfo.a;specular_ior=vReflectanceInfo.z;specular_roughness_anisotropy=vSpecularAnisotropy.b;geometry_tangent=vSpecularAnisotropy.rg;geometry_thickness=vGeometryThickness;
488
+ #ifdef BASE_COLOR
489
+ #ifdef BASE_COLOR_GAMMA
490
+ base_color*=toLinearSpace(baseColorFromTexture.rgb);
491
+ #else
492
+ base_color*=baseColorFromTexture.rgb;
493
+ #endif
494
+ base_color*=vBaseColorInfos.y;
495
+ #endif
496
+ #ifdef BASE_WEIGHT
497
+ base_color*=baseWeightFromTexture.r;
498
+ #endif
499
+ #if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE)
500
+ alpha*=baseColorFromTexture.a;
501
+ #elif defined(GEOMETRY_OPACITY)
502
+ alpha*=opacityFromTexture.r;alpha*=vGeometryOpacityInfos.y;
503
+ #endif
504
+ #ifdef GEOMETRY_THICKNESS
505
+ #ifdef GEOMETRY_THICKNESS_FROM_GREEN_CHANNEL
506
+ geometry_thickness*=thicknessFromTexture.g;
507
+ #else
508
+ geometry_thickness*=thicknessFromTexture.r;
509
+ #endif
510
+ geometry_thickness*=vGeometryThicknessInfos.y;
511
+ #endif
512
+ #ifdef ALPHATEST
513
+ #if DEBUGMODE != 88
514
+ if (alpha<ALPHATESTVALUE)
515
+ discard;
516
+ #endif
517
+ #ifndef ALPHABLEND
518
+ alpha=1.0;
519
+ #endif
520
+ #endif
521
+ #ifdef BASE_METALNESS
522
+ #ifdef BASE_METALNESS_FROM_METALNESS_TEXTURE_BLUE
523
+ base_metalness*=metallicFromTexture.b;
524
+ #else
525
+ base_metalness*=metallicFromTexture.r;
526
+ #endif
527
+ #endif
528
+ #ifdef BASE_DIFFUSE_ROUGHNESS
529
+ base_diffuse_roughness*=baseDiffuseRoughnessFromTexture*vBaseDiffuseRoughnessInfos.y;
530
+ #endif
531
+ #ifdef SPECULAR_COLOR
532
+ #ifdef SPECULAR_COLOR_GAMMA
533
+ specular_color*=toLinearSpace(specularColorFromTexture.rgb);
534
+ #else
535
+ specular_color*=specularColorFromTexture.rgb;
536
+ #endif
537
+ #ifdef SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE
538
+ specular_weight*=specularColorFromTexture.a;
539
+ #elif defined(SPECULAR_WEIGHT)
540
+ specular_weight*=specularWeightFromTexture;
541
+ #endif
542
+ #endif
543
+ #if defined(SPECULAR_ROUGHNESS) || (defined(SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN) && defined(BASE_METALNESS))
544
+ specular_roughness*=roughnessFromTexture;
545
+ #endif
546
+ #ifdef GEOMETRY_TANGENT
547
+ {vec2 tangentFromTexture=normalize(geometryTangentFromTexture.xy*2.0-1.0);float tangent_angle_texture=atan(tangentFromTexture.y,tangentFromTexture.x);float tangent_angle_uniform=atan(geometry_tangent.y,geometry_tangent.x);float tangent_angle=tangent_angle_texture+tangent_angle_uniform;geometry_tangent=vec2(cos(tangent_angle),sin(tangent_angle));}
548
+ #endif
549
+ #if defined(GEOMETRY_TANGENT) && \
550
+ defined(SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE)
551
+ specular_roughness_anisotropy*=geometryTangentFromTexture.b;
552
+ #elif defined(SPECULAR_ROUGHNESS_ANISOTROPY)
553
+ specular_roughness_anisotropy*=anisotropyFromTexture;
554
+ #endif
555
+ #ifdef DETAIL
556
+ float detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);float loLerp=mix(0.,specular_roughness,detailRoughness*2.);float hiLerp=mix(specular_roughness,1.,(detailRoughness-0.5)*2.);specular_roughness=mix(loLerp,hiLerp,step(detailRoughness,0.5));
557
+ #endif
558
+ #ifdef USE_GLTF_STYLE_ANISOTROPY
559
+ float baseAlpha=specular_roughness*specular_roughness;float roughnessT=mix(baseAlpha,1.0,specular_roughness_anisotropy*specular_roughness_anisotropy);float roughnessB=baseAlpha;specular_roughness_anisotropy=1.0-roughnessB/max(roughnessT,0.00001);specular_roughness=sqrt(roughnessT/sqrt(2.0/(1.0+(1.0-specular_roughness_anisotropy)*(1.0-specular_roughness_anisotropy))));
560
+ #endif
561
+ `;i.ShaderStore.IncludesShadersStore[et]||(i.ShaderStore.IncludesShadersStore[et]=ea);var en=e.i(17796),es=e.i(16630);let el="openpbrCoatLayerData",ec=`float coat_weight=0.0;vec3 coat_color=vec3(1.0);float coat_roughness=0.0;float coat_roughness_anisotropy=0.0;float coat_ior=1.6;float coat_darkening=1.0;vec2 geometry_coat_tangent=vec2(1.0,0.0);
562
+ #ifdef COAT_WEIGHT
563
+ vec4 coatWeightFromTexture=TEXRD(coatWeightSampler,vCoatWeightUV+uvOffset);
564
+ #endif
565
+ #ifdef COAT_COLOR
566
+ vec4 coatColorFromTexture=TEXRD(coatColorSampler,vCoatColorUV+uvOffset);
567
+ #endif
568
+ #ifdef COAT_ROUGHNESS
569
+ vec4 coatRoughnessFromTexture=TEXRD(coatRoughnessSampler,vCoatRoughnessUV+uvOffset);
570
+ #endif
571
+ #ifdef COAT_ROUGHNESS_ANISOTROPY
572
+ float coatRoughnessAnisotropyFromTexture=TEXRD(coatRoughnessAnisotropySampler,vCoatRoughnessAnisotropyUV+uvOffset).r;
573
+ #endif
574
+ #ifdef COAT_DARKENING
575
+ vec4 coatDarkeningFromTexture=TEXRD(coatDarkeningSampler,vCoatDarkeningUV+uvOffset);
576
+ #endif
577
+ #ifdef GEOMETRY_COAT_TANGENT
578
+ vec3 geometryCoatTangentFromTexture=TEXRD(geometryCoatTangentSampler,vGeometryCoatTangentUV+uvOffset).rgb;
579
+ #endif
580
+ coat_color=vCoatColor.rgb;coat_weight=vCoatWeight;coat_roughness=vCoatRoughness;coat_roughness_anisotropy=vCoatRoughnessAnisotropy;coat_ior=vCoatIor;coat_darkening=vCoatDarkening;geometry_coat_tangent=vGeometryCoatTangent.rg;
581
+ #ifdef COAT_WEIGHT
582
+ coat_weight*=coatWeightFromTexture.r;
583
+ #endif
584
+ #ifdef COAT_COLOR
585
+ #ifdef COAT_COLOR_GAMMA
586
+ coat_color*=toLinearSpace(coatColorFromTexture.rgb);
587
+ #else
588
+ coat_color*=coatColorFromTexture.rgb;
589
+ #endif
590
+ coat_color*=vCoatColorInfos.y;
591
+ #endif
592
+ #ifdef COAT_ROUGHNESS
593
+ #ifdef COAT_ROUGHNESS_FROM_GREEN_CHANNEL
594
+ coat_roughness*=coatRoughnessFromTexture.g;
595
+ #else
596
+ coat_roughness*=coatRoughnessFromTexture.r;
597
+ #endif
598
+ #endif
599
+ #if defined(GEOMETRY_COAT_TANGENT) && defined(COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE)
600
+ coat_roughness_anisotropy*=geometryCoatTangentFromTexture.b;
601
+ #elif defined(COAT_ROUGHNESS_ANISOTROPY)
602
+ coat_roughness_anisotropy*=coatRoughnessAnisotropyFromTexture;
603
+ #endif
604
+ #ifdef COAT_DARKENING
605
+ coat_darkening*=coatDarkeningFromTexture.r;
606
+ #endif
607
+ #ifdef GEOMETRY_COAT_TANGENT
608
+ {vec2 tangentFromTexture=normalize(geometryCoatTangentFromTexture.xy*2.0-1.0);float tangent_angle_texture=atan(tangentFromTexture.y,tangentFromTexture.x);float tangent_angle_uniform=atan(geometry_coat_tangent.y,geometry_coat_tangent.x);float tangent_angle=tangent_angle_texture+tangent_angle_uniform;geometry_coat_tangent=vec2(cos(tangent_angle),sin(tangent_angle));}
609
+ #endif
610
+ #ifdef USE_GLTF_STYLE_ANISOTROPY
611
+ float coatAlpha=coat_roughness*coat_roughness;float coatRoughnessT=mix(coatAlpha,1.0,coat_roughness_anisotropy*coat_roughness_anisotropy);float coatRoughnessB=coatAlpha;coat_roughness_anisotropy=1.0-coatRoughnessB/max(coatRoughnessT,0.00001);coat_roughness=sqrt(coatRoughnessT/sqrt(2.0/(1.0+(1.0-coat_roughness_anisotropy)*(1.0-coat_roughness_anisotropy))));
612
+ #endif
613
+ `;i.ShaderStore.IncludesShadersStore[el]||(i.ShaderStore.IncludesShadersStore[el]=ec);let ef="openpbrThinFilmLayerData",e_=`#ifdef THIN_FILM
614
+ float thin_film_weight=vThinFilmWeight;float thin_film_thickness=vThinFilmThickness.r*1000.0;
615
+ float thin_film_ior=vThinFilmIor;
616
+ #ifdef THIN_FILM_WEIGHT
617
+ float thinFilmWeightFromTexture=TEXRD(thinFilmWeightSampler,vThinFilmWeightUV+uvOffset).r*vThinFilmWeightInfos.y;
618
+ #endif
619
+ #ifdef THIN_FILM_THICKNESS
620
+ float thinFilmThicknessFromTexture=TEXRD(thinFilmThicknessSampler,vThinFilmThicknessUV+uvOffset).g*vThinFilmThicknessInfos.y;
621
+ #endif
622
+ #ifdef THIN_FILM_WEIGHT
623
+ thin_film_weight*=thinFilmWeightFromTexture;
624
+ #endif
625
+ #ifdef THIN_FILM_THICKNESS
626
+ thin_film_thickness*=thinFilmThicknessFromTexture;
627
+ #endif
628
+ float thin_film_ior_scale=clamp(2.0f*abs(thin_film_ior-1.0f),0.0f,1.0f);
629
+ #endif
630
+ `;i.ShaderStore.IncludesShadersStore[ef]||(i.ShaderStore.IncludesShadersStore[ef]=e_);let ed="openpbrFuzzLayerData",em=`float fuzz_weight=0.0;vec3 fuzz_color=vec3(1.0);float fuzz_roughness=0.0;
631
+ #ifdef FUZZ
632
+ #ifdef FUZZ_WEIGHT
633
+ vec4 fuzzWeightFromTexture=TEXRD(fuzzWeightSampler,vFuzzWeightUV+uvOffset);
634
+ #endif
635
+ #ifdef FUZZ_COLOR
636
+ vec4 fuzzColorFromTexture=TEXRD(fuzzColorSampler,vFuzzColorUV+uvOffset);
637
+ #endif
638
+ #ifdef FUZZ_ROUGHNESS
639
+ vec4 fuzzRoughnessFromTexture=TEXRD(fuzzRoughnessSampler,vFuzzRoughnessUV+uvOffset);
640
+ #endif
641
+ fuzz_color=vFuzzColor.rgb;fuzz_weight=vFuzzWeight;fuzz_roughness=vFuzzRoughness;
642
+ #ifdef FUZZ_WEIGHT
643
+ fuzz_weight*=fuzzWeightFromTexture.r;
644
+ #endif
645
+ #ifdef FUZZ_COLOR
646
+ #ifdef FUZZ_COLOR_GAMMA
647
+ fuzz_color*=toLinearSpace(fuzzColorFromTexture.rgb);
648
+ #else
649
+ fuzz_color*=fuzzColorFromTexture.rgb;
650
+ #endif
651
+ fuzz_color*=vFuzzColorInfos.y;
652
+ #endif
653
+ #if defined(FUZZ_ROUGHNESS) && defined(FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA)
654
+ fuzz_roughness*=fuzzRoughnessFromTexture.a;
655
+ #elif defined(FUZZ_ROUGHNESS)
656
+ fuzz_roughness*=fuzzRoughnessFromTexture.r;
657
+ #endif
658
+ #endif
659
+ `;i.ShaderStore.IncludesShadersStore[ed]||(i.ShaderStore.IncludesShadersStore[ed]=em);let eu="openpbrAmbientOcclusionData",eg=`vec3 ambient_occlusion=vec3(1.0);float specular_ambient_occlusion=1.0;float coat_specular_ambient_occlusion=1.0;
660
+ #ifdef AMBIENT_OCCLUSION
661
+ vec3 ambientOcclusionFromTexture=TEXRD(ambientOcclusionSampler,vAmbientOcclusionUV+uvOffset).rgb;ambient_occlusion=vec3(ambientOcclusionFromTexture.r*vAmbientOcclusionInfos.y+(1.0-vAmbientOcclusionInfos.y));
662
+ #endif
663
+ `;i.ShaderStore.IncludesShadersStore[eu]||(i.ShaderStore.IncludesShadersStore[eu]=eg);var ev=e.i(76286);let eE="openpbrBackgroundTransmission",ep=`vec4 slab_translucent_background=vec4(0.,0.,0.,1.);
664
+ #ifdef REFRACTED_BACKGROUND
665
+ {float refractionLOD=min(transmission_roughness,0.8)*vBackgroundRefractionInfos.x;float lodTexelSize=pow(2.0,refractionLOD-vBackgroundRefractionInfos.x);
666
+ #ifdef DISPERSION
667
+ {
668
+ #ifdef REFRACTION_HIGH_QUALITY_BLUR
669
+ {vec3 dispResult=vec3(0.0);vec3 dispWeight=vec3(0.0);vec2 noiseOffset=noise.xy*(refractionLOD>0.0 ? lodTexelSize : 0.0);for (int k=0; k<6; k++) {float t=(float(k)+noise.y)/6.0;float t_rg=clamp(t*2.0,0.0,1.0);float t_gb=clamp((t-0.5)*2.0,0.0,1.0);vec3 refVec=mix(mix(refractedViewVectors[0],refractedViewVectors[1],t_rg),refractedViewVectors[2],t_gb);vec3 uvw=vec3(backgroundRefractionMatrix*(view*vec4(vPositionW+refVec*geometry_thickness,1.0)));vec2 coords=uvw.xy/uvw.z;coords.y=1.0-coords.y;vec4 s=texture2DLodEXT(backgroundRefractionSampler,coords+noiseOffset,refractionLOD);float rw=max(0.0,1.0-2.0*t);float gw=max(0.0,1.0-abs(2.0*t-1.0));float bw=max(0.0,2.0*t-1.0);vec3 w=vec3(rw,gw,bw);dispResult+=s.rgb*w;dispWeight+=w;}
670
+ slab_translucent_background=vec4(dispResult/max(dispWeight,vec3(1e-6)),1.0);}
671
+ #else
672
+ for (int i=0; i<3; i++) {vec3 refractedViewVector=refractedViewVectors[i];vec3 uvw=vec3(backgroundRefractionMatrix*(view*vec4(vPositionW+refractedViewVector*geometry_thickness,1.0)));vec2 coords=uvw.xy/uvw.z;coords.y=1.0-coords.y;if (refractionLOD>0.0) {vec2 noiseOffset=noise.xy*lodTexelSize;slab_translucent_background[i]=texture2DLodEXT(backgroundRefractionSampler,coords+noiseOffset,refractionLOD)[i];} else {slab_translucent_background[i]=texture2DLodEXT(backgroundRefractionSampler,coords,0.0)[i];}}
673
+ #endif
674
+ }
675
+ #else
676
+ {vec3 refractionUVW=vec3(backgroundRefractionMatrix*(view*vec4(vPositionW+refractedViewVector*geometry_thickness,1.0)));vec2 refractionCoords=refractionUVW.xy/refractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;if (refractionLOD>0.0) {
677
+ #ifdef REFRACTION_HIGH_QUALITY_BLUR
678
+ float cosA=cos(noise.x*PI);float sinA=sin(noise.x*PI);vec2 u=vec2( cosA,sinA)*(0.5*lodTexelSize);vec2 v=vec2(-sinA,cosA)*(0.5*lodTexelSize);slab_translucent_background=0.25*(
679
+ texture2DLodEXT(backgroundRefractionSampler,refractionCoords+u+v,refractionLOD) +
680
+ texture2DLodEXT(backgroundRefractionSampler,refractionCoords-u+v,refractionLOD) +
681
+ texture2DLodEXT(backgroundRefractionSampler,refractionCoords+u-v,refractionLOD) +
682
+ texture2DLodEXT(backgroundRefractionSampler,refractionCoords-u-v,refractionLOD)
683
+ );
684
+ #else
685
+ vec2 noiseOffset=noise.xy*lodTexelSize;slab_translucent_background=texture2DLodEXT(backgroundRefractionSampler,refractionCoords+noiseOffset,refractionLOD);
686
+ #endif
687
+ } else {slab_translucent_background=texture2DLodEXT(backgroundRefractionSampler,refractionCoords,0.0);}}
688
+ #endif
689
+ }
690
+ #endif
691
+ `;i.ShaderStore.IncludesShadersStore[eE]||(i.ShaderStore.IncludesShadersStore[eE]=ep);let eh="openpbrEnvironmentLighting",eS=`#if defined(REFLECTION) || defined(REFRACTED_BACKGROUND)
692
+ vec3 coatAbsorption=vec3(1.0);float coatIblFresnel=0.0;if (coat_weight>0.0) {coatIblFresnel=computeDielectricIblFresnel(coatReflectance,coatGeoInfo.environmentBrdf);float hemisphere_avg_fresnel=coatReflectance.F0+0.5*(1.0-coatReflectance.F0);float averageReflectance=(coatIblFresnel+hemisphere_avg_fresnel)*0.5;float roughnessFactor=1.0-coat_roughness*0.5;averageReflectance*=roughnessFactor;float darkened_transmission=(1.0-averageReflectance)*(1.0-averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);float sin2=1.0-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior)*coat_weight;float cos_t=sqrt(1.0-sin2);float coatPathLength=1.0/cos_t;float effectivePathLength=coatPathLength*coat_weight;vec3 colored_transmission=pow(coat_color,vec3(effectivePathLength));coatAbsorption=colored_transmission*mix(1.0,darkened_transmission,coat_weight);}
693
+ #endif
694
+ #ifdef REFLECTION
695
+ #if defined(FUZZ) && defined(FUZZENVIRONMENTBRDF)
696
+ vec3 environmentFuzzBrdf=getFuzzBRDFLookup(fuzzGeoInfo.NdotV,sqrt(fuzz_roughness));
697
+ #endif
698
+ vec3 baseDiffuseEnvironmentLight=sampleIrradiance(
699
+ normalW
700
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
701
+ ,vEnvironmentIrradiance
702
+ #endif
703
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
704
+ ,reflectionMatrix
705
+ #endif
706
+ #ifdef USEIRRADIANCEMAP
707
+ ,irradianceSampler
708
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
709
+ ,vReflectionDominantDirection
710
+ #endif
711
+ #endif
712
+ #ifdef REALTIME_FILTERING
713
+ ,vReflectionFilteringInfo
714
+ #ifdef IBL_CDF_FILTERING
715
+ ,icdfSampler
716
+ #endif
717
+ #endif
718
+ ,vReflectionInfos
719
+ ,viewDirectionW
720
+ ,base_diffuse_roughness
721
+ ,base_color
722
+ );
723
+ #ifdef REFLECTIONMAP_3D
724
+ vec3 reflectionCoords=vec3(0.,0.,0.);
725
+ #else
726
+ vec2 reflectionCoords=vec2(0.,0.);
727
+ #endif
728
+ float specularAlphaG=specular_roughness*specular_roughness;
729
+ #ifdef ANISOTROPIC_BASE
730
+ vec3 baseSpecularEnvironmentLight=sampleRadianceAnisotropic(specularAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
731
+ ,baseGeoInfo
732
+ ,normalW
733
+ ,viewDirectionW
734
+ ,vPositionW
735
+ ,noise
736
+ ,false
737
+ ,1.0
738
+ ,reflectionSampler
739
+ #ifdef REALTIME_FILTERING
740
+ ,vReflectionFilteringInfo
741
+ #endif
742
+ );
743
+ #else
744
+ reflectionCoords=createReflectionCoords(vPositionW,normalW);vec3 baseSpecularEnvironmentLight=sampleRadiance(specularAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
745
+ ,baseGeoInfo
746
+ ,reflectionSampler
747
+ ,reflectionCoords
748
+ #ifdef REALTIME_FILTERING
749
+ ,vReflectionFilteringInfo
750
+ #endif
751
+ );
752
+ #endif
753
+ #ifdef ANISOTROPIC_BASE
754
+ baseSpecularEnvironmentLight=mix(baseSpecularEnvironmentLight.rgb,baseDiffuseEnvironmentLight,specularAlphaG*specularAlphaG*max(1.0-baseGeoInfo.anisotropy,0.3));
755
+ #else
756
+ baseSpecularEnvironmentLight=mix(baseSpecularEnvironmentLight.rgb,baseDiffuseEnvironmentLight,specularAlphaG);
757
+ #endif
758
+ vec3 coatEnvironmentLight=vec3(0.,0.,0.);if (coat_weight>0.0) {
759
+ #ifdef REFLECTIONMAP_3D
760
+ vec3 reflectionCoords=vec3(0.,0.,0.);
761
+ #else
762
+ vec2 reflectionCoords=vec2(0.,0.);
763
+ #endif
764
+ reflectionCoords=createReflectionCoords(vPositionW,coatNormalW);float coatAlphaG=coat_roughness*coat_roughness;
765
+ #ifdef ANISOTROPIC_COAT
766
+ coatEnvironmentLight=sampleRadianceAnisotropic(coatAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
767
+ ,coatGeoInfo
768
+ ,coatNormalW
769
+ ,viewDirectionW
770
+ ,vPositionW
771
+ ,noise
772
+ ,false
773
+ ,1.0
774
+ ,reflectionSampler
775
+ #ifdef REALTIME_FILTERING
776
+ ,vReflectionFilteringInfo
777
+ #endif
778
+ );
779
+ #else
780
+ coatEnvironmentLight=sampleRadiance(coatAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
781
+ ,coatGeoInfo
782
+ ,reflectionSampler
783
+ ,reflectionCoords
784
+ #ifdef REALTIME_FILTERING
785
+ ,vReflectionFilteringInfo
786
+ #endif
787
+ );
788
+ #endif
789
+ }
790
+ #if defined(FUZZ) &&defined(FUZZENVIRONMENTBRDF)
791
+ float modifiedFuzzRoughness=clamp(fuzz_roughness*(1.0-0.5*environmentFuzzBrdf.y),0.0,1.0);vec3 fuzzEnvironmentLight=vec3(0.0);float totalWeight=0.0;float fuzzIblFresnel=sqrt(environmentFuzzBrdf.z);for (int i=0; i<FUZZ_IBL_SAMPLES; ++i) {float angle=(float(i)+noise.x)*(3.141592*2.0/float(FUZZ_IBL_SAMPLES));vec3 fiberCylinderNormal=normalize(cos(angle)*fuzzTangent+sin(angle)*fuzzBitangent);float fiberBend=min(environmentFuzzBrdf.x*environmentFuzzBrdf.x*modifiedFuzzRoughness,1.0);fiberCylinderNormal=normalize(mix(fiberCylinderNormal,fuzzNormalW,fiberBend));float sampleWeight=max(dot(viewDirectionW,fiberCylinderNormal),0.0);vec3 fuzzReflectionCoords=createReflectionCoords(vPositionW,fiberCylinderNormal);vec3 radianceSample=sampleRadiance(modifiedFuzzRoughness,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
792
+ ,fuzzGeoInfo
793
+ ,reflectionSampler
794
+ ,fuzzReflectionCoords
795
+ #ifdef REALTIME_FILTERING
796
+ ,vReflectionFilteringInfo
797
+ #endif
798
+ );fuzzEnvironmentLight+=sampleWeight*mix(radianceSample,baseDiffuseEnvironmentLight,fiberBend);totalWeight+=sampleWeight;}
799
+ fuzzEnvironmentLight/=totalWeight;
800
+ #endif
801
+ float dielectricIblFresnel=computeDielectricIblFresnel(baseDielectricReflectance,baseGeoInfo.environmentBrdf);vec3 dielectricIblColoredFresnel=dielectricIblFresnel*specular_color;
802
+ #ifdef THIN_FILM
803
+ float thin_film_cos_theta=max(baseGeoInfo.NdotV,specularAlphaG);float thin_film_desaturation_scale=(thin_film_ior-1.0)*sqrt(thin_film_thickness*0.001*thin_film_cos_theta);float tf_brdf_x=baseGeoInfo.environmentBrdf.x;float tf_E_ss =baseGeoInfo.environmentBrdf.y;vec3 thinFilmDielectricF0=evalIridescence(thin_film_outside_ior,thin_film_ior,1.0,thin_film_thickness,vec3(baseDielectricReflectance.F0));thinFilmDielectricF0=mix(thinFilmDielectricF0,vec3(dot(thinFilmDielectricF0,vec3(0.3333))),thin_film_desaturation_scale);vec3 thinFilmDielectricDir=evalIridescence(thin_film_outside_ior,thin_film_ior,thin_film_cos_theta,thin_film_thickness,vec3(baseDielectricReflectance.F0));thinFilmDielectricDir=mix(thinFilmDielectricDir,vec3(dot(thinFilmDielectricDir,vec3(0.3333))),thin_film_desaturation_scale);float tf_f0d_avg =dot(thinFilmDielectricF0, vec3(0.3333));float tf_dird_avg=dot(thinFilmDielectricDir,vec3(0.3333));vec3 thinFilmDielectricFresnel=thinFilmDielectricDir*(tf_f0d_avg/max(tf_dird_avg,1e-5));vec3 tf_E_dielectric=(vec3(1.0)-thinFilmDielectricFresnel)*vec3(tf_brdf_x)+thinFilmDielectricFresnel*vec3(tf_E_ss);vec3 tf_F_avg_dielectric=thinFilmDielectricFresnel+(vec3(1.0)-thinFilmDielectricFresnel)/21.0;vec3 tf_ECF_dielectric=vec3(1.0)+tf_F_avg_dielectric*(vec3(1.0)/vec3(tf_E_ss)-vec3(1.0));thinFilmDielectricFresnel=clamp(tf_E_dielectric*tf_ECF_dielectric,vec3(0.0),vec3(1.0));dielectricIblColoredFresnel=mix(dielectricIblColoredFresnel,thinFilmDielectricFresnel*specular_color,thin_film_weight*thin_film_ior_scale);dielectricIblFresnel=max(dielectricIblColoredFresnel.r,max(dielectricIblColoredFresnel.g,dielectricIblColoredFresnel.b));
804
+ #endif
805
+ vec3 conductorIblFresnel=computeConductorIblFresnel(baseConductorReflectance,baseGeoInfo.environmentBrdf);
806
+ #ifdef THIN_FILM
807
+ vec3 thinFilmConductorF0=evalIridescence(thin_film_outside_ior,thin_film_ior,1.0,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorF0=mix(thinFilmConductorF0,vec3(dot(thinFilmConductorF0,vec3(0.3333))),thin_film_desaturation_scale);vec3 thinFilmConductorDir=evalIridescence(thin_film_outside_ior,thin_film_ior,thin_film_cos_theta,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorDir=mix(thinFilmConductorDir,vec3(dot(thinFilmConductorDir,vec3(0.3333))),thin_film_desaturation_scale);float tf_f0c_avg =dot(thinFilmConductorF0, vec3(0.3333));float tf_dirc_avg=dot(thinFilmConductorDir,vec3(0.3333));vec3 thinFilmConductorRaw=thinFilmConductorDir*(tf_f0c_avg/max(tf_dirc_avg,1e-5));
808
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) && defined(ENVIRONMENTBRDF)
809
+ vec3 tf_b=getF82B(baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90);float tf_brdf_z=baseGeoInfo.environmentBrdf.z/BRDF_Z_SCALE;vec3 tf_E_conductor=(vec3(1.0)-thinFilmConductorRaw)*vec3(tf_brdf_x)+thinFilmConductorRaw*vec3(tf_E_ss)-tf_b*vec3(tf_brdf_z);vec3 tf_F_avg_conductor=thinFilmConductorRaw+(vec3(1.0)-thinFilmConductorRaw)/21.0-tf_b/126.0;
810
+ #else
811
+ vec3 tf_E_conductor=(vec3(1.0)-thinFilmConductorRaw)*vec3(tf_brdf_x)+thinFilmConductorRaw*vec3(tf_E_ss);vec3 tf_F_avg_conductor=thinFilmConductorRaw+(vec3(1.0)-thinFilmConductorRaw)/21.0;
812
+ #endif
813
+ vec3 tf_ECF_conductor=vec3(1.0)+tf_F_avg_conductor*(vec3(1.0)/vec3(tf_E_ss)-vec3(1.0));vec3 thinFilmConductorFresnel=specular_weight*clamp(tf_E_conductor*tf_ECF_conductor,vec3(0.0),vec3(1.0));conductorIblFresnel=mix(conductorIblFresnel,thinFilmConductorFresnel,thin_film_weight*thin_film_ior_scale);
814
+ #endif
815
+ vec3 slab_diffuse_ibl=vec3(0.,0.,0.);vec3 slab_glossy_ibl=vec3(0.,0.,0.);vec3 slab_metal_ibl=vec3(0.,0.,0.);vec3 slab_coat_ibl=vec3(0.,0.,0.);slab_diffuse_ibl=baseDiffuseEnvironmentLight*vLightingIntensity.z;
816
+ #ifdef AMBIENT_OCCLUSION
817
+ specular_ambient_occlusion=compute_specular_occlusion(baseGeoInfo.NdotV,base_metalness,ambient_occlusion.x,specular_roughness);
818
+ #endif
819
+ slab_glossy_ibl=baseSpecularEnvironmentLight*vLightingIntensity.z;slab_metal_ibl=baseSpecularEnvironmentLight*conductorIblFresnel*vLightingIntensity.z;if (coat_weight>0.0) {slab_coat_ibl=coatEnvironmentLight*vLightingIntensity.z;
820
+ #ifdef AMBIENT_OCCLUSION
821
+ coat_specular_ambient_occlusion=compute_specular_occlusion(coatGeoInfo.NdotV,0.0,ambient_occlusion.x,coat_roughness);
822
+ #endif
823
+ }
824
+ #if defined(FUZZ) &&defined(FUZZENVIRONMENTBRDF)
825
+ vec3 slab_fuzz_ibl=fuzzEnvironmentLight*vLightingIntensity.z;
826
+ #endif
827
+ vec3 slab_translucent_base_ibl=vec3(0.0);vec3 slab_subsurface_ibl=vec3(0.,0.,0.);
828
+ #ifdef REFRACTED_ENVIRONMENT
829
+ #ifdef ANISOTROPIC_BASE
830
+ vec3 forwardScatteredEnvironmentLight=sampleRadianceAnisotropic(transmission_roughness_alpha,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
831
+ ,baseGeoInfo
832
+ #ifdef GEOMETRY_THIN_WALLED
833
+ ,viewDirectionW
834
+ #else
835
+ ,normalW
836
+ #endif
837
+ ,viewDirectionW
838
+ ,vPositionW
839
+ ,noise
840
+ ,true
841
+ #ifdef GEOMETRY_THIN_WALLED
842
+ ,1.05
843
+ #else
844
+ ,specular_ior
845
+ #endif
846
+ ,reflectionSampler
847
+ #ifdef REALTIME_FILTERING
848
+ ,vReflectionFilteringInfo
849
+ #endif
850
+ );
851
+ #else
852
+ vec3 forwardScatteredEnvironmentLight=vec3(0.,0.,0.);
853
+ #ifdef DISPERSION
854
+ for (int i=0; i<3; i++) {vec3 iblRefractionCoords=refractedViewVectors[i];
855
+ #else
856
+ vec3 iblRefractionCoords=refractedViewVector;
857
+ #endif
858
+ #ifdef REFRACTED_ENVIRONMENT_OPPOSITEZ
859
+ iblRefractionCoords.z*=-1.0;
860
+ #endif
861
+ #ifdef REFRACTED_ENVIRONMENT_LOCAL_CUBE
862
+ iblRefractionCoords=parallaxCorrectNormal(vPositionW,refractedViewVector,refractionSize,refractionPosition);
863
+ #endif
864
+ iblRefractionCoords=vec3(reflectionMatrix*vec4(iblRefractionCoords,0));
865
+ #ifdef DISPERSION
866
+ forwardScatteredEnvironmentLight[i]=sampleRadiance(transmission_roughness_alpha,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
867
+ ,baseGeoInfo
868
+ ,reflectionSampler
869
+ ,iblRefractionCoords
870
+ #ifdef REALTIME_FILTERING
871
+ ,vReflectionFilteringInfo
872
+ #endif
873
+ )[i];
874
+ #else
875
+ forwardScatteredEnvironmentLight=sampleRadiance(transmission_roughness_alpha,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos
876
+ ,baseGeoInfo
877
+ ,reflectionSampler
878
+ ,iblRefractionCoords
879
+ #ifdef REALTIME_FILTERING
880
+ ,vReflectionFilteringInfo
881
+ #endif
882
+ );
883
+ #endif
884
+ #ifdef DISPERSION
885
+ }
886
+ #endif
887
+ #endif
888
+ #ifdef REFRACTED_BACKGROUND
889
+ #ifdef GEOMETRY_THIN_WALLED
890
+ forwardScatteredEnvironmentLight=mix(slab_translucent_background.rgb,forwardScatteredEnvironmentLight.rgb,0.2*transmission_roughness_alpha);
891
+ #else
892
+ forwardScatteredEnvironmentLight=max(slab_translucent_background.rgb,mix(slab_translucent_background.rgb,forwardScatteredEnvironmentLight,transmission_roughness_alpha));
893
+ #endif
894
+ #endif
895
+ #ifdef SCATTERING
896
+ #ifdef GEOMETRY_THIN_WALLED
897
+ vec3 scatterVector=normalW;
898
+ #else
899
+ #if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION)
900
+ vec3 scatterVector=mix(vReflectionDominantDirection,normalW,max3(iso_scatter_density));
901
+ #else
902
+ vec3 scatterVector=normalW;
903
+ #endif
904
+ scatterVector=mix(viewDirectionW,scatterVector,back_to_iso_scattering_blend);
905
+ #endif
906
+ #if defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) && !defined(GEOMETRY_THIN_WALLED)
907
+ vec3 scatteredEnvironmentLight=scattered_light_from_irradiance_texture;
908
+ #else
909
+ vec3 scatteredEnvironmentLight=sampleIrradiance(
910
+ scatterVector
911
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
912
+ ,vEnvironmentIrradiance
913
+ #endif
914
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
915
+ ,reflectionMatrix
916
+ #endif
917
+ #ifdef USEIRRADIANCEMAP
918
+ ,irradianceSampler
919
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
920
+ ,vReflectionDominantDirection
921
+ #endif
922
+ #endif
923
+ #ifdef REALTIME_FILTERING
924
+ ,vReflectionFilteringInfo
925
+ #ifdef IBL_CDF_FILTERING
926
+ ,icdfSampler
927
+ #endif
928
+ #endif
929
+ ,vReflectionInfos
930
+ ,viewDirectionW
931
+ #if defined(GEOMETRY_THIN_WALLED)
932
+ ,base_diffuse_roughness
933
+ ,subsurface_color.rgb
934
+ #else
935
+ ,1.0
936
+ ,volumeParams.multi_scatter_color
937
+ #endif
938
+ );
939
+ #endif
940
+ #ifdef GEOMETRY_THIN_WALLED
941
+ vec3 forward_scattered_light=forwardScatteredEnvironmentLight*transmission_tint*volumeParams.multi_scatter_color;vec3 back_scattered_light=scatteredEnvironmentLight*volumeParams.multi_scatter_color;slab_translucent_base_ibl=mix(back_scattered_light,forward_scattered_light,0.5+0.5*volumeParams.anisotropy);
942
+ #else
943
+ vec3 forward_scattered_light=forwardScatteredEnvironmentLight*volume_absorption;vec3 back_scattered_light=mix(forward_scattered_light,scatteredEnvironmentLight*backscatter_color,iso_scatter_density);vec3 iso_scattered_light=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;
944
+ #endif
945
+ #else
946
+ slab_translucent_base_ibl+=forwardScatteredEnvironmentLight*transmission_tint*volume_absorption;
947
+ #endif
948
+ #endif
949
+ #define CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION
950
+ slab_diffuse_ibl*=ambient_occlusion;slab_metal_ibl*=specular_ambient_occlusion;slab_glossy_ibl*=specular_ambient_occlusion;slab_coat_ibl*=coat_specular_ambient_occlusion;vec3 material_dielectric_base_ibl=mix(slab_diffuse_ibl*base_color.rgb,slab_translucent_base_ibl,surface_translucency_weight);vec3 material_dielectric_gloss_ibl=material_dielectric_base_ibl*(1.0-dielectricIblFresnel)+slab_glossy_ibl*dielectricIblColoredFresnel;vec3 material_base_substrate_ibl=mix(material_dielectric_gloss_ibl,slab_metal_ibl,base_metalness);vec3 material_coated_base_ibl=layer(material_base_substrate_ibl,slab_coat_ibl,coatIblFresnel,coatAbsorption,vec3(1.0));
951
+ #if defined(FUZZ) && defined(FUZZENVIRONMENTBRDF)
952
+ slab_fuzz_ibl*=min(vec3(specular_ambient_occlusion),ambient_occlusion);material_surface_ibl=layer(material_coated_base_ibl,slab_fuzz_ibl,fuzzIblFresnel*fuzz_weight,vec3(1.0),fuzz_color);
953
+ #else
954
+ material_surface_ibl=material_coated_base_ibl;
955
+ #endif
956
+ #elif defined(REFRACTED_BACKGROUND)
957
+ vec3 black=vec3(0.0);vec3 slab_translucent_base_ibl=vec3(0.0);
958
+ #ifdef GEOMETRY_THIN_WALLED
959
+ #ifdef SCATTERING
960
+ vec3 forward_scattered_light=slab_translucent_background.rgb*transmission_tint*volumeParams.multi_scatter_color;slab_translucent_base_ibl=mix(black,forward_scattered_light,0.5+0.5*volumeParams.anisotropy);
961
+ #else
962
+ slab_translucent_base_ibl=slab_translucent_background.rgb*transmission_tint;
963
+ #endif
964
+ #else
965
+ #ifdef SCATTERING
966
+ vec3 forward_scattered_light=slab_translucent_background.rgb*volume_absorption;vec3 iso_scattered_light=(1.0-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;
967
+ #else
968
+ slab_translucent_base_ibl=slab_translucent_background.rgb*volume_absorption*transmission_tint;
969
+ #endif
970
+ #endif
971
+ vec3 material_dielectric_base_ibl=mix(black,slab_translucent_base_ibl.rgb,surface_translucency_weight);vec3 material_dielectric_gloss_ibl=material_dielectric_base_ibl*(baseGeoInfo.NdotV);vec3 material_base_substrate_ibl=mix(material_dielectric_gloss_ibl,black,base_metalness);vec3 material_coated_base_ibl=layer(material_base_substrate_ibl,black,coatIblFresnel,coatAbsorption,vec3(1.0));material_surface_ibl=material_coated_base_ibl;
972
+ #endif
973
+ `;i.ShaderStore.IncludesShadersStore[eh]||(i.ShaderStore.IncludesShadersStore[eh]=eS);let eR="openpbrDirectLightingInit",eI=`#ifdef LIGHT{X}
974
+ preLightingInfo preInfo{X};preLightingInfo preInfoCoat{X};vec4 lightColor{X}=light{X}.vLightDiffuse;float shadow{X}=1.;
975
+ #if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})
976
+ #else
977
+ #define CUSTOM_LIGHT{X}_COLOR
978
+ #ifdef SPOTLIGHT{X}
979
+ preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW);
980
+ #elif defined(POINTLIGHT{X})
981
+ preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW);
982
+ #elif defined(HEMILIGHT{X})
983
+ preInfo{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW);
984
+ #elif defined(DIRLIGHT{X})
985
+ preInfo{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW);
986
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
987
+ preInfo{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,specular_roughness);preInfoCoat{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,coatNormalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,coat_roughness);
988
+ #endif
989
+ preInfo{X}.NdotV=baseGeoInfo.NdotV;preInfoCoat{X}.NdotV=coatGeoInfo.NdotV;
990
+ #ifdef SPOTLIGHT{X}
991
+ #ifdef LIGHT_FALLOFF_GLTF{X}
992
+ preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y);
993
+ #ifdef IESLIGHTTEXTURE{X}
994
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
995
+ #else
996
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);
997
+ #endif
998
+ #elif defined(LIGHT_FALLOFF_PHYSICAL{X})
999
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared);
1000
+ #ifdef IESLIGHTTEXTURE{X}
1001
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
1002
+ #else
1003
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w);
1004
+ #endif
1005
+ #elif defined(LIGHT_FALLOFF_STANDARD{X})
1006
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x);
1007
+ #ifdef IESLIGHTTEXTURE{X}
1008
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
1009
+ #else
1010
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w);
1011
+ #endif
1012
+ #else
1013
+ preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);
1014
+ #ifdef IESLIGHTTEXTURE{X}
1015
+ preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X});
1016
+ #else
1017
+ 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);
1018
+ #endif
1019
+ #endif
1020
+ #elif defined(POINTLIGHT{X})
1021
+ #ifdef LIGHT_FALLOFF_GLTF{X}
1022
+ preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y);
1023
+ #elif defined(LIGHT_FALLOFF_PHYSICAL{X})
1024
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared);
1025
+ #elif defined(LIGHT_FALLOFF_STANDARD{X})
1026
+ preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x);
1027
+ #else
1028
+ preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);
1029
+ #endif
1030
+ #else
1031
+ preInfo{X}.attenuation=1.0;
1032
+ #endif
1033
+ preInfoCoat{X}.attenuation=preInfo{X}.attenuation;
1034
+ #if defined(HEMILIGHT{X})
1035
+ preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness;
1036
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1037
+ preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness;
1038
+ #else
1039
+ 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);
1040
+ #endif
1041
+ preInfo{X}.diffuseRoughness=base_diffuse_roughness;preInfo{X}.surfaceAlbedo=base_color.rgb;
1042
+ #endif
1043
+ #endif
1044
+ `;i.ShaderStore.IncludesShadersStore[eR]||(i.ShaderStore.IncludesShadersStore[eR]=eI);let eT="openpbrDirectLighting",eA=`#ifdef LIGHT{X}
1045
+ {vec3 slab_diffuse=vec3(0.,0.,0.);vec3 slab_translucent=vec3(0.,0.,0.);vec3 slab_glossy=vec3(0.,0.,0.);float specularFresnel=0.0;vec3 specularColoredFresnel=vec3(0.,0.,0.);vec3 slab_metal=vec3(0.,0.,0.);vec3 slab_coat=vec3(0.,0.,0.);float coatFresnel=0.0;vec3 slab_fuzz=vec3(0.,0.,0.);float fuzzFresnel=0.0;
1046
+ #ifdef HEMILIGHT{X}
1047
+ slab_diffuse=computeHemisphericDiffuseLighting(preInfo{X},lightColor{X}.rgb,light{X}.vLightGround);
1048
+ #elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1049
+ slab_diffuse=computeAreaDiffuseLighting(preInfo{X},lightColor{X}.rgb);
1050
+ #else
1051
+ slab_diffuse=computeDiffuseLighting(preInfo{X},lightColor{X}.rgb);
1052
+ #endif
1053
+ #ifdef PROJECTEDLIGHTTEXTURE{X}
1054
+ slab_diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW);
1055
+ #endif
1056
+ #ifdef FUZZ
1057
+ float fuzzNdotH=max(dot(fuzzNormalW,preInfo{X}.H),0.0);vec3 fuzzBrdf=getFuzzBRDFLookup(fuzzNdotH,sqrt(fuzz_roughness));
1058
+ #endif
1059
+ #ifdef THIN_FILM
1060
+ float thin_film_desaturation_scale=(thin_film_ior-1.0)*sqrt(thin_film_thickness*0.001);
1061
+ #endif
1062
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1063
+ slab_glossy=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90);
1064
+ #else
1065
+ {
1066
+ #ifdef ANISOTROPIC_BASE
1067
+ slab_glossy=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,
1068
+ baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,
1069
+ 0.0,lightColor{X}.rgb);
1070
+ #else
1071
+ slab_glossy=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),vec3(1.0),specular_roughness,lightColor{X}.rgb);
1072
+ #endif
1073
+ specularFresnel=fresnelSchlickGGX(preInfo{X}.VdotH,baseDielectricReflectance.F0,baseDielectricReflectance.F90);specularColoredFresnel=specularFresnel*specular_color;
1074
+ #ifdef THIN_FILM
1075
+ vec3 thinFilmDielectricFresnel=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,vec3(baseDielectricReflectance.F0));thinFilmDielectricFresnel=mix(thinFilmDielectricFresnel,vec3(dot(thinFilmDielectricFresnel,vec3(0.3333))),thin_film_desaturation_scale);specularColoredFresnel=mix(specularColoredFresnel,thinFilmDielectricFresnel*specular_color,thin_film_weight*thin_film_ior_scale);
1076
+ #endif
1077
+ }
1078
+ #endif
1079
+ #ifdef REFRACTED_LIGHTS
1080
+ vec3 forwardScatteredLight=vec3(0.0);
1081
+ #if AREALIGHT{X}
1082
+ #else
1083
+ {preLightingInfo preInfoTrans=preInfo{X};
1084
+ #ifdef SCATTERING
1085
+ preInfoTrans.roughness=sqrt(sqrt(max(transmission_roughness_alpha,0.05)));
1086
+ #else
1087
+ preInfoTrans.roughness=transmission_roughness;
1088
+ #endif
1089
+ if (preInfoTrans.NdotLUnclamped<=0.0) {specularFresnel=0.0;specularColoredFresnel=specularFresnel*specular_color;}
1090
+ #ifdef GEOMETRY_THIN_WALLED
1091
+ vec3 refractNormalW=viewDirectionW;
1092
+ #else
1093
+ vec3 refractNormalW=normalW;
1094
+ #endif
1095
+ preInfoTrans.NdotL=0.5*max(dot(-refractNormalW,preInfoTrans.L),0.0)+0.5;
1096
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
1097
+ float diff=min(dispersion_iors[2]-dispersion_iors[0],max(dispersion_iors[0]-1.0,1.0));dispersion_iors[2]+=diff;dispersion_iors[0]-=diff;for (int i=0; i<3; i++) {float eta=1.0/dispersion_iors[i];
1098
+ #elif defined(GEOMETRY_THIN_WALLED)
1099
+ float eta=1.0;
1100
+ #else
1101
+ float eta=1.0/specular_ior;
1102
+ #endif
1103
+ preInfoTrans.H=preInfoTrans.L+min(eta,0.95)*viewDirectionW;float len2=dot(preInfoTrans.H,preInfoTrans.H);if (len2<1e-6) {preInfoTrans.H=preInfoTrans.L;} else {preInfoTrans.H=preInfoTrans.H*inversesqrt(len2);}
1104
+ #ifdef ANISOTROPIC_BASE
1105
+ preInfoTrans.H=-preInfoTrans.H;
1106
+ #endif
1107
+ preInfoTrans.VdotH=dot(viewDirectionW,preInfoTrans.H);
1108
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
1109
+ forwardScatteredLight[i]+=
1110
+ #else
1111
+ forwardScatteredLight+=
1112
+ #endif
1113
+ #if defined(ANISOTROPIC_BASE)
1114
+ computeAnisotropicSpecularLighting(preInfoTrans,viewDirectionW,refractNormalW,
1115
+ baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,
1116
+ transmission_roughness_alpha,lightColor{X}.rgb
1117
+ #else
1118
+ computeSpecularLighting(preInfoTrans,-refractNormalW,vec3(1.0),vec3(1.0),transmission_roughness_alpha,lightColor{X}.rgb
1119
+ #endif
1120
+ #if defined(DISPERSION) && !defined(GEOMETRY_THIN_WALLED)
1121
+ )[i];}
1122
+ #else
1123
+ );
1124
+ #endif
1125
+ #if !defined(GEOMETRY_THIN_WALLED)
1126
+ forwardScatteredLight=mix(forwardScatteredLight,0.25*preInfoTrans.attenuation*lightColor{X}.rgb,clamp(1.0-pow(baseGeoInfo.NdotV,transmission_roughness_alpha),0.0,1.0));
1127
+ #endif
1128
+ #ifdef REFRACTED_BACKGROUND
1129
+ #ifdef GEOMETRY_THIN_WALLED
1130
+ forwardScatteredLight=mix(vec3(0.0),forwardScatteredLight.rgb,0.2*transmission_roughness_alpha);
1131
+ #else
1132
+ forwardScatteredLight=max(vec3(0.0),mix(vec3(0.0),forwardScatteredLight,transmission_roughness_alpha));
1133
+ #endif
1134
+ #endif
1135
+ #ifdef SCATTERING
1136
+ #if !defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) || defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER)
1137
+ preInfoTrans.roughness=1.0;vec3 diffused_forward_scattered_light=computeSpecularLighting(preInfoTrans,normalW,vec3(1.0),vec3(1.0),1.0,lightColor{X}.rgb)*volume_absorption;
1138
+ #endif
1139
+ #ifdef GEOMETRY_THIN_WALLED
1140
+ vec3 forward_scattered_light=forwardScatteredLight*transmission_tint*volumeParams.multi_scatter_color;vec3 back_scattered_light=slab_diffuse*volumeParams.multi_scatter_color;slab_translucent=mix(back_scattered_light,forward_scattered_light,0.5+0.5*volumeParams.anisotropy);
1141
+ #else
1142
+ vec3 back_scattered_normal=normalize(normalW+viewDirectionW);preInfoTrans.NdotL=max(dot(back_scattered_normal,preInfoTrans.L),0.0);preInfoTrans.NdotV=dot(back_scattered_normal,viewDirectionW);preInfoTrans.H=normalize(viewDirectionW+preInfoTrans.L);preInfoTrans.VdotH=clamp(dot(viewDirectionW,preInfoTrans.H),0.0,1.0);preInfoTrans.roughness=0.2;vec3 back_scattered_light=computeSpecularLighting(preInfoTrans,viewDirectionW,vec3(1.0),vec3(0.08),0.0,lightColor{X}.rgb);vec3 forward_scattered_light=(forwardScatteredLight*volume_absorption);vec3 iso_scattered_light=slab_diffuse;vec3 back_scattering=mix(forward_scattered_light,forward_scattered_light+back_scattered_light*backscatter_color,iso_scatter_density);
1143
+ #if defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) && !defined(USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER)
1144
+ vec3 iso_scattering=mix(forward_scattered_light,scattered_light_from_irradiance_texture*volumeParams.multi_scatter_color,iso_scatter_density);
1145
+ #else
1146
+ vec3 iso_scattering=mix(forward_scattered_light,(diffused_forward_scattered_light+iso_scattered_light)*volumeParams.multi_scatter_color,iso_scatter_density);
1147
+ #endif
1148
+ 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;
1149
+ #endif
1150
+ #else
1151
+ slab_translucent=forwardScatteredLight*transmission_tint*volume_absorption;
1152
+ #endif
1153
+ }
1154
+ #endif
1155
+ #endif
1156
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1157
+ slab_metal=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90);
1158
+ #else
1159
+ {
1160
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)
1161
+ vec3 coloredFresnel=getF82Specular(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90,specular_roughness);
1162
+ #else
1163
+ vec3 coloredFresnel=fresnelSchlickGGX(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90);
1164
+ #endif
1165
+ #ifdef THIN_FILM
1166
+ float thinFilmConductorAngle=max(preInfo{X}.VdotH,specular_roughness);vec3 thinFilmConductorFresnel=evalIridescence(thin_film_outside_ior,thin_film_ior,thinFilmConductorAngle,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorFresnel=mix(thinFilmConductorFresnel,vec3(dot(thinFilmConductorFresnel,vec3(0.3333))),thin_film_desaturation_scale);coloredFresnel=mix(coloredFresnel,specular_weight*thinFilmConductorFresnel,thin_film_weight*thin_film_ior_scale);
1167
+ #endif
1168
+ #ifdef ANISOTROPIC_BASE
1169
+ slab_metal=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,0.0,lightColor{X}.rgb);
1170
+ #else
1171
+ slab_metal=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),coloredFresnel,specular_roughness,lightColor{X}.rgb);
1172
+ #endif
1173
+ }
1174
+ #endif
1175
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1176
+ slab_coat=computeAreaSpecularLighting(preInfoCoat{X},light{X}.vLightSpecular.rgb,coatReflectance.F0,coatReflectance.F90);
1177
+ #else
1178
+ {
1179
+ #ifdef ANISOTROPIC_COAT
1180
+ slab_coat=computeAnisotropicSpecularLighting(preInfoCoat{X},viewDirectionW,coatNormalW,
1181
+ coatGeoInfo.anisotropicTangent,coatGeoInfo.anisotropicBitangent,coatGeoInfo.anisotropy,
1182
+ 0.0,lightColor{X}.rgb);
1183
+ #else
1184
+ slab_coat=computeSpecularLighting(preInfoCoat{X},coatNormalW,vec3(coatReflectance.F0),vec3(1.0),coat_roughness,lightColor{X}.rgb);
1185
+ #endif
1186
+ float NdotH=max(dot(coatNormalW,preInfoCoat{X}.H),0.0);coatFresnel=fresnelSchlickGGX(NdotH,coatReflectance.F0,coatReflectance.F90);}
1187
+ #endif
1188
+ vec3 coatAbsorption=vec3(1.0);if (coat_weight>0.0) {float cosTheta_view=max(preInfoCoat{X}.NdotV,0.001);float cosTheta_light=max(preInfoCoat{X}.NdotL,0.001);float fresnel_view=coatReflectance.F0+(1.0-coatReflectance.F0)*pow(1.0-cosTheta_view,5.0);float fresnel_light=coatReflectance.F0+(1.0-coatReflectance.F0)*pow(1.0-cosTheta_light,5.0);float averageReflectance=(fresnel_view+fresnel_light)*0.5;float darkened_transmission=(1.0-averageReflectance)/(1.0+averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);float sin2=1.0-cosTheta_view*cosTheta_view;sin2=sin2/(coat_ior*coat_ior)*coat_weight;float cos_t=sqrt(1.0-sin2);float coatPathLength=1.0/cos_t;float effectivePathLength=coatPathLength*coat_weight;vec3 colored_transmission=pow(coat_color,vec3(effectivePathLength));coatAbsorption=colored_transmission*mix(1.0,darkened_transmission,coat_weight);}
1189
+ #ifdef FUZZ
1190
+ fuzzFresnel=fuzzBrdf.z;vec3 fuzzNormalW=mix(normalW,coatNormalW,coat_weight);float fuzzNdotV=max(dot(fuzzNormalW,viewDirectionW.xyz),0.0);float fuzzNdotL=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);
1191
+ #else
1192
+ vec3 fuzz_color=vec3(0.0);
1193
+ #endif
1194
+ #ifdef PREPASS_IRRADIANCE
1195
+ total_direct_diffuse+=slab_diffuse;
1196
+ #endif
1197
+ vec3 material_dielectric_base=mix(slab_diffuse*base_color.rgb,slab_translucent,surface_translucency_weight);vec3 material_dielectric_gloss=material_dielectric_base*(1.0-specularFresnel)+slab_glossy*specularColoredFresnel;vec3 material_base_substrate=mix(material_dielectric_gloss,slab_metal,base_metalness);vec3 material_coated_base=layer(material_base_substrate,slab_coat,coatFresnel,coatAbsorption,vec3(1.0));material_surface_direct+=layer(material_coated_base,slab_fuzz,fuzzFresnel*fuzz_weight,vec3(1.0),fuzz_color);}
1198
+ #endif
1199
+ `;i.ShaderStore.IncludesShadersStore[eT]||(i.ShaderStore.IncludesShadersStore[eT]=eA);var eN=e.i(68695),eb=e.i(40671),eF=e.i(53251);let eL="openpbrBlockPrePass",eO=`#if SCENE_MRT_COUNT>0
1200
+ float writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;
1201
+ #ifdef PREPASS_POSITION
1202
+ gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
1203
+ #endif
1204
+ #ifdef PREPASS_LOCAL_POSITION
1205
+ gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
1206
+ #endif
1207
+ #if defined(PREPASS_VELOCITY)
1208
+ vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
1209
+ #elif defined(PREPASS_VELOCITY_LINEAR)
1210
+ vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
1211
+ #endif
1212
+ #ifdef PREPASS_ALBEDO
1213
+ gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(base_color,writeGeometryInfo);
1214
+ #endif
1215
+ #ifdef PREPASS_ALBEDO_SQRT
1216
+ vec3 sqAlbedo=sqrt(base_color);
1217
+ #endif
1218
+ #ifdef PREPASS_IRRADIANCE
1219
+ vec3 irradiance=total_direct_diffuse;
1220
+ #ifndef UNLIT
1221
+ #ifdef REFLECTION
1222
+ irradiance+=slab_diffuse_ibl;
1223
+ #endif
1224
+ #endif
1225
+ #ifdef SCATTERING
1226
+ float scatter_mask=min(subsurface_weight+transmission_weight,1.0);
1227
+ #else
1228
+ float scatter_mask=0.0;
1229
+ #endif
1230
+ gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,writeGeometryInfo*scatter_mask);
1231
+ #endif
1232
+ #if defined(PREPASS_COLOR)
1233
+ gl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a);
1234
+ #endif
1235
+ #ifdef PREPASS_DEPTH
1236
+ gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo);
1237
+ #endif
1238
+ #ifdef PREPASS_SCREENSPACE_DEPTH
1239
+ gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);
1240
+ #endif
1241
+ #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
1242
+ gl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);
1243
+ #endif
1244
+ #ifdef PREPASS_NORMAL
1245
+ #ifdef PREPASS_NORMAL_WORLDSPACE
1246
+ gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);
1247
+ #else
1248
+ gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);
1249
+ #endif
1250
+ #endif
1251
+ #ifdef PREPASS_WORLD_NORMAL
1252
+ gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);
1253
+ #endif
1254
+ #ifdef PREPASS_ALBEDO_SQRT
1255
+ gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo);
1256
+ #endif
1257
+ #ifdef PREPASS_REFLECTIVITY
1258
+ #ifndef UNLIT
1259
+ gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;
1260
+ #else
1261
+ gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;
1262
+ #endif
1263
+ #endif
1264
+ #endif
1265
+ `;i.ShaderStore.IncludesShadersStore[eL]||(i.ShaderStore.IncludesShadersStore[eL]=eO);var eC=e.i(19310),eD=e.i(3291);let eP="openpbrPixelShader",eM=`#define OPENPBR_FRAGMENT_SHADER
1266
+ #define CUSTOM_FRAGMENT_EXTENSION
1267
+ #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA)
1268
+ #extension GL_OES_standard_derivatives : enable
1269
+ #endif
1270
+ #ifdef LODBASEDMICROSFURACE
1271
+ #extension GL_EXT_shader_texture_lod : enable
1272
+ #endif
1273
+ #define CUSTOM_FRAGMENT_BEGIN
1274
+ #ifdef LOGARITHMICDEPTH
1275
+ #extension GL_EXT_frag_depth : enable
1276
+ #endif
1277
+ #include<prePassDeclaration>[SCENE_MRT_COUNT]
1278
+ precision highp float;
1279
+ #include<oitDeclaration>
1280
+ #ifndef FROMLINEARSPACE
1281
+ #define FROMLINEARSPACE
1282
+ #endif
1283
+ #include<__decl__openpbrFragment>
1284
+ #include<pbrFragmentExtraDeclaration>
1285
+ #include<__decl__lightFragment>[0..maxSimultaneousLights]
1286
+ #include<openpbrFragmentSamplersDeclaration>
1287
+ #include<imageProcessingDeclaration>
1288
+ #include<clipPlaneFragmentDeclaration>
1289
+ #include<logDepthDeclaration>
1290
+ #include<fogFragmentDeclaration>
1291
+ #include<textureRepetitionFunctions>
1292
+ #include<helperFunctions>
1293
+ #include<subSurfaceScatteringFunctions>
1294
+ #include<importanceSampling>
1295
+ #include<pbrHelperFunctions>
1296
+ #include<imageProcessingFunctions>
1297
+ #include<shadowsFragmentFunctions>
1298
+ #include<harmonicsFunctions>
1299
+ #include<pbrDirectLightingSetupFunctions>
1300
+ #include<pbrDirectLightingFalloffFunctions>
1301
+ #include<pbrBRDFFunctions>
1302
+ #include<hdrFilteringFunctions>
1303
+ #include<pbrDirectLightingFunctions>
1304
+ #include<pbrIBLFunctions>
1305
+ #include<openpbrNormalMapFragmentMainFunctions>
1306
+ #include<openpbrNormalMapFragmentFunctions>
1307
+ #ifdef REFLECTION
1308
+ #include<reflectionFunction>
1309
+ #endif
1310
+ #define CUSTOM_FRAGMENT_DEFINITIONS
1311
+ #include<openpbrDielectricReflectance>
1312
+ #include<openpbrConductorReflectance>
1313
+ #include<openpbrAmbientOcclusionFunctions>
1314
+ #include<openpbrGeometryInfo>
1315
+ #include<openpbrIblFunctions>
1316
+ #include<openpbrVolumeFunctions>
1317
+ vec3 layer(vec3 slab_bottom,vec3 slab_top,float lerp_factor,vec3 bottom_multiplier,vec3 top_multiplier) {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);}
1318
+ void main(void) {
1319
+ #ifdef PREPASS_IRRADIANCE
1320
+ vec3 total_direct_diffuse=vec3(0.0);
1321
+ #endif
1322
+ #define CUSTOM_FRAGMENT_MAIN_BEGIN
1323
+ #include<clipPlaneFragment>
1324
+ #include<pbrBlockNormalGeometric>
1325
+ vec3 coatNormalW=normalW;
1326
+ #include<openpbrNormalMapFragment>
1327
+ #include<openpbrBlockNormalFinal>
1328
+ #include<openpbrBaseLayerData>
1329
+ #include<openpbrTransmissionLayerData>
1330
+ #include<openpbrSubsurfaceLayerData>
1331
+ #include<openpbrCoatLayerData>
1332
+ #include<openpbrThinFilmLayerData>
1333
+ #include<openpbrFuzzLayerData>
1334
+ #include<openpbrAmbientOcclusionData>
1335
+ #define CUSTOM_FRAGMENT_UPDATE_ALPHA
1336
+ #include<depthPrePass>
1337
+ #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
1338
+ #ifdef ANISOTROPIC_COAT
1339
+ geometryInfoAnisoOutParams coatGeoInfo=geometryInfoAniso(
1340
+ coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
1341
+ ,vec3(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN
1342
+ );
1343
+ #else
1344
+ geometryInfoOutParams coatGeoInfo=geometryInfo(
1345
+ coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
1346
+ );
1347
+ #endif
1348
+ specular_roughness=mix(specular_roughness,pow(min(1.0,pow(specular_roughness,4.0)+2.0*pow(coat_roughness,4.0)),0.25),coat_weight);
1349
+ #ifdef ANISOTROPIC_BASE
1350
+ geometryInfoAnisoOutParams baseGeoInfo=geometryInfoAniso(
1351
+ normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
1352
+ ,vec3(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN
1353
+ );
1354
+ #else
1355
+ geometryInfoOutParams baseGeoInfo=geometryInfo(
1356
+ normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
1357
+ );
1358
+ #endif
1359
+ #ifdef FUZZ
1360
+ vec3 fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));vec3 fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);vec3 fuzzBitangent=cross(fuzzNormalW,fuzzTangent);geometryInfoOutParams fuzzGeoInfo=geometryInfo(
1361
+ fuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW
1362
+ );
1363
+ #endif
1364
+ ReflectanceParams coatReflectance;coatReflectance=dielectricReflectance(
1365
+ coat_ior
1366
+ ,1.0
1367
+ ,vec3(1.0)
1368
+ ,coat_weight
1369
+ );
1370
+ #ifdef THIN_FILM
1371
+ float thin_film_outside_ior=mix(1.0,coat_ior,coat_weight);
1372
+ #endif
1373
+ ReflectanceParams baseDielectricReflectance;{float effectiveCoatIor=mix(1.0,coat_ior,coat_weight);baseDielectricReflectance=dielectricReflectance(
1374
+ specular_ior
1375
+ ,effectiveCoatIor
1376
+ ,specular_color
1377
+ ,specular_weight
1378
+ );}
1379
+ ReflectanceParams baseConductorReflectance;baseConductorReflectance=conductorReflectance(base_color,specular_color,specular_weight);vec3 volume_absorption=vec3(1.0);vec3 transmission_tint=vec3(1.0);float surface_translucency_weight=0.0;
1380
+ #if defined(REFRACTED_BACKGROUND) || defined(REFRACTED_ENVIRONMENT) || defined(REFRACTED_LIGHTS)
1381
+ #if defined(GEOMETRY_THIN_WALLED)
1382
+ vec3 refractedViewVector=-viewDirectionW;
1383
+ #else
1384
+ #ifdef DISPERSION
1385
+ vec3 refractedViewVectors[3];float iorDispersionSpread=transmission_dispersion_scale/transmission_dispersion_abbe_number*(specular_ior-1.0);vec3 dispersion_iors=vec3(specular_ior-iorDispersionSpread,specular_ior,specular_ior+iorDispersionSpread);for (int i=0; i<3; i++) {refractedViewVectors[i]=double_refract(-viewDirectionW,normalW,dispersion_iors[i]); }
1386
+ #else
1387
+ vec3 refractedViewVector=double_refract(-viewDirectionW,normalW,specular_ior);
1388
+ #endif
1389
+ #endif
1390
+ #ifdef GEOMETRY_THIN_WALLED
1391
+ float transmission_roughness=specular_roughness;
1392
+ #else
1393
+ float transmission_roughness=specular_roughness*clamp(4.0*(specular_ior-1.0),0.001,1.0);
1394
+ #endif
1395
+ #if (defined(TRANSMISSION_SLAB) || defined(SUBSURFACE_SLAB))
1396
+ OpenPBRHomogeneousVolume volumeParams;{
1397
+ #if defined(TRANSMISSION_SLAB)
1398
+ OpenPBRHomogeneousVolume transmissionVolumeParams=computeOpenPBRTransmissionVolume(
1399
+ transmission_color.rgb,
1400
+ transmission_depth,
1401
+ transmission_scatter.rgb,
1402
+ transmission_scatter_anisotropy
1403
+ );
1404
+ #endif
1405
+ #if defined(SUBSURFACE_SLAB)
1406
+ OpenPBRHomogeneousVolume subsurfaceVolumeParams=computeOpenPBRSubsurfaceVolume(
1407
+ subsurface_color.rgb,
1408
+ subsurface_radius,
1409
+ subsurface_radius_scale.rgb,
1410
+ subsurface_scatter_anisotropy
1411
+ );
1412
+ #endif
1413
+ #if !defined(TRANSMISSION_SLAB)
1414
+ volumeParams=subsurfaceVolumeParams;surface_translucency_weight=subsurface_weight;
1415
+ #elif !defined(SUBSURFACE_SLAB)
1416
+ volumeParams=transmissionVolumeParams;
1417
+ #ifdef TRANSMISSION_SLAB_VOLUME
1418
+ volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);
1419
+ #endif
1420
+ surface_translucency_weight=transmission_weight;
1421
+ #else
1422
+ float subsurface_fraction_of_dielectric=(1.0f-transmission_weight)*subsurface_weight;float subsurface_and_transmission_fraction_of_dielectric=subsurface_fraction_of_dielectric+transmission_weight;float reciprocal_of_subsurface_and_transmission_fraction_of_dielectric =
1423
+ 1.0f/maxEps(subsurface_and_transmission_fraction_of_dielectric);float trans_weight=transmission_weight*reciprocal_of_subsurface_and_transmission_fraction_of_dielectric;float subsurf_weight=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/maxEps(volumeParams.extinction_coeff);volumeParams.multi_scatter_color=singleScatterToMultiScatterAlbedo(volumeParams.ss_albedo);surface_translucency_weight=subsurface_and_transmission_fraction_of_dielectric;
1424
+ #endif
1425
+ }
1426
+ volume_absorption=exp(-volumeParams.absorption_coeff*geometry_thickness);vec3 backscatter_color=vec3(1.0);{vec3 reduced_scatter=volumeParams.scatter_coeff*vec3(1.0-volumeParams.anisotropy);vec3 reduced_albedo=reduced_scatter/(volumeParams.absorption_coeff+reduced_scatter);vec3 sqrt_term=max(sqrt(1.0-reduced_albedo),0.0001);backscatter_color=(1.0-sqrt_term)/(1.0+sqrt_term);}
1427
+ #elif defined(TRANSMISSION_SLAB)
1428
+ surface_translucency_weight=transmission_weight;
1429
+ #endif
1430
+ #ifdef SCATTERING
1431
+ #ifdef GEOMETRY_THIN_WALLED
1432
+ vec3 iso_scatter_density=vec3(1.0);
1433
+ #else
1434
+ #ifdef USE_IRRADIANCE_TEXTURE_FOR_SCATTERING
1435
+ vec3 mfp=vec3(100.0)/volumeParams.extinction_coeff;vec3 scattered_light_from_irradiance_texture=sss_convolve(sceneIrradianceSampler,sceneDepthSampler,renderTargetSize,mfp,projection,inverseProjection,SSS_SAMPLE_COUNT,noise.xy);float numLights=float(LIGHTCOUNT);
1436
+ #ifdef REFLECTION
1437
+ numLights+=1.0;
1438
+ #endif
1439
+ scattered_light_from_irradiance_texture/=numLights;
1440
+ #else
1441
+ vec3 scattered_light_from_irradiance_texture=vec3(0.0);
1442
+ #endif
1443
+ float back_to_iso_scattering_blend=min(1.0+volumeParams.anisotropy,1.0);float iso_to_forward_scattering_blend=max(volumeParams.anisotropy,0.0);vec3 iso_scatter_transmittance=pow(exp(-volumeParams.scatter_coeff*geometry_thickness),vec3(0.2));vec3 iso_scatter_density=clamp(vec3(1.0)-iso_scatter_transmittance,0.0,1.0);transmission_roughness=min(transmission_roughness+pow((1.0-abs(volumeParams.anisotropy))*max3(iso_scatter_density*iso_scatter_density),3.0),1.0);
1444
+ #endif
1445
+ volumeParams.multi_scatter_color=mix(volumeParams.ss_albedo,volumeParams.multi_scatter_color,max3(iso_scatter_density));
1446
+ #endif
1447
+ #if defined(TRANSMISSION_SLAB) && (!defined(TRANSMISSION_SLAB_VOLUME) || defined(GEOMETRY_THIN_WALLED))
1448
+ transmission_tint*=transmission_color.rgb;
1449
+ #ifdef GEOMETRY_THIN_WALLED
1450
+ float sin2=1.0-baseGeoInfo.NdotV*baseGeoInfo.NdotV;sin2=sin2/(specular_ior*specular_ior);float cos_t=sqrt(1.0-sin2);float pathLength=1.0/cos_t;transmission_tint=pow(transmission_tint,vec3(pathLength));
1451
+ #else
1452
+ transmission_tint*=transmission_color.rgb;
1453
+ #endif
1454
+ #endif
1455
+ #if defined(SUBSURFACE_SLAB) && defined(GEOMETRY_THIN_WALLED)
1456
+ float unweighted_translucency=max(mix(subsurface_weight,1.0f,transmission_weight),0.0001);transmission_tint=mix(vec3(1.0),transmission_tint,transmission_weight/unweighted_translucency);transmission_roughness=mix(1.0,transmission_roughness,transmission_weight/unweighted_translucency);
1457
+ #endif
1458
+ float transmission_roughness_alpha=transmission_roughness*transmission_roughness;
1459
+ #endif
1460
+ #include<openpbrBackgroundTransmission>
1461
+ vec3 material_surface_ibl=vec3(0.,0.,0.);
1462
+ #include<openpbrEnvironmentLighting>
1463
+ vec3 material_surface_direct=vec3(0.,0.,0.);
1464
+ #if defined(LIGHT0)
1465
+ float aggShadow=0.;
1466
+ #include<openpbrDirectLightingInit>[0..maxSimultaneousLights]
1467
+ #include<openpbrDirectLighting>[0..maxSimultaneousLights]
1468
+ #endif
1469
+ vec3 material_surface_emission=vEmissionColor;
1470
+ #ifdef EMISSION_COLOR
1471
+ vec3 emissionColorTex=TEXRD(emissionColorSampler,vEmissionColorUV+uvOffset).rgb;
1472
+ #ifdef EMISSION_COLOR_GAMMA
1473
+ material_surface_emission*=toLinearSpace(emissionColorTex.rgb);
1474
+ #else
1475
+ material_surface_emission*=emissionColorTex.rgb;
1476
+ #endif
1477
+ material_surface_emission*= vEmissionColorInfos.y;
1478
+ #endif
1479
+ material_surface_emission*=vLightingIntensity.y;
1480
+ #define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION
1481
+ vec4 finalColor=vec4(material_surface_ibl+material_surface_direct+material_surface_emission,alpha);
1482
+ #define CUSTOM_FRAGMENT_BEFORE_FOG
1483
+ finalColor=max(finalColor,0.0);
1484
+ #include<logDepthFragment>
1485
+ #include<fogFragment>(color,finalColor)
1486
+ #include<pbrBlockImageProcessing>
1487
+ #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
1488
+ #ifdef PREPASS
1489
+ #include<openpbrBlockPrePass>
1490
+ #endif
1491
+ #if !defined(PREPASS) || defined(WEBGL2)
1492
+ gl_FragColor=finalColor;
1493
+ #endif
1494
+ #include<oitFragment>
1495
+ #if ORDER_INDEPENDENT_TRANSPARENCY
1496
+ if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}
1497
+ #endif
1498
+ #include<pbrDebug>
1499
+ #define CUSTOM_FRAGMENT_MAIN_END
1500
+ }
1501
+ `;for(let e of(i.ShaderStore.ShadersStore[eP]||(i.ShaderStore.ShadersStore[eP]=eM),[o.prePassDeclaration,r.oitDeclaration,t.sceneFragmentDeclaration,a.decalFragmentDeclaration,{name:n,shader:s},l.sceneUboDeclaration,c.meshUboDeclaration,f.openpbrUboDeclaration,_.mainUVVaryingDeclaration,d.pbrFragmentExtraDeclaration,m.lightFragmentDeclaration,u.lightUboDeclaration,g.samplerFragmentDeclaration,v.pbrFragmentReflectionDeclaration,{name:E,shader:p},h.imageProcessingDeclaration,S.clipPlaneFragmentDeclaration,R.logDepthDeclaration,I.fogFragmentDeclaration,T.textureRepetitionFunctions,A.helperFunctions,N.subSurfaceScatteringFunctions,b.importanceSampling,F.pbrHelperFunctions,L.imageProcessingFunctions,O.shadowsFragmentFunctions,C.harmonicsFunctions,D.ltcHelperFunctions,P.pbrDirectLightingSetupFunctions,M.pbrDirectLightingFalloffFunctions,G.pbrBRDFFunctions,x.hdrFilteringFunctions,y.pbrDirectLightingFunctions,z.pbrIBLFunctions,{name:U,shader:W},{name:X,shader:w},H.reflectionFunction,B.openpbrDielectricReflectance,{name:V,shader:k},{name:Y,shader:Z},j.openpbrGeometryInfo,q.openpbrIblFunctions,{name:K,shader:Q},J.clipPlaneFragment,$.pbrBlockNormalGeometric,{name:ee,shader:ei},{name:eo,shader:er},{name:et,shader:ea},en.openpbrTransmissionLayerData,es.openpbrSubsurfaceLayerData,{name:el,shader:ec},{name:ef,shader:e_},{name:ed,shader:em},{name:eu,shader:eg},ev.depthPrePass,{name:eE,shader:ep},{name:eh,shader:eS},{name:eR,shader:eI},{name:eT,shader:eA},eN.logDepthFragment,eb.fogFragment,eF.pbrBlockImageProcessing,{name:eL,shader:eO},eC.oitFragment,eD.pbrDebug]))i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);e.s(["openpbrPixelShader",0,{name:eP,shader:eM}],1013)}]);