@uptimizr/dashboard 0.1.3 → 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 (235) 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/09510356f0lad.js +1 -0
  16. package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
  17. package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
  18. package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
  19. package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
  20. package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
  21. package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
  22. package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
  23. package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
  24. package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
  25. package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
  26. package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
  27. package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
  28. package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
  29. package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
  30. package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
  31. package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
  32. package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
  33. package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
  34. package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
  35. package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
  36. package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
  37. package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
  38. package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
  39. package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
  40. package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
  41. package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
  42. package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
  43. package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
  44. package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
  45. package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
  46. package/out/_next/static/chunks/137xbvd4nd41j.js +3 -0
  47. package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
  48. package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
  49. package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
  50. package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
  51. package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
  52. package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
  53. package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
  54. package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
  55. package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
  56. package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
  57. package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
  58. package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
  59. package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
  60. package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
  61. package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
  62. package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
  63. package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
  64. package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
  65. package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
  66. package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
  67. package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
  68. package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
  69. package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
  70. package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
  71. package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
  72. package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
  73. package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
  74. package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
  75. package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
  76. package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
  77. package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
  78. package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
  79. package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
  80. package/out/_next/static/chunks/1tta1a064979p.js +1 -0
  81. package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
  82. package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
  83. package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
  84. package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
  85. package/out/_next/static/chunks/{1flb8adpj6_2o.js → 1xpwp4m1tqugp.js} +1 -1
  86. package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
  87. package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
  88. package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
  89. package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
  90. package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
  91. package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
  92. package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
  93. package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
  94. package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
  95. package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
  96. package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
  97. package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
  98. package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
  99. package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
  100. package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
  101. package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
  102. package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
  103. package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
  104. package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
  105. package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
  106. package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
  107. package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
  108. package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
  109. package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
  110. package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
  111. package/out/_next/static/chunks/2mdbvf1b5h00_.css +3 -0
  112. package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
  113. package/out/_next/static/chunks/2our10fwtj87e.js +1 -0
  114. package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
  115. package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
  116. package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
  117. package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
  118. package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
  119. package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
  120. package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
  121. package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
  122. package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
  123. package/out/_next/static/chunks/2x-00glogc485.js +1 -0
  124. package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
  125. package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
  126. package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
  127. package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
  128. package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
  129. package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
  130. package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
  131. package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
  132. package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
  133. package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
  134. package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
  135. package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
  136. package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
  137. package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
  138. package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
  139. package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
  140. package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
  141. package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
  142. package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
  143. package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
  144. package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
  145. package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
  146. package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
  147. package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
  148. package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
  149. package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
  150. package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
  151. package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
  152. package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
  153. package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
  154. package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
  155. package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
  156. package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
  157. package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
  158. package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
  159. package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
  160. package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
  161. package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
  162. package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
  163. package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
  164. package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
  165. package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
  166. package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
  167. package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
  168. package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
  169. package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
  170. package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
  171. package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
  172. package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
  173. package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
  174. package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
  175. package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
  176. package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
  177. package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
  178. package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
  179. package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
  180. package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
  181. package/out/_not-found/__next._full.txt +9 -9
  182. package/out/_not-found/__next._head.txt +4 -4
  183. package/out/_not-found/__next._index.txt +4 -4
  184. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  185. package/out/_not-found/__next._not-found.txt +3 -3
  186. package/out/_not-found/__next._tree.txt +2 -2
  187. package/out/_not-found.html +1 -1
  188. package/out/_not-found.txt +9 -9
  189. package/out/index.html +1 -1
  190. package/out/index.txt +11 -11
  191. package/package.json +5 -4
  192. package/out/_next/static/chunks/068j6934u8j16.js +0 -1
  193. package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
  194. package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
  195. package/out/_next/static/chunks/0aznt7717miff.js +0 -1
  196. package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
  197. package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
  198. package/out/_next/static/chunks/0o_tpe5tlugtr.js +0 -3
  199. package/out/_next/static/chunks/0pj9pajm2xz97.css +0 -3
  200. package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
  201. package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
  202. package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
  203. package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
  204. package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
  205. package/out/_next/static/chunks/11v6j6q59u-f_.js +0 -1
  206. package/out/_next/static/chunks/123xxske5c9na.js +0 -1
  207. package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
  208. package/out/_next/static/chunks/157d9euci08yu.js +0 -1
  209. package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
  210. package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
  211. package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
  212. package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
  213. package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
  214. package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
  215. package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
  216. package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
  217. package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
  218. package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
  219. package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
  220. package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
  221. package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
  222. package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
  223. package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
  224. package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
  225. package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
  226. package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
  227. package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
  228. package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
  229. package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
  230. package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
  231. package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
  232. package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
  233. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → M9ZSIaKJeBgkjz1qktYio}/_buildManifest.js +0 -0
  234. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → M9ZSIaKJeBgkjz1qktYio}/_clientMiddlewareManifest.js +0 -0
  235. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → M9ZSIaKJeBgkjz1qktYio}/_ssgManifest.js +0 -0
@@ -0,0 +1,779 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,4357,e=>{"use strict";var r=e.i(12423);let t="helperFunctions",a=`const PI: f32=3.1415926535897932384626433832795;const TWO_PI: f32=6.283185307179586;const HALF_PI: f32=1.5707963267948966;const RECIPROCAL_PI: f32=0.3183098861837907;const RECIPROCAL_PI2: f32=0.15915494309189535;const RECIPROCAL_PI4: f32=0.07957747154594767;const HALF_MIN: f32=5.96046448e-08;
2
+ const LinearEncodePowerApprox: f32=2.2;const GammaEncodePowerApprox: f32=1.0/LinearEncodePowerApprox;const LuminanceEncodeApprox: vec3f=vec3f(0.2126,0.7152,0.0722);const Epsilon:f32=0.0000001;fn square(x: f32)->f32 {return x*x;}
3
+ fn saturate(x: f32)->f32 {return clamp(x,0.0,1.0);}
4
+ fn saturateVec3(x: vec3f)->vec3f {return clamp(x,vec3f(),vec3f(1.0));}
5
+ fn saturateEps(x: f32)->f32 {return clamp(x,Epsilon,1.0);}
6
+ fn maxEps(x: f32)->f32 {return max(x,Epsilon);}
7
+ fn maxEpsVec3(x: vec3f)->vec3f {return max(x,vec3f(Epsilon));}
8
+ fn absEps(x: f32)->f32 {return abs(x)+Epsilon;}
9
+ fn transposeMat3(inMatrix: mat3x3f)->mat3x3f {let i0: vec3f=inMatrix[0];let i1: vec3f=inMatrix[1];let i2: vec3f=inMatrix[2];let outMatrix:mat3x3f=mat3x3f(
10
+ vec3(i0.x,i1.x,i2.x),
11
+ vec3(i0.y,i1.y,i2.y),
12
+ vec3(i0.z,i1.z,i2.z)
13
+ );return outMatrix;}
14
+ fn inverseMat3(inMatrix: mat3x3f)->mat3x3f {let a00: f32=inMatrix[0][0];let a01: f32=inMatrix[0][1];let a02: f32=inMatrix[0][2];let a10: f32=inMatrix[1][0];let a11: f32=inMatrix[1][1];let a12: f32=inMatrix[1][2];let a20: f32=inMatrix[2][0];let a21: f32=inMatrix[2][1];let a22: f32=inMatrix[2][2];let b01: f32=a22*a11-a12*a21;let b11: f32=-a22*a10+a12*a20;let b21: f32=a21*a10-a11*a20;let det: f32=a00*b01+a01*b11+a02*b21;return mat3x3f(b01/det,(-a22*a01+a02*a21)/det,(a12*a01-a02*a11)/det,
15
+ b11/det,(a22*a00-a02*a20)/det,(-a12*a00+a02*a10)/det,
16
+ b21/det,(-a21*a00+a01*a20)/det,(a11*a00-a01*a10)/det);}
17
+ #if USE_EXACT_SRGB_CONVERSIONS
18
+ fn toLinearSpaceExact(color: vec3f)->vec3f
19
+ {let nearZeroSection: vec3f=0.0773993808*color;let remainingSection: vec3f=pow(0.947867299*(color+vec3f(0.055)),vec3f(2.4));return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.04045)));}
20
+ fn toGammaSpaceExact(color: vec3f)->vec3f
21
+ {let nearZeroSection: vec3f=12.92*color;let remainingSection: vec3f=1.055*pow(color,vec3f(0.41666))-vec3f(0.055);return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.0031308)));}
22
+ #endif
23
+ fn toLinearSpace(color: f32)->f32
24
+ {
25
+ #if USE_EXACT_SRGB_CONVERSIONS
26
+ var nearZeroSection=0.0773993808*color;var remainingSection=pow(0.947867299*(color+0.055),2.4);return select(remainingSection,nearZeroSection,color<=0.04045);
27
+ #else
28
+ return pow(color,LinearEncodePowerApprox);
29
+ #endif
30
+ }
31
+ fn toLinearSpaceVec3(color: vec3f)->vec3f
32
+ {
33
+ #if USE_EXACT_SRGB_CONVERSIONS
34
+ return toLinearSpaceExact(color);
35
+ #else
36
+ return pow(color,vec3f(LinearEncodePowerApprox));
37
+ #endif
38
+ }
39
+ fn toLinearSpaceVec4(color: vec4<f32>)->vec4<f32>
40
+ {
41
+ #if USE_EXACT_SRGB_CONVERSIONS
42
+ return vec4f(toLinearSpaceExact(color.rgb),color.a);
43
+ #else
44
+ return vec4f(pow(color.rgb,vec3f(LinearEncodePowerApprox)),color.a);
45
+ #endif
46
+ }
47
+ fn toGammaSpace(color: vec4<f32>)->vec4<f32>
48
+ {
49
+ #if USE_EXACT_SRGB_CONVERSIONS
50
+ return vec4<f32>(toGammaSpaceExact(color.rgb),color.a);
51
+ #else
52
+ return vec4<f32>(pow(color.rgb,vec3f(GammaEncodePowerApprox)),color.a);
53
+ #endif
54
+ }
55
+ fn toGammaSpaceVec3(color: vec3f)->vec3f
56
+ {
57
+ #if USE_EXACT_SRGB_CONVERSIONS
58
+ return toGammaSpaceExact(color);
59
+ #else
60
+ return pow(color,vec3f(GammaEncodePowerApprox));
61
+ #endif
62
+ }
63
+ fn squareVec3(value: vec3f)->vec3f
64
+ {return value*value;}
65
+ fn pow5(value: f32)->f32 {let sq: f32=value*value;return sq*sq*value;}
66
+ fn double_refract(I: vec3f,N: vec3f,eta: f32)->vec3f {let Tfront: vec3f=refract(I,N,1.0/eta);let Nback: vec3f=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);}
67
+ fn getLuminanceUnclamped(color: vec3f)->f32
68
+ {return dot(color,LuminanceEncodeApprox);}
69
+ fn getLuminance(color: vec3f)->f32
70
+ {return saturate(getLuminanceUnclamped(color));}
71
+ fn getRand(seed: vec2<f32>)->f32 {return fract(sin(dot(seed.xy ,vec2<f32>(12.9898,78.233)))*43758.5453);}
72
+ fn dither(seed: vec2<f32>,varianceAmount: f32)->f32 {let rand: f32=getRand(seed);let normVariance: f32=varianceAmount/255.0;let dither: f32=mix(-normVariance,normVariance,rand);return dither;}
73
+ const rgbdMaxRange: f32=255.0;fn toRGBD(color: vec3f)->vec4<f32> {let maxRGB: f32=max(max(color.r,max(color.g,color.b)),Epsilon);var D: f32 =max(rgbdMaxRange/maxRGB,1.);D =clamp(floor(D)/255.0,0.,1.);var rgb: vec3f =color.rgb*D;rgb=toGammaSpaceVec3(rgb);return vec4<f32>(saturateVec3(rgb),D);}
74
+ fn fromRGBD(rgbd: vec4<f32>)->vec3f {let rgb=toLinearSpaceVec3(rgbd.rgb);return rgb/rgbd.a;}
75
+ fn parallaxCorrectNormal(vertexPos: vec3f,origVec: vec3f,cubeSize: vec3f,cubePos: vec3f)->vec3f {let invOrigVec: vec3f=vec3f(1.)/origVec;let halfSize: vec3f=cubeSize*0.5;let intersecAtMaxPlane: vec3f=(cubePos+halfSize-vertexPos)*invOrigVec;let intersecAtMinPlane: vec3f=(cubePos-halfSize-vertexPos)*invOrigVec;let largestIntersec: vec3f=max(intersecAtMaxPlane,intersecAtMinPlane);let distance: f32=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);let intersectPositionWS: vec3f=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}
76
+ fn equirectangularToCubemapDirection(uv : vec2f)->vec3f {var longitude : f32=uv.x*TWO_PI-PI;var latitude : f32=HALF_PI-uv.y*PI;var direction : vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}
77
+ fn sqrtClamped(value: f32)->f32 {return sqrt(max(value,0.));}
78
+ fn avg(value: vec3f)->f32 {return dot(value,vec3f(0.333333333));}
79
+ fn singleScatterToMultiScatterAlbedo(rho_ss: vec3f)->vec3f {let s: vec3f=sqrt(max(vec3f(1.0)-rho_ss,vec3f(0.0)));return (vec3f(1.0)-s)*(vec3f(1.0)-vec3f(0.139)*s)/(vec3f(1.0)+vec3f(1.17)*s);}
80
+ fn multiScatterToSingleScatterAlbedo(rho_ms: vec3f)->vec3f {let s: vec3f=4.09712f+4.20863f*rho_ms-sqrt(9.59217f+41.6808f*rho_ms+17.7126f*rho_ms*rho_ms);return 1.0f-s*s;}
81
+ fn multiScatterToSingleScatterAlbedoWithAniso(rho_ms: vec3f,aniso: f32)->vec3f {let s: vec3f=4.09712+4.20863f*rho_ms-sqrt(9.59217f+41.6808f*rho_ms+17.7126f*rho_ms*rho_ms);return (vec3f(1.0f)-s*s)/maxEpsVec3(vec3f(1.0f)-vec3f(aniso)*s*s);}
82
+ fn min3(v: vec3f)->f32 {return min(v.x,min(v.y,v.z));}
83
+ fn max3(v: vec3f)->f32 {return max(v.x,max(v.y,v.z));}
84
+ fn uint2float(i: u32)->f32 {return bitcast<f32>(0x3F800000u | (i>>9u))-1.0;}
85
+ fn plasticSequence(rstate: u32)->vec2f {return vec2f(uint2float(rstate*3242174889u),
86
+ uint2float(rstate*2447445414u));}
87
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["helperFunctionsWGSL",0,{name:t,shader:a}])},60106,e=>{"use strict";var r=e.i(12423);let t="sceneUboDeclaration",a=`struct Scene {viewProjection : mat4x4<f32>,
88
+ #ifdef MULTIVIEW
89
+ viewProjectionR : mat4x4<f32>,
90
+ #endif
91
+ view : mat4x4<f32>,
92
+ projection : mat4x4<f32>,
93
+ vEyePosition : vec4<f32>,
94
+ inverseProjection : mat4x4<f32>,};
95
+ #define SCENE_UBO
96
+ var<uniform> scene : Scene;
97
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["sceneUboDeclarationWGSL",0,{name:t,shader:a}])},50008,39780,54758,e=>{"use strict";var r=e.i(12423);let t="meshUboDeclaration",a=`struct Mesh {world : mat4x4<f32>,
98
+ visibility : f32,};var<uniform> mesh : Mesh;
99
+ #define WORLD_UBO
100
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["meshUboDeclarationWGSL",0,{name:t,shader:a}],50008);let o="mainUVVaryingDeclaration",f=`#ifdef MAINUV{X}
101
+ varying vMainUV{X}: vec2f;
102
+ #endif
103
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["mainUVVaryingDeclarationWGSL",0,{name:o,shader:f}],39780);let i="logDepthDeclaration",v=`#ifdef LOGARITHMICDEPTH
104
+ uniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;
105
+ #endif
106
+ `;r.ShaderStore.IncludesShadersStoreWGSL[i]||(r.ShaderStore.IncludesShadersStoreWGSL[i]=v),e.s(["logDepthDeclarationWGSL",0,{name:i,shader:v}],54758)},35182,63406,e=>{"use strict";var r=e.i(12423);let t="clipPlaneFragmentDeclaration",a=`#ifdef CLIPPLANE
107
+ varying fClipDistance: f32;
108
+ #endif
109
+ #ifdef CLIPPLANE2
110
+ varying fClipDistance2: f32;
111
+ #endif
112
+ #ifdef CLIPPLANE3
113
+ varying fClipDistance3: f32;
114
+ #endif
115
+ #ifdef CLIPPLANE4
116
+ varying fClipDistance4: f32;
117
+ #endif
118
+ #ifdef CLIPPLANE5
119
+ varying fClipDistance5: f32;
120
+ #endif
121
+ #ifdef CLIPPLANE6
122
+ varying fClipDistance6: f32;
123
+ #endif
124
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["clipPlaneFragmentDeclarationWGSL",0,{name:t,shader:a}],35182);let o="clipPlaneFragment",f=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
125
+ if (false) {}
126
+ #endif
127
+ #ifdef CLIPPLANE
128
+ else if (fragmentInputs.fClipDistance>0.0)
129
+ {discard;}
130
+ #endif
131
+ #ifdef CLIPPLANE2
132
+ else if (fragmentInputs.fClipDistance2>0.0)
133
+ {discard;}
134
+ #endif
135
+ #ifdef CLIPPLANE3
136
+ else if (fragmentInputs.fClipDistance3>0.0)
137
+ {discard;}
138
+ #endif
139
+ #ifdef CLIPPLANE4
140
+ else if (fragmentInputs.fClipDistance4>0.0)
141
+ {discard;}
142
+ #endif
143
+ #ifdef CLIPPLANE5
144
+ else if (fragmentInputs.fClipDistance5>0.0)
145
+ {discard;}
146
+ #endif
147
+ #ifdef CLIPPLANE6
148
+ else if (fragmentInputs.fClipDistance6>0.0)
149
+ {discard;}
150
+ #endif
151
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["clipPlaneFragmentWGSL",0,{name:o,shader:f}],63406)},25626,31213,e=>{"use strict";var r=e.i(12423);let t="fogFragmentDeclaration",a=`#ifdef FOG
152
+ #define FOGMODE_NONE 0.
153
+ #define FOGMODE_EXP 1.
154
+ #define FOGMODE_EXP2 2.
155
+ #define FOGMODE_LINEAR 3.
156
+ const E=2.71828;uniform vFogInfos: vec4f;uniform vFogColor: vec3f;varying vFogDistance: vec3f;fn CalcFogFactor()->f32
157
+ {var fogCoeff: f32=1.0;var fogStart: f32=uniforms.vFogInfos.y;var fogEnd: f32=uniforms.vFogInfos.z;var fogDensity: f32=uniforms.vFogInfos.w;var fogDistance: f32=length(fragmentInputs.vFogDistance);if (FOGMODE_LINEAR==uniforms.vFogInfos.x)
158
+ {fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}
159
+ else if (FOGMODE_EXP==uniforms.vFogInfos.x)
160
+ {fogCoeff=1.0/pow(E,fogDistance*fogDensity);}
161
+ else if (FOGMODE_EXP2==uniforms.vFogInfos.x)
162
+ {fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}
163
+ return clamp(fogCoeff,0.0,1.0);}
164
+ #endif
165
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["fogFragmentDeclarationWGSL",0,{name:t,shader:a}],25626);let o="fogFragment",f=`#ifdef FOG
166
+ var fog: f32=CalcFogFactor();
167
+ #ifdef PBR
168
+ fog=toLinearSpace(fog);
169
+ #endif
170
+ color= vec4f(mix(uniforms.vFogColor,color.rgb,fog),color.a);
171
+ #endif
172
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["fogFragmentWGSL",0,{name:o,shader:f}],31213)},19640,22548,14640,e=>{"use strict";var r=e.i(12423);let t="prePassDeclaration",a=`#ifdef PREPASS
173
+ #ifdef PREPASS_LOCAL_POSITION
174
+ varying vPosition : vec3f;
175
+ #endif
176
+ #ifdef PREPASS_DEPTH
177
+ varying vViewPos: vec3f;
178
+ #endif
179
+ #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
180
+ varying vNormViewDepth: f32;
181
+ #endif
182
+ #if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)
183
+ varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;
184
+ #endif
185
+ #endif
186
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["prePassDeclarationWGSL",0,{name:t,shader:a}],19640);let o="oitDeclaration",f=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
187
+ #define MAX_DEPTH 99999.0
188
+ var oitDepthSamplerSampler: sampler;var oitDepthSampler: texture_2d<f32>;var oitFrontColorSamplerSampler: sampler;var oitFrontColorSampler: texture_2d<f32>;
189
+ #endif
190
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["oitDeclarationWGSL",0,{name:o,shader:f}],22548);let i="lightUboDeclaration",v=`#ifdef LIGHT{X}
191
+ struct Light{X}
192
+ {vLightData: vec4f,
193
+ vLightDiffuse: vec4f,
194
+ vLightSpecular: vec4f,
195
+ #ifdef SPOTLIGHT{X}
196
+ vLightDirection: vec4f,
197
+ vLightFalloff: vec4f,
198
+ #elif defined(POINTLIGHT{X})
199
+ vLightFalloff: vec4f,
200
+ #elif defined(HEMILIGHT{X})
201
+ vLightGround: vec3f,
202
+ #elif defined(CLUSTLIGHT{X})
203
+ vSliceData: vec2f,
204
+ vSliceRanges: array<vec4f,CLUSTLIGHT_SLICES>,
205
+ #endif
206
+ #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
207
+ vLightWidth: vec4f,
208
+ vLightHeight: vec4f,
209
+ #endif
210
+ shadowsInfo: vec4f,
211
+ depthValues: vec2f} ;var<uniform> light{X} : Light{X};
212
+ #ifdef IESLIGHTTEXTURE{X}
213
+ var iesLightTexture{X}Sampler: sampler;var iesLightTexture{X}: texture_2d<f32>;
214
+ #endif
215
+ #ifdef RECTAREALIGHTEMISSIONTEXTURE{X}
216
+ var rectAreaLightEmissionTexture{X}Sampler: sampler;var rectAreaLightEmissionTexture{X}: texture_2d<f32>;
217
+ #endif
218
+ #ifdef PROJECTEDLIGHTTEXTURE{X}
219
+ uniform textureProjectionMatrix{X}: mat4x4f;var projectionLightTexture{X}Sampler: sampler;var projectionLightTexture{X}: texture_2d<f32>;
220
+ #endif
221
+ #ifdef CLUSTLIGHT{X}
222
+ var lightDataTexture{X}: texture_2d<f32>;var<storage,read> tileMaskBuffer{X}: array<u32>;
223
+ #endif
224
+ #ifdef SHADOW{X}
225
+ #ifdef SHADOWCSM{X}
226
+ uniform lightMatrix{X}: array<mat4x4f,SHADOWCSMNUM_CASCADES{X}>;uniform viewFrustumZ{X}: array<f32,SHADOWCSMNUM_CASCADES{X}>;uniform frustumLengths{X}: array<f32,SHADOWCSMNUM_CASCADES{X}>;uniform cascadeBlendFactor{X}: f32;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f;var<private> vPositionFromLight{X}: array<vec4f,4>;var<private> vDepthMetric{X} : array<f32,4>;
227
+ #if defined(SHADOWPCSS{X})
228
+ var shadowTexture{X}Sampler: sampler_comparison;
229
+ var shadowTexture{X}: texture_depth_2d_array;var depthTexture{X}Sampler: sampler;var depthTexture{X}: texture_2d_array<f32>;uniform lightSizeUVCorrection{X}: array<vec2f,SHADOWCSMNUM_CASCADES{X}>;uniform depthCorrection{X}: array<f32,SHADOWCSMNUM_CASCADES{X}>;uniform penumbraDarkness{X}: f32;
230
+ #elif defined(SHADOWPCF{X})
231
+ var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d_array;
232
+ #else
233
+ var shadowTexture{X}Sampler: sampler;
234
+ var shadowTexture{X}: texture_2d_array<f32>;
235
+ #endif
236
+ #ifdef SHADOWCSMDEBUG{X}
237
+ const vCascadeColorsMultiplier{X}: array<vec3f,8>=array<vec3f,8>
238
+ (
239
+ vec3f ( 1.5,0.0,0.0 ),
240
+ vec3f ( 0.0,1.5,0.0 ),
241
+ vec3f ( 0.0,0.0,5.5 ),
242
+ vec3f ( 1.5,0.0,5.5 ),
243
+ vec3f ( 1.5,1.5,0.0 ),
244
+ vec3f ( 1.0,1.0,1.0 ),
245
+ vec3f ( 0.0,1.0,5.5 ),
246
+ vec3f ( 0.5,3.5,0.75 )
247
+ );
248
+ #endif
249
+ #elif defined(SHADOWCUBE{X})
250
+ var shadowTexture{X}Sampler: sampler;var shadowTexture{X}: texture_cube<f32>;
251
+ #else
252
+ varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;
253
+ #if defined(SHADOWPCSS{X})
254
+ var shadowTexture{X}Sampler: sampler_comparison;
255
+ var shadowTexture{X}: texture_depth_2d;var depthTexture{X}Sampler: sampler;
256
+ var depthTexture{X}: texture_2d<f32>;
257
+ #elif defined(SHADOWPCF{X})
258
+ var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d;
259
+ #else
260
+ var shadowTexture{X}Sampler: sampler;
261
+ var shadowTexture{X}: texture_2d<f32>;
262
+ #endif
263
+ uniform lightMatrix{X}: mat4x4f;
264
+ #endif
265
+ #endif
266
+ #endif
267
+ `;r.ShaderStore.IncludesShadersStoreWGSL[i]||(r.ShaderStore.IncludesShadersStoreWGSL[i]=v),e.s(["lightUboDeclarationWGSL",0,{name:i,shader:v}],14640)},42420,87850,e=>{"use strict";var r=e.i(12423);let t="ltcHelperFunctions",a=`fn LTCUv(N: vec3f,V: vec3f,roughness: f32)->vec2f {var LUTSIZE: f32=64.0;var LUTSCALE: f32=( LUTSIZE-1.0 )/LUTSIZE;var LUTBIAS:f32=0.5/LUTSIZE;var dotNV:f32=saturate( dot( N,V ) );var uv:vec2f=vec2f( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;}
268
+ fn LTCClippedSphereFormFactor( f:vec3f )->f32 {var l: f32=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );}
269
+ fn LTCEdgeVectorFormFactor( v1:vec3f,v2:vec3f )->vec3f {var x:f32=dot( v1,v2 );var y:f32=abs( x );var a:f32=0.8543985+( 0.4965155+0.0145206*y )*y;var b:f32=3.4175940+( 4.1616724+y )*y;var v:f32=a/b;var thetaSintheta:f32=0.0;if( x>0.0 )
270
+ {thetaSintheta=v;}
271
+ else
272
+ {thetaSintheta=0.5*inverseSqrt( max( 1.0-x*x,0.00000001 ) )-v;}
273
+ return cross( v1,v2 )*thetaSintheta;}
274
+ fn LTCEvaluate( N:vec3f,V:vec3f,P:vec3f,mInv: mat3x3<f32>,rectCoords0:vec3f,rectCoords1:vec3f,rectCoords2:vec3f,rectCoords3:vec3f )->vec3f {var v1:vec3f=rectCoords1-rectCoords0;var v2:vec3f=rectCoords3-rectCoords0;var lightNormal:vec3f=cross( v1,v2 );if( dot( lightNormal,P-rectCoords0 )<0.0 ){return vec3f( 0.0 );}
275
+ var T1:vec3f=normalize( V-N*dot( V,N ) );var T2:vec3f=- cross( N,T1 );
276
+ var mat: mat3x3<f32>=mInv*transposeMat3( mat3x3<f32>( T1,T2,N ) );var coords0: vec3f=mat*( rectCoords0-P );var coords1: vec3f=mat*( rectCoords1-P );var coords2: vec3f=mat*( rectCoords2-P );var coords3: vec3f=mat*( rectCoords3-P );coords0=normalize( coords0 );coords1=normalize( coords1 );coords2=normalize( coords2 );coords3=normalize( coords3 );var vectorFormFactor:vec3f=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords0,coords1 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords1,coords2 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords2,coords3 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords3,coords0 );var result:f32=LTCClippedSphereFormFactor( vectorFormFactor );return vec3f( result );}
277
+ struct areaLightData
278
+ {Diffuse: vec3f,
279
+ Specular: vec3f,
280
+ Fresnel: vec4f};fn computeAreaLightSpecularDiffuseFresnel(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDir: vec3f,normal:vec3f,position:vec3f,lightPos:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->areaLightData {var result: areaLightData;var rectCoords0:vec3f=lightPos+halfWidth-halfHeight;
281
+ var rectCoords1:vec3f=lightPos-halfWidth-halfHeight;var rectCoords2:vec3f=lightPos-halfWidth+halfHeight;var rectCoords3:vec3f=lightPos+halfWidth+halfHeight;
282
+ #ifdef SPECULARTERM
283
+ var uv:vec2f=LTCUv( normal,viewDir,roughness );var t1:vec4f=textureSample( ltc1,ltc1Sampler,uv );var t2:vec4f=textureSample( ltc2,ltc2Sampler,uv );var mInv:mat3x3<f32>=mat3x3<f32>(
284
+ vec3f( t1.x,0,t1.y ),
285
+ vec3f( 0,1, 0 ),
286
+ vec3f( t1.z,0,t1.w )
287
+ );result.Fresnel=t2;result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );
288
+ #endif
289
+ var mInvEmpty:mat3x3<f32>=mat3x3<f32>(
290
+ vec3f( 1,0,0 ),
291
+ vec3f( 0,1,0 ),
292
+ vec3f( 0,0,1 )
293
+ );result.Diffuse+=LTCEvaluate( normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );return result;}
294
+ fn FetchDiffuseFilteredTexture(texLightFiltered: texture_2d<f32>,texLightFilteredSampler: sampler,p1_: vec3f,p2_: vec3f,p3_: vec3f,p4_: vec3f)->vec3f {var V1: vec3f=p2_-p1_;var V2: vec3f=p4_-p1_;var planeOrtho: vec3f=cross(V1,V2);var planeAreaSquared: f32=dot(planeOrtho,planeOrtho);var planeDistxPlaneArea: f32=dot(planeOrtho,p1_);var P: vec3f=planeDistxPlaneArea*planeOrtho/planeAreaSquared-p1_;var dot_V1_V2: f32=dot(V1,V2);var inv_dot_V1_V1: f32=1.0/dot(V1,V1);var V2_: vec3f=V2-V1*dot_V1_V2*inv_dot_V1_V1;var Puv: vec2f;Puv.y=dot(V2_,P)/dot(V2_,V2_);Puv.x=dot(V1,P)*inv_dot_V1_V1-dot_V1_V2*inv_dot_V1_V1*Puv.y;var d: f32=abs(planeDistxPlaneArea)/pow(planeAreaSquared,0.75);var sampleLOD: f32=log(2048.0*d)/log(3.0);var sampleUV: vec2f=vec2f(0.125,0.125)+(vec2f(0.75)*Puv);sampleUV.x=1.0-sampleUV.x;return textureSampleLevel(texLightFiltered,texLightFilteredSampler,sampleUV,sampleLOD).rgb;}
295
+ fn LTCEvaluateWithEmission(N: vec3f,V: vec3f,P: vec3f,mInv: mat3x3<f32>,rectCoords0: vec3f,rectCoords1: vec3f,rectCoords2: vec3f,rectCoords3: vec3f,texFilteredMap: texture_2d<f32>,texFilteredMapSampler: sampler)->vec3f {var v1: vec3f=rectCoords1-rectCoords0;var v2: vec3f=rectCoords3-rectCoords0;var lightNormal: vec3f=cross(v1,v2);if (dot(lightNormal,P-rectCoords0)<0.0) {return vec3f(0.0);}
296
+ var T1: vec3f=normalize(V-N*dot(V,N));var T2: vec3f=-cross(N,T1);var mat: mat3x3<f32>=mInv*transposeMat3(mat3x3<f32>(T1,T2,N));var coords0: vec3f=mat*(rectCoords0-P);var coords1: vec3f=mat*(rectCoords1-P);var coords2: vec3f=mat*(rectCoords2-P);var coords3: vec3f=mat*(rectCoords3-P);var textureLight: vec3f=FetchDiffuseFilteredTexture(texFilteredMap,texFilteredMapSampler,coords0,coords1,coords2,coords3);coords0=normalize(coords0);coords1=normalize(coords1);coords2=normalize(coords2);coords3=normalize(coords3);var vectorFormFactor: vec3f=vec3f(0.0);vectorFormFactor+=LTCEdgeVectorFormFactor(coords0,coords1);vectorFormFactor+=LTCEdgeVectorFormFactor(coords1,coords2);vectorFormFactor+=LTCEdgeVectorFormFactor(coords2,coords3);vectorFormFactor+=LTCEdgeVectorFormFactor(coords3,coords0);var result: f32=LTCClippedSphereFormFactor(vectorFormFactor);return vec3f(result)*textureLight;}
297
+ fn computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,emissionTexture: texture_2d<f32>,emissionTextureSampler:sampler,viewDir: vec3f,normal:vec3f,position:vec3f,lightPos:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->areaLightData {var result: areaLightData;var rectCoords0: vec3f=lightPos+halfWidth-halfHeight;
298
+ var rectCoords1: vec3f=lightPos-halfWidth-halfHeight;var rectCoords2: vec3f=lightPos-halfWidth+halfHeight;var rectCoords3: vec3f=lightPos+halfWidth+halfHeight;
299
+ #ifdef SPECULARTERM
300
+ var uv: vec2f=LTCUv(normal,viewDir,roughness);var t1: vec4f=textureSample(ltc1,ltc1Sampler,uv);var t2: vec4f=textureSample(ltc2,ltc2Sampler,uv);var mInv: mat3x3<f32>=mat3x3<f32>(
301
+ vec3f(t1.x,0,t1.y),
302
+ vec3f(0,1,0),
303
+ vec3f(t1.z,0,t1.w)
304
+ );result.Specular=LTCEvaluateWithEmission(normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3,emissionTexture,emissionTextureSampler);result.Fresnel=t2;
305
+ #endif
306
+ var mInvEmpty: mat3x3<f32>=mat3x3<f32>(
307
+ vec3f(1,0,0),
308
+ vec3f(0,1,0),
309
+ vec3f(0,0,1)
310
+ );result.Diffuse=LTCEvaluateWithEmission(normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3,emissionTexture,emissionTextureSampler);return result;}
311
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["ltcHelperFunctionsWGSL",0,{name:t,shader:a}],42420);let o="clusteredLightingFunctions",f=`struct ClusteredLight {vLightData: vec4f,
312
+ vLightDiffuse: vec4f,
313
+ vLightSpecular: vec4f,
314
+ vLightDirection: vec4f,
315
+ vLightFalloff: vec4f,}
316
+ fn getClusteredLight(lightDataTexture: texture_2d<f32>,index: u32)->ClusteredLight {return ClusteredLight(
317
+ textureLoad(lightDataTexture,vec2u(0,index),0),
318
+ textureLoad(lightDataTexture,vec2u(1,index),0),
319
+ textureLoad(lightDataTexture,vec2u(2,index),0),
320
+ textureLoad(lightDataTexture,vec2u(3,index),0),
321
+ textureLoad(lightDataTexture,vec2u(4,index),0)
322
+ );}
323
+ fn getClusteredSliceIndex(sliceData: vec2f,viewDepth: f32)->i32 {return i32(log(viewDepth)*sliceData.x+sliceData.y);}
324
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["clusteredLightingFunctionsWGSL",0,{name:o,shader:f}],87850)},60315,e=>{"use strict";var r=e.i(12423);let t="shadowsFragmentFunctions",a=`#ifdef SHADOWS
325
+ #ifndef SHADOWFLOAT
326
+ fn unpack(color: vec4f)->f32
327
+ {const bit_shift: vec4f= vec4f(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}
328
+ #endif
329
+ fn computeFallOff(value: f32,clipSpace: vec2f,frustumEdgeFalloff: f32)->f32
330
+ {var mask: f32=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}
331
+ fn computeShadowCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthValues: vec2f)->f32
332
+ {var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
333
+ #ifndef SHADOWFLOAT
334
+ var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
335
+ #else
336
+ var shadow: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
337
+ #endif
338
+ return select(1.0,darkness,depth>shadow);}
339
+ fn computeShadowWithPoissonSamplingCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,mapSize: f32,darkness: f32,depthValues: vec2f)->f32
340
+ {var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;var visibility: f32=1.;var poissonDisk: array<vec3f,4>;poissonDisk[0]= vec3f(-1.0,1.0,-1.0);poissonDisk[1]= vec3f(1.0,-1.0,-1.0);poissonDisk[2]= vec3f(-1.0,-1.0,-1.0);poissonDisk[3]= vec3f(1.0,-1.0,1.0);
341
+ #ifndef SHADOWFLOAT
342
+ if (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) {visibility-=0.25;};if (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) {visibility-=0.25;};if (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) {visibility-=0.25;};if (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) {visibility-=0.25;};
343
+ #else
344
+ if (textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) {visibility-=0.25;};if (textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) {visibility-=0.25;};if (textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) {visibility-=0.25;};if (textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) {visibility-=0.25;};
345
+ #endif
346
+ return min(1.0,visibility+darkness);}
347
+ fn computeShadowWithESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32
348
+ {var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
349
+ #ifndef SHADOWFLOAT
350
+ var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
351
+ #else
352
+ var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
353
+ #endif
354
+ var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return esm;}
355
+ fn computeShadowWithCloseESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32
356
+ {var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
357
+ #ifndef SHADOWFLOAT
358
+ var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
359
+ #else
360
+ var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
361
+ #endif
362
+ var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return esm;}
363
+ fn computeShadowCSM(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d_array<f32>,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32
364
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
365
+ #ifndef SHADOWFLOAT
366
+ var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,uv,layer));
367
+ #else
368
+ var shadow: f32=textureSample(shadowTexture,shadowSampler,uv,layer).x;
369
+ #endif
370
+ return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}
371
+ fn computeShadow(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32
372
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
373
+ {return 1.0;}
374
+ else
375
+ {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
376
+ #ifndef SHADOWFLOAT
377
+ var shadow: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
378
+ #else
379
+ var shadow: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
380
+ #endif
381
+ return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}}
382
+ fn computeShadowWithPoissonSampling(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,mapSize: f32,darkness: f32,frustumEdgeFalloff: f32)->f32
383
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
384
+ {return 1.0;}
385
+ else
386
+ {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);var visibility: f32=1.;var poissonDisk: array<vec2f,4>;poissonDisk[0]= vec2f(-0.94201624,-0.39906216);poissonDisk[1]= vec2f(0.94558609,-0.76890725);poissonDisk[2]= vec2f(-0.094184101,-0.92938870);poissonDisk[3]= vec2f(0.34495938,0.29387760);
387
+ #ifndef SHADOWFLOAT
388
+ if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
389
+ if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[1]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
390
+ if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[2]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
391
+ if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[3]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
392
+ #else
393
+ if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
394
+ if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[1]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
395
+ if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[2]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
396
+ if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[3]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
397
+ #endif
398
+ return computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);}}
399
+ fn computeShadowWithESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32
400
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
401
+ {return 1.0;}
402
+ else
403
+ {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
404
+ #ifndef SHADOWFLOAT
405
+ var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
406
+ #else
407
+ var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
408
+ #endif
409
+ var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
410
+ fn computeShadowWithCloseESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32
411
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
412
+ {return 1.0;}
413
+ else
414
+ {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
415
+ #ifndef SHADOWFLOAT
416
+ var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
417
+ #else
418
+ var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
419
+ #endif
420
+ var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
421
+ fn getZInClip(clipSpace: vec3f,uvDepth: vec3f)->f32
422
+ {
423
+ #ifdef IS_NDC_HALF_ZRANGE
424
+ return clipSpace.z;
425
+ #else
426
+ return uvDepth.z;
427
+ #endif
428
+ }
429
+ const GREATEST_LESS_THAN_ONE: f32=0.99999994;
430
+ #define DISABLE_UNIFORMITY_ANALYSIS
431
+ fn computeShadowWithCSMPCF1(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32
432
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var shadow: f32=textureSampleCompare(shadowTexture,shadowSampler,uvDepth.xy,layer,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
433
+ fn computeShadowWithCSMPCF3(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
434
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x;
435
+ uv+=0.5;
436
+ var st: vec2f=fract(uv);
437
+ var base_uv: vec2f=floor(uv)-0.5;
438
+ base_uv*=shadowMapSizeAndInverse.y;
439
+ var uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
440
+ fn computeShadowWithCSMPCF5(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
441
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x;
442
+ uv+=0.5;
443
+ var st: vec2f=fract(uv);
444
+ var base_uv: vec2f=floor(uv)-0.5;
445
+ base_uv*=shadowMapSizeAndInverse.y;
446
+ var uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),layer,uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),layer,uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),layer,uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),layer,uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
447
+ fn computeShadowWithPCF1(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32
448
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var shadow: f32=textureSampleCompareLevel(shadowTexture,shadowSampler,uvDepth.xy,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
449
+ fn computeShadowWithPCF3(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
450
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x;
451
+ uv+=0.5;
452
+ var st: vec2f=fract(uv);
453
+ var base_uv: vec2f=floor(uv)-0.5;
454
+ base_uv*=shadowMapSizeAndInverse.y;
455
+ var uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
456
+ fn computeShadowWithPCF5(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
457
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x;
458
+ uv+=0.5;
459
+ var st: vec2f=fract(uv);
460
+ var base_uv: vec2f=floor(uv)-0.5;
461
+ base_uv*=shadowMapSizeAndInverse.y;
462
+ var uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
463
+ const PoissonSamplers32: array<vec3f,64>=array<vec3f,64> (
464
+ vec3f(0.06407013,0.05409927,0.),
465
+ vec3f(0.7366577,0.5789394,0.),
466
+ vec3f(-0.6270542,-0.5320278,0.),
467
+ vec3f(-0.4096107,0.8411095,0.),
468
+ vec3f(0.6849564,-0.4990818,0.),
469
+ vec3f(-0.874181,-0.04579735,0.),
470
+ vec3f(0.9989998,0.0009880066,0.),
471
+ vec3f(-0.004920578,-0.9151649,0.),
472
+ vec3f(0.1805763,0.9747483,0.),
473
+ vec3f(-0.2138451,0.2635818,0.),
474
+ vec3f(0.109845,0.3884785,0.),
475
+ vec3f(0.06876755,-0.3581074,0.),
476
+ vec3f(0.374073,-0.7661266,0.),
477
+ vec3f(0.3079132,-0.1216763,0.),
478
+ vec3f(-0.3794335,-0.8271583,0.),
479
+ vec3f(-0.203878,-0.07715034,0.),
480
+ vec3f(0.5912697,0.1469799,0.),
481
+ vec3f(-0.88069,0.3031784,0.),
482
+ vec3f(0.5040108,0.8283722,0.),
483
+ vec3f(-0.5844124,0.5494877,0.),
484
+ vec3f(0.6017799,-0.1726654,0.),
485
+ vec3f(-0.5554981,0.1559997,0.),
486
+ vec3f(-0.3016369,-0.3900928,0.),
487
+ vec3f(-0.5550632,-0.1723762,0.),
488
+ vec3f(0.925029,0.2995041,0.),
489
+ vec3f(-0.2473137,0.5538505,0.),
490
+ vec3f(0.9183037,-0.2862392,0.),
491
+ vec3f(0.2469421,0.6718712,0.),
492
+ vec3f(0.3916397,-0.4328209,0.),
493
+ vec3f(-0.03576927,-0.6220032,0.),
494
+ vec3f(-0.04661255,0.7995201,0.),
495
+ vec3f(0.4402924,0.3640312,0.),
496
+ vec3f(0.),
497
+ vec3f(0.),
498
+ vec3f(0.),
499
+ vec3f(0.),
500
+ vec3f(0.),
501
+ vec3f(0.),
502
+ vec3f(0.),
503
+ vec3f(0.),
504
+ vec3f(0.),
505
+ vec3f(0.),
506
+ vec3f(0.),
507
+ vec3f(0.),
508
+ vec3f(0.),
509
+ vec3f(0.),
510
+ vec3f(0.),
511
+ vec3f(0.),
512
+ vec3f(0.),
513
+ vec3f(0.),
514
+ vec3f(0.),
515
+ vec3f(0.),
516
+ vec3f(0.),
517
+ vec3f(0.),
518
+ vec3f(0.),
519
+ vec3f(0.),
520
+ vec3f(0.),
521
+ vec3f(0.),
522
+ vec3f(0.),
523
+ vec3f(0.),
524
+ vec3f(0.),
525
+ vec3f(0.),
526
+ vec3f(0.),
527
+ vec3f(0.)
528
+ );const PoissonSamplers64: array<vec3f,64>=array<vec3f,64> (
529
+ vec3f(-0.613392,0.617481,0.),
530
+ vec3f(0.170019,-0.040254,0.),
531
+ vec3f(-0.299417,0.791925,0.),
532
+ vec3f(0.645680,0.493210,0.),
533
+ vec3f(-0.651784,0.717887,0.),
534
+ vec3f(0.421003,0.027070,0.),
535
+ vec3f(-0.817194,-0.271096,0.),
536
+ vec3f(-0.705374,-0.668203,0.),
537
+ vec3f(0.977050,-0.108615,0.),
538
+ vec3f(0.063326,0.142369,0.),
539
+ vec3f(0.203528,0.214331,0.),
540
+ vec3f(-0.667531,0.326090,0.),
541
+ vec3f(-0.098422,-0.295755,0.),
542
+ vec3f(-0.885922,0.215369,0.),
543
+ vec3f(0.566637,0.605213,0.),
544
+ vec3f(0.039766,-0.396100,0.),
545
+ vec3f(0.751946,0.453352,0.),
546
+ vec3f(0.078707,-0.715323,0.),
547
+ vec3f(-0.075838,-0.529344,0.),
548
+ vec3f(0.724479,-0.580798,0.),
549
+ vec3f(0.222999,-0.215125,0.),
550
+ vec3f(-0.467574,-0.405438,0.),
551
+ vec3f(-0.248268,-0.814753,0.),
552
+ vec3f(0.354411,-0.887570,0.),
553
+ vec3f(0.175817,0.382366,0.),
554
+ vec3f(0.487472,-0.063082,0.),
555
+ vec3f(-0.084078,0.898312,0.),
556
+ vec3f(0.488876,-0.783441,0.),
557
+ vec3f(0.470016,0.217933,0.),
558
+ vec3f(-0.696890,-0.549791,0.),
559
+ vec3f(-0.149693,0.605762,0.),
560
+ vec3f(0.034211,0.979980,0.),
561
+ vec3f(0.503098,-0.308878,0.),
562
+ vec3f(-0.016205,-0.872921,0.),
563
+ vec3f(0.385784,-0.393902,0.),
564
+ vec3f(-0.146886,-0.859249,0.),
565
+ vec3f(0.643361,0.164098,0.),
566
+ vec3f(0.634388,-0.049471,0.),
567
+ vec3f(-0.688894,0.007843,0.),
568
+ vec3f(0.464034,-0.188818,0.),
569
+ vec3f(-0.440840,0.137486,0.),
570
+ vec3f(0.364483,0.511704,0.),
571
+ vec3f(0.034028,0.325968,0.),
572
+ vec3f(0.099094,-0.308023,0.),
573
+ vec3f(0.693960,-0.366253,0.),
574
+ vec3f(0.678884,-0.204688,0.),
575
+ vec3f(0.001801,0.780328,0.),
576
+ vec3f(0.145177,-0.898984,0.),
577
+ vec3f(0.062655,-0.611866,0.),
578
+ vec3f(0.315226,-0.604297,0.),
579
+ vec3f(-0.780145,0.486251,0.),
580
+ vec3f(-0.371868,0.882138,0.),
581
+ vec3f(0.200476,0.494430,0.),
582
+ vec3f(-0.494552,-0.711051,0.),
583
+ vec3f(0.612476,0.705252,0.),
584
+ vec3f(-0.578845,-0.768792,0.),
585
+ vec3f(-0.772454,-0.090976,0.),
586
+ vec3f(0.504440,0.372295,0.),
587
+ vec3f(0.155736,0.065157,0.),
588
+ vec3f(0.391522,0.849605,0.),
589
+ vec3f(-0.620106,-0.328104,0.),
590
+ vec3f(0.789239,-0.419965,0.),
591
+ vec3f(-0.545396,0.538133,0.),
592
+ vec3f(-0.178564,-0.596057,0.)
593
+ );fn computeShadowWithCSMPCSS(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array<vec3f,64>,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32
594
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uvDepthLayer: vec4f= vec4f(uvDepth.x,uvDepth.y,f32(layer),uvDepth.z);var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;for (var i: i32=0; i<searchTapCount; i ++) {blockerDepth=textureSample(depthTexture,depthSampler, uvDepth.xy+(lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse*PoissonSamplers32[i].xy),layer).r;numBlocker+=select(0.,1.,blockerDepth<depthMetric);sumBlockerDepth+=select(0.,blockerDepth,blockerDepth<depthMetric);}
595
+ var avgBlockerDepth: f32=sumBlockerDepth/numBlocker;var AAOffset: f32=shadowMapSizeInverse*10.;var penumbraRatio: f32=((depthMetric-avgBlockerDepth)*depthCorrection+AAOffset);var filterRadius: vec4f= vec4f(penumbraRatio*lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse,0.,0.);var random: f32=getRand(vPositionFromLight.xy);var rotationAngle: f32=random*3.1415926;var rotationVector: vec2f= vec2f(cos(rotationAngle),sin(rotationAngle));var shadow: f32=0.;for (var i: i32=0; i<pcfTapCount; i++) {var offset: vec4f= vec4f(poissonSamplers[i],0.);offset= vec4f(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.,0.);let coords=uvDepthLayer+offset*filterRadius;shadow+=textureSampleCompare(shadowTexture,shadowSampler,coords.xy,i32(coords.z),coords.w);}
596
+ shadow/= f32(pcfTapCount);shadow=mix(shadow,1.,min((depthMetric-avgBlockerDepth)*depthCorrection*penumbraDarkness,1.));shadow=mix(darkness,1.,shadow);return select(computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff),1.0,numBlocker<1.0);}
597
+ fn computeShadowWithPCSS(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array<vec3f,64>)->f32
598
+ {var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;}
599
+ var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;for (var i: i32=0; i<searchTapCount; i ++) {blockerDepth=textureSampleLevel(depthTexture,depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy),0).r;numBlocker+=select(0.,1.,blockerDepth<depthMetric);sumBlockerDepth+=select(0.,blockerDepth,blockerDepth<depthMetric);}
600
+ if (numBlocker<1.0) {return 1.0;}
601
+ var avgBlockerDepth: f32=sumBlockerDepth/numBlocker;var AAOffset: f32=shadowMapSizeInverse*10.;var penumbraRatio: f32=((depthMetric-avgBlockerDepth)+AAOffset);var filterRadius: f32=penumbraRatio*lightSizeUV*shadowMapSizeInverse;var random: f32=getRand(vPositionFromLight.xy);var rotationAngle: f32=random*3.1415926;var rotationVector: vec2f= vec2f(cos(rotationAngle),sin(rotationAngle));var shadow: f32=0.;for (var i: i32=0; i<pcfTapCount; i++) {var offset: vec3f=poissonSamplers[i];offset= vec3f(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);let coords=uvDepth+offset*filterRadius;shadow+=textureSampleCompareLevel(shadowTexture,shadowSampler,coords.xy,coords.z);}
602
+ shadow/= f32(pcfTapCount);shadow=mix(shadow,1.,depthMetric-avgBlockerDepth);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
603
+ fn computeShadowWithPCSS16(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32
604
+ {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);}
605
+ fn computeShadowWithPCSS32(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32
606
+ {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);}
607
+ fn computeShadowWithPCSS64(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32
608
+ {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);}
609
+ fn computeShadowWithCSMPCSS16(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32
610
+ {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
611
+ fn computeShadowWithCSMPCSS32(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32
612
+ {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
613
+ fn computeShadowWithCSMPCSS64(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array<f32>,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32
614
+ {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
615
+ #endif
616
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["shadowsFragmentFunctionsWGSL",0,{name:t,shader:a}])},61059,e=>{"use strict";var r=e.i(12423);let t="imageProcessingDeclaration",a=`#ifdef EXPOSURE
617
+ uniform exposureLinear: f32;
618
+ #endif
619
+ #ifdef CONTRAST
620
+ uniform contrast: f32;
621
+ #endif
622
+ #if defined(VIGNETTE) || defined(DITHER)
623
+ uniform vInverseScreenSize: vec2f;
624
+ #endif
625
+ #ifdef VIGNETTE
626
+ uniform vignetteSettings1: vec4f;uniform vignetteSettings2: vec4f;
627
+ #endif
628
+ #ifdef COLORCURVES
629
+ uniform vCameraColorCurveNegative: vec4f;uniform vCameraColorCurveNeutral: vec4f;uniform vCameraColorCurvePositive: vec4f;
630
+ #endif
631
+ #ifdef COLORGRADING
632
+ #ifdef COLORGRADING3D
633
+ var txColorTransformSampler: sampler;var txColorTransform: texture_3d<f32>;
634
+ #else
635
+ var txColorTransformSampler: sampler;var txColorTransform: texture_2d<f32>;
636
+ #endif
637
+ uniform colorTransformSettings: vec4f;
638
+ #endif
639
+ #ifdef DITHER
640
+ uniform ditherIntensity: f32;
641
+ #endif
642
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["imageProcessingDeclarationWGSL",0,{name:t,shader:a}])},30733,e=>{"use strict";var r=e.i(12423);let t="imageProcessingFunctions",a=`#if TONEMAPPING==3
643
+ const PBRNeutralStartCompression: f32=0.8-0.04;const PBRNeutralDesaturation: f32=0.15;fn PBRNeutralToneMapping( color: vec3f )->vec3f {var x: f32=min(color.r,min(color.g,color.b));var offset: f32=select(0.04,x-6.25*x*x,x<0.08);var result=color;result-=offset;var peak: f32=max(result.r,max(result.g,result.b));if (peak<PBRNeutralStartCompression) {return result;}
644
+ var d: f32=1.-PBRNeutralStartCompression;var newPeak: f32=1.-d*d/(peak+d-PBRNeutralStartCompression);result*=newPeak/peak;var g: f32=1.-1./(PBRNeutralDesaturation*(peak-newPeak)+1.);return mix(result,newPeak* vec3f(1,1,1),g);}
645
+ #endif
646
+ #if TONEMAPPING==2
647
+ const ACESInputMat: mat3x3f= mat3x3f(
648
+ vec3f(0.59719,0.07600,0.02840),
649
+ vec3f(0.35458,0.90834,0.13383),
650
+ vec3f(0.04823,0.01566,0.83777)
651
+ );const ACESOutputMat: mat3x3f= mat3x3f(
652
+ vec3f( 1.60475,-0.10208,-0.00327),
653
+ vec3f(-0.53108, 1.10813,-0.07276),
654
+ vec3f(-0.07367,-0.00605, 1.07602)
655
+ );fn RRTAndODTFit(v: vec3f)->vec3f
656
+ {var a: vec3f=v*(v+0.0245786)-0.000090537;var b: vec3f=v*(0.983729*v+0.4329510)+0.238081;return a/b;}
657
+ fn ACESFitted(color: vec3f)->vec3f
658
+ {var output=ACESInputMat*color;output=RRTAndODTFit(output);output=ACESOutputMat*output;output=saturateVec3(output);return output;}
659
+ #endif
660
+ #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS
661
+ fn applyImageProcessing(result: vec4f)->vec4f {
662
+ #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART
663
+ var rgb=result.rgb;;
664
+ #ifdef EXPOSURE
665
+ rgb*=uniforms.exposureLinear;
666
+ #endif
667
+ #ifdef VIGNETTE
668
+ var viewportXY: vec2f=fragmentInputs.position.xy*uniforms.vInverseScreenSize;viewportXY=viewportXY*2.0-1.0;var vignetteXY1: vec3f= vec3f(viewportXY*uniforms.vignetteSettings1.xy+uniforms.vignetteSettings1.zw,1.0);var vignetteTerm: f32=dot(vignetteXY1,vignetteXY1);var vignette: f32=pow(vignetteTerm,uniforms.vignetteSettings2.w);var vignetteColor: vec3f=uniforms.vignetteSettings2.rgb;
669
+ #ifdef VIGNETTEBLENDMODEMULTIPLY
670
+ var vignetteColorMultiplier: vec3f=mix(vignetteColor, vec3f(1,1,1),vignette);rgb*=vignetteColorMultiplier;
671
+ #endif
672
+ #ifdef VIGNETTEBLENDMODEOPAQUE
673
+ rgb=mix(vignetteColor,rgb,vignette);
674
+ #endif
675
+ #endif
676
+ #if TONEMAPPING==3
677
+ rgb=PBRNeutralToneMapping(rgb);
678
+ #elif TONEMAPPING==2
679
+ rgb=ACESFitted(rgb);
680
+ #elif TONEMAPPING==1
681
+ const tonemappingCalibration: f32=1.590579;rgb=1.0-exp2(-tonemappingCalibration*rgb);
682
+ #endif
683
+ rgb=toGammaSpaceVec3(rgb);rgb=saturateVec3(rgb);
684
+ #ifdef CONTRAST
685
+ var resultHighContrast: vec3f=rgb*rgb*(3.0-2.0*rgb);if (uniforms.contrast<1.0) {rgb=mix( vec3f(0.5,0.5,0.5),rgb,uniforms.contrast);} else {rgb=mix(rgb,resultHighContrast,uniforms.contrast-1.0);}
686
+ rgb=max(rgb,vec3f(0.));
687
+ #endif
688
+ #ifdef COLORGRADING
689
+ var colorTransformInput: vec3f=rgb*uniforms.colorTransformSettings.xxx+uniforms.colorTransformSettings.yyy;
690
+ #ifdef COLORGRADING3D
691
+ var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput).rgb;
692
+ #else
693
+ var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput,uniforms.colorTransformSettings.yz).rgb;
694
+ #endif
695
+ rgb=mix(rgb,colorTransformOutput,uniforms.colorTransformSettings.www);
696
+ #endif
697
+ #ifdef COLORCURVES
698
+ var luma: f32=getLuminance(rgb);var curveMix: vec2f=clamp( vec2f(luma*3.0-1.5,luma*-3.0+1.5), vec2f(0.0), vec2f(1.0));var colorCurve: vec4f=uniforms.vCameraColorCurveNeutral+curveMix.x*uniforms.vCameraColorCurvePositive-curveMix.y*uniforms.vCameraColorCurveNegative;rgb*=colorCurve.rgb;rgb=mix( vec3f(luma),rgb,colorCurve.a);
699
+ #endif
700
+ #ifdef DITHER
701
+ var rand: f32=getRand(fragmentInputs.position.xy*uniforms.vInverseScreenSize);var dither: f32=mix(-uniforms.ditherIntensity,uniforms.ditherIntensity,rand);rgb=saturateVec3(rgb+ vec3f(dither));
702
+ #endif
703
+ #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND
704
+ return vec4f(rgb,result.a);}`;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["imageProcessingFunctionsWGSL",0,{name:t,shader:a}])},69488,e=>{"use strict";var r=e.i(12423);let t="textureRepetitionFunctions",a=`#if TEXTURE_REPETITION_MODE>0
705
+ fn _texRepHash4(p: vec2f)->vec4f {return fract(sin(vec4f(
706
+ 1.0+dot(p,vec2f(37.0,17.0)),
707
+ 2.0+dot(p,vec2f(11.0,47.0)),
708
+ 3.0+dot(p,vec2f(41.0,29.0)),
709
+ 4.0+dot(p,vec2f(23.0,31.0))
710
+ ))*103.0);}
711
+ #endif
712
+ #if TEXTURE_REPETITION_MODE==1
713
+ fn _texRepSample(tex: texture_2d<f32>,samp: sampler,uv: vec2f)->vec4f {var k: f32=textureSample(tex,samp,0.005*uv).x;var index: f32=k*8.0;var f: f32=fract(index);var i: f32=floor(index+0.5);var ib: f32=floor(index);f=min(f,1.0-f)*2.0;var offa: vec2f=sin(vec2f(3.0,7.0)*i);var offb: vec2f=sin(vec2f(3.0,7.0)*ib);var dx: vec2f=dpdx(uv);var dy: vec2f=dpdy(uv);var cola: vec4f=textureSampleGrad(tex,samp,uv+0.3*offa,dx,dy);var colb: vec4f=textureSampleGrad(tex,samp,uv+0.3*offb,dx,dy);var colSum: f32=cola.x+cola.y+cola.z-colb.x-colb.y-colb.z;return mix(cola,colb,vec4f(smoothstep(0.2,0.8,f-0.1*colSum)));}
714
+ #elif TEXTURE_REPETITION_MODE==2
715
+ fn _texRepHexHash(p: vec2f)->vec2f {var r: vec2f=mat2x2f(127.1,269.5,311.7,183.3)*p;return fract(sin(r)*43758.5453);}
716
+ struct _TexRepTriGrid {w1: f32,
717
+ w2: f32,
718
+ w3: f32,
719
+ vertex1: vec2i,
720
+ vertex2: vec2i,
721
+ vertex3: vec2i,};fn _texRepTriangleGrid(st_in: vec2f)->_TexRepTriGrid {var st: vec2f=st_in*2.0*sqrt(3.0);var gridToSkewedGrid: mat2x2f=mat2x2f(1.0,0.0,-0.57735027,1.15470054);var skewedCoord: vec2f=gridToSkewedGrid*st;var baseId: vec2i=vec2i(floor(skewedCoord));var temp: vec3f=vec3f(fract(skewedCoord),0.0);temp.z=1.0-temp.x-temp.y;var s: f32=step(0.0,-temp.z);var s2: f32=2.0*s-1.0;var result: _TexRepTriGrid;result.w1=-temp.z*s2;result.w2=s-temp.y*s2;result.w3=s-temp.x*s2;result.vertex1=baseId+vec2i(i32(s),i32(s));result.vertex2=baseId+vec2i(i32(s),i32(1.0-s));result.vertex3=baseId+vec2i(i32(1.0-s),i32(s));return result;}
722
+ fn _texRepMakeCenST(Vertex: vec2i)->vec2f {var invSkewMat: mat2x2f=mat2x2f(1.0,0.0,0.5,1.0/1.15470054);return (invSkewMat*vec2f(Vertex))/(2.0*sqrt(3.0));}
723
+ fn _texRepLoadRot2x2(idx: vec2i,rotStr: f32)->mat2x2f {var angle: f32=f32(abs(idx.x*idx.y)+abs(idx.x+idx.y))+3.14159265358979;angle=angle % (2.0*3.14159265358979);if (angle<0.0) { angle+=2.0*3.14159265358979; }
724
+ if (angle>3.14159265358979) { angle-=3.14159265358979; }
725
+ angle*=rotStr;var cs: f32=cos(angle);var si: f32=sin(angle);return mat2x2f(cs,si,-si,cs);}
726
+ fn _texRepGain3(x: vec3f,r: f32)->vec3f {var k: f32=log(1.0-r)/log(0.5);var s: vec3f=2.0*step(vec3f(0.5),x);var m: vec3f=2.0*(1.0-s);var res: vec3f=0.5*s+0.25*m*pow(max(vec3f(0.0),s+x*m),vec3f(k));return res/(res.x+res.y+res.z);}
727
+ fn _texRepSample(tex: texture_2d<f32>,samp: sampler,uv: vec2f)->vec4f {var rotStrength: f32=uniforms.vTextureRepetitionHexTilingParams.x;var fallOffContrast: f32=uniforms.vTextureRepetitionHexTilingParams.y;var expVal: f32=uniforms.vTextureRepetitionHexTilingParams.z;var r: f32=uniforms.vTextureRepetitionHexTilingParams.w;var dSTdx: vec2f=dpdx(uv);var dSTdy: vec2f=dpdy(uv);var grid: _TexRepTriGrid=_texRepTriangleGrid(uv);var rot1: mat2x2f=_texRepLoadRot2x2(grid.vertex1,rotStrength);var rot2: mat2x2f=_texRepLoadRot2x2(grid.vertex2,rotStrength);var rot3: mat2x2f=_texRepLoadRot2x2(grid.vertex3,rotStrength);var cen1: vec2f=_texRepMakeCenST(grid.vertex1);var cen2: vec2f=_texRepMakeCenST(grid.vertex2);var cen3: vec2f=_texRepMakeCenST(grid.vertex3);var st1: vec2f=(uv-cen1)*rot1+cen1+_texRepHexHash(vec2f(grid.vertex1));var st2: vec2f=(uv-cen2)*rot2+cen2+_texRepHexHash(vec2f(grid.vertex2));var st3: vec2f=(uv-cen3)*rot3+cen3+_texRepHexHash(vec2f(grid.vertex3));var c1: vec4f=textureSampleGrad(tex,samp,st1,dSTdx*rot1,dSTdy*rot1);var c2: vec4f=textureSampleGrad(tex,samp,st2,dSTdx*rot2,dSTdy*rot2);var c3: vec4f=textureSampleGrad(tex,samp,st3,dSTdx*rot3,dSTdy*rot3);var Lw: vec3f=vec3f(0.299,0.587,0.114);var Dw: vec3f=vec3f(dot(c1.rgb,Lw),dot(c2.rgb,Lw),dot(c3.rgb,Lw));Dw=mix(vec3f(1.0),Dw,fallOffContrast);var W: vec3f=Dw*pow(vec3f(grid.w1,grid.w2,grid.w3),vec3f(expVal));W=W/(W.x+W.y+W.z);if (r != 0.5) {W=_texRepGain3(W,r);}
728
+ return W.x*c1+W.y*c2+W.z*c3;}
729
+ #elif TEXTURE_REPETITION_MODE==3
730
+ fn _texRepSample(tex: texture_2d<f32>,samp: sampler,uv: vec2f)->vec4f {var iuv: vec2f=floor(uv);var fuv: vec2f=fract(uv);var ofa: vec4f=_texRepHash4(iuv+vec2f(0.0,0.0));var ofb: vec4f=_texRepHash4(iuv+vec2f(1.0,0.0));var ofc: vec4f=_texRepHash4(iuv+vec2f(0.0,1.0));var ofd: vec4f=_texRepHash4(iuv+vec2f(1.0,1.0));var dx: vec2f=dpdx(uv);var dy: vec2f=dpdy(uv);ofa=vec4f(ofa.xy,sign(ofa.zw-0.5));ofb=vec4f(ofb.xy,sign(ofb.zw-0.5));ofc=vec4f(ofc.xy,sign(ofc.zw-0.5));ofd=vec4f(ofd.xy,sign(ofd.zw-0.5));var uva: vec2f=uv*ofa.zw+ofa.xy; var ddxa: vec2f=dx*ofa.zw; var ddya: vec2f=dy*ofa.zw;var uvb: vec2f=uv*ofb.zw+ofb.xy; var ddxb: vec2f=dx*ofb.zw; var ddyb: vec2f=dy*ofb.zw;var uvc: vec2f=uv*ofc.zw+ofc.xy; var ddxc: vec2f=dx*ofc.zw; var ddyc: vec2f=dy*ofc.zw;var uvd: vec2f=uv*ofd.zw+ofd.xy; var ddxd: vec2f=dx*ofd.zw; var ddyd: vec2f=dy*ofd.zw;var b: vec2f=smoothstep(vec2f(0.25),vec2f(0.75),fuv);return mix(
731
+ mix(textureSampleGrad(tex,samp,uva,ddxa,ddya),textureSampleGrad(tex,samp,uvb,ddxb,ddyb),b.x),
732
+ mix(textureSampleGrad(tex,samp,uvc,ddxc,ddyc),textureSampleGrad(tex,samp,uvd,ddxd,ddyd),b.x),
733
+ b.y
734
+ );}
735
+ #elif TEXTURE_REPETITION_MODE==4
736
+ fn _texRepSample(tex: texture_2d<f32>,samp: sampler,uv: vec2f)->vec4f {var p: vec2f=floor(uv);var f: vec2f=fract(uv);var dx: vec2f=dpdx(uv);var dy: vec2f=dpdy(uv);var va: vec4f=vec4f(0.0);var wt: f32=0.0;var w2: f32=0.0;for (var j: i32=-1; j<=1; j++) {for (var i: i32=-1; i<=1; i++) {var g: vec2f=vec2f(f32(i),f32(j));var o: vec4f=_texRepHash4(p+g);var r: vec2f=g-f+o.xy;var d: f32=dot(r,r);var w: f32=exp(-5.0*d);var c: vec4f=textureSampleGrad(tex,samp,uv+o.zw,dx,dy);va+=w*c;wt+=w;w2+=w*w;}}
737
+ var mean: f32=0.3;var res: vec4f=mean+(va-wt*mean)/sqrt(w2);return mix(va/wt,res,0.4);}
738
+ #endif
739
+ #if TEXTURE_REPETITION_MODE>0
740
+ fn TEXRD(t: texture_2d<f32>,ts: sampler,uv: vec2f)->vec4f {return _texRepSample(t,ts,uv);}
741
+ #else
742
+ fn TEXRD(t: texture_2d<f32>,ts: sampler,uv: vec2f)->vec4f {return textureSample(t,ts,uv);}
743
+ #endif
744
+ #define TEXRD_DEFINED
745
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["textureRepetitionFunctionsWGSL",0,{name:t,shader:a}])},31329,23009,4818,e=>{"use strict";var r=e.i(12423);let t="depthPrePass",a=`#ifdef DEPTHPREPASS
746
+ #if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
747
+ fragmentOutputs.color= vec4f(0.,0.,0.,1.0);
748
+ #endif
749
+ return fragmentOutputs;
750
+ #endif
751
+ `;r.ShaderStore.IncludesShadersStoreWGSL[t]||(r.ShaderStore.IncludesShadersStoreWGSL[t]=a),e.s(["depthPrePassWGSL",0,{name:t,shader:a}],31329);let o="logDepthFragment",f=`#ifdef LOGARITHMICDEPTH
752
+ fragmentOutputs.fragDepth=log2(fragmentInputs.vFragmentDepth)*uniforms.logarithmicDepthConstant*0.5;
753
+ #endif
754
+ `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f),e.s(["logDepthFragmentWGSL",0,{name:o,shader:f}],23009);let i="oitFragment",v=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
755
+ var fragDepth: f32=fragmentInputs.position.z;
756
+ #ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS
757
+ var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x;
758
+ #endif
759
+ var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var lastDepth: vec2f=textureLoad(oitDepthSampler,fragCoord,0).rg;var lastFrontColor: vec4f=textureLoad(oitFrontColorSampler,fragCoord,0);fragmentOutputs.depth=vec2f(-MAX_DEPTH);fragmentOutputs.frontColor=lastFrontColor;fragmentOutputs.backColor= vec4f(0.0);
760
+ #ifdef USE_REVERSE_DEPTHBUFFER
761
+ var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y;
762
+ #else
763
+ var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y;
764
+ #endif
765
+ var alphaMultiplier: f32=1.0-lastFrontColor.a;
766
+ #ifdef USE_REVERSE_DEPTHBUFFER
767
+ if (fragDepth>nearestDepth || fragDepth<furthestDepth) {
768
+ #else
769
+ if (fragDepth<nearestDepth || fragDepth>furthestDepth) {
770
+ #endif
771
+ return fragmentOutputs;}
772
+ #ifdef USE_REVERSE_DEPTHBUFFER
773
+ if (fragDepth<nearestDepth && fragDepth>furthestDepth) {
774
+ #else
775
+ if (fragDepth>nearestDepth && fragDepth<furthestDepth) {
776
+ #endif
777
+ fragmentOutputs.depth=vec2f(-fragDepth,fragDepth);return fragmentOutputs;}
778
+ #endif
779
+ `;r.ShaderStore.IncludesShadersStoreWGSL[i]||(r.ShaderStore.IncludesShadersStoreWGSL[i]=v),e.s(["oitFragmentWGSL",0,{name:i,shader:v}],4818)}]);