@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
@@ -1,545 +1,8 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,26022,e=>{"use strict";var r=e.i(12423),t=e.i(60106),a=e.i(50008),i=e.i(84933);let o="prePassDeclaration",f=`#ifdef PREPASS
2
- #ifdef PREPASS_LOCAL_POSITION
3
- varying vPosition : vec3f;
4
- #endif
5
- #ifdef PREPASS_DEPTH
6
- varying vViewPos: vec3f;
7
- #endif
8
- #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
9
- varying vNormViewDepth: f32;
10
- #endif
11
- #if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)
12
- varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;
13
- #endif
14
- #endif
15
- `;r.ShaderStore.IncludesShadersStoreWGSL[o]||(r.ShaderStore.IncludesShadersStoreWGSL[o]=f);let n="oitDeclaration",s=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
16
- #define MAX_DEPTH 99999.0
17
- var oitDepthSamplerSampler: sampler;var oitDepthSampler: texture_2d<f32>;var oitFrontColorSamplerSampler: sampler;var oitFrontColorSampler: texture_2d<f32>;
18
- #endif
19
- `;r.ShaderStore.IncludesShadersStoreWGSL[n]||(r.ShaderStore.IncludesShadersStoreWGSL[n]=s);var l=e.i(39780),d=e.i(4357);let c="lightUboDeclaration",v=`#ifdef LIGHT{X}
20
- struct Light{X}
21
- {vLightData: vec4f,
22
- vLightDiffuse: vec4f,
23
- vLightSpecular: vec4f,
24
- #ifdef SPOTLIGHT{X}
25
- vLightDirection: vec4f,
26
- vLightFalloff: vec4f,
27
- #elif defined(POINTLIGHT{X})
28
- vLightFalloff: vec4f,
29
- #elif defined(HEMILIGHT{X})
30
- vLightGround: vec3f,
31
- #elif defined(CLUSTLIGHT{X})
32
- vSliceData: vec2f,
33
- vSliceRanges: array<vec4f,CLUSTLIGHT_SLICES>,
34
- #endif
35
- #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
36
- vLightWidth: vec4f,
37
- vLightHeight: vec4f,
38
- #endif
39
- shadowsInfo: vec4f,
40
- depthValues: vec2f} ;var<uniform> light{X} : Light{X};
41
- #ifdef IESLIGHTTEXTURE{X}
42
- var iesLightTexture{X}Sampler: sampler;var iesLightTexture{X}: texture_2d<f32>;
43
- #endif
44
- #ifdef RECTAREALIGHTEMISSIONTEXTURE{X}
45
- var rectAreaLightEmissionTexture{X}Sampler: sampler;var rectAreaLightEmissionTexture{X}: texture_2d<f32>;
46
- #endif
47
- #ifdef PROJECTEDLIGHTTEXTURE{X}
48
- uniform textureProjectionMatrix{X}: mat4x4f;var projectionLightTexture{X}Sampler: sampler;var projectionLightTexture{X}: texture_2d<f32>;
49
- #endif
50
- #ifdef CLUSTLIGHT{X}
51
- var lightDataTexture{X}: texture_2d<f32>;var<storage,read> tileMaskBuffer{X}: array<u32>;
52
- #endif
53
- #ifdef SHADOW{X}
54
- #ifdef SHADOWCSM{X}
55
- 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>;
56
- #if defined(SHADOWPCSS{X})
57
- var shadowTexture{X}Sampler: sampler_comparison;
58
- 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;
59
- #elif defined(SHADOWPCF{X})
60
- var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d_array;
61
- #else
62
- var shadowTexture{X}Sampler: sampler;
63
- var shadowTexture{X}: texture_2d_array<f32>;
64
- #endif
65
- #ifdef SHADOWCSMDEBUG{X}
66
- const vCascadeColorsMultiplier{X}: array<vec3f,8>=array<vec3f,8>
67
- (
68
- vec3f ( 1.5,0.0,0.0 ),
69
- vec3f ( 0.0,1.5,0.0 ),
70
- vec3f ( 0.0,0.0,5.5 ),
71
- vec3f ( 1.5,0.0,5.5 ),
72
- vec3f ( 1.5,1.5,0.0 ),
73
- vec3f ( 1.0,1.0,1.0 ),
74
- vec3f ( 0.0,1.0,5.5 ),
75
- vec3f ( 0.5,3.5,0.75 )
76
- );
77
- #endif
78
- #elif defined(SHADOWCUBE{X})
79
- var shadowTexture{X}Sampler: sampler;var shadowTexture{X}: texture_cube<f32>;
80
- #else
81
- varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;
82
- #if defined(SHADOWPCSS{X})
83
- var shadowTexture{X}Sampler: sampler_comparison;
84
- var shadowTexture{X}: texture_depth_2d;var depthTexture{X}Sampler: sampler;
85
- var depthTexture{X}: texture_2d<f32>;
86
- #elif defined(SHADOWPCF{X})
87
- var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d;
88
- #else
89
- var shadowTexture{X}Sampler: sampler;
90
- var shadowTexture{X}: texture_2d<f32>;
91
- #endif
92
- uniform lightMatrix{X}: mat4x4f;
93
- #endif
94
- #endif
95
- #endif
96
- `;r.ShaderStore.IncludesShadersStoreWGSL[c]||(r.ShaderStore.IncludesShadersStoreWGSL[c]=v);let u="ltcHelperFunctions",p=`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;}
97
- fn LTCClippedSphereFormFactor( f:vec3f )->f32 {var l: f32=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );}
98
- 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 )
99
- {thetaSintheta=v;}
100
- else
101
- {thetaSintheta=0.5*inverseSqrt( max( 1.0-x*x,0.00000001 ) )-v;}
102
- return cross( v1,v2 )*thetaSintheta;}
103
- 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 );}
104
- var T1:vec3f=normalize( V-N*dot( V,N ) );var T2:vec3f=- cross( N,T1 );
105
- 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 );}
106
- struct areaLightData
107
- {Diffuse: vec3f,
108
- Specular: vec3f,
109
- 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;
110
- var rectCoords1:vec3f=lightPos-halfWidth-halfHeight;var rectCoords2:vec3f=lightPos-halfWidth+halfHeight;var rectCoords3:vec3f=lightPos+halfWidth+halfHeight;
111
- #ifdef SPECULARTERM
112
- 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>(
113
- vec3f( t1.x,0,t1.y ),
114
- vec3f( 0,1, 0 ),
115
- vec3f( t1.z,0,t1.w )
116
- );result.Fresnel=t2;result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );
117
- #endif
118
- var mInvEmpty:mat3x3<f32>=mat3x3<f32>(
119
- vec3f( 1,0,0 ),
120
- vec3f( 0,1,0 ),
121
- vec3f( 0,0,1 )
122
- );result.Diffuse+=LTCEvaluate( normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );return result;}
123
- 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;}
124
- 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);}
125
- 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;}
126
- 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;
127
- var rectCoords1: vec3f=lightPos-halfWidth-halfHeight;var rectCoords2: vec3f=lightPos-halfWidth+halfHeight;var rectCoords3: vec3f=lightPos+halfWidth+halfHeight;
128
- #ifdef SPECULARTERM
129
- 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>(
130
- vec3f(t1.x,0,t1.y),
131
- vec3f(0,1,0),
132
- vec3f(t1.z,0,t1.w)
133
- );result.Specular=LTCEvaluateWithEmission(normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3,emissionTexture,emissionTextureSampler);result.Fresnel=t2;
134
- #endif
135
- var mInvEmpty: mat3x3<f32>=mat3x3<f32>(
136
- vec3f(1,0,0),
137
- vec3f(0,1,0),
138
- vec3f(0,0,1)
139
- );result.Diffuse=LTCEvaluateWithEmission(normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3,emissionTexture,emissionTextureSampler);return result;}
140
- `;r.ShaderStore.IncludesShadersStoreWGSL[u]||(r.ShaderStore.IncludesShadersStoreWGSL[u]=p);let h="clusteredLightingFunctions",m=`struct ClusteredLight {vLightData: vec4f,
141
- vLightDiffuse: vec4f,
142
- vLightSpecular: vec4f,
143
- vLightDirection: vec4f,
144
- vLightFalloff: vec4f,}
145
- fn getClusteredLight(lightDataTexture: texture_2d<f32>,index: u32)->ClusteredLight {return ClusteredLight(
146
- textureLoad(lightDataTexture,vec2u(0,index),0),
147
- textureLoad(lightDataTexture,vec2u(1,index),0),
148
- textureLoad(lightDataTexture,vec2u(2,index),0),
149
- textureLoad(lightDataTexture,vec2u(3,index),0),
150
- textureLoad(lightDataTexture,vec2u(4,index),0)
151
- );}
152
- fn getClusteredSliceIndex(sliceData: vec2f,viewDepth: f32)->i32 {return i32(log(viewDepth)*sliceData.x+sliceData.y);}
153
- `;r.ShaderStore.IncludesShadersStoreWGSL[h]||(r.ShaderStore.IncludesShadersStoreWGSL[h]=m);let S="lightsFragmentFunctions",g=`struct lightingInfo
154
- {diffuse: vec3f,
155
- #ifdef SPECULARTERM
156
- specular: vec3f,
157
- #endif
158
- #ifdef NDOTL
159
- ndl: f32,
160
- #endif
161
- };fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.)
162
- {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
163
- else
164
- {lightVectorW=normalize(-lightData.xyz);}
165
- var ndl: f32=max(0.,dot(vNormal,lightVectorW));
166
- #ifdef NDOTL
167
- result.ndl=ndl;
168
- #endif
169
- result.diffuse=ndl*diffuseColor*attenuation;
170
- #ifdef SPECULARTERM
171
- var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
172
- #endif
173
- return result;}
174
- fn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));}
175
- fn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}
176
- fn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW));
177
- #ifdef NDOTL
178
- result.ndl=ndl;
179
- #endif
180
- result.diffuse=ndl*diffuseColor*attenuation;
181
- #ifdef SPECULARTERM
182
- var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
183
- #endif
184
- return result;}
185
- fn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
186
- {attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
187
- var result: lightingInfo;result.diffuse=vec3f(0.);
188
- #ifdef SPECULARTERM
189
- result.specular=vec3f(0.);
190
- #endif
191
- #ifdef NDOTL
192
- result.ndl=0.;
193
- #endif
194
- return result;}
195
- fn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
196
- {attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
197
- var result: lightingInfo;result.diffuse=vec3f(0.);
198
- #ifdef SPECULARTERM
199
- result.specular=vec3f(0.);
200
- #endif
201
- #ifdef NDOTL
202
- result.ndl=0.;
203
- #endif
204
- return result;}
205
- fn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5;
206
- #ifdef NDOTL
207
- result.ndl=ndl;
208
- #endif
209
- result.diffuse=mix(groundColor,diffuseColor,ndl);
210
- #ifdef SPECULARTERM
211
- var angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
212
- #endif
213
- return result;}
214
- fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d<f32>,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;}
215
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
216
- #include<ltcHelperFunctions>
217
- var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d<f32>;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d<f32>;fn computeAreaLighting(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
218
- {var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
219
- #ifdef SPECULARTERM
220
- var fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
221
- #endif
222
- result.diffuse+=diffuseColor*data.Diffuse;return result;}
223
- fn computeAreaLightingWithTexture(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,emissionTexture: texture_2d<f32>,emissionTextureSampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
224
- {var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc1Sampler,ltc2,ltc2Sampler,emissionTexture,emissionTextureSampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
225
- #ifdef SPECULARTERM
226
- var fresnel: vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
227
- #endif
228
- result.diffuse+=diffuseColor*data.Diffuse;return result;}
229
- #endif
230
- #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
231
- #include<clusteredLightingFunctions>
232
- fn computeClusteredLighting(
233
- lightDataTexture: texture_2d<f32>,
234
- tileMaskBuffer: ptr<storage,array<u32>>,
235
- viewDirectionW: vec3f,
236
- vNormal: vec3f,
237
- lightData: vec4f,
238
- sliceRange: vec2u,
239
- glossiness: f32
240
- )->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset;
241
- let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<<trailing;let light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+trailing);var info: lightingInfo;if light.vLightDirection.w<0.0 {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
242
- result.diffuse+=info.diffuse;
243
- #ifdef SPECULARTERM
244
- result.specular+=info.specular;
245
- #endif
246
- }
247
- batchOffset+=CLUSTLIGHT_BATCH;}
248
- return result;}
249
- #endif
250
- `;r.ShaderStore.IncludesShadersStoreWGSL[S]||(r.ShaderStore.IncludesShadersStoreWGSL[S]=g);let x="shadowsFragmentFunctions",T=`#ifdef SHADOWS
251
- #ifndef SHADOWFLOAT
252
- fn unpack(color: vec4f)->f32
253
- {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);}
254
- #endif
255
- fn computeFallOff(value: f32,clipSpace: vec2f,frustumEdgeFalloff: f32)->f32
256
- {var mask: f32=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}
257
- fn computeShadowCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthValues: vec2f)->f32
258
- {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;
259
- #ifndef SHADOWFLOAT
260
- var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
261
- #else
262
- var shadow: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
263
- #endif
264
- return select(1.0,darkness,depth>shadow);}
265
- fn computeShadowWithPoissonSamplingCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,mapSize: f32,darkness: f32,depthValues: vec2f)->f32
266
- {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);
267
- #ifndef SHADOWFLOAT
268
- 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;};
269
- #else
270
- 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;};
271
- #endif
272
- return min(1.0,visibility+darkness);}
273
- fn computeShadowWithESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32
274
- {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;
275
- #ifndef SHADOWFLOAT
276
- var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
277
- #else
278
- var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
279
- #endif
280
- var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return esm;}
281
- fn computeShadowWithCloseESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32
282
- {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;
283
- #ifndef SHADOWFLOAT
284
- var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));
285
- #else
286
- var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;
287
- #endif
288
- var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return esm;}
289
- fn computeShadowCSM(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d_array<f32>,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32
290
- {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);
291
- #ifndef SHADOWFLOAT
292
- var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,uv,layer));
293
- #else
294
- var shadow: f32=textureSample(shadowTexture,shadowSampler,uv,layer).x;
295
- #endif
296
- return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}
297
- fn computeShadow(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32
298
- {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)
299
- {return 1.0;}
300
- else
301
- {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
302
- #ifndef SHADOWFLOAT
303
- var shadow: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
304
- #else
305
- var shadow: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
306
- #endif
307
- return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}}
308
- fn computeShadowWithPoissonSampling(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,mapSize: f32,darkness: f32,frustumEdgeFalloff: f32)->f32
309
- {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)
310
- {return 1.0;}
311
- else
312
- {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);
313
- #ifndef SHADOWFLOAT
314
- if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
315
- if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[1]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
316
- if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[2]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
317
- if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[3]*mapSize,0.))<shadowPixelDepth) {visibility-=0.25;}
318
- #else
319
- if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
320
- if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[1]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
321
- if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[2]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
322
- if (textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[3]*mapSize,0.).x<shadowPixelDepth) {visibility-=0.25;}
323
- #endif
324
- return computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);}}
325
- fn computeShadowWithESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32
326
- {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)
327
- {return 1.0;}
328
- else
329
- {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
330
- #ifndef SHADOWFLOAT
331
- var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
332
- #else
333
- var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
334
- #endif
335
- var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
336
- fn computeShadowWithCloseESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d<f32>,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32
337
- {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)
338
- {return 1.0;}
339
- else
340
- {var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);
341
- #ifndef SHADOWFLOAT
342
- var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));
343
- #else
344
- var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;
345
- #endif
346
- var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
347
- fn getZInClip(clipSpace: vec3f,uvDepth: vec3f)->f32
348
- {
349
- #ifdef IS_NDC_HALF_ZRANGE
350
- return clipSpace.z;
351
- #else
352
- return uvDepth.z;
353
- #endif
354
- }
355
- const GREATEST_LESS_THAN_ONE: f32=0.99999994;
356
- #define DISABLE_UNIFORMITY_ANALYSIS
357
- fn computeShadowWithCSMPCF1(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32
358
- {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);}
359
- fn computeShadowWithCSMPCF3(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
360
- {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;
361
- uv+=0.5;
362
- var st: vec2f=fract(uv);
363
- var base_uv: vec2f=floor(uv)-0.5;
364
- base_uv*=shadowMapSizeAndInverse.y;
365
- 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);}
366
- fn computeShadowWithCSMPCF5(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
367
- {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;
368
- uv+=0.5;
369
- var st: vec2f=fract(uv);
370
- var base_uv: vec2f=floor(uv)-0.5;
371
- base_uv*=shadowMapSizeAndInverse.y;
372
- 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);}
373
- fn computeShadowWithPCF1(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32
374
- {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);}}
375
- fn computeShadowWithPCF3(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
376
- {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;
377
- uv+=0.5;
378
- var st: vec2f=fract(uv);
379
- var base_uv: vec2f=floor(uv)-0.5;
380
- base_uv*=shadowMapSizeAndInverse.y;
381
- 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);}}
382
- fn computeShadowWithPCF5(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32
383
- {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;
384
- uv+=0.5;
385
- var st: vec2f=fract(uv);
386
- var base_uv: vec2f=floor(uv)-0.5;
387
- base_uv*=shadowMapSizeAndInverse.y;
388
- 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);}}
389
- const PoissonSamplers32: array<vec3f,64>=array<vec3f,64> (
390
- vec3f(0.06407013,0.05409927,0.),
391
- vec3f(0.7366577,0.5789394,0.),
392
- vec3f(-0.6270542,-0.5320278,0.),
393
- vec3f(-0.4096107,0.8411095,0.),
394
- vec3f(0.6849564,-0.4990818,0.),
395
- vec3f(-0.874181,-0.04579735,0.),
396
- vec3f(0.9989998,0.0009880066,0.),
397
- vec3f(-0.004920578,-0.9151649,0.),
398
- vec3f(0.1805763,0.9747483,0.),
399
- vec3f(-0.2138451,0.2635818,0.),
400
- vec3f(0.109845,0.3884785,0.),
401
- vec3f(0.06876755,-0.3581074,0.),
402
- vec3f(0.374073,-0.7661266,0.),
403
- vec3f(0.3079132,-0.1216763,0.),
404
- vec3f(-0.3794335,-0.8271583,0.),
405
- vec3f(-0.203878,-0.07715034,0.),
406
- vec3f(0.5912697,0.1469799,0.),
407
- vec3f(-0.88069,0.3031784,0.),
408
- vec3f(0.5040108,0.8283722,0.),
409
- vec3f(-0.5844124,0.5494877,0.),
410
- vec3f(0.6017799,-0.1726654,0.),
411
- vec3f(-0.5554981,0.1559997,0.),
412
- vec3f(-0.3016369,-0.3900928,0.),
413
- vec3f(-0.5550632,-0.1723762,0.),
414
- vec3f(0.925029,0.2995041,0.),
415
- vec3f(-0.2473137,0.5538505,0.),
416
- vec3f(0.9183037,-0.2862392,0.),
417
- vec3f(0.2469421,0.6718712,0.),
418
- vec3f(0.3916397,-0.4328209,0.),
419
- vec3f(-0.03576927,-0.6220032,0.),
420
- vec3f(-0.04661255,0.7995201,0.),
421
- vec3f(0.4402924,0.3640312,0.),
422
- vec3f(0.),
423
- vec3f(0.),
424
- vec3f(0.),
425
- vec3f(0.),
426
- vec3f(0.),
427
- vec3f(0.),
428
- vec3f(0.),
429
- vec3f(0.),
430
- vec3f(0.),
431
- vec3f(0.),
432
- vec3f(0.),
433
- vec3f(0.),
434
- vec3f(0.),
435
- vec3f(0.),
436
- vec3f(0.),
437
- vec3f(0.),
438
- vec3f(0.),
439
- vec3f(0.),
440
- vec3f(0.),
441
- vec3f(0.),
442
- vec3f(0.),
443
- vec3f(0.),
444
- vec3f(0.),
445
- vec3f(0.),
446
- vec3f(0.),
447
- vec3f(0.),
448
- vec3f(0.),
449
- vec3f(0.),
450
- vec3f(0.),
451
- vec3f(0.),
452
- vec3f(0.),
453
- vec3f(0.)
454
- );const PoissonSamplers64: array<vec3f,64>=array<vec3f,64> (
455
- vec3f(-0.613392,0.617481,0.),
456
- vec3f(0.170019,-0.040254,0.),
457
- vec3f(-0.299417,0.791925,0.),
458
- vec3f(0.645680,0.493210,0.),
459
- vec3f(-0.651784,0.717887,0.),
460
- vec3f(0.421003,0.027070,0.),
461
- vec3f(-0.817194,-0.271096,0.),
462
- vec3f(-0.705374,-0.668203,0.),
463
- vec3f(0.977050,-0.108615,0.),
464
- vec3f(0.063326,0.142369,0.),
465
- vec3f(0.203528,0.214331,0.),
466
- vec3f(-0.667531,0.326090,0.),
467
- vec3f(-0.098422,-0.295755,0.),
468
- vec3f(-0.885922,0.215369,0.),
469
- vec3f(0.566637,0.605213,0.),
470
- vec3f(0.039766,-0.396100,0.),
471
- vec3f(0.751946,0.453352,0.),
472
- vec3f(0.078707,-0.715323,0.),
473
- vec3f(-0.075838,-0.529344,0.),
474
- vec3f(0.724479,-0.580798,0.),
475
- vec3f(0.222999,-0.215125,0.),
476
- vec3f(-0.467574,-0.405438,0.),
477
- vec3f(-0.248268,-0.814753,0.),
478
- vec3f(0.354411,-0.887570,0.),
479
- vec3f(0.175817,0.382366,0.),
480
- vec3f(0.487472,-0.063082,0.),
481
- vec3f(-0.084078,0.898312,0.),
482
- vec3f(0.488876,-0.783441,0.),
483
- vec3f(0.470016,0.217933,0.),
484
- vec3f(-0.696890,-0.549791,0.),
485
- vec3f(-0.149693,0.605762,0.),
486
- vec3f(0.034211,0.979980,0.),
487
- vec3f(0.503098,-0.308878,0.),
488
- vec3f(-0.016205,-0.872921,0.),
489
- vec3f(0.385784,-0.393902,0.),
490
- vec3f(-0.146886,-0.859249,0.),
491
- vec3f(0.643361,0.164098,0.),
492
- vec3f(0.634388,-0.049471,0.),
493
- vec3f(-0.688894,0.007843,0.),
494
- vec3f(0.464034,-0.188818,0.),
495
- vec3f(-0.440840,0.137486,0.),
496
- vec3f(0.364483,0.511704,0.),
497
- vec3f(0.034028,0.325968,0.),
498
- vec3f(0.099094,-0.308023,0.),
499
- vec3f(0.693960,-0.366253,0.),
500
- vec3f(0.678884,-0.204688,0.),
501
- vec3f(0.001801,0.780328,0.),
502
- vec3f(0.145177,-0.898984,0.),
503
- vec3f(0.062655,-0.611866,0.),
504
- vec3f(0.315226,-0.604297,0.),
505
- vec3f(-0.780145,0.486251,0.),
506
- vec3f(-0.371868,0.882138,0.),
507
- vec3f(0.200476,0.494430,0.),
508
- vec3f(-0.494552,-0.711051,0.),
509
- vec3f(0.612476,0.705252,0.),
510
- vec3f(-0.578845,-0.768792,0.),
511
- vec3f(-0.772454,-0.090976,0.),
512
- vec3f(0.504440,0.372295,0.),
513
- vec3f(0.155736,0.065157,0.),
514
- vec3f(0.391522,0.849605,0.),
515
- vec3f(-0.620106,-0.328104,0.),
516
- vec3f(0.789239,-0.419965,0.),
517
- vec3f(-0.545396,0.538133,0.),
518
- vec3f(-0.178564,-0.596057,0.)
519
- );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
520
- {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);}
521
- 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);}
522
- 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);}
523
- 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
524
- {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;}
525
- 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);}
526
- if (numBlocker<1.0) {return 1.0;}
527
- 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);}
528
- shadow/= f32(pcfTapCount);shadow=mix(shadow,1.,depthMetric-avgBlockerDepth);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
529
- 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
530
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);}
531
- 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
532
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);}
533
- 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
534
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);}
535
- 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
536
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
537
- 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
538
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
539
- 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
540
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
541
- #endif
542
- `;r.ShaderStore.IncludesShadersStoreWGSL[x]||(r.ShaderStore.IncludesShadersStoreWGSL[x]=T);let L="samplerFragmentDeclaration",C=`#ifdef _DEFINENAME_
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,84933,e=>{"use strict";var i=e.i(12423);e.i(60106),e.i(50008);let r="defaultUboDeclaration",t=`uniform diffuseLeftColor: vec4f;uniform diffuseRightColor: vec4f;uniform opacityParts: vec4f;uniform reflectionLeftColor: vec4f;uniform reflectionRightColor: vec4f;uniform refractionLeftColor: vec4f;uniform refractionRightColor: vec4f;uniform emissiveLeftColor: vec4f;uniform emissiveRightColor: vec4f;uniform vDiffuseInfos: vec2f;uniform vAmbientInfos: vec2f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vSpecularInfos: vec2f;uniform vBumpInfos: vec3f;uniform diffuseMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform specularMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform pointSize: f32;uniform alphaCutOff: f32;uniform refractionMatrix: mat4x4f;uniform vRefractionInfos: vec4f;uniform vRefractionPosition: vec3f;uniform vRefractionSize: vec3f;uniform vSpecularColor: vec4f;uniform vEmissiveColor: vec3f;uniform vDiffuseColor: vec4f;uniform vAmbientColor: vec3f;uniform cameraInfo: vec4f;uniform vTextureRepetitionHexTilingParams: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;
2
+ #define ADDITIONAL_UBO_DECLARATION
3
+ #include<sceneUboDeclaration>
4
+ #include<meshUboDeclaration>
5
+ `;i.ShaderStore.IncludesShadersStoreWGSL[r]||(i.ShaderStore.IncludesShadersStoreWGSL[r]=t),e.s(["defaultUboDeclarationWGSL",0,{name:r,shader:t}])},67367,23356,e=>{"use strict";var i=e.i(12423);let r="samplerFragmentDeclaration",t=`#ifdef _DEFINENAME_
543
6
  #if _DEFINENAME_DIRECTUV==1
544
7
  #define v_VARYINGNAME_UV vMainUV1
545
8
  #elif _DEFINENAME_DIRECTUV==2
@@ -557,11 +20,7 @@ varying v_VARYINGNAME_UV: vec2f;
557
20
  #endif
558
21
  var _SAMPLERNAME_SamplerSampler: sampler;var _SAMPLERNAME_Sampler: texture_2d<f32>;
559
22
  #endif
560
- `;r.ShaderStore.IncludesShadersStoreWGSL[L]||(r.ShaderStore.IncludesShadersStoreWGSL[L]=C);let w="fresnelFunction",E=`#ifdef FRESNEL
561
- fn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32
562
- {let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
563
- #endif
564
- `;r.ShaderStore.IncludesShadersStoreWGSL[w]||(r.ShaderStore.IncludesShadersStoreWGSL[w]=E);let I="reflectionFunction",D=`fn computeFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f
23
+ `;i.ShaderStore.IncludesShadersStoreWGSL[r]||(i.ShaderStore.IncludesShadersStoreWGSL[r]=t),e.s(["samplerFragmentDeclarationWGSL",0,{name:r,shader:t}],67367);let o="reflectionFunction",a=`fn computeFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f
565
24
  {var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(s,t,0); }
566
25
  fn computeMirroredFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f
567
26
  {var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(1.0-s,t,0); }
@@ -625,136 +84,7 @@ return vec3f(0,0,0);
625
84
  #endif
626
85
  }
627
86
  #endif
628
- `;r.ShaderStore.IncludesShadersStoreWGSL[I]||(r.ShaderStore.IncludesShadersStoreWGSL[I]=D);let A="imageProcessingDeclaration",P=`#ifdef EXPOSURE
629
- uniform exposureLinear: f32;
630
- #endif
631
- #ifdef CONTRAST
632
- uniform contrast: f32;
633
- #endif
634
- #if defined(VIGNETTE) || defined(DITHER)
635
- uniform vInverseScreenSize: vec2f;
636
- #endif
637
- #ifdef VIGNETTE
638
- uniform vignetteSettings1: vec4f;uniform vignetteSettings2: vec4f;
639
- #endif
640
- #ifdef COLORCURVES
641
- uniform vCameraColorCurveNegative: vec4f;uniform vCameraColorCurveNeutral: vec4f;uniform vCameraColorCurvePositive: vec4f;
642
- #endif
643
- #ifdef COLORGRADING
644
- #ifdef COLORGRADING3D
645
- var txColorTransformSampler: sampler;var txColorTransform: texture_3d<f32>;
646
- #else
647
- var txColorTransformSampler: sampler;var txColorTransform: texture_2d<f32>;
648
- #endif
649
- uniform colorTransformSettings: vec4f;
650
- #endif
651
- #ifdef DITHER
652
- uniform ditherIntensity: f32;
653
- #endif
654
- `;r.ShaderStore.IncludesShadersStoreWGSL[A]||(r.ShaderStore.IncludesShadersStoreWGSL[A]=P);let X="imageProcessingFunctions",R=`#if TONEMAPPING==3
655
- 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;}
656
- 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);}
657
- #endif
658
- #if TONEMAPPING==2
659
- const ACESInputMat: mat3x3f= mat3x3f(
660
- vec3f(0.59719,0.07600,0.02840),
661
- vec3f(0.35458,0.90834,0.13383),
662
- vec3f(0.04823,0.01566,0.83777)
663
- );const ACESOutputMat: mat3x3f= mat3x3f(
664
- vec3f( 1.60475,-0.10208,-0.00327),
665
- vec3f(-0.53108, 1.10813,-0.07276),
666
- vec3f(-0.07367,-0.00605, 1.07602)
667
- );fn RRTAndODTFit(v: vec3f)->vec3f
668
- {var a: vec3f=v*(v+0.0245786)-0.000090537;var b: vec3f=v*(0.983729*v+0.4329510)+0.238081;return a/b;}
669
- fn ACESFitted(color: vec3f)->vec3f
670
- {var output=ACESInputMat*color;output=RRTAndODTFit(output);output=ACESOutputMat*output;output=saturateVec3(output);return output;}
671
- #endif
672
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS
673
- fn applyImageProcessing(result: vec4f)->vec4f {
674
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART
675
- var rgb=result.rgb;;
676
- #ifdef EXPOSURE
677
- rgb*=uniforms.exposureLinear;
678
- #endif
679
- #ifdef VIGNETTE
680
- 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;
681
- #ifdef VIGNETTEBLENDMODEMULTIPLY
682
- var vignetteColorMultiplier: vec3f=mix(vignetteColor, vec3f(1,1,1),vignette);rgb*=vignetteColorMultiplier;
683
- #endif
684
- #ifdef VIGNETTEBLENDMODEOPAQUE
685
- rgb=mix(vignetteColor,rgb,vignette);
686
- #endif
687
- #endif
688
- #if TONEMAPPING==3
689
- rgb=PBRNeutralToneMapping(rgb);
690
- #elif TONEMAPPING==2
691
- rgb=ACESFitted(rgb);
692
- #elif TONEMAPPING==1
693
- const tonemappingCalibration: f32=1.590579;rgb=1.0-exp2(-tonemappingCalibration*rgb);
694
- #endif
695
- rgb=toGammaSpaceVec3(rgb);rgb=saturateVec3(rgb);
696
- #ifdef CONTRAST
697
- 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);}
698
- rgb=max(rgb,vec3f(0.));
699
- #endif
700
- #ifdef COLORGRADING
701
- var colorTransformInput: vec3f=rgb*uniforms.colorTransformSettings.xxx+uniforms.colorTransformSettings.yyy;
702
- #ifdef COLORGRADING3D
703
- var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput).rgb;
704
- #else
705
- var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput,uniforms.colorTransformSettings.yz).rgb;
706
- #endif
707
- rgb=mix(rgb,colorTransformOutput,uniforms.colorTransformSettings.www);
708
- #endif
709
- #ifdef COLORCURVES
710
- 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);
711
- #endif
712
- #ifdef DITHER
713
- var rand: f32=getRand(fragmentInputs.position.xy*uniforms.vInverseScreenSize);var dither: f32=mix(-uniforms.ditherIntensity,uniforms.ditherIntensity,rand);rgb=saturateVec3(rgb+ vec3f(dither));
714
- #endif
715
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND
716
- return vec4f(rgb,result.a);}`;r.ShaderStore.IncludesShadersStoreWGSL[X]||(r.ShaderStore.IncludesShadersStoreWGSL[X]=R);let _="textureRepetitionFunctions",y=`#if TEXTURE_REPETITION_MODE>0
717
- fn _texRepHash4(p: vec2f)->vec4f {return fract(sin(vec4f(
718
- 1.0+dot(p,vec2f(37.0,17.0)),
719
- 2.0+dot(p,vec2f(11.0,47.0)),
720
- 3.0+dot(p,vec2f(41.0,29.0)),
721
- 4.0+dot(p,vec2f(23.0,31.0))
722
- ))*103.0);}
723
- #endif
724
- #if TEXTURE_REPETITION_MODE==1
725
- 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)));}
726
- #elif TEXTURE_REPETITION_MODE==2
727
- fn _texRepHexHash(p: vec2f)->vec2f {var r: vec2f=mat2x2f(127.1,269.5,311.7,183.3)*p;return fract(sin(r)*43758.5453);}
728
- struct _TexRepTriGrid {w1: f32,
729
- w2: f32,
730
- w3: f32,
731
- vertex1: vec2i,
732
- vertex2: vec2i,
733
- 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;}
734
- 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));}
735
- 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; }
736
- if (angle>3.14159265358979) { angle-=3.14159265358979; }
737
- angle*=rotStr;var cs: f32=cos(angle);var si: f32=sin(angle);return mat2x2f(cs,si,-si,cs);}
738
- 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);}
739
- 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);}
740
- return W.x*c1+W.y*c2+W.z*c3;}
741
- #elif TEXTURE_REPETITION_MODE==3
742
- 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(
743
- mix(textureSampleGrad(tex,samp,uva,ddxa,ddya),textureSampleGrad(tex,samp,uvb,ddxb,ddyb),b.x),
744
- mix(textureSampleGrad(tex,samp,uvc,ddxc,ddyc),textureSampleGrad(tex,samp,uvd,ddxd,ddyd),b.x),
745
- b.y
746
- );}
747
- #elif TEXTURE_REPETITION_MODE==4
748
- 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;}}
749
- var mean: f32=0.3;var res: vec4f=mean+(va-wt*mean)/sqrt(w2);return mix(va/wt,res,0.4);}
750
- #endif
751
- #if TEXTURE_REPETITION_MODE>0
752
- fn TEXRD(t: texture_2d<f32>,ts: sampler,uv: vec2f)->vec4f {return _texRepSample(t,ts,uv);}
753
- #else
754
- fn TEXRD(t: texture_2d<f32>,ts: sampler,uv: vec2f)->vec4f {return textureSample(t,ts,uv);}
755
- #endif
756
- #define TEXRD_DEFINED
757
- `;r.ShaderStore.IncludesShadersStoreWGSL[_]||(r.ShaderStore.IncludesShadersStoreWGSL[_]=y);let N="bumpFragmentMainFunctions",M=`#ifndef TEXRD_DEFINED
87
+ `;i.ShaderStore.IncludesShadersStoreWGSL[o]||(i.ShaderStore.IncludesShadersStoreWGSL[o]=a),e.s(["reflectionFunctionWGSL",0,{name:o,shader:a}],23356)},28657,78875,23344,e=>{"use strict";var i=e.i(12423);let r="bumpFragmentMainFunctions",t=`#ifndef TEXRD_DEFINED
758
88
  fn TEXRD(t: texture_2d<f32>,ts: sampler,uv: vec2f)->vec4f {return textureSample(t,ts,uv);}
759
89
  #define TEXRD_DEFINED
760
90
  #endif
@@ -798,7 +128,7 @@ fn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f
798
128
  fn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f
799
129
  {var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);}
800
130
  #endif
801
- `;r.ShaderStore.IncludesShadersStoreWGSL[N]||(r.ShaderStore.IncludesShadersStoreWGSL[N]=M);let F="bumpFragmentFunctions",O=`#if defined(BUMP)
131
+ `;i.ShaderStore.IncludesShadersStoreWGSL[r]||(i.ShaderStore.IncludesShadersStoreWGSL[r]=t),e.s(["bumpFragmentMainFunctionsWGSL",0,{name:r,shader:t}],28657),e.i(67367);let o="bumpFragmentFunctions",a=`#if defined(BUMP)
802
132
  #include<samplerFragmentDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)
803
133
  #endif
804
134
  #if defined(DETAIL)
@@ -828,7 +158,7 @@ return -texCoordOffset;
828
158
  #endif
829
159
  }
830
160
  #endif
831
- `;r.ShaderStore.IncludesShadersStoreWGSL[F]||(r.ShaderStore.IncludesShadersStoreWGSL[F]=O);var b=e.i(35182),W=e.i(54758),z=e.i(25626),U=e.i(63406);let G="bumpFragment",H=`var uvOffset: vec2f= vec2f(0.0,0.0);
161
+ `;i.ShaderStore.IncludesShadersStoreWGSL[o]||(i.ShaderStore.IncludesShadersStoreWGSL[o]=a),e.s(["bumpFragmentFunctionsWGSL",0,{name:o,shader:a}],78875);let f="bumpFragment",n=`var uvOffset: vec2f= vec2f(0.0,0.0);
832
162
  #if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)
833
163
  #ifdef NORMALXYSCALE
834
164
  var normalScale: f32=1.0;
@@ -880,7 +210,7 @@ normalW=perturbNormalBase(TBN,blendedNormal,uniforms.vBumpInfos.y);
880
210
  #elif defined(DETAIL)
881
211
  detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z);
882
212
  #endif
883
- `;r.ShaderStore.IncludesShadersStoreWGSL[G]||(r.ShaderStore.IncludesShadersStoreWGSL[G]=H);let V="decalFragment",k=`#ifdef DECAL
213
+ `;i.ShaderStore.IncludesShadersStoreWGSL[f]||(i.ShaderStore.IncludesShadersStoreWGSL[f]=n),e.s(["bumpFragmentWGSL",0,{name:f,shader:n}],23344)},21439,49692,e=>{"use strict";var i=e.i(12423);let r="decalFragment",t=`#ifdef DECAL
884
214
  var decalTempColor=decalColor.rgb;var decalTempAlpha=decalColor.a;
885
215
  #ifdef GAMMADECAL
886
216
  decalTempColor=toLinearSpaceVec3(decalColor.rgb);
@@ -890,13 +220,7 @@ decalTempAlpha=decalColor.a*decalColor.a;
890
220
  #endif
891
221
  surfaceAlbedo=mix(surfaceAlbedo.rgb,decalTempColor,decalTempAlpha);
892
222
  #endif
893
- `;r.ShaderStore.IncludesShadersStoreWGSL[V]||(r.ShaderStore.IncludesShadersStoreWGSL[V]=k);let B="depthPrePass",Y=`#ifdef DEPTHPREPASS
894
- #if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
895
- fragmentOutputs.color= vec4f(0.,0.,0.,1.0);
896
- #endif
897
- return fragmentOutputs;
898
- #endif
899
- `;r.ShaderStore.IncludesShadersStoreWGSL[B]||(r.ShaderStore.IncludesShadersStoreWGSL[B]=Y);let q="lightFragment",j=`#ifdef LIGHT{X}
223
+ `;i.ShaderStore.IncludesShadersStoreWGSL[r]||(i.ShaderStore.IncludesShadersStoreWGSL[r]=t),e.s(["decalFragmentWGSL",0,{name:r,shader:t}],21439);let o="lightFragment",a=`#ifdef LIGHT{X}
900
224
  #if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})
901
225
  #else
902
226
  var diffuse{X}: vec4f=light{X}.vLightDiffuse;
@@ -1283,35 +607,108 @@ sheenBase+=info.sheen.rgb*shadow;
1283
607
  #endif
1284
608
  #endif
1285
609
  #endif
1286
- `;r.ShaderStore.IncludesShadersStoreWGSL[q]||(r.ShaderStore.IncludesShadersStoreWGSL[q]=j);let Z="logDepthFragment",Q=`#ifdef LOGARITHMICDEPTH
1287
- fragmentOutputs.fragDepth=log2(fragmentInputs.vFragmentDepth)*uniforms.logarithmicDepthConstant*0.5;
610
+ `;i.ShaderStore.IncludesShadersStoreWGSL[o]||(i.ShaderStore.IncludesShadersStoreWGSL[o]=a),e.s(["lightFragmentWGSL",0,{name:o,shader:a}],49692)},26022,e=>{"use strict";var i=e.i(12423),r=e.i(60106),t=e.i(50008),o=e.i(84933),a=e.i(19640),f=e.i(22548),n=e.i(39780),l=e.i(4357),s=e.i(14640),d=e.i(42420),c=e.i(87850);let u="lightsFragmentFunctions",m=`struct lightingInfo
611
+ {diffuse: vec3f,
612
+ #ifdef SPECULARTERM
613
+ specular: vec3f,
1288
614
  #endif
1289
- `;r.ShaderStore.IncludesShadersStoreWGSL[Z]||(r.ShaderStore.IncludesShadersStoreWGSL[Z]=Q);var J=e.i(31213);let K="oitFragment",$=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
1290
- var fragDepth: f32=fragmentInputs.position.z;
1291
- #ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS
1292
- var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x;
615
+ #ifdef NDOTL
616
+ ndl: f32,
1293
617
  #endif
1294
- 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);
1295
- #ifdef USE_REVERSE_DEPTHBUFFER
1296
- var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y;
1297
- #else
1298
- var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y;
618
+ };fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.)
619
+ {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
620
+ else
621
+ {lightVectorW=normalize(-lightData.xyz);}
622
+ var ndl: f32=max(0.,dot(vNormal,lightVectorW));
623
+ #ifdef NDOTL
624
+ result.ndl=ndl;
1299
625
  #endif
1300
- var alphaMultiplier: f32=1.0-lastFrontColor.a;
1301
- #ifdef USE_REVERSE_DEPTHBUFFER
1302
- if (fragDepth>nearestDepth || fragDepth<furthestDepth) {
1303
- #else
1304
- if (fragDepth<nearestDepth || fragDepth>furthestDepth) {
626
+ result.diffuse=ndl*diffuseColor*attenuation;
627
+ #ifdef SPECULARTERM
628
+ var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
1305
629
  #endif
1306
- return fragmentOutputs;}
1307
- #ifdef USE_REVERSE_DEPTHBUFFER
1308
- if (fragDepth<nearestDepth && fragDepth>furthestDepth) {
1309
- #else
1310
- if (fragDepth>nearestDepth && fragDepth<furthestDepth) {
630
+ return result;}
631
+ fn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));}
632
+ fn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}
633
+ fn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW));
634
+ #ifdef NDOTL
635
+ result.ndl=ndl;
636
+ #endif
637
+ result.diffuse=ndl*diffuseColor*attenuation;
638
+ #ifdef SPECULARTERM
639
+ var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
640
+ #endif
641
+ return result;}
642
+ fn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
643
+ {attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
644
+ var result: lightingInfo;result.diffuse=vec3f(0.);
645
+ #ifdef SPECULARTERM
646
+ result.specular=vec3f(0.);
647
+ #endif
648
+ #ifdef NDOTL
649
+ result.ndl=0.;
650
+ #endif
651
+ return result;}
652
+ fn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
653
+ {attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
654
+ var result: lightingInfo;result.diffuse=vec3f(0.);
655
+ #ifdef SPECULARTERM
656
+ result.specular=vec3f(0.);
657
+ #endif
658
+ #ifdef NDOTL
659
+ result.ndl=0.;
1311
660
  #endif
1312
- fragmentOutputs.depth=vec2f(-fragDepth,fragDepth);return fragmentOutputs;}
661
+ return result;}
662
+ fn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5;
663
+ #ifdef NDOTL
664
+ result.ndl=ndl;
665
+ #endif
666
+ result.diffuse=mix(groundColor,diffuseColor,ndl);
667
+ #ifdef SPECULARTERM
668
+ var angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
669
+ #endif
670
+ return result;}
671
+ fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d<f32>,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;}
672
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
673
+ #include<ltcHelperFunctions>
674
+ var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d<f32>;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d<f32>;fn computeAreaLighting(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
675
+ {var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
676
+ #ifdef SPECULARTERM
677
+ var fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
678
+ #endif
679
+ result.diffuse+=diffuseColor*data.Diffuse;return result;}
680
+ fn computeAreaLightingWithTexture(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,emissionTexture: texture_2d<f32>,emissionTextureSampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
681
+ {var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc1Sampler,ltc2,ltc2Sampler,emissionTexture,emissionTextureSampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
682
+ #ifdef SPECULARTERM
683
+ var fresnel: vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
684
+ #endif
685
+ result.diffuse+=diffuseColor*data.Diffuse;return result;}
686
+ #endif
687
+ #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
688
+ #include<clusteredLightingFunctions>
689
+ fn computeClusteredLighting(
690
+ lightDataTexture: texture_2d<f32>,
691
+ tileMaskBuffer: ptr<storage,array<u32>>,
692
+ viewDirectionW: vec3f,
693
+ vNormal: vec3f,
694
+ lightData: vec4f,
695
+ sliceRange: vec2u,
696
+ glossiness: f32
697
+ )->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset;
698
+ let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<<trailing;let light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+trailing);var info: lightingInfo;if light.vLightDirection.w<0.0 {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
699
+ result.diffuse+=info.diffuse;
700
+ #ifdef SPECULARTERM
701
+ result.specular+=info.specular;
702
+ #endif
703
+ }
704
+ batchOffset+=CLUSTLIGHT_BATCH;}
705
+ return result;}
706
+ #endif
707
+ `;i.ShaderStore.IncludesShadersStoreWGSL[u]||(i.ShaderStore.IncludesShadersStoreWGSL[u]=m);var v=e.i(60315),g=e.i(67367);let h="fresnelFunction",p=`#ifdef FRESNEL
708
+ fn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32
709
+ {let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
1313
710
  #endif
1314
- `;r.ShaderStore.IncludesShadersStoreWGSL[K]||(r.ShaderStore.IncludesShadersStoreWGSL[K]=$);let ee="defaultPixelShader",er=`#include<defaultUboDeclaration>
711
+ `;i.ShaderStore.IncludesShadersStoreWGSL[h]||(i.ShaderStore.IncludesShadersStoreWGSL[h]=p);var S=e.i(23356),I=e.i(61059),L=e.i(30733),C=e.i(69488),E=e.i(28657),T=e.i(78875),A=e.i(35182),X=e.i(54758),D=e.i(25626),x=e.i(63406),R=e.i(23344),P=e.i(21439),N=e.i(31329),w=e.i(49692),O=e.i(23009),M=e.i(31213),_=e.i(4818);let F="defaultPixelShader",b=`#include<defaultUboDeclaration>
1315
712
  #include<prePassDeclaration>[SCENE_MRT_COUNT]
1316
713
  #include<oitDeclaration>
1317
714
  #define CUSTOM_FRAGMENT_BEGIN
@@ -1678,4 +1075,4 @@ if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.f
1678
1075
  #endif
1679
1076
  #define CUSTOM_FRAGMENT_MAIN_END
1680
1077
  }
1681
- `;for(let e of(r.ShaderStore.ShadersStoreWGSL[ee]||(r.ShaderStore.ShadersStoreWGSL[ee]=er),[t.sceneUboDeclarationWGSL,a.meshUboDeclarationWGSL,i.defaultUboDeclarationWGSL,{name:o,shader:f},{name:n,shader:s},l.mainUVVaryingDeclarationWGSL,d.helperFunctionsWGSL,{name:c,shader:v},{name:u,shader:p},{name:h,shader:m},{name:S,shader:g},{name:x,shader:T},{name:L,shader:C},{name:w,shader:E},{name:I,shader:D},{name:A,shader:P},{name:X,shader:R},{name:_,shader:y},{name:N,shader:M},{name:F,shader:O},b.clipPlaneFragmentDeclarationWGSL,W.logDepthDeclarationWGSL,z.fogFragmentDeclarationWGSL,U.clipPlaneFragmentWGSL,{name:G,shader:H},{name:V,shader:k},{name:B,shader:Y},{name:q,shader:j},{name:Z,shader:Q},J.fogFragmentWGSL,{name:K,shader:$}]))r.ShaderStore.IncludesShadersStoreWGSL[e.name]||(r.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);e.s(["defaultPixelShaderWGSL",0,{name:ee,shader:er}],26022)}]);
1078
+ `;for(let e of(i.ShaderStore.ShadersStoreWGSL[F]||(i.ShaderStore.ShadersStoreWGSL[F]=b),[r.sceneUboDeclarationWGSL,t.meshUboDeclarationWGSL,o.defaultUboDeclarationWGSL,a.prePassDeclarationWGSL,f.oitDeclarationWGSL,n.mainUVVaryingDeclarationWGSL,l.helperFunctionsWGSL,s.lightUboDeclarationWGSL,d.ltcHelperFunctionsWGSL,c.clusteredLightingFunctionsWGSL,{name:u,shader:m},v.shadowsFragmentFunctionsWGSL,g.samplerFragmentDeclarationWGSL,{name:h,shader:p},S.reflectionFunctionWGSL,I.imageProcessingDeclarationWGSL,L.imageProcessingFunctionsWGSL,C.textureRepetitionFunctionsWGSL,E.bumpFragmentMainFunctionsWGSL,T.bumpFragmentFunctionsWGSL,A.clipPlaneFragmentDeclarationWGSL,X.logDepthDeclarationWGSL,D.fogFragmentDeclarationWGSL,x.clipPlaneFragmentWGSL,R.bumpFragmentWGSL,P.decalFragmentWGSL,N.depthPrePassWGSL,w.lightFragmentWGSL,O.logDepthFragmentWGSL,M.fogFragmentWGSL,_.oitFragmentWGSL]))i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);e.s(["defaultPixelShaderWGSL",0,{name:F,shader:b}],26022)}]);