@uptimizr/dashboard 0.4.6 → 0.4.7

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 (383) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +19 -5
  3. package/out/__next._full.txt +10 -10
  4. package/out/__next._tree.txt +1 -1
  5. package/out/_next/static/chunks/{2-_a-v1xeo5hb.js → 0-_j1khfoib6l.js} +116 -115
  6. package/out/_next/static/chunks/{25brs445bjbik.js → 005bbq_px7lke.js} +2 -2
  7. package/out/_next/static/chunks/00fbhtmui-yxg.js +1 -0
  8. package/out/_next/static/chunks/017pn-pen381_.js +1 -0
  9. package/out/_next/static/chunks/01vov6inx1zzt.js +1 -0
  10. package/out/_next/static/chunks/{2x-7kbwq8tl-o.js → 02qk_wmkf9at-.js} +196 -196
  11. package/out/_next/static/chunks/03bd5plut08tg.js +1 -0
  12. package/out/_next/static/chunks/03dwfqmo73w_z.js +1 -0
  13. package/out/_next/static/chunks/03sn4419dam-h.js +5 -0
  14. package/out/_next/static/chunks/05ere0-228syf.js +1 -0
  15. package/out/_next/static/chunks/{1jjw9hxgi2vzi.js → 05h8u5lrypn5m.js} +1 -1
  16. package/out/_next/static/chunks/{23-y1f_zw56vo.js → 05v-nubi896jg.js} +1 -1
  17. package/out/_next/static/chunks/05z79zh625ezu.js +1 -0
  18. package/out/_next/static/chunks/{2xe4bgir5l-9b.js → 060iult6f68_e.js} +504 -504
  19. package/out/_next/static/chunks/08lvtnv7b1cxp.js +1 -0
  20. package/out/_next/static/chunks/0_v2luu_qmeid.js +1 -0
  21. package/out/_next/static/chunks/0ai0zgbgjqb92.js +1 -0
  22. package/out/_next/static/chunks/0boov9mwycanf.js +1 -0
  23. package/out/_next/static/chunks/{2mrkv0z2i74pv.js → 0btmk0wmekl02.js} +2 -2
  24. package/out/_next/static/chunks/0d8x8m2x6ca_m.js +1 -0
  25. package/out/_next/static/chunks/0dmrdrwtd093b.js +1 -0
  26. package/out/_next/static/chunks/0e1jfrmioeuws.js +1 -0
  27. package/out/_next/static/chunks/0e7nlxmneb2j_.js +1 -0
  28. package/out/_next/static/chunks/0es97pusfxupl.js +1 -0
  29. package/out/_next/static/chunks/{2fspbfbxbswzd.js → 0fd-0i1yt23kz.js} +1 -1
  30. package/out/_next/static/chunks/0fxdyvb1w23d1.js +1 -0
  31. package/out/_next/static/chunks/0fxhc24djjcgq.js +1 -0
  32. package/out/_next/static/chunks/0gf-ztg86zd80.js +1 -0
  33. package/out/_next/static/chunks/{287hakn2ijupp.js → 0grasqqf5dw7r.js} +2 -2
  34. package/out/_next/static/chunks/{161yjxmdz9obc.js → 0hajwk2yd-rwr.js} +1 -1
  35. package/out/_next/static/chunks/0hk1wg7h4araz.js +1 -0
  36. package/out/_next/static/chunks/{1aa9g197l4twm.js → 0j74ipw4fps-n.js} +1 -1
  37. package/out/_next/static/chunks/{1s0dpdqy480hg.js → 0kj-vckdn7t5p.js} +1 -1
  38. package/out/_next/static/chunks/0lbs5xdyjuzuo.js +1 -0
  39. package/out/_next/static/chunks/0lep3_bqwfuin.js +1 -0
  40. package/out/_next/static/chunks/0mp0jh1gj7290.js +1 -0
  41. package/out/_next/static/chunks/0ngpoj2g5i4kz.js +1 -0
  42. package/out/_next/static/chunks/0nhljhguceh66.js +1 -0
  43. package/out/_next/static/chunks/0p6z73afb9dj2.js +1 -0
  44. package/out/_next/static/chunks/0p9zfmidzqkps.js +1 -0
  45. package/out/_next/static/chunks/0q75860p8u_ii.js +1 -0
  46. package/out/_next/static/chunks/{3mmy9zsb7zo-m.js → 0rracz73p38mo.js} +23 -23
  47. package/out/_next/static/chunks/{3_dm45k0vk1aa.js → 0sw-8gxbg4x0l.js} +565 -565
  48. package/out/_next/static/chunks/0sx-6rf3eteqn.js +1 -0
  49. package/out/_next/static/chunks/0thw099xk3_0p.js +3 -0
  50. package/out/_next/static/chunks/0u85f0dhb4i8e.js +1 -0
  51. package/out/_next/static/chunks/0uk7kigzm4vi2.js +31 -0
  52. package/out/_next/static/chunks/0ulufxnsrou61.js +1 -0
  53. package/out/_next/static/chunks/0xa9dyg6ezzyd.js +2 -0
  54. package/out/_next/static/chunks/0xvrfvur0p534.js +1 -0
  55. package/out/_next/static/chunks/{2clevl_9ayd0x.js → 0ybs1u66q26su.js} +1 -1
  56. package/out/_next/static/chunks/0ydfhk-p6zvm0.js +1 -0
  57. package/out/_next/static/chunks/{0j2ygtc_-bo3m.js → 0z004fn14pbcu.js} +1 -1
  58. package/out/_next/static/chunks/{2c8rmxz151fxa.js → 0z9erbl3llr_b.js} +224 -224
  59. package/out/_next/static/chunks/0zcsxvcvog9ue.js +1 -0
  60. package/out/_next/static/chunks/0zqgq0lwtz9tn.js +1 -0
  61. package/out/_next/static/chunks/1-ogak5u00kwa.js +1 -0
  62. package/out/_next/static/chunks/{3si3migsmvz9o.js → 10_5p5-xf2aoo.js} +1 -1
  63. package/out/_next/static/chunks/118qlrzdwpfmo.js +1 -0
  64. package/out/_next/static/chunks/11km5p4gd0ut4.js +1 -0
  65. package/out/_next/static/chunks/120rl4l29q9xs.js +1 -0
  66. package/out/_next/static/chunks/{44m1ijc5cv80x.js → 129m5i93ltoym.js} +1 -1
  67. package/out/_next/static/chunks/12n73o884lyyl.js +1 -0
  68. package/out/_next/static/chunks/{27z7j17kcrty_.js → 13zcn4lv0qj76.js} +11 -11
  69. package/out/_next/static/chunks/15jlgfcaeaki9.js +1 -0
  70. package/out/_next/static/chunks/{374lzksboll-t.js → 15o4_2t-l3rj5.js} +1 -1
  71. package/out/_next/static/chunks/175st2ogkg_1o.js +1 -0
  72. package/out/_next/static/chunks/19rsodtu91ja_.js +1 -0
  73. package/out/_next/static/chunks/1a2ouhup611bz.js +1 -0
  74. package/out/_next/static/chunks/{2117sv2qzo6yq.js → 1by60_b14x-3o.js} +1 -1
  75. package/out/_next/static/chunks/{2al9dh3_1ixhv.js → 1cyq7i39885sl.js} +1 -1
  76. package/out/_next/static/chunks/1d9it6yocgt54.js +1 -0
  77. package/out/_next/static/chunks/{29_n5j-hg_gsa.js → 1dp1s1t-y7gal.js} +1 -1
  78. package/out/_next/static/chunks/1dr7gh6xgypl8.js +1 -0
  79. package/out/_next/static/chunks/{1eirucr9s6-h5.js → 1dt30s_sp8415.js} +1 -1
  80. package/out/_next/static/chunks/{3vtmucpx25o7q.js → 1e8_jl2cxd3rp.js} +584 -584
  81. package/out/_next/static/chunks/1f1rek_fxk3of.js +1 -0
  82. package/out/_next/static/chunks/1f2mna0k5efeq.js +1 -0
  83. package/out/_next/static/chunks/1gfz3sxwkkg3d.js +1 -0
  84. package/out/_next/static/chunks/1gr35qeguuws0.js +1 -0
  85. package/out/_next/static/chunks/{3p03l0z65c8vc.js → 1gttu-n9am66k.js} +253 -253
  86. package/out/_next/static/chunks/1imi0xwi9hd99.js +1 -0
  87. package/out/_next/static/chunks/1ka5v5zu0cstt.js +1 -0
  88. package/out/_next/static/chunks/{3my05px5mv_s5.js → 1l_3oidssbhns.js} +235 -235
  89. package/out/_next/static/chunks/{0r-x702_jvhud.js → 1m9zc5gm-327d.js} +12 -12
  90. package/out/_next/static/chunks/1n9nhz-6azcp3.js +3 -0
  91. package/out/_next/static/chunks/1ncqwe81t_9_x.js +1 -0
  92. package/out/_next/static/chunks/{3un-w6wutw1qn.js → 1nix_lulkpklo.js} +1 -1
  93. package/out/_next/static/chunks/1ntqovuz2c217.js +1 -0
  94. package/out/_next/static/chunks/1pgs-98tfkq9_.js +1 -0
  95. package/out/_next/static/chunks/1q2z0aeopo8t8.js +1 -0
  96. package/out/_next/static/chunks/{1x0j78ohufpul.js → 1q4lkgxfnqnew.js} +1 -1
  97. package/out/_next/static/chunks/{0yd4_xh476fjn.js → 1qg1l7t00nyib.js} +97 -97
  98. package/out/_next/static/chunks/{2wgh5i70bzelt.js → 1rcdimhu0qhlu.js} +392 -392
  99. package/out/_next/static/chunks/1rlfg62jxqj3z.js +1 -0
  100. package/out/_next/static/chunks/1ses023uud001.js +1 -0
  101. package/out/_next/static/chunks/1t5oynmttpfsw.js +1 -0
  102. package/out/_next/static/chunks/{39cou9lia_g7l.js → 1t9i20i5-f8ze.js} +1 -1
  103. package/out/_next/static/chunks/{0rykrf_vofbad.js → 1tgj55b305g4h.js} +1 -1
  104. package/out/_next/static/chunks/{3rj-5v0j_2-_2.js → 1u8snlm6a7uhi.js} +4 -4
  105. package/out/_next/static/chunks/{2neieeo9g2u56.js → 1ug4k-1zhr63a.js} +1 -1
  106. package/out/_next/static/chunks/{3ioxfi3bvznhh.js → 1uh9zgsy69g92.js} +1 -1
  107. package/out/_next/static/chunks/1vrpzlif-z_p0.js +1 -0
  108. package/out/_next/static/chunks/{0lwjmr8efrlbt.js → 1vurgl6oz2qey.js} +1 -1
  109. package/out/_next/static/chunks/1w-qc09n9ijtq.js +1 -0
  110. package/out/_next/static/chunks/1ycqxcht6x54p.js +1 -0
  111. package/out/_next/static/chunks/1zj4307ugq0qz.js +1 -0
  112. package/out/_next/static/chunks/{14e4k-718qadd.js → 1zkd8v-qka--j.js} +163 -168
  113. package/out/_next/static/chunks/1zm52cjrfrq7c.js +1 -0
  114. package/out/_next/static/chunks/{3-yhe6rcsjh88.js → 1zm6eo861i3c8.js} +1 -1
  115. package/out/_next/static/chunks/{06fbalmyyfpsy.js → 1zp9363yfhpom.js} +1 -1
  116. package/out/_next/static/chunks/1zt1xxovnjhkm.js +1 -0
  117. package/out/_next/static/chunks/2-3hk_db5fpok.js +1 -0
  118. package/out/_next/static/chunks/2-bv9a_0zgw1f.js +1 -0
  119. package/out/_next/static/chunks/{3cp5nmtwxq4gr.js → 209sxygecny37.js} +1 -1
  120. package/out/_next/static/chunks/{133dqp8_7_yo6.js → 216uiih3_vdfd.js} +1 -1
  121. package/out/_next/static/chunks/21kfpd_bityxt.js +1 -0
  122. package/out/_next/static/chunks/{3yk0hzfq5rcs6.js → 22yqh0zlo_vwr.js} +1 -1
  123. package/out/_next/static/chunks/24ecas0m9tao7.js +3 -0
  124. package/out/_next/static/chunks/24pq9210rng3f.js +1 -0
  125. package/out/_next/static/chunks/{184pz6z3dflfm.js → 267prao6fyt22.js} +20 -20
  126. package/out/_next/static/chunks/26skkagvj1z96.js +1 -0
  127. package/out/_next/static/chunks/{0i9wa8hjd-5tc.js → 26y9sv8_-ykxf.js} +1 -1
  128. package/out/_next/static/chunks/2701xfv_07wz_.js +1 -0
  129. package/out/_next/static/chunks/{39rhmj_32ujyj.js → 271333m8y3k0e.js} +1 -1
  130. package/out/_next/static/chunks/29rkmguzky-bp.js +1 -0
  131. package/out/_next/static/chunks/{3qo7e6b73mfxq.js → 2a07so920b6aa.js} +1 -1
  132. package/out/_next/static/chunks/{1z790xxb46gxy.js → 2a2oy8ryz2tsk.js} +1 -1
  133. package/out/_next/static/chunks/{2-i29-jdbwww6.js → 2ao-3jzz7yw3p.js} +111 -111
  134. package/out/_next/static/chunks/2apihn9ra2ufp.js +1 -0
  135. package/out/_next/static/chunks/2apnpj0-fs9ks.js +1 -0
  136. package/out/_next/static/chunks/2b481pitl4k85.js +1 -0
  137. package/out/_next/static/chunks/2bettxaqt3d2p.js +1 -0
  138. package/out/_next/static/chunks/{1bv-jzy_2jiqs.js → 2c721vfva711t.js} +1 -1
  139. package/out/_next/static/chunks/{17_jjyx4jz9dd.js → 2d2kl_m64j9cb.js} +1 -1
  140. package/out/_next/static/chunks/2droqjmvmgj13.js +1 -0
  141. package/out/_next/static/chunks/2dxbvwbbgpzoq.js +1 -0
  142. package/out/_next/static/chunks/2eqbsut829r5l.js +1 -0
  143. package/out/_next/static/chunks/2f3_mzxjh3gso.js +1 -0
  144. package/out/_next/static/chunks/2fsde0jwi5qtt.js +1 -0
  145. package/out/_next/static/chunks/{0jap7l5-bskj4.js → 2h249uvhh2sij.js} +12 -12
  146. package/out/_next/static/chunks/{2as_br1awqk6k.js → 2izok2otbk8-2.js} +496 -496
  147. package/out/_next/static/chunks/2j120dkh7q3uf.js +1 -0
  148. package/out/_next/static/chunks/2j2ynchpqh34-.js +1 -0
  149. package/out/_next/static/chunks/2kj6pzs_wap1v.js +1 -0
  150. package/out/_next/static/chunks/{2epukrz6paj9n.js → 2kok6zedeeltw.js} +1 -1
  151. package/out/_next/static/chunks/2lnj9jruy4nrv.js +1 -0
  152. package/out/_next/static/chunks/{0j0a0wvmmghxj.js → 2lsvk7xcfkarc.js} +1 -1
  153. package/out/_next/static/chunks/2n-pveub8b_5t.js +1 -0
  154. package/out/_next/static/chunks/{3puu2_-t0lln9.js → 2n3xu_wbvtj7h.js} +12 -12
  155. package/out/_next/static/chunks/{1lu7rjfvxj8yj.js → 2of8q0kaeqpf0.js} +1 -1
  156. package/out/_next/static/chunks/2ofwtw6p08sfz.js +1 -0
  157. package/out/_next/static/chunks/{1t-yolk97lmot.js → 2phl5ta4iim7l.js} +1 -1
  158. package/out/_next/static/chunks/2q6l-xdqzgmpf.js +1 -0
  159. package/out/_next/static/chunks/2q8yg63br2jc9.js +1 -0
  160. package/out/_next/static/chunks/2r5qgieqldcd9.js +1 -0
  161. package/out/_next/static/chunks/2r7y401cvjc1s.js +1 -0
  162. package/out/_next/static/chunks/{1a94whad0y57f.js → 2r96kyeehsji9.js} +1 -1
  163. package/out/_next/static/chunks/{1gvu5a6ffbs7l.js → 2rmc6ru7mc-kg.js} +1 -1
  164. package/out/_next/static/chunks/{3_gfl66zf638s.js → 2s6kpclh6ie7o.js} +901 -906
  165. package/out/_next/static/chunks/{0xzamrecplwzw.js → 2sys9nj8lo3uk.js} +1 -1
  166. package/out/_next/static/chunks/{336ckqpboqmbn.js → 2tc3e-iqv71y_.js} +1 -1
  167. package/out/_next/static/chunks/{1t2g1v0ubcsam.js → 2uo6vm7mfgrbf.js} +1 -1
  168. package/out/_next/static/chunks/{2kmmk9coo9_b0.js → 2urx6fow8c8c9.js} +143 -143
  169. package/out/_next/static/chunks/2w2k1gveljyb7.js +1 -0
  170. package/out/_next/static/chunks/{1zmx71cvc6ksk.js → 2w99knknr5i8c.js} +1 -1
  171. package/out/_next/static/chunks/2w_ptlw-ad8-9.js +4 -0
  172. package/out/_next/static/chunks/2ws1s9d52ayv8.js +1 -0
  173. package/out/_next/static/chunks/2x7enks3ydgai.js +1 -0
  174. package/out/_next/static/chunks/{2_6b9lraq-exh.js → 2y8i7_nxm4r05.js} +5 -5
  175. package/out/_next/static/chunks/2ydub0t01728d.js +1 -0
  176. package/out/_next/static/chunks/{29hkkj9raxte9.js → 2z_iab7ozohhq.js} +77 -77
  177. package/out/_next/static/chunks/3-m_vzabs1uez.js +1 -0
  178. package/out/_next/static/chunks/{1h1gixjbjkbsl.js → 302qk2fjdrthp.js} +5 -5
  179. package/out/_next/static/chunks/30bhz7czzs4mf.js +1 -0
  180. package/out/_next/static/chunks/{3d43gd91r06y6.js → 30n4y_uu8chbh.js} +507 -505
  181. package/out/_next/static/chunks/{0o0qtv35dqv3i.js → 32_c4mbb6j1l6.js} +239 -239
  182. package/out/_next/static/chunks/33hp-khdfohdq.js +1 -0
  183. package/out/_next/static/chunks/{3zv5kyos9vtmm.js → 33i36o_l69sm5.js} +1 -1
  184. package/out/_next/static/chunks/3527r3jo5fj3i.js +1 -0
  185. package/out/_next/static/chunks/355dg8yaa94hr.js +1 -0
  186. package/out/_next/static/chunks/{2h9i_adbqaxs4.js → 35ntbr_c-yx44.js} +1 -1
  187. package/out/_next/static/chunks/{0cmyc-uvk93kl.js → 35sne1llxnc-m.js} +74 -74
  188. package/out/_next/static/chunks/36enkx1skkv2-.js +4 -0
  189. package/out/_next/static/chunks/{0e5dcxmkprebg.js → 3772oce1n3t_g.js} +1 -1
  190. package/out/_next/static/chunks/37cnbm5ft1mqf.js +1 -0
  191. package/out/_next/static/chunks/38xdo3cifphut.js +1 -0
  192. package/out/_next/static/chunks/{0o73w0cn5n_vl.js → 3_dgblylldcgb.js} +1 -1
  193. package/out/_next/static/chunks/3beawo-qwuk8k.js +1 -0
  194. package/out/_next/static/chunks/3cj_6sl9kr3e9.js +1 -0
  195. package/out/_next/static/chunks/3d-i_skta_wes.js +1 -0
  196. package/out/_next/static/chunks/3df_l2we755bb.js +1 -0
  197. package/out/_next/static/chunks/{0o1vph7x9shzu.js → 3eve5y7fpzx2h.js} +1 -1
  198. package/out/_next/static/chunks/3ewgyb4y19w-3.js +1 -0
  199. package/out/_next/static/chunks/3f3789eh18_oy.js +1 -0
  200. package/out/_next/static/chunks/{0gk5rnci1hznh.js → 3f8qelpscqfym.js} +2 -2
  201. package/out/_next/static/chunks/3g3-e9m1en45q.js +1 -0
  202. package/out/_next/static/chunks/{2kk_vvmr2xm3d.js → 3h6akt2uu05ku.js} +12 -12
  203. package/out/_next/static/chunks/{2_lw4d7t-xcqi.js → 3huu0tqmxwowu.js} +523 -522
  204. package/out/_next/static/chunks/3i239y-1hbkm-.js +1 -0
  205. package/out/_next/static/chunks/{2mjjo0yj-4ro4.js → 3ipx7xbxchsq9.js} +1 -1
  206. package/out/_next/static/chunks/{3txu-i5qn183a.js → 3j9xvdz55bi4p.js} +321 -321
  207. package/out/_next/static/chunks/3kp8qmhoi24oz.js +1 -0
  208. package/out/_next/static/chunks/3ksq69yq-40_r.js +1 -0
  209. package/out/_next/static/chunks/{3nwaovnpiyrt8.js → 3njwfothmmg7u.js} +3 -3
  210. package/out/_next/static/chunks/{2iu0_3cx-ny74.js → 3oqxl46ukaojj.js} +11 -11
  211. package/out/_next/static/chunks/{2oacwtbslo90t.js → 3qn6r8-0u6dij.js} +360 -360
  212. package/out/_next/static/chunks/3qye1lytea2i8.js +1 -0
  213. package/out/_next/static/chunks/{0gsh_d0m5xss1.js → 3rlp9yr75liz7.js} +1 -1
  214. package/out/_next/static/chunks/{3j3ol_d1vsdhx.js → 3sa_hlx3konc7.js} +1 -1
  215. package/out/_next/static/chunks/3tyo643l62h3m.js +1 -0
  216. package/out/_next/static/chunks/3tz2tpqa9uvwm.js +1 -0
  217. package/out/_next/static/chunks/{0_jrfk2u1u3fi.js → 3utpc-fc6_y0f.js} +1 -1
  218. package/out/_next/static/chunks/3v-0c2aj6c0on.js +1 -0
  219. package/out/_next/static/chunks/3v6nxa28rxngq.js +1 -0
  220. package/out/_next/static/chunks/{3twr9ds68-9us.js → 3vbamaoiuk9yj.js} +1 -1
  221. package/out/_next/static/chunks/3vv99btjc-mky.js +1 -0
  222. package/out/_next/static/chunks/{22yht3s7c-xih.js → 3w59kt5ztyvoq.js} +1 -1
  223. package/out/_next/static/chunks/3x02lxdo28u9i.js +1 -0
  224. package/out/_next/static/chunks/{1my968s78he8g.js → 3xl-op0hwxytg.js} +15 -15
  225. package/out/_next/static/chunks/3ydnxyc4rvad_.js +1 -0
  226. package/out/_next/static/chunks/3ylg4gfetwgxw.js +1 -0
  227. package/out/_next/static/chunks/{0a475u_q5i_dd.js → 3zdtteq-r2fs5.js} +2 -2
  228. package/out/_next/static/chunks/3zkwt0gybqtgm.js +1 -0
  229. package/out/_next/static/chunks/{3nr48h9zwum-3.js → 3zs7l4362msjd.js} +1 -1
  230. package/out/_next/static/chunks/40etabvml_71y.js +1 -0
  231. package/out/_next/static/chunks/{2xujlsx3stqig.js → 417jkzz0slv9m.js} +1 -1
  232. package/out/_next/static/chunks/{0ypejzd74ixbw.js → 41b5gpyqbj58m.js} +15 -15
  233. package/out/_next/static/chunks/41u2-5jayyajf.js +22 -0
  234. package/out/_next/static/chunks/42gcpy51w7lk1.js +1 -0
  235. package/out/_next/static/chunks/{2h07np207nlx7.js → 42ymanq326mo7.js} +1 -1
  236. package/out/_next/static/chunks/{36pz_ews7u0xb.js → 43fp64xnfy646.js} +1 -1
  237. package/out/_next/static/chunks/43v4y2gu5z9_h.js +1 -0
  238. package/out/_next/static/chunks/44cer242u-f8v.js +1 -0
  239. package/out/_next/static/chunks/{0d9pxx1w_zqr9.js → 44zi0gl0a6a8w.js} +1 -1
  240. package/out/_next/static/chunks/turbopack-0n2o5_bkskckx.js +1 -0
  241. package/out/_not-found/__next._full.txt +11 -11
  242. package/out/_not-found/__next._not-found.__PAGE__.txt +19 -2
  243. package/out/_not-found/__next._tree.txt +1 -1
  244. package/out/_not-found.html +1 -1
  245. package/out/_not-found.txt +11 -11
  246. package/out/index.html +1 -1
  247. package/out/index.txt +10 -10
  248. package/package.json +9 -9
  249. package/out/__next._head.txt +0 -6
  250. package/out/__next._index.txt +0 -5
  251. package/out/_next/static/chunks/0-k4hp87gwues.js +0 -1
  252. package/out/_next/static/chunks/0-laj-bivzp4x.js +0 -1
  253. package/out/_next/static/chunks/04zj0yf1qhk1o.js +0 -1
  254. package/out/_next/static/chunks/07hgbbqksqd1g.js +0 -1
  255. package/out/_next/static/chunks/08ou2nvy48e0u.js +0 -1
  256. package/out/_next/static/chunks/08y5-irjbsiy8.js +0 -1
  257. package/out/_next/static/chunks/0aad2r4s4wl1x.js +0 -5
  258. package/out/_next/static/chunks/0gnjtwq-474uc.js +0 -1
  259. package/out/_next/static/chunks/0ibzpjo0h731v.js +0 -1
  260. package/out/_next/static/chunks/0j_3k5qhv_mdx.js +0 -1
  261. package/out/_next/static/chunks/0jis2w2mfx062.js +0 -1
  262. package/out/_next/static/chunks/0jjvp2slpf7d6.js +0 -1
  263. package/out/_next/static/chunks/0ko10wo4rc9-b.js +0 -1
  264. package/out/_next/static/chunks/0lqmvz6k2h_of.js +0 -1
  265. package/out/_next/static/chunks/0noxyupihh8dk.js +0 -1
  266. package/out/_next/static/chunks/0p6phe9kjlxn8.js +0 -1
  267. package/out/_next/static/chunks/0ptxb9dcwsw3o.js +0 -1
  268. package/out/_next/static/chunks/0q0i4pdyq66gb.js +0 -1
  269. package/out/_next/static/chunks/0q8pt8fd0ma30.js +0 -1
  270. package/out/_next/static/chunks/0qqx9aoz8l5d2.js +0 -1
  271. package/out/_next/static/chunks/0tsk32q-88t_7.js +0 -1
  272. package/out/_next/static/chunks/0u7577db_ivyr.js +0 -1
  273. package/out/_next/static/chunks/0unnrt0un064x.js +0 -1
  274. package/out/_next/static/chunks/0uygtr4mo3h0v.js +0 -1
  275. package/out/_next/static/chunks/0vf3facit951s.js +0 -1
  276. package/out/_next/static/chunks/0vzo-8t8c26k9.js +0 -1
  277. package/out/_next/static/chunks/0xx7_7y5jdlh4.js +0 -1
  278. package/out/_next/static/chunks/0xyija62b6txc.js +0 -1
  279. package/out/_next/static/chunks/0zeb37703zcz3.js +0 -1
  280. package/out/_next/static/chunks/0zu5ato7-1-q9.js +0 -1
  281. package/out/_next/static/chunks/0zydv7y47dxgh.js +0 -1
  282. package/out/_next/static/chunks/103x4jwovb6d-.js +0 -1
  283. package/out/_next/static/chunks/107wfq84g9-kn.js +0 -1
  284. package/out/_next/static/chunks/10afagk8yn__n.js +0 -1
  285. package/out/_next/static/chunks/12ory_c78yl31.js +0 -1
  286. package/out/_next/static/chunks/1365lgwdd4vuo.js +0 -1
  287. package/out/_next/static/chunks/146ou-ohb_qhs.js +0 -1
  288. package/out/_next/static/chunks/14orr68xgdykd.js +0 -1
  289. package/out/_next/static/chunks/15qfoj-vl9thu.js +0 -1
  290. package/out/_next/static/chunks/166yqx3_qvbpy.js +0 -1
  291. package/out/_next/static/chunks/16gwjao676ieb.js +0 -1
  292. package/out/_next/static/chunks/16rmmzhy2p7bw.js +0 -1
  293. package/out/_next/static/chunks/18h9ugdz6igdb.js +0 -1
  294. package/out/_next/static/chunks/19d8n5t7ka2fb.js +0 -1
  295. package/out/_next/static/chunks/1_4hh3dfop93j.js +0 -1
  296. package/out/_next/static/chunks/1_rbzw3n4fk0g.js +0 -1
  297. package/out/_next/static/chunks/1bq0fcnt1wy86.js +0 -1
  298. package/out/_next/static/chunks/1c6mho7e0enta.js +0 -1
  299. package/out/_next/static/chunks/1dfaheve77dhi.js +0 -1
  300. package/out/_next/static/chunks/1dgf112ehnhm1.js +0 -1
  301. package/out/_next/static/chunks/1f07l3q77zat1.js +0 -1
  302. package/out/_next/static/chunks/1fervgvgv10r-.js +0 -1
  303. package/out/_next/static/chunks/1fsof7un7igrn.js +0 -1
  304. package/out/_next/static/chunks/1iel4pzhhh-c3.js +0 -1
  305. package/out/_next/static/chunks/1iojfx3-g4_n9.js +0 -1
  306. package/out/_next/static/chunks/1j4c0nvdo5q68.js +0 -3
  307. package/out/_next/static/chunks/1j4jt5q7px8sy.js +0 -1
  308. package/out/_next/static/chunks/1k_8olnprvi8r.js +0 -1
  309. package/out/_next/static/chunks/1l0rt7d4m-xdk.js +0 -5
  310. package/out/_next/static/chunks/1mt4cnd_d6jvf.js +0 -1
  311. package/out/_next/static/chunks/1tbes2sv-qzcx.js +0 -1
  312. package/out/_next/static/chunks/1upy8a5cb75kt.js +0 -1
  313. package/out/_next/static/chunks/1xed71f608m4b.js +0 -1
  314. package/out/_next/static/chunks/219n3q-_eengm.js +0 -1
  315. package/out/_next/static/chunks/21wo3vdr_uby8.js +0 -1
  316. package/out/_next/static/chunks/25gep78-izw79.js +0 -4
  317. package/out/_next/static/chunks/26i7dn31afdtm.js +0 -1
  318. package/out/_next/static/chunks/27hbplu797elx.js +0 -1
  319. package/out/_next/static/chunks/28i3wgvgn_at1.js +0 -1
  320. package/out/_next/static/chunks/2992eiy52nazj.js +0 -1
  321. package/out/_next/static/chunks/29bxq-67oazfg.js +0 -1
  322. package/out/_next/static/chunks/29ings58w7kp1.js +0 -1
  323. package/out/_next/static/chunks/2_n0cpkdsjzli.js +0 -1
  324. package/out/_next/static/chunks/2a3iy701j4r_y.js +0 -1
  325. package/out/_next/static/chunks/2awr1c_vfsutb.js +0 -1
  326. package/out/_next/static/chunks/2b5nt7yn-pq3a.js +0 -1
  327. package/out/_next/static/chunks/2bxe3kjr17tdp.js +0 -1
  328. package/out/_next/static/chunks/2dvbzar93ooc-.js +0 -1
  329. package/out/_next/static/chunks/2e-vp0e11g9ew.js +0 -1
  330. package/out/_next/static/chunks/2exj9-0p6n9x-.js +0 -1
  331. package/out/_next/static/chunks/2gf8l6hbmt7v3.js +0 -1
  332. package/out/_next/static/chunks/2jio3sio-_43z.js +0 -1
  333. package/out/_next/static/chunks/2laz1v9fg2a2z.js +0 -1
  334. package/out/_next/static/chunks/2pb_uosb-aa8x.js +0 -1
  335. package/out/_next/static/chunks/2qu-gpm3ux1l6.js +0 -1
  336. package/out/_next/static/chunks/2rsi6v7qmqx2b.js +0 -1
  337. package/out/_next/static/chunks/2s4fzgzkwjluu.js +0 -2
  338. package/out/_next/static/chunks/2tdvuc-27khif.js +0 -1
  339. package/out/_next/static/chunks/2trolrgd7neax.js +0 -1
  340. package/out/_next/static/chunks/2uyuafmoe5wi0.js +0 -3
  341. package/out/_next/static/chunks/2w2e0pxgs-n8f.js +0 -1
  342. package/out/_next/static/chunks/30y71dxdpv52d.js +0 -1
  343. package/out/_next/static/chunks/32c-e_v8_2xkf.js +0 -1
  344. package/out/_next/static/chunks/32oj0iudhp8bm.js +0 -1
  345. package/out/_next/static/chunks/33p9du6y9eegg.js +0 -1
  346. package/out/_next/static/chunks/38om-j0h0rryk.js +0 -1
  347. package/out/_next/static/chunks/38q0enmlg5q9o.js +0 -3
  348. package/out/_next/static/chunks/39pkya0_bvcaj.js +0 -1
  349. package/out/_next/static/chunks/3_1zzmx92j9c0.js +0 -1
  350. package/out/_next/static/chunks/3_earszshuz4n.js +0 -1
  351. package/out/_next/static/chunks/3ap_uxc8lx7ni.js +0 -1
  352. package/out/_next/static/chunks/3b6na8zrex8jo.js +0 -1
  353. package/out/_next/static/chunks/3c0cxt72vilyz.js +0 -1
  354. package/out/_next/static/chunks/3g78x0pdaoi_4.js +0 -1
  355. package/out/_next/static/chunks/3gjvl1p-tugfe.js +0 -4
  356. package/out/_next/static/chunks/3i8iro1gas1vx.js +0 -1
  357. package/out/_next/static/chunks/3kpqfqr99vo7z.js +0 -1
  358. package/out/_next/static/chunks/3lladf_wemm-2.js +0 -1
  359. package/out/_next/static/chunks/3n62hbywoknop.js +0 -1
  360. package/out/_next/static/chunks/3o_dmzpahx-5g.js +0 -1
  361. package/out/_next/static/chunks/3r7v7un976sn7.js +0 -1
  362. package/out/_next/static/chunks/3rl_nhqwew40w.js +0 -1
  363. package/out/_next/static/chunks/3s7hqij6xp_4e.js +0 -1
  364. package/out/_next/static/chunks/3t4ys6th6gf2w.js +0 -1
  365. package/out/_next/static/chunks/3uarw1i1ij1er.js +0 -1
  366. package/out/_next/static/chunks/3v8kgnjk27wbe.js +0 -1
  367. package/out/_next/static/chunks/3vu5y270muh-7.js +0 -1
  368. package/out/_next/static/chunks/3we1khqfexh3x.js +0 -1
  369. package/out/_next/static/chunks/3z35loj4i-id4.js +0 -1
  370. package/out/_next/static/chunks/415g3asdds1ac.js +0 -1
  371. package/out/_next/static/chunks/42lqt7ig40wk5.js +0 -1
  372. package/out/_next/static/chunks/42s6ghsurq5q7.js +0 -1
  373. package/out/_next/static/chunks/42yctcfi2rfwr.js +0 -1
  374. package/out/_next/static/chunks/43_fau1gg69eo.js +0 -1
  375. package/out/_next/static/chunks/43ywrdzg_7af8.js +0 -31
  376. package/out/_next/static/chunks/453_bg0lgesmp.js +0 -1
  377. package/out/_next/static/chunks/turbopack-1s36ieuku1ds3.js +0 -1
  378. package/out/_not-found/__next._head.txt +0 -6
  379. package/out/_not-found/__next._index.txt +0 -5
  380. package/out/_not-found/__next._not-found.txt +0 -5
  381. /package/out/_next/static/{5UjNvd7WCk97iC2cSmEGH → A1hxMz783bIWo0Q9qqV3L}/_buildManifest.js +0 -0
  382. /package/out/_next/static/{5UjNvd7WCk97iC2cSmEGH → A1hxMz783bIWo0Q9qqV3L}/_clientMiddlewareManifest.js +0 -0
  383. /package/out/_next/static/{5UjNvd7WCk97iC2cSmEGH → A1hxMz783bIWo0Q9qqV3L}/_ssgManifest.js +0 -0
@@ -1,4 +1,19 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3954,e=>{"use strict";var o=e.i(47150);let t="helperFunctions",i=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08;
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8500,e=>{"use strict";var o=e.i(2342);let t="harmonicsFunctions",i=`#ifdef USESPHERICALFROMREFLECTIONMAP
2
+ #ifdef SPHERICAL_HARMONICS
3
+ vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00
4
+ + vSphericalL1_1*(normal.y)
5
+ + vSphericalL10*(normal.z)
6
+ + vSphericalL11*(normal.x)
7
+ + vSphericalL2_2*(normal.y*normal.x)
8
+ + vSphericalL2_1*(normal.y*normal.z)
9
+ + vSphericalL20*((3.0*normal.z*normal.z)-1.0)
10
+ + vSphericalL21*(normal.z*normal.x)
11
+ + vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
12
+ #else
13
+ vec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}
14
+ #endif
15
+ #endif
16
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["harmonicsFunctions",0,{name:t,shader:i}])},62308,e=>{"use strict";var o=e.i(2342);let t="helperFunctions",i=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08;
2
17
  const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;
3
18
  #define saturate(x) clamp(x,0.0,1.0)
4
19
  #define absEps(x) abs(x)+Epsilon
@@ -116,40 +131,89 @@ float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}
116
131
  vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),
117
132
  uint2float(rstate*2447445414u));}
118
133
  #endif
119
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["helperFunctions",0,{name:t,shader:i}])},68381,e=>{"use strict";var o=e.i(47150);let t="logDepthDeclaration",i=`#ifdef LOGARITHMICDEPTH
134
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["helperFunctions",0,{name:t,shader:i}])},80790,e=>{"use strict";var o=e.i(2342);let t="logDepthDeclaration",i=`#ifdef LOGARITHMICDEPTH
120
135
  uniform float logarithmicDepthConstant;varying float vFragmentDepth;
121
136
  #endif
122
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["logDepthDeclaration",0,{name:t,shader:i}])},67827,e=>{"use strict";var o=e.i(47150);let t="sceneUboDeclaration",i=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
123
- #ifdef MULTIVIEW
124
- mat4 viewProjectionR;
125
- #endif
126
- mat4 view;mat4 projection;vec4 vEyePosition;mat4 inverseProjection;};
127
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneUboDeclaration",0,{name:t,shader:i}])},38605,e=>{"use strict";var o=e.i(47150);let t="meshUboDeclaration",i=`#ifdef WEBGL2
137
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["logDepthDeclaration",0,{name:t,shader:i}])},65225,e=>{"use strict";var o=e.i(2342);let t="mainUVVaryingDeclaration",i=`#ifdef MAINUV{X}
138
+ varying vec2 vMainUV{X};
139
+ #endif
140
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["mainUVVaryingDeclaration",0,{name:t,shader:i}])},49676,e=>{"use strict";var o=e.i(2342);let t="meshUboDeclaration",i=`#ifdef WEBGL2
128
141
  uniform mat4 world;uniform float visibility;
129
142
  #else
130
143
  layout(std140,column_major) uniform;uniform Mesh
131
144
  {mat4 world;float visibility;};
132
145
  #endif
133
146
  #define WORLD_UBO
134
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["meshUboDeclaration",0,{name:t,shader:i}])},30868,e=>{"use strict";var o=e.i(47150);let t="mainUVVaryingDeclaration",i=`#ifdef MAINUV{X}
135
- varying vec2 vMainUV{X};
147
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["meshUboDeclaration",0,{name:t,shader:i}])},64541,e=>{"use strict";var o=e.i(2342);let t="openpbrSubsurfaceLayerData",i=`float subsurface_weight=vSubsurfaceWeight;vec3 subsurface_color=vSubsurfaceColor.rgb;float subsurface_radius=vSubsurfaceRadius;vec3 subsurface_radius_scale=vSubsurfaceRadiusScale;float subsurface_scatter_anisotropy=clamp(vSubsurfaceScatterAnisotropy,-0.9999,0.9999);
148
+ #ifdef SUBSURFACE_WEIGHT
149
+ vec4 subsurfaceWeightFromTexture=TEXRD(subsurfaceWeightSampler,vSubsurfaceWeightUV+uvOffset);
136
150
  #endif
137
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["mainUVVaryingDeclaration",0,{name:t,shader:i}])},88913,e=>{"use strict";var o=e.i(47150);let t="harmonicsFunctions",i=`#ifdef USESPHERICALFROMREFLECTIONMAP
138
- #ifdef SPHERICAL_HARMONICS
139
- vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00
140
- + vSphericalL1_1*(normal.y)
141
- + vSphericalL10*(normal.z)
142
- + vSphericalL11*(normal.x)
143
- + vSphericalL2_2*(normal.y*normal.x)
144
- + vSphericalL2_1*(normal.y*normal.z)
145
- + vSphericalL20*((3.0*normal.z*normal.z)-1.0)
146
- + vSphericalL21*(normal.z*normal.x)
147
- + vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
151
+ #ifdef SUBSURFACE_COLOR
152
+ vec4 subsurfaceColorFromTexture=TEXRD(subsurfaceColorSampler,vSubsurfaceColorUV+uvOffset);
153
+ #endif
154
+ #ifdef SUBSURFACE_RADIUS_SCALE
155
+ vec4 subsurfaceRadiusScaleFromTexture=TEXRD(subsurfaceRadiusScaleSampler,vSubsurfaceRadiusScaleUV+uvOffset);
156
+ #endif
157
+ #ifdef SUBSURFACE_WEIGHT
158
+ #ifdef SUBSURFACE_WEIGHT_FROM_TEXTURE_ALPHA
159
+ subsurface_weight*=subsurfaceWeightFromTexture.a;
148
160
  #else
149
- vec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}
161
+ subsurface_weight*=subsurfaceWeightFromTexture.r;
162
+ #endif
163
+ #endif
164
+ #ifdef SUBSURFACE_COLOR
165
+ #ifdef SUBSURFACE_COLOR_GAMMA
166
+ subsurface_color*=toLinearSpace(subsurfaceColorFromTexture.rgb);
167
+ #else
168
+ subsurface_color*=subsurfaceColorFromTexture.rgb;
169
+ #endif
170
+ subsurface_color*=vSubsurfaceColorInfos.y;
171
+ #endif
172
+ #ifdef SUBSURFACE_RADIUS_SCALE
173
+ subsurface_radius_scale*=subsurfaceRadiusScaleFromTexture.rgb;
174
+ #endif
175
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrSubsurfaceLayerData",0,{name:t,shader:i}])},33521,e=>{"use strict";var o=e.i(2342);let t="openpbrTransmissionLayerData",i=`float transmission_weight=vTransmissionWeight;vec3 transmission_color=vTransmissionColor.rgb;float transmission_depth=vTransmissionDepth;vec3 transmission_scatter=vTransmissionScatter.rgb;float transmission_scatter_anisotropy=clamp(vTransmissionScatterAnisotropy,-0.9999,0.9999);float transmission_dispersion_scale=vTransmissionDispersionScale;float transmission_dispersion_abbe_number=vTransmissionDispersionAbbeNumber;
176
+ #ifdef TRANSMISSION_WEIGHT
177
+ vec4 transmissionWeightFromTexture=TEXRD(transmissionWeightSampler,vTransmissionWeightUV+uvOffset);
178
+ #endif
179
+ #ifdef TRANSMISSION_COLOR
180
+ vec4 transmissionColorFromTexture=TEXRD(transmissionColorSampler,vTransmissionColorUV+uvOffset);
181
+ #endif
182
+ #ifdef TRANSMISSION_DEPTH
183
+ vec4 transmissionDepthFromTexture=TEXRD(transmissionDepthSampler,vTransmissionDepthUV+uvOffset);
184
+ #endif
185
+ #ifdef TRANSMISSION_SCATTER
186
+ vec4 transmissionScatterFromTexture=TEXRD(transmissionScatterSampler,vTransmissionScatterUV+uvOffset);
187
+ #endif
188
+ #ifdef TRANSMISSION_DISPERSION_SCALE
189
+ vec4 transmissionDispersionScaleFromTexture=TEXRD(transmissionDispersionScaleSampler,vTransmissionDispersionScaleUV+uvOffset);
190
+ #endif
191
+ #ifdef TRANSMISSION_WEIGHT
192
+ transmission_weight*=transmissionWeightFromTexture.r;
193
+ #endif
194
+ #ifdef TRANSMISSION_COLOR
195
+ #ifdef TRANSMISSION_COLOR_GAMMA
196
+ transmission_color*=toLinearSpace(transmissionColorFromTexture.rgb);
197
+ #else
198
+ transmission_color*=transmissionColorFromTexture.rgb;
150
199
  #endif
200
+ transmission_color*=vTransmissionColorInfos.y;
201
+ #endif
202
+ #ifdef TRANSMISSION_DEPTH
203
+ transmission_depth*=transmissionDepthFromTexture.r;
204
+ #endif
205
+ #ifdef TRANSMISSION_SCATTER
206
+ transmission_scatter*=transmissionScatterFromTexture.rgb;
207
+ #endif
208
+ #ifdef TRANSMISSION_DISPERSION_SCALE
209
+ transmission_dispersion_scale*=transmissionDispersionScaleFromTexture.r;
151
210
  #endif
152
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["harmonicsFunctions",0,{name:t,shader:i}])},98680,e=>{"use strict";var o=e.i(47150);let t="pbrBRDFFunctions",i=`#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
211
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrTransmissionLayerData",0,{name:t,shader:i}])},91141,e=>{"use strict";var o=e.i(2342);e.i(19831),e.i(49676);let t="openpbrUboDeclaration",i=`layout(std140,column_major) uniform;uniform Material {vec2 vTangentSpaceParams;vec4 vLightingIntensity;float pointSize;vec2 vDebugMode;vec2 renderTargetSize;vec4 cameraInfo;vec4 vTextureRepetitionHexTilingParams;mat4 backgroundRefractionMatrix;vec3 vBackgroundRefractionInfos;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;float vBaseWeight;vec4 vBaseColor;float vBaseDiffuseRoughness;vec4 vReflectanceInfo;vec4 vSpecularColor;vec3 vSpecularAnisotropy;float vTransmissionWeight;vec3 vTransmissionColor;float vTransmissionDepth;vec3 vTransmissionScatter;float vTransmissionScatterAnisotropy;float vTransmissionDispersionScale;float vTransmissionDispersionAbbeNumber;float vSubsurfaceWeight;vec3 vSubsurfaceColor;float vSubsurfaceRadius;vec3 vSubsurfaceRadiusScale;float vSubsurfaceScatterAnisotropy;float vCoatWeight;vec3 vCoatColor;float vCoatRoughness;float vCoatRoughnessAnisotropy;float vCoatIor;float vCoatDarkening;float vFuzzWeight;vec3 vFuzzColor;float vFuzzRoughness;float vGeometryThinWalled;vec2 vGeometryCoatTangent;float vGeometryThickness;vec3 vEmissionColor;float vThinFilmWeight;vec2 vThinFilmThickness;float vThinFilmIor;vec2 vBaseWeightInfos;mat4 baseWeightMatrix;vec2 vBaseColorInfos;mat4 baseColorMatrix;vec2 vBaseDiffuseRoughnessInfos;mat4 baseDiffuseRoughnessMatrix;vec2 vBaseMetalnessInfos;mat4 baseMetalnessMatrix;vec2 vSpecularWeightInfos;mat4 specularWeightMatrix;vec2 vSpecularColorInfos;mat4 specularColorMatrix;vec2 vSpecularRoughnessInfos;mat4 specularRoughnessMatrix;vec2 vSpecularRoughnessAnisotropyInfos;mat4 specularRoughnessAnisotropyMatrix;vec2 vTransmissionWeightInfos;mat4 transmissionWeightMatrix;vec2 vTransmissionColorInfos;mat4 transmissionColorMatrix;vec2 vTransmissionDepthInfos;mat4 transmissionDepthMatrix;vec2 vTransmissionScatterInfos;mat4 transmissionScatterMatrix;vec2 vTransmissionDispersionScaleInfos;mat4 transmissionDispersionScaleMatrix;vec2 vSubsurfaceWeightInfos;mat4 subsurfaceWeightMatrix;vec2 vSubsurfaceColorInfos;mat4 subsurfaceColorMatrix;vec2 vSubsurfaceRadiusScaleInfos;mat4 subsurfaceRadiusScaleMatrix;vec2 vCoatWeightInfos;mat4 coatWeightMatrix;vec2 vCoatColorInfos;mat4 coatColorMatrix;vec2 vCoatRoughnessInfos;mat4 coatRoughnessMatrix;vec2 vCoatRoughnessAnisotropyInfos;mat4 coatRoughnessAnisotropyMatrix;vec2 vCoatDarkeningInfos;mat4 coatDarkeningMatrix;vec2 vFuzzWeightInfos;mat4 fuzzWeightMatrix;vec2 vFuzzColorInfos;mat4 fuzzColorMatrix;vec2 vFuzzRoughnessInfos;mat4 fuzzRoughnessMatrix;vec2 vGeometryNormalInfos;mat4 geometryNormalMatrix;vec2 vGeometryTangentInfos;mat4 geometryTangentMatrix;vec2 vGeometryCoatNormalInfos;mat4 geometryCoatNormalMatrix;vec2 vGeometryCoatTangentInfos;mat4 geometryCoatTangentMatrix;vec2 vGeometryOpacityInfos;mat4 geometryOpacityMatrix;vec2 vGeometryThicknessInfos;mat4 geometryThicknessMatrix;vec2 vEmissionColorInfos;mat4 emissionColorMatrix;vec2 vThinFilmWeightInfos;mat4 thinFilmWeightMatrix;vec2 vThinFilmThicknessInfos;mat4 thinFilmThicknessMatrix;vec2 vAmbientOcclusionInfos;mat4 ambientOcclusionMatrix;
212
+ #define ADDITIONAL_UBO_DECLARATION
213
+ };
214
+ #include<sceneUboDeclaration>
215
+ #include<meshUboDeclaration>
216
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrUboDeclaration",0,{name:t,shader:i}])},74701,e=>{"use strict";var o=e.i(2342);let t="pbrBRDFFunctions",i=`#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
153
217
  #define BRDF_DIFFUSE_MODEL_EON 0
154
218
  #define BRDF_DIFFUSE_MODEL_BURLEY 1
155
219
  #define BRDF_DIFFUSE_MODEL_LAMBERT 2
@@ -322,1062 +386,993 @@ vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,
322
386
  float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}
323
387
  #endif
324
388
  #endif
325
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrBRDFFunctions",0,{name:t,shader:i}])},21928,e=>{"use strict";var o=e.i(47150);e.i(67827),e.i(38605);let t="openpbrUboDeclaration",i=`layout(std140,column_major) uniform;uniform Material {vec2 vTangentSpaceParams;vec4 vLightingIntensity;float pointSize;vec2 vDebugMode;vec2 renderTargetSize;vec4 cameraInfo;vec4 vTextureRepetitionHexTilingParams;mat4 backgroundRefractionMatrix;vec3 vBackgroundRefractionInfos;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;float vBaseWeight;vec4 vBaseColor;float vBaseDiffuseRoughness;vec4 vReflectanceInfo;vec4 vSpecularColor;vec3 vSpecularAnisotropy;float vTransmissionWeight;vec3 vTransmissionColor;float vTransmissionDepth;vec3 vTransmissionScatter;float vTransmissionScatterAnisotropy;float vTransmissionDispersionScale;float vTransmissionDispersionAbbeNumber;float vSubsurfaceWeight;vec3 vSubsurfaceColor;float vSubsurfaceRadius;vec3 vSubsurfaceRadiusScale;float vSubsurfaceScatterAnisotropy;float vCoatWeight;vec3 vCoatColor;float vCoatRoughness;float vCoatRoughnessAnisotropy;float vCoatIor;float vCoatDarkening;float vFuzzWeight;vec3 vFuzzColor;float vFuzzRoughness;float vGeometryThinWalled;vec2 vGeometryCoatTangent;float vGeometryThickness;vec3 vEmissionColor;float vThinFilmWeight;vec2 vThinFilmThickness;float vThinFilmIor;vec2 vBaseWeightInfos;mat4 baseWeightMatrix;vec2 vBaseColorInfos;mat4 baseColorMatrix;vec2 vBaseDiffuseRoughnessInfos;mat4 baseDiffuseRoughnessMatrix;vec2 vBaseMetalnessInfos;mat4 baseMetalnessMatrix;vec2 vSpecularWeightInfos;mat4 specularWeightMatrix;vec2 vSpecularColorInfos;mat4 specularColorMatrix;vec2 vSpecularRoughnessInfos;mat4 specularRoughnessMatrix;vec2 vSpecularRoughnessAnisotropyInfos;mat4 specularRoughnessAnisotropyMatrix;vec2 vTransmissionWeightInfos;mat4 transmissionWeightMatrix;vec2 vTransmissionColorInfos;mat4 transmissionColorMatrix;vec2 vTransmissionDepthInfos;mat4 transmissionDepthMatrix;vec2 vTransmissionScatterInfos;mat4 transmissionScatterMatrix;vec2 vTransmissionDispersionScaleInfos;mat4 transmissionDispersionScaleMatrix;vec2 vSubsurfaceWeightInfos;mat4 subsurfaceWeightMatrix;vec2 vSubsurfaceColorInfos;mat4 subsurfaceColorMatrix;vec2 vSubsurfaceRadiusScaleInfos;mat4 subsurfaceRadiusScaleMatrix;vec2 vCoatWeightInfos;mat4 coatWeightMatrix;vec2 vCoatColorInfos;mat4 coatColorMatrix;vec2 vCoatRoughnessInfos;mat4 coatRoughnessMatrix;vec2 vCoatRoughnessAnisotropyInfos;mat4 coatRoughnessAnisotropyMatrix;vec2 vCoatDarkeningInfos;mat4 coatDarkeningMatrix;vec2 vFuzzWeightInfos;mat4 fuzzWeightMatrix;vec2 vFuzzColorInfos;mat4 fuzzColorMatrix;vec2 vFuzzRoughnessInfos;mat4 fuzzRoughnessMatrix;vec2 vGeometryNormalInfos;mat4 geometryNormalMatrix;vec2 vGeometryTangentInfos;mat4 geometryTangentMatrix;vec2 vGeometryCoatNormalInfos;mat4 geometryCoatNormalMatrix;vec2 vGeometryCoatTangentInfos;mat4 geometryCoatTangentMatrix;vec2 vGeometryOpacityInfos;mat4 geometryOpacityMatrix;vec2 vGeometryThicknessInfos;mat4 geometryThicknessMatrix;vec2 vEmissionColorInfos;mat4 emissionColorMatrix;vec2 vThinFilmWeightInfos;mat4 thinFilmWeightMatrix;vec2 vThinFilmThicknessInfos;mat4 thinFilmThicknessMatrix;vec2 vAmbientOcclusionInfos;mat4 ambientOcclusionMatrix;
326
- #define ADDITIONAL_UBO_DECLARATION
327
- };
328
- #include<sceneUboDeclaration>
329
- #include<meshUboDeclaration>
330
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrUboDeclaration",0,{name:t,shader:i}])},844,40676,e=>{"use strict";var o=e.i(47150);let t="samplerFragmentDeclaration",i=`#ifdef _DEFINENAME_
331
- #if _DEFINENAME_DIRECTUV==1
332
- #define v_VARYINGNAME_UV vMainUV1
333
- #elif _DEFINENAME_DIRECTUV==2
334
- #define v_VARYINGNAME_UV vMainUV2
335
- #elif _DEFINENAME_DIRECTUV==3
336
- #define v_VARYINGNAME_UV vMainUV3
337
- #elif _DEFINENAME_DIRECTUV==4
338
- #define v_VARYINGNAME_UV vMainUV4
339
- #elif _DEFINENAME_DIRECTUV==5
340
- #define v_VARYINGNAME_UV vMainUV5
341
- #elif _DEFINENAME_DIRECTUV==6
342
- #define v_VARYINGNAME_UV vMainUV6
343
- #else
344
- varying vec2 v_VARYINGNAME_UV;
345
- #endif
346
- uniform sampler2D _SAMPLERNAME_Sampler;
347
- #endif
348
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["samplerFragmentDeclaration",0,{name:t,shader:i}],844);let r="reflectionFunction",a=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
349
- {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0); }
350
- vec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
351
- {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(1.0-s,t,0); }
352
- vec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
353
- {vec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);vec3 r=normalize(reflect(cameraToVertex,worldNormal));r=vec3(reflectionMatrix*vec4(r,0));float lon=atan(r.z,r.x);float lat=acos(r.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0);}
354
- vec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)
355
- {vec3 viewDir=normalize(vec3(view*worldPos));vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));vec3 r=reflect(viewDir,viewNormal);r=vec3(reflectionMatrix*vec4(r,0));r.z=r.z-1.0;float m=2.0*length(r);return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);}
356
- vec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
357
- {vec3 viewDir=worldPos.xyz-eyePosition;vec3 coords=normalize(reflect(viewDir,worldNormal));return vec3(reflectionMatrix*vec4(coords,1));}
358
- vec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
359
- {vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=vec3(reflectionMatrix*vec4(coords,0));
360
- #ifdef INVERTCUBICMAP
361
- coords.y*=-1.0;
362
- #endif
363
- return coords;}
364
- vec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)
365
- {vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=vec3(reflectionMatrix*vec4(coords,0));
366
- #ifdef INVERTCUBICMAP
367
- coords.y*=-1.0;
389
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrBRDFFunctions",0,{name:t,shader:i}])},22488,70541,85374,26122,38385,25181,38416,54398,53804,22806,73400,e=>{"use strict";var o=e.i(2342);e.i(65225);let t="pbrFragmentExtraDeclaration",i=`varying vec3 vPositionW;
390
+ #if DEBUGMODE>0
391
+ varying vec4 vClipSpacePosition;
368
392
  #endif
369
- return coords;}
370
- vec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)
371
- {return vec3(reflectionMatrix*(view*worldPos));}
372
- vec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)
373
- {return vec3(reflectionMatrix*vec4(positionW,1.));}
374
- #ifdef REFLECTION
375
- vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)
376
- {
377
- #ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
378
- vec3 direction=normalize(vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);
393
+ #include<mainUVVaryingDeclaration>[1..7]
394
+ #ifdef NORMAL
395
+ varying vec3 vNormalW;
396
+ #if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
397
+ varying vec3 vEnvironmentIrradiance;
379
398
  #endif
380
- #ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
381
- vec3 direction=normalize(vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction);
382
399
  #endif
383
- #ifdef REFLECTIONMAP_EQUIRECTANGULAR
384
- return computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
400
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
401
+ varying vec4 vColor;
385
402
  #endif
386
- #ifdef REFLECTIONMAP_SPHERICAL
387
- return computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);
403
+ #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
404
+ varying float vViewDepth;
388
405
  #endif
389
- #ifdef REFLECTIONMAP_PLANAR
390
- return computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
406
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentExtraDeclaration",0,{name:t,shader:i}],22488);let r="subSurfaceScatteringFunctions",a=`bool testLightingForSSS(float diffusionProfile)
407
+ {return diffusionProfile<1.;}`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["subSurfaceScatteringFunctions",0,{name:r,shader:a}],70541);let n="importanceSampling",l=`vec3 hemisphereCosSample(vec2 u) {float phi=2.*PI*u.x;float cosTheta2=1.-u.y;float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
408
+ vec3 hemisphereImportanceSampleDggx(vec2 u,float a) {float phi=2.*PI*u.x;float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
409
+ vec3 hemisphereImportanceSampleDggxAnisotropic(vec2 Xi,float alphaTangent,float alphaBitangent)
410
+ {alphaTangent=max(alphaTangent,0.0001);alphaBitangent=max(alphaBitangent,0.0001);float phi=atan(alphaBitangent/alphaTangent*tan(2.0*3.14159265*Xi.x));if (Xi.x>0.5) phi+=3.14159265;
411
+ float cosPhi=cos(phi);float sinPhi=sin(phi);float alpha2=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) +
412
+ (sinPhi*sinPhi)/(alphaBitangent*alphaBitangent);float tanTheta2=Xi.y/(1.0-Xi.y)/alpha2;float cosTheta=1.0/sqrt(1.0+tanTheta2);float sinTheta=sqrt(max(0.0,1.0-cosTheta*cosTheta));return vec3(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);}
413
+ vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {
414
+ float phi=2.*PI*u.x;float sinTheta=pow(u.y,a/(2.*a+1.));float cosTheta=sqrt(1.-sinTheta*sinTheta);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=l),e.s(["importanceSampling",0,{name:n,shader:l}],85374);let c="pbrHelperFunctions",f=`#define MINIMUMVARIANCE 0.0005
415
+ #ifndef TEXRD_DEFINED
416
+ #define TEXRD(s,uv) texture2D(s,uv)
417
+ #define TEXRD_DEFINED
391
418
  #endif
392
- #ifdef REFLECTIONMAP_CUBIC
393
- #ifdef USE_LOCAL_REFLECTIONMAP_CUBIC
394
- return computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);
419
+ float convertRoughnessToAverageSlope(float roughness)
420
+ {return square(roughness)+MINIMUMVARIANCE;}
421
+ float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}
422
+ vec2 getAARoughnessFactors(vec3 normalVector) {
423
+ #ifdef SPECULARAA
424
+ vec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor);
395
425
  #else
396
- return computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
397
- #endif
398
- #endif
399
- #ifdef REFLECTIONMAP_PROJECTION
400
- return computeProjectionCoords(worldPos,view,reflectionMatrix);
401
- #endif
402
- #ifdef REFLECTIONMAP_SKYBOX
403
- return computeSkyBoxCoords(vPositionUVW,reflectionMatrix);
404
- #endif
405
- #ifdef REFLECTIONMAP_EXPLICIT
406
- return vec3(0,0,0);
426
+ return vec2(0.);
407
427
  #endif
408
428
  }
409
- #endif
410
- `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["reflectionFunction",0,{name:r,shader:a}],40676)},64242,72306,e=>{"use strict";var o=e.i(47150);let t="pbrFragmentReflectionDeclaration",i=`#ifdef REFLECTION
411
- #ifdef REFLECTIONMAP_3D
412
- #define sampleReflection(s,c) textureCube(s,c)
413
- uniform samplerCube reflectionSampler;
414
- #ifdef LODBASEDMICROSFURACE
415
- #define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
429
+ #ifdef ANISOTROPIC
430
+ #ifdef ANISOTROPIC_LEGACY
431
+ vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
432
+ vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection;if (anisotropy>=0.0) {anisotropicFrameDirection=B;} else {anisotropicFrameDirection=T;}
433
+ vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
434
+ #elif ANISOTROPIC_OPENPBR
435
+ vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy))),MINIMUMVARIANCE);float alphaB=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
416
436
  #else
417
- uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;
437
+ vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
438
+ vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}
418
439
  #endif
419
- #ifdef USEIRRADIANCEMAP
420
- uniform samplerCube irradianceSampler;
421
440
  #endif
422
- #else
423
- #define sampleReflection(s,c) texture2D(s,c)
424
- uniform sampler2D reflectionSampler;
425
- #ifdef LODBASEDMICROSFURACE
426
- #define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
427
- #else
428
- uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;
441
+ #if defined(CLEARCOAT) || defined(SS_REFRACTION)
442
+ vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}
443
+ vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
444
+ vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}
445
+ vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),
446
+ cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
447
+ clearCoatIntensity);return clearCoatAbsorption;}
429
448
  #endif
430
- #ifdef USEIRRADIANCEMAP
431
- uniform sampler2D irradianceSampler;
449
+ #ifdef MICROSURFACEAUTOMATIC
450
+ float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
451
+ {const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}
432
452
  #endif
453
+ `;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["pbrHelperFunctions",0,{name:c,shader:f}],26122),e.i(83457);let s="pbrDirectLightingSetupFunctions",d=`struct preLightingInfo
454
+ {vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float LdotV;float roughness;float diffuseRoughness;vec3 surfaceAlbedo;
455
+ #ifdef IRIDESCENCE
456
+ float iridescenceIntensity;
433
457
  #endif
434
- #ifdef REFLECTIONMAP_SKYBOX
435
- varying vec3 vPositionUVW;
436
- #else
437
- #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
438
- varying vec3 vDirectionW;
458
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
459
+ vec3 areaLightDiffuse;
460
+ #ifdef SPECULARTERM
461
+ vec3 areaLightSpecular;vec4 areaLightFresnel;
439
462
  #endif
440
463
  #endif
464
+ };preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N,vec3 posW) {preLightingInfo result;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
465
+ preLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
466
+ preLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;
467
+ #ifdef SPECULARTERM
468
+ result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
441
469
  #endif
442
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentReflectionDeclaration",0,{name:t,shader:i}],64242);let r="pbrIBLFunctions",a=`#if defined(REFLECTION) || defined(SS_REFRACTION)
443
- float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}
444
- float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}
470
+ result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
471
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
472
+ #include<ltcHelperFunctions>
473
+ uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;preLightingInfo computeAreaPreLightingInfo(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
474
+ {preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
475
+ #ifdef SPECULARTERM
476
+ result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
445
477
  #endif
446
- #if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
447
- float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}
448
- #endif
449
- #if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
450
- float environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {vec3 reflection=reflect(view,normal);float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));return square(temp);}
451
- #endif
452
- #if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
453
- #define UNPACK_LOD(x) (1.0-x)*255.0
454
- float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
478
+ result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
479
+ preLightingInfo computeAreaPreLightingInfoWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
480
+ {preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
481
+ #ifdef SPECULARTERM
482
+ result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
455
483
  #endif
456
- `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["pbrIBLFunctions",0,{name:r,shader:a}],72306)},6606,43128,97242,99165,e=>{"use strict";var o=e.i(47150);let t="sceneFragmentDeclaration",i=`uniform mat4 viewProjection;
457
- #ifdef MULTIVIEW
458
- uniform mat4 viewProjectionR;
484
+ result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
459
485
  #endif
460
- uniform mat4 view;uniform mat4 projection;uniform vec4 vEyePosition;uniform mat4 inverseProjection;
461
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneFragmentDeclaration",0,{name:t,shader:i}],6606);let r="openpbrDielectricReflectance",a=`struct ReflectanceParams
462
- {float F0;float F90;vec3 coloredF0;vec3 coloredF90;};
463
- #define pbr_inline
464
- ReflectanceParams dielectricReflectance(
465
- in float insideIOR,in float outsideIOR,in vec3 specularColor,in float specularWeight
466
- )
467
- {ReflectanceParams outParams;float dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);float f90Scale=clamp(2.0*abs(insideIOR-outsideIOR),0.0,1.0);
468
- #if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)
469
- vec3 dielectricColorF90=specularColor.rgb*vec3(f90Scale);
486
+ `;o.ShaderStore.IncludesShadersStore[s]||(o.ShaderStore.IncludesShadersStore[s]=d),e.s(["pbrDirectLightingSetupFunctions",0,{name:s,shader:d}],38385);let u="pbrDirectLightingFalloffFunctions",v=`float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
487
+ {return max(0.,1.0-length(lightOffset)/range);}
488
+ float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
489
+ {return 1.0/maxEps(lightDistanceSquared);}
490
+ float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
491
+ {float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
492
+ float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
493
+ {
494
+ #ifdef USEPHYSICALLIGHTFALLOFF
495
+ return computeDistanceLightFalloff_Physical(lightDistanceSquared);
496
+ #elif defined(USEGLTFLIGHTFALLOFF)
497
+ return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
470
498
  #else
471
- vec3 dielectricColorF90=vec3(f90Scale);
499
+ return computeDistanceLightFalloff_Standard(lightOffset,range);
472
500
  #endif
473
- #if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF
474
- float maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=dielectricF0*specularWeight*maxF0;
501
+ }
502
+ float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
503
+ {float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
504
+ {falloff=max(0.,pow(cosAngle,exponent));}
505
+ return falloff;}
506
+ float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
507
+ {float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
508
+ float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
509
+ {const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
510
+ float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
511
+ float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
512
+ {float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
513
+ float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
514
+ {
515
+ #ifdef USEPHYSICALLIGHTFALLOFF
516
+ return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
517
+ #elif defined(USEGLTFLIGHTFALLOFF)
518
+ return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
475
519
  #else
476
- outParams.F0=dielectricF0*specularWeight;
520
+ return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
477
521
  #endif
478
- outParams.F90=f90Scale*specularWeight;outParams.coloredF0=vec3(dielectricF0*specularWeight)*specularColor.rgb;outParams.coloredF90=dielectricColorF90*vec3(specularWeight);return outParams;}
479
- `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["openpbrDielectricReflectance",0,{name:r,shader:a}],43128);let n="openpbrGeometryInfo",l=`struct geometryInfoOutParams
480
- {float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;};struct geometryInfoAnisoOutParams
481
- {float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;mat3 TBN;};
482
- #define pbr_inline
483
- geometryInfoOutParams geometryInfo(
484
- in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
485
- )
486
- {geometryInfoOutParams outParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped);
487
- #if defined(ENVIRONMENTBRDF)
488
- outParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness);
522
+ }`;o.ShaderStore.IncludesShadersStore[u]||(o.ShaderStore.IncludesShadersStore[u]=v),e.s(["pbrDirectLightingFalloffFunctions",0,{name:u,shader:v}],25181);let m="hdrFilteringFunctions",g=`#if NUM_SAMPLES
523
+ #if NUM_SAMPLES>0
524
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
525
+ float radicalInverse_VdC(uint bits)
526
+ {bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }
527
+ vec2 hammersley(uint i,uint N)
528
+ {return vec2(float(i)/float(N),radicalInverse_VdC(i));}
489
529
  #else
490
- outParams.environmentBrdf=vec3(0.0);
491
- #endif
492
- outParams.horizonOcclusion=1.0;
493
- #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
494
- #ifdef HORIZONOCCLUSION
495
- #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)
496
- #ifdef REFLECTIONMAP_3D
497
- outParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
498
- #endif
530
+ float vanDerCorpus(int n,int base)
531
+ {float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)
532
+ {if(n>0)
533
+ {denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}
534
+ return result;}
535
+ vec2 hammersley(int i,int N)
536
+ {return vec2(float(i)/float(N),vanDerCorpus(i,2));}
499
537
  #endif
538
+ float log4(float x) {return log2(x)/2.;}
539
+ vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}
540
+ const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;
541
+ #define inline
542
+ vec3 irradiance(
543
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
544
+ CUSTOM_IRRADIANCE_FILTERING_INPUT
545
+ #else
546
+ samplerCube inputTexture,
500
547
  #endif
548
+ vec3 inputN,vec2 filteringInfo,
549
+ float diffuseRoughness,
550
+ vec3 surfaceAlbedo,
551
+ vec3 inputV
552
+ #if IBL_CDF_FILTERING
553
+ ,sampler2D icdfSampler
501
554
  #endif
502
- return outParams;}
503
- #define pbr_inline
504
- geometryInfoAnisoOutParams geometryInfoAniso(
505
- in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
506
- ,in vec3 vAnisotropy,in mat3 TBN
507
555
  )
508
- {geometryInfoOutParams geoInfo=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);geometryInfoAnisoOutParams outParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;}`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=l),e.s(["openpbrGeometryInfo",0,{name:n,shader:l}],97242);let c="openpbrIblFunctions",f=`#ifdef REFLECTION
509
- vec3 sampleIrradiance(
510
- in vec3 surfaceNormal
511
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
512
- ,in vec3 vEnvironmentIrradianceSH
513
- #endif
514
- #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
515
- ,in mat4 iblMatrix
556
+ {vec3 n=normalize(inputN);vec3 result=vec3(0.);
557
+ #ifndef IBL_CDF_FILTERING
558
+ vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z);
516
559
  #endif
517
- #ifdef USEIRRADIANCEMAP
518
- #ifdef REFLECTIONMAP_3D
519
- ,in samplerCube irradianceSampler
560
+ float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));
561
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
562
+ for(uint i=0u; i<NUM_SAMPLES; ++i)
520
563
  #else
521
- ,in sampler2D irradianceSampler
522
- #endif
523
- #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
524
- ,in vec3 reflectionDominantDirection
525
- #endif
526
- #endif
527
- #ifdef REALTIME_FILTERING
528
- ,in vec2 vReflectionFilteringInfo
529
- #ifdef IBL_CDF_FILTERING
530
- ,in sampler2D icdfSampler
531
- #endif
532
- #endif
533
- ,in vec2 vReflectionInfos
534
- ,in vec3 viewDirectionW
535
- ,in float diffuseRoughness
536
- ,in vec3 surfaceAlbedo
537
- ) {vec3 environmentIrradiance=vec3(0.,0.,0.);
538
- #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
539
- vec3 irradianceVector=(iblMatrix*vec4(surfaceNormal,0)).xyz;vec3 irradianceView=(iblMatrix*vec4(viewDirectionW,0)).xyz;
540
- #if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)
541
- #if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY
542
- {float NdotV=max(dot(surfaceNormal,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);}
543
- #endif
544
- #endif
545
- #ifdef REFLECTIONMAP_OPPOSITEZ
546
- irradianceVector.z*=-1.0;irradianceView.z*=-1.0;
547
- #endif
548
- #ifdef INVERTCUBICMAP
549
- irradianceVector.y*=-1.0;irradianceView.y*=-1.0;
550
- #endif
564
+ for(int i=0; i<NUM_SAMPLES; ++i)
551
565
  #endif
552
- #ifdef USESPHERICALFROMREFLECTIONMAP
553
- #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
554
- environmentIrradiance=vEnvironmentIrradianceSH;
555
- #else
556
- #if defined(REALTIME_FILTERING)
557
- environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView
558
- #ifdef IBL_CDF_FILTERING
559
- ,icdfSampler
566
+ {vec2 Xi=hammersley(i,NUM_SAMPLES);
567
+ #if IBL_CDF_FILTERING
568
+ vec2 T;T.x=texture2D(icdfSampler,vec2(Xi.x,0.)).x;T.y=texture2D(icdfSampler,vec2(T.x,Xi.y)).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));float NoL=dot(n,Ls);float NoV=dot(n,inputV);
569
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
570
+ float LoV=dot (Ls,inputV);
571
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
572
+ vec3 H=(inputV+Ls)*0.5;float VoH=dot(inputV,H);
560
573
  #endif
561
- );
562
574
  #else
563
- environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
575
+ vec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);float NoL=Ls.z;
576
+ vec3 V=tbnInverse*inputV;float NoV=V.z;
577
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
578
+ float LoV=dot (Ls,V);
579
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
580
+ vec3 H=(V+Ls)*0.5;float VoH=dot(V,H);
564
581
  #endif
565
582
  #endif
566
- #elif defined(USEIRRADIANCEMAP)
567
- #ifdef REFLECTIONMAP_3D
568
- vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,irradianceVector);
583
+ if (NoL>0.) {
584
+ #if IBL_CDF_FILTERING
585
+ float pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;
569
586
  #else
570
- vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,reflectionCoords);
587
+ float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);
588
+ #ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
589
+ CUSTOM_IRRADIANCE_FILTERING_FUNCTION
590
+ #else
591
+ vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
571
592
  #endif
572
- environmentIrradiance=environmentIrradianceFromTexture.rgb;
573
- #ifdef RGBDREFLECTION
574
- environmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture);
575
593
  #endif
576
- #ifdef GAMMAREFLECTION
577
- environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);
594
+ #if GAMMA_INPUT
595
+ c=toLinearSpace(c);
578
596
  #endif
579
- #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
580
- vec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0);
597
+ vec3 diffuseRoughnessTerm=vec3(1.0);
581
598
  #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
582
- float LoV=dot (Ls,irradianceView);float mag=length(reflectionDominantDirection)*2.0;vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0)));
599
+ diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;
583
600
  #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
584
- vec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
585
- #endif
586
- environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm;
587
- #endif
601
+ diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
588
602
  #endif
589
- environmentIrradiance*=vReflectionInfos.x;return environmentIrradiance;}
590
- #define pbr_inline
591
- #ifdef REFLECTIONMAP_3D
592
- vec3 createReflectionCoords(
603
+ #if IBL_CDF_FILTERING
604
+ vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;
593
605
  #else
594
- vec2 createReflectionCoords(
606
+ result+=c*diffuseRoughnessTerm;
595
607
  #endif
596
- in vec3 vPositionW
597
- ,in vec3 normalW
598
- )
599
- {vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
600
- #ifdef REFLECTIONMAP_OPPOSITEZ
601
- reflectionVector.z*=-1.0;
608
+ }}
609
+ result=result*NUM_SAMPLES_FLOAT_INVERSED;
610
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
611
+ result=result/clampedAlbedo;
602
612
  #endif
603
- #ifdef REFLECTIONMAP_3D
604
- vec3 reflectionCoords=reflectionVector;
613
+ return result;}
614
+ #define inline
615
+ vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
616
+ {vec3 n=normalize(inputN);vec3 c=textureCubeLodEXT(inputTexture,n,0.).rgb;
617
+ if (alphaG==0.) {
618
+ #if GAMMA_INPUT
619
+ c=toLinearSpace(c);
620
+ #endif
621
+ return c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;
622
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
623
+ for(uint i=0u; i<NUM_SAMPLES; ++i)
605
624
  #else
606
- vec2 reflectionCoords=reflectionVector.xy;
607
- #ifdef REFLECTIONMAP_PROJECTION
608
- reflectionCoords/=reflectionVector.z;
625
+ for(int i=0; i<NUM_SAMPLES; ++i)
609
626
  #endif
610
- reflectionCoords.y=1.0-reflectionCoords.y;
627
+ {vec2 Xi=hammersley(i,NUM_SAMPLES);vec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);float NoV=1.;float NoH=H.z;float NoH2=H.z*H.z;float NoL=2.*NoH2-1.;vec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;
628
+ #if GAMMA_INPUT
629
+ c=toLinearSpace(c);
611
630
  #endif
612
- return reflectionCoords;}
613
- #define pbr_inline
631
+ result+=c*NoL;}}
632
+ result=result/weight;return result;}}
633
+ #ifdef ANISOTROPIC
614
634
  #define inline
615
- vec3 sampleRadiance(
616
- in float alphaG
617
- ,in vec3 vReflectionMicrosurfaceInfos
618
- ,in vec2 vReflectionInfos
619
- ,in geometryInfoOutParams geoInfo
620
- #ifdef REFLECTIONMAP_3D
621
- ,in samplerCube reflectionSampler
622
- ,const vec3 reflectionCoords
623
- #else
624
- ,in sampler2D reflectionSampler
625
- ,const vec2 reflectionCoords
626
- #endif
627
- #ifdef REALTIME_FILTERING
628
- ,in vec2 vReflectionFilteringInfo
629
- #endif
635
+ vec3 radianceAnisotropic(
636
+ float alphaTangent,
637
+ float alphaBitangent,
638
+ samplerCube inputTexture,
639
+ vec3 inputView,
640
+ vec3 inputTangent,
641
+ vec3 inputBitangent,
642
+ vec3 inputNormal,
643
+ vec2 filteringInfo,
644
+ vec2 noiseInput,
645
+ bool isRefraction,
646
+ float ior
630
647
  )
631
- {vec4 environmentRadiance=vec4(0.,0.,0.,0.);
632
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
633
- float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
634
- #elif defined(LINEARSPECULARREFLECTION)
635
- float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
636
- #else
637
- float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
638
- #endif
639
- reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
640
- #ifdef REALTIME_FILTERING
641
- environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
642
- #else
643
- environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
644
- #endif
645
- #ifdef RGBDREFLECTION
646
- environmentRadiance.rgb=fromRGBD(environmentRadiance);
647
- #endif
648
- #ifdef GAMMAREFLECTION
649
- environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);
650
- #endif
651
- environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
652
- #if defined(ANISOTROPIC)
653
- #define pbr_inline
654
- #define inline
655
- vec3 sampleRadianceAnisotropic(
656
- in float alphaG
657
- ,in vec3 vReflectionMicrosurfaceInfos
658
- ,in vec2 vReflectionInfos
659
- ,in geometryInfoAnisoOutParams geoInfo
660
- ,const vec3 normalW
661
- ,const vec3 viewDirectionW
662
- ,const vec3 positionW
663
- ,const vec3 noise
664
- ,bool isRefraction
665
- ,float ior
666
- #ifdef REFLECTIONMAP_3D
667
- ,in samplerCube reflectionSampler
648
+ {vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float clampedAlphaT=max(alphaTangent,MINIMUMVARIANCE);float clampedAlphaB=max(alphaBitangent,MINIMUMVARIANCE);float effectiveDim=dim0*sqrt(clampedAlphaT*clampedAlphaB);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0,0.0,1.0);float weight=0.;
649
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
650
+ for(uint i=0u; i<NUM_SAMPLES; ++i)
668
651
  #else
669
- ,in sampler2D reflectionSampler
652
+ for(int i=0; i<NUM_SAMPLES; ++i)
670
653
  #endif
671
- #ifdef REALTIME_FILTERING
672
- ,in vec2 vReflectionFilteringInfo
654
+ {vec2 Xi=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5,0.015,noiseScale));
655
+ vec3 H_tangent=hemisphereImportanceSampleDggxAnisotropic(Xi,clampedAlphaT,clampedAlphaB);vec3 H=normalize(H_tangent.x*T+H_tangent.y*B+H_tangent.z*N);vec3 L;if (isRefraction) {L=refract(-V,H,1.0/ior);} else {L=reflect(-V,H);}
656
+ float NoH=max(dot(N,H),0.001);float VoH=max(dot(V,H),0.001);float NoL=max(dot(N,L),0.001);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_BurleyGGX_Anisotropic(
657
+ H_tangent.z,H_tangent.x,H_tangent.y,vec2(clampedAlphaT,clampedAlphaB)
658
+ );float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,L,mipLevel).rgb;
659
+ #if GAMMA_INPUT
660
+ c=toLinearSpace(c);
673
661
  #endif
674
- )
675
- {vec4 environmentRadiance=vec4(0.,0.,0.,0.);float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-geoInfo.anisotropy)*(1.0-geoInfo.anisotropy)));float alphaB=(1.0-geoInfo.anisotropy)*alphaT;alphaG=alphaB;
676
- #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
677
- float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
678
- #elif defined(LINEARSPECULARREFLECTION)
679
- float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
680
- #else
681
- float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
662
+ result+=c*NoL;}}
663
+ result=result/weight;return result;}
682
664
  #endif
683
- reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
684
- #ifdef REALTIME_FILTERING
685
- vec3 view=(reflectionMatrix*vec4(viewDirectionW,0.0)).xyz;vec3 tangent=(reflectionMatrix*vec4(geoInfo.anisotropicTangent,0.0)).xyz;vec3 bitangent=(reflectionMatrix*vec4(geoInfo.anisotropicBitangent,0.0)).xyz;vec3 normal=(reflectionMatrix*vec4(normalW,0.0)).xyz;
686
- #ifdef REFLECTIONMAP_OPPOSITEZ
687
- view.z*=-1.0;tangent.z*=-1.0;bitangent.z*=-1.0;normal.z*=-1.0;
688
665
  #endif
689
- environmentRadiance =
690
- vec4(radianceAnisotropic(alphaT,alphaB,reflectionSampler,
691
- view,tangent,
692
- bitangent,normal,
693
- vReflectionFilteringInfo,noise.xy,isRefraction,ior),
694
- 1.0);
695
- #else
696
- const int samples=16;vec4 radianceSample=vec4(0.0);vec3 reflectionCoords=vec3(0.0);float sample_weight=0.0;float total_weight=0.0;float step=1.0/float(max(samples-1,1));for (int i=0; i<samples; ++i) {float t=mix(-1.0,1.0,float(i)*step);t+=step*2.0*noise.x;sample_weight=max(1.0-abs(t),0.001);sample_weight*=sample_weight;t*=min(4.0*alphaT*geoInfo.anisotropy,1.0);vec3 bentNormal;if (t<0.0) {float blend=t+1.0;bentNormal=normalize(mix(-geoInfo.anisotropicTangent,normalW,blend));} else if (t>0.0) {float blend=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;}
697
- if (isRefraction) {reflectionCoords=double_refract(-viewDirectionW,bentNormal,ior);} else {reflectionCoords=reflect(-viewDirectionW,bentNormal);}
698
- reflectionCoords=vec3(reflectionMatrix*vec4(reflectionCoords,0));
699
- #ifdef REFLECTIONMAP_OPPOSITEZ
700
- reflectionCoords.z*=-1.0;
701
666
  #endif
702
- radianceSample=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
703
- #ifdef RGBDREFLECTION
704
- environmentRadiance.rgb+=sample_weight*fromRGBD(radianceSample);
705
- #elif defined(GAMMAREFLECTION)
706
- environmentRadiance.rgb+=sample_weight*toLinearSpace(radianceSample.rgb);
707
- #else
708
- environmentRadiance.rgb+=sample_weight*radianceSample.rgb;
667
+ `;o.ShaderStore.IncludesShadersStore[m]||(o.ShaderStore.IncludesShadersStore[m]=g),e.s(["hdrFilteringFunctions",0,{name:m,shader:g}],38416);let E="pbrDirectLightingFunctions",p=`#define CLEARCOATREFLECTANCE90 1.0
668
+ struct lightingInfo
669
+ {vec3 diffuse;
670
+ #ifdef SS_TRANSLUCENCY
671
+ vec3 diffuseTransmission;
709
672
  #endif
710
- total_weight+=sample_weight;}
711
- environmentRadiance=vec4(environmentRadiance.xyz/float(total_weight),1.0);
673
+ #ifdef SPECULARTERM
674
+ vec3 specular;
712
675
  #endif
713
- environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
676
+ #ifdef CLEARCOAT
677
+ vec4 clearCoat;
714
678
  #endif
679
+ #ifdef SHEEN
680
+ vec3 sheen;
715
681
  #endif
716
- #if defined(ENVIRONMENTBRDF)
717
- #define pbr_inline
718
- float computeDielectricIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
719
- {float dielectricIblFresnel=getReflectanceFromBRDFLookup(vec3(reflectance.F0),vec3(reflectance.F90),environmentBrdf).r;float dielectricECF=1.0+reflectance.F0*(1.0/environmentBrdf.y-1.0);return clamp(dielectricIblFresnel*dielectricECF,0.0,1.0);}
720
- #define pbr_inline
721
- vec3 computeConductorIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
722
- {
723
- #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) && defined(ENVIRONMENTBRDF)
724
- vec3 openPBRBrdf=vec3(environmentBrdf.xy,environmentBrdf.z/BRDF_Z_SCALE);vec3 b =getF82B(reflectance.coloredF0,reflectance.coloredF90);vec3 E_F82=getF82DirectionalAlbedo(reflectance.coloredF0,vec3(1.0),b,openPBRBrdf);vec3 F_avg=getF82AverageFresnel(reflectance.coloredF0,b);vec3 ECF =vec3(1.0)+F_avg*(vec3(1.0)/openPBRBrdf.y-vec3(1.0));return clamp(E_F82*ECF,vec3(0.0),vec3(1.0));
682
+ };float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
683
+ #if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
684
+ float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;
725
685
  #else
726
- return getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf);
686
+ return roughness;
727
687
  #endif
728
688
  }
689
+ vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}
690
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
691
+ vec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;}
729
692
  #endif
730
- `;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["openpbrIblFunctions",0,{name:c,shader:f}],99165)},87323,e=>{"use strict";var o=e.i(47150);let t="openpbrTransmissionLayerData",i=`float transmission_weight=vTransmissionWeight;vec3 transmission_color=vTransmissionColor.rgb;float transmission_depth=vTransmissionDepth;vec3 transmission_scatter=vTransmissionScatter.rgb;float transmission_scatter_anisotropy=clamp(vTransmissionScatterAnisotropy,-0.9999,0.9999);float transmission_dispersion_scale=vTransmissionDispersionScale;float transmission_dispersion_abbe_number=vTransmissionDispersionAbbeNumber;
731
- #ifdef TRANSMISSION_WEIGHT
732
- vec4 transmissionWeightFromTexture=TEXRD(transmissionWeightSampler,vTransmissionWeightUV+uvOffset);
693
+ vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI);
694
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
695
+ diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
696
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
697
+ diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
698
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
699
+ vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
733
700
  #endif
734
- #ifdef TRANSMISSION_COLOR
735
- vec4 transmissionColorFromTexture=TEXRD(transmissionColorSampler,vTransmissionColorUV+uvOffset);
701
+ return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
702
+ #define inline
703
+ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);}
704
+ #ifdef SS_TRANSLUCENCY
705
+ vec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped);
706
+ #ifndef SS_TRANSLUCENCY_LEGACY
707
+ if (info.NdotLUnclamped<0.0) {
736
708
  #endif
737
- #ifdef TRANSMISSION_DEPTH
738
- vec4 transmissionDepthFromTexture=TEXRD(transmissionDepthSampler,vTransmissionDepthUV+uvOffset);
709
+ float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);
710
+ #ifndef SS_TRANSLUCENCY_LEGACY
711
+ }
712
+ vec3 diffuseTerm=vec3(1.0/PI);
713
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
714
+ diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
715
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
716
+ diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
717
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
718
+ vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
739
719
  #endif
740
- #ifdef TRANSMISSION_SCATTER
741
- vec4 transmissionScatterFromTexture=TEXRD(transmissionScatterSampler,vTransmissionScatterUV+uvOffset);
720
+ #else
721
+ float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);
742
722
  #endif
743
- #ifdef TRANSMISSION_DISPERSION_SCALE
744
- vec4 transmissionDispersionScaleFromTexture=TEXRD(transmissionDispersionScaleSampler,vTransmissionDispersionScaleUV+uvOffset);
723
+ return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
745
724
  #endif
746
- #ifdef TRANSMISSION_WEIGHT
747
- transmission_weight*=transmissionWeightFromTexture.r;
725
+ #ifdef SPECULARTERM
726
+ vec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 fresnel,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);
727
+ #ifdef IRIDESCENCE
728
+ fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
748
729
  #endif
749
- #ifdef TRANSMISSION_COLOR
750
- #ifdef TRANSMISSION_COLOR_GAMMA
751
- transmission_color*=toLinearSpace(transmissionColorFromTexture.rgb);
730
+ float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
731
+ #ifdef BRDF_V_HEIGHT_CORRELATED
732
+ float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
752
733
  #else
753
- transmission_color*=transmissionColorFromTexture.rgb;
734
+ float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
754
735
  #endif
755
- transmission_color*=vTransmissionColorInfos.y;
736
+ vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
737
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
738
+ vec3 computeAreaSpecularLighting(preLightingInfo info,vec3 specularColor,vec3 reflectance0,vec3 reflectance90) {vec3 fresnel=specularColor*info.areaLightFresnel.x*reflectance0+( vec3( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}
756
739
  #endif
757
- #ifdef TRANSMISSION_DEPTH
758
- transmission_depth*=transmissionDepthFromTexture.r;
759
740
  #endif
760
- #ifdef TRANSMISSION_SCATTER
761
- transmission_scatter*=transmissionScatterFromTexture.rgb;
741
+ #ifdef FUZZ
742
+ float evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut)
743
+ {if (NdotL<=0.0 || NdotV<=0.0)
744
+ return 0.0;mat3 M=mat3(
745
+ vec3(ltcLut.r,0.0,0.0),
746
+ vec3(ltcLut.g,1.0,0.0),
747
+ vec3(0.0,0.0,1.0)
748
+ );vec3 Llocal=vec3(dot(L,T),dot(L,B),NdotL);vec3 Lwarp=normalize(M*Llocal);float cosThetaWarp=max(Lwarp.z,0.0);return cosThetaWarp*NdotL;}
762
749
  #endif
763
- #ifdef TRANSMISSION_DISPERSION_SCALE
764
- transmission_dispersion_scale*=transmissionDispersionScaleFromTexture.r;
750
+ #if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)
751
+ vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=vec3(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}
752
+ #elif defined(ANISOTROPIC)
753
+ vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
754
+ #ifdef IRIDESCENCE
755
+ fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
765
756
  #endif
766
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrTransmissionLayerData",0,{name:t,shader:i}])},86145,e=>{"use strict";var o=e.i(47150);let t="openpbrSubsurfaceLayerData",i=`float subsurface_weight=vSubsurfaceWeight;vec3 subsurface_color=vSubsurfaceColor.rgb;float subsurface_radius=vSubsurfaceRadius;vec3 subsurface_radius_scale=vSubsurfaceRadiusScale;float subsurface_scatter_anisotropy=clamp(vSubsurfaceScatterAnisotropy,-0.9999,0.9999);
767
- #ifdef SUBSURFACE_WEIGHT
768
- vec4 subsurfaceWeightFromTexture=TEXRD(subsurfaceWeightSampler,vSubsurfaceWeightUV+uvOffset);
757
+ float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
769
758
  #endif
770
- #ifdef SUBSURFACE_COLOR
771
- vec4 subsurfaceColorFromTexture=TEXRD(subsurfaceColorSampler,vSubsurfaceColorUV+uvOffset);
759
+ #ifdef CLEARCOAT
760
+ vec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4(
761
+ clearCoatTerm*info.attenuation*NccdotL*lightColor,
762
+ 1.0-fresnel
763
+ );}
764
+ vec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}
772
765
  #endif
773
- #ifdef SUBSURFACE_RADIUS_SCALE
774
- vec4 subsurfaceRadiusScaleFromTexture=TEXRD(subsurfaceRadiusScaleSampler,vSubsurfaceRadiusScaleUV+uvOffset);
766
+ #ifdef SHEEN
767
+ vec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER
768
+ float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
769
+ #else */
770
+ float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
771
+ float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
775
772
  #endif
776
- #ifdef SUBSURFACE_WEIGHT
777
- #ifdef SUBSURFACE_WEIGHT_FROM_TEXTURE_ALPHA
778
- subsurface_weight*=subsurfaceWeightFromTexture.a;
773
+ `;o.ShaderStore.IncludesShadersStore[E]||(o.ShaderStore.IncludesShadersStore[E]=p),e.s(["pbrDirectLightingFunctions",0,{name:E,shader:p}],54398);let h="pbrBlockNormalGeometric",S=`vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
774
+ #ifdef NORMAL
775
+ vec3 normalW=normalize(vNormalW);
779
776
  #else
780
- subsurface_weight*=subsurfaceWeightFromTexture.r;
781
- #endif
777
+ vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
782
778
  #endif
783
- #ifdef SUBSURFACE_COLOR
784
- #ifdef SUBSURFACE_COLOR_GAMMA
785
- subsurface_color*=toLinearSpace(subsurfaceColorFromTexture.rgb);
786
- #else
787
- subsurface_color*=subsurfaceColorFromTexture.rgb;
779
+ vec3 geometricNormalW=normalW;
780
+ #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
781
+ geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
788
782
  #endif
789
- subsurface_color*=vSubsurfaceColorInfos.y;
783
+ `;o.ShaderStore.IncludesShadersStore[h]||(o.ShaderStore.IncludesShadersStore[h]=S),e.s(["pbrBlockNormalGeometric",0,{name:h,shader:S}],53804);let R="pbrBlockImageProcessing",I=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
784
+ #if !defined(SKIPFINALCOLORCLAMP)
785
+ finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
790
786
  #endif
791
- #ifdef SUBSURFACE_RADIUS_SCALE
792
- subsurface_radius_scale*=subsurfaceRadiusScaleFromTexture.rgb;
787
+ #else
788
+ finalColor=applyImageProcessing(finalColor);
793
789
  #endif
794
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrSubsurfaceLayerData",0,{name:t,shader:i}])},18582,74197,83900,3707,83025,7629,86563,74188,97657,10891,20904,e=>{"use strict";var o=e.i(47150);e.i(30868);let t="pbrFragmentExtraDeclaration",i=`varying vec3 vPositionW;
795
- #if DEBUGMODE>0
796
- varying vec4 vClipSpacePosition;
790
+ finalColor.a*=visibility;
791
+ #ifdef PREMULTIPLYALPHA
792
+ finalColor.rgb*=finalColor.a;
797
793
  #endif
798
- #include<mainUVVaryingDeclaration>[1..7]
799
- #ifdef NORMAL
800
- varying vec3 vNormalW;
801
- #if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
802
- varying vec3 vEnvironmentIrradiance;
794
+ `;o.ShaderStore.IncludesShadersStore[R]||(o.ShaderStore.IncludesShadersStore[R]=I),e.s(["pbrBlockImageProcessing",0,{name:R,shader:I}],22806);let L="pbrDebug",N=`#if DEBUGMODE>0
795
+ if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
796
+ #if DEBUGMODE==1
797
+ gl_FragColor.rgb=vPositionW.rgb;
798
+ #define DEBUGMODE_NORMALIZE
799
+ #elif DEBUGMODE==2 && defined(NORMAL)
800
+ gl_FragColor.rgb=vNormalW.rgb;
801
+ #define DEBUGMODE_NORMALIZE
802
+ #elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
803
+ gl_FragColor.rgb=TBN[0];
804
+ #define DEBUGMODE_NORMALIZE
805
+ #elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
806
+ gl_FragColor.rgb=TBN[1];
807
+ #define DEBUGMODE_NORMALIZE
808
+ #elif DEBUGMODE==5
809
+ gl_FragColor.rgb=normalW;
810
+ #define DEBUGMODE_NORMALIZE
811
+ #elif DEBUGMODE==6 && defined(MAINUV1)
812
+ gl_FragColor.rgb=vec3(vMainUV1,0.0);
813
+ #elif DEBUGMODE==7 && defined(MAINUV2)
814
+ gl_FragColor.rgb=vec3(vMainUV2,0.0);
815
+ #elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
816
+ gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
817
+ #define DEBUGMODE_NORMALIZE
818
+ #elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
819
+ gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
820
+ #define DEBUGMODE_NORMALIZE
821
+ #elif DEBUGMODE==10 && defined(CLEARCOAT)
822
+ gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
823
+ #define DEBUGMODE_NORMALIZE
824
+ #elif DEBUGMODE==11 && defined(ANISOTROPIC)
825
+ gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
826
+ #define DEBUGMODE_NORMALIZE
827
+ #elif DEBUGMODE==12 && defined(ANISOTROPIC)
828
+ gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
829
+ #define DEBUGMODE_NORMALIZE
830
+ #elif DEBUGMODE==13 && defined(ANISOTROPIC)
831
+ gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
832
+ #define DEBUGMODE_NORMALIZE
833
+ #elif DEBUGMODE==20 && defined(ALBEDO)
834
+ gl_FragColor.rgb=albedoTexture.rgb;
835
+ #ifndef GAMMAALBEDO
836
+ #define DEBUGMODE_GAMMA
803
837
  #endif
838
+ #elif DEBUGMODE==21 && defined(AMBIENT)
839
+ gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
840
+ #elif DEBUGMODE==22 && defined(OPACITY)
841
+ gl_FragColor.rgb=opacityMap.rgb;
842
+ #elif DEBUGMODE==23 && defined(EMISSIVE)
843
+ gl_FragColor.rgb=emissiveColorTex.rgb;
844
+ #ifndef GAMMAEMISSIVE
845
+ #define DEBUGMODE_GAMMA
804
846
  #endif
805
- #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
806
- varying vec4 vColor;
847
+ #elif DEBUGMODE==24 && defined(LIGHTMAP)
848
+ gl_FragColor.rgb=lightmapColor.rgb;
849
+ #ifndef GAMMALIGHTMAP
850
+ #define DEBUGMODE_GAMMA
807
851
  #endif
808
- #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
809
- varying float vViewDepth;
852
+ #elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
853
+ gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
854
+ #elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
855
+ gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
856
+ #define DEBUGMODE_GAMMA
857
+ #elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
858
+ gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
859
+ #elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
860
+ gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
861
+ #elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
862
+ gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
863
+ #elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
864
+ gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
865
+ #elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
866
+ gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
867
+ #elif DEBUGMODE==32 && defined(BUMP)
868
+ gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;
869
+ #elif DEBUGMODE==40 && defined(SS_REFRACTION)
870
+ gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
871
+ #define DEBUGMODE_GAMMA
872
+ #elif DEBUGMODE==41 && defined(REFLECTION)
873
+ gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
874
+ #ifndef GAMMAREFLECTION
875
+ #define DEBUGMODE_GAMMA
810
876
  #endif
811
- `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentExtraDeclaration",0,{name:t,shader:i}],18582);let r="subSurfaceScatteringFunctions",a=`bool testLightingForSSS(float diffusionProfile)
812
- {return diffusionProfile<1.;}`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["subSurfaceScatteringFunctions",0,{name:r,shader:a}],74197);let n="importanceSampling",l=`vec3 hemisphereCosSample(vec2 u) {float phi=2.*PI*u.x;float cosTheta2=1.-u.y;float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
813
- vec3 hemisphereImportanceSampleDggx(vec2 u,float a) {float phi=2.*PI*u.x;float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}
814
- vec3 hemisphereImportanceSampleDggxAnisotropic(vec2 Xi,float alphaTangent,float alphaBitangent)
815
- {alphaTangent=max(alphaTangent,0.0001);alphaBitangent=max(alphaBitangent,0.0001);float phi=atan(alphaBitangent/alphaTangent*tan(2.0*3.14159265*Xi.x));if (Xi.x>0.5) phi+=3.14159265;
816
- float cosPhi=cos(phi);float sinPhi=sin(phi);float alpha2=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) +
817
- (sinPhi*sinPhi)/(alphaBitangent*alphaBitangent);float tanTheta2=Xi.y/(1.0-Xi.y)/alpha2;float cosTheta=1.0/sqrt(1.0+tanTheta2);float sinTheta=sqrt(max(0.0,1.0-cosTheta*cosTheta));return vec3(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);}
818
- vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {
819
- float phi=2.*PI*u.x;float sinTheta=pow(u.y,a/(2.*a+1.));float cosTheta=sqrt(1.-sinTheta*sinTheta);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=l),e.s(["importanceSampling",0,{name:n,shader:l}],83900);let c="pbrHelperFunctions",f=`#define MINIMUMVARIANCE 0.0005
820
- #ifndef TEXRD_DEFINED
821
- #define TEXRD(s,uv) texture2D(s,uv)
822
- #define TEXRD_DEFINED
877
+ #elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
878
+ gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
879
+ #define DEBUGMODE_GAMMA
880
+ #elif DEBUGMODE==50
881
+ gl_FragColor.rgb=diffuseBase.rgb;
882
+ #define DEBUGMODE_GAMMA
883
+ #elif DEBUGMODE==51 && defined(SPECULARTERM)
884
+ gl_FragColor.rgb=specularBase.rgb;
885
+ #define DEBUGMODE_GAMMA
886
+ #elif DEBUGMODE==52 && defined(CLEARCOAT)
887
+ gl_FragColor.rgb=clearCoatBase.rgb;
888
+ #define DEBUGMODE_GAMMA
889
+ #elif DEBUGMODE==53 && defined(SHEEN)
890
+ gl_FragColor.rgb=sheenBase.rgb;
891
+ #define DEBUGMODE_GAMMA
892
+ #elif DEBUGMODE==54 && defined(REFLECTION)
893
+ gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
894
+ #ifndef GAMMAREFLECTION
895
+ #define DEBUGMODE_GAMMA
823
896
  #endif
824
- float convertRoughnessToAverageSlope(float roughness)
825
- {return square(roughness)+MINIMUMVARIANCE;}
826
- float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}
827
- vec2 getAARoughnessFactors(vec3 normalVector) {
828
- #ifdef SPECULARAA
829
- vec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor);
897
+ #elif DEBUGMODE==60
898
+ gl_FragColor.rgb=surfaceAlbedo.rgb;
899
+ #define DEBUGMODE_GAMMA
900
+ #elif DEBUGMODE==61
901
+ gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
902
+ #define DEBUGMODE_GAMMA
903
+ #elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
904
+ gl_FragColor.rgb=vec3(reflectivityOut.metallic);
905
+ #elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
906
+ gl_FragColor.rgb=reflectivityOut.metallicF0;
907
+ #elif DEBUGMODE==63
908
+ gl_FragColor.rgb=vec3(roughness);
909
+ #elif DEBUGMODE==64
910
+ gl_FragColor.rgb=vec3(alphaG);
911
+ #elif DEBUGMODE==65
912
+ gl_FragColor.rgb=vec3(NdotV);
913
+ #elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
914
+ gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
915
+ #define DEBUGMODE_GAMMA
916
+ #elif DEBUGMODE==67 && defined(CLEARCOAT)
917
+ gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
918
+ #elif DEBUGMODE==68 && defined(CLEARCOAT)
919
+ gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
920
+ #elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
921
+ gl_FragColor.rgb=subSurfaceOut.transmittance;
922
+ #elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
923
+ gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
924
+ #elif DEBUGMODE==72
925
+ gl_FragColor.rgb=vec3(microSurface);
926
+ #elif DEBUGMODE==73
927
+ gl_FragColor.rgb=vAlbedoColor.rgb;
928
+ #define DEBUGMODE_GAMMA
929
+ #elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
930
+ gl_FragColor.rgb=vReflectivityColor.rgb;
931
+ #define DEBUGMODE_GAMMA
932
+ #elif DEBUGMODE==75
933
+ gl_FragColor.rgb=vEmissiveColor.rgb;
934
+ #define DEBUGMODE_GAMMA
935
+ #elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
936
+ gl_FragColor.rgb=vec3(seo);
937
+ #elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
938
+ gl_FragColor.rgb=vec3(eho);
939
+ #elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
940
+ gl_FragColor.rgb=vec3(energyConservationFactor);
941
+ #elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
942
+ gl_FragColor.rgb=baseSpecularEnvironmentReflectance;
943
+ #define DEBUGMODE_GAMMA
944
+ #elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
945
+ gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
946
+ #define DEBUGMODE_GAMMA
947
+ #elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
948
+ gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
949
+ #define DEBUGMODE_GAMMA
950
+ #elif DEBUGMODE==86 && defined(ALPHABLEND)
951
+ gl_FragColor.rgb=vec3(luminanceOverAlpha);
952
+ #elif DEBUGMODE==87
953
+ gl_FragColor.rgb=vec3(alpha);
954
+ #elif DEBUGMODE==88 && defined(ALBEDO)
955
+ gl_FragColor.rgb=vec3(albedoTexture.a);
956
+ #elif DEBUGMODE==89
957
+ gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;
830
958
  #else
831
- return vec2(0.);
959
+ float stripeWidth=30.;float stripePos=floor(gl_FragCoord.x/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor);
960
+ #endif
961
+ gl_FragColor.rgb*=vDebugMode.y;
962
+ #ifdef DEBUGMODE_NORMALIZE
963
+ gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
964
+ #endif
965
+ #ifdef DEBUGMODE_GAMMA
966
+ gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
967
+ #endif
968
+ gl_FragColor.a=1.0;
969
+ #ifdef PREPASS
970
+ gl_FragData[0]=toLinearSpace(gl_FragColor);
971
+ gl_FragData[1]=vec4(0.,0.,0.,0.);
972
+ #endif
973
+ #ifdef DEBUGMODE_FORCERETURN
974
+ return;
832
975
  #endif
833
976
  }
834
- #ifdef ANISOTROPIC
835
- #ifdef ANISOTROPIC_LEGACY
836
- vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
837
- vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection;if (anisotropy>=0.0) {anisotropicFrameDirection=B;} else {anisotropicFrameDirection=T;}
838
- vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
839
- #elif ANISOTROPIC_OPENPBR
840
- vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy))),MINIMUMVARIANCE);float alphaB=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
977
+ #endif
978
+ `;o.ShaderStore.IncludesShadersStore[L]||(o.ShaderStore.IncludesShadersStore[L]=N),e.s(["pbrDebug",0,{name:L,shader:N}],73400)},22577,43894,e=>{"use strict";var o=e.i(2342);let t="pbrFragmentReflectionDeclaration",i=`#ifdef REFLECTION
979
+ #ifdef REFLECTIONMAP_3D
980
+ #define sampleReflection(s,c) textureCube(s,c)
981
+ uniform samplerCube reflectionSampler;
982
+ #ifdef LODBASEDMICROSFURACE
983
+ #define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
841
984
  #else
842
- vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
843
- vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}
985
+ uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;
844
986
  #endif
987
+ #ifdef USEIRRADIANCEMAP
988
+ uniform samplerCube irradianceSampler;
845
989
  #endif
846
- #if defined(CLEARCOAT) || defined(SS_REFRACTION)
847
- vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}
848
- vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
849
- vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}
850
- vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),
851
- cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
852
- clearCoatIntensity);return clearCoatAbsorption;}
990
+ #else
991
+ #define sampleReflection(s,c) texture2D(s,c)
992
+ uniform sampler2D reflectionSampler;
993
+ #ifdef LODBASEDMICROSFURACE
994
+ #define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
995
+ #else
996
+ uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;
853
997
  #endif
854
- #ifdef MICROSURFACEAUTOMATIC
855
- float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
856
- {const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}
998
+ #ifdef USEIRRADIANCEMAP
999
+ uniform sampler2D irradianceSampler;
857
1000
  #endif
858
- `;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["pbrHelperFunctions",0,{name:c,shader:f}],3707),e.i(93663);let s="pbrDirectLightingSetupFunctions",d=`struct preLightingInfo
859
- {vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float LdotV;float roughness;float diffuseRoughness;vec3 surfaceAlbedo;
860
- #ifdef IRIDESCENCE
861
- float iridescenceIntensity;
862
1001
  #endif
863
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
864
- vec3 areaLightDiffuse;
865
- #ifdef SPECULARTERM
866
- vec3 areaLightSpecular;vec4 areaLightFresnel;
1002
+ #ifdef REFLECTIONMAP_SKYBOX
1003
+ varying vec3 vPositionUVW;
1004
+ #else
1005
+ #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
1006
+ varying vec3 vDirectionW;
867
1007
  #endif
868
1008
  #endif
869
- };preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N,vec3 posW) {preLightingInfo result;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
870
- preLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
871
- preLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;
872
- #ifdef SPECULARTERM
873
- result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
874
1009
  #endif
875
- result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
876
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
877
- #include<ltcHelperFunctions>
878
- uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;preLightingInfo computeAreaPreLightingInfo(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
879
- {preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
880
- #ifdef SPECULARTERM
881
- result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
1010
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentReflectionDeclaration",0,{name:t,shader:i}],22577);let r="pbrIBLFunctions",a=`#if defined(REFLECTION) || defined(SS_REFRACTION)
1011
+ float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}
1012
+ float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}
882
1013
  #endif
883
- result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
884
- preLightingInfo computeAreaPreLightingInfoWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
885
- {preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
886
- #ifdef SPECULARTERM
887
- result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
1014
+ #if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
1015
+ float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}
888
1016
  #endif
889
- result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
1017
+ #if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
1018
+ float environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {vec3 reflection=reflect(view,normal);float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));return square(temp);}
890
1019
  #endif
891
- `;o.ShaderStore.IncludesShadersStore[s]||(o.ShaderStore.IncludesShadersStore[s]=d),e.s(["pbrDirectLightingSetupFunctions",0,{name:s,shader:d}],83025);let u="pbrDirectLightingFalloffFunctions",v=`float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
892
- {return max(0.,1.0-length(lightOffset)/range);}
893
- float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
894
- {return 1.0/maxEps(lightDistanceSquared);}
895
- float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
896
- {float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
897
- float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
898
- {
899
- #ifdef USEPHYSICALLIGHTFALLOFF
900
- return computeDistanceLightFalloff_Physical(lightDistanceSquared);
901
- #elif defined(USEGLTFLIGHTFALLOFF)
902
- return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
1020
+ #if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
1021
+ #define UNPACK_LOD(x) (1.0-x)*255.0
1022
+ float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
1023
+ #endif
1024
+ `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["pbrIBLFunctions",0,{name:r,shader:a}],43894)},28758,51215,e=>{"use strict";var o=e.i(2342);let t="samplerFragmentDeclaration",i=`#ifdef _DEFINENAME_
1025
+ #if _DEFINENAME_DIRECTUV==1
1026
+ #define v_VARYINGNAME_UV vMainUV1
1027
+ #elif _DEFINENAME_DIRECTUV==2
1028
+ #define v_VARYINGNAME_UV vMainUV2
1029
+ #elif _DEFINENAME_DIRECTUV==3
1030
+ #define v_VARYINGNAME_UV vMainUV3
1031
+ #elif _DEFINENAME_DIRECTUV==4
1032
+ #define v_VARYINGNAME_UV vMainUV4
1033
+ #elif _DEFINENAME_DIRECTUV==5
1034
+ #define v_VARYINGNAME_UV vMainUV5
1035
+ #elif _DEFINENAME_DIRECTUV==6
1036
+ #define v_VARYINGNAME_UV vMainUV6
903
1037
  #else
904
- return computeDistanceLightFalloff_Standard(lightOffset,range);
1038
+ varying vec2 v_VARYINGNAME_UV;
905
1039
  #endif
906
- }
907
- float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
908
- {float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
909
- {falloff=max(0.,pow(cosAngle,exponent));}
910
- return falloff;}
911
- float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
912
- {float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
913
- float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
914
- {const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
915
- float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
916
- float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
917
- {float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
918
- float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
1040
+ uniform sampler2D _SAMPLERNAME_Sampler;
1041
+ #endif
1042
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["samplerFragmentDeclaration",0,{name:t,shader:i}],28758);let r="reflectionFunction",a=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
1043
+ {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0); }
1044
+ vec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
1045
+ {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(1.0-s,t,0); }
1046
+ vec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
1047
+ {vec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);vec3 r=normalize(reflect(cameraToVertex,worldNormal));r=vec3(reflectionMatrix*vec4(r,0));float lon=atan(r.z,r.x);float lat=acos(r.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0);}
1048
+ vec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)
1049
+ {vec3 viewDir=normalize(vec3(view*worldPos));vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));vec3 r=reflect(viewDir,viewNormal);r=vec3(reflectionMatrix*vec4(r,0));r.z=r.z-1.0;float m=2.0*length(r);return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);}
1050
+ vec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
1051
+ {vec3 viewDir=worldPos.xyz-eyePosition;vec3 coords=normalize(reflect(viewDir,worldNormal));return vec3(reflectionMatrix*vec4(coords,1));}
1052
+ vec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
1053
+ {vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=vec3(reflectionMatrix*vec4(coords,0));
1054
+ #ifdef INVERTCUBICMAP
1055
+ coords.y*=-1.0;
1056
+ #endif
1057
+ return coords;}
1058
+ vec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)
1059
+ {vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=vec3(reflectionMatrix*vec4(coords,0));
1060
+ #ifdef INVERTCUBICMAP
1061
+ coords.y*=-1.0;
1062
+ #endif
1063
+ return coords;}
1064
+ vec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)
1065
+ {return vec3(reflectionMatrix*(view*worldPos));}
1066
+ vec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)
1067
+ {return vec3(reflectionMatrix*vec4(positionW,1.));}
1068
+ #ifdef REFLECTION
1069
+ vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)
919
1070
  {
920
- #ifdef USEPHYSICALLIGHTFALLOFF
921
- return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
922
- #elif defined(USEGLTFLIGHTFALLOFF)
923
- return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
924
- #else
925
- return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
1071
+ #ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
1072
+ vec3 direction=normalize(vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);
926
1073
  #endif
927
- }`;o.ShaderStore.IncludesShadersStore[u]||(o.ShaderStore.IncludesShadersStore[u]=v),e.s(["pbrDirectLightingFalloffFunctions",0,{name:u,shader:v}],7629);let m="hdrFilteringFunctions",g=`#if NUM_SAMPLES
928
- #if NUM_SAMPLES>0
929
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
930
- float radicalInverse_VdC(uint bits)
931
- {bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }
932
- vec2 hammersley(uint i,uint N)
933
- {return vec2(float(i)/float(N),radicalInverse_VdC(i));}
934
- #else
935
- float vanDerCorpus(int n,int base)
936
- {float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)
937
- {if(n>0)
938
- {denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}
939
- return result;}
940
- vec2 hammersley(int i,int N)
941
- {return vec2(float(i)/float(N),vanDerCorpus(i,2));}
1074
+ #ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
1075
+ vec3 direction=normalize(vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction);
942
1076
  #endif
943
- float log4(float x) {return log2(x)/2.;}
944
- vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}
945
- const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;
946
- #define inline
947
- vec3 irradiance(
948
- #ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
949
- CUSTOM_IRRADIANCE_FILTERING_INPUT
950
- #else
951
- samplerCube inputTexture,
1077
+ #ifdef REFLECTIONMAP_EQUIRECTANGULAR
1078
+ return computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
952
1079
  #endif
953
- vec3 inputN,vec2 filteringInfo,
954
- float diffuseRoughness,
955
- vec3 surfaceAlbedo,
956
- vec3 inputV
957
- #if IBL_CDF_FILTERING
958
- ,sampler2D icdfSampler
1080
+ #ifdef REFLECTIONMAP_SPHERICAL
1081
+ return computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);
959
1082
  #endif
960
- )
961
- {vec3 n=normalize(inputN);vec3 result=vec3(0.);
962
- #ifndef IBL_CDF_FILTERING
963
- vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z);
1083
+ #ifdef REFLECTIONMAP_PLANAR
1084
+ return computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
964
1085
  #endif
965
- float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));
966
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
967
- for(uint i=0u; i<NUM_SAMPLES; ++i)
1086
+ #ifdef REFLECTIONMAP_CUBIC
1087
+ #ifdef USE_LOCAL_REFLECTIONMAP_CUBIC
1088
+ return computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);
968
1089
  #else
969
- for(int i=0; i<NUM_SAMPLES; ++i)
1090
+ return computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
970
1091
  #endif
971
- {vec2 Xi=hammersley(i,NUM_SAMPLES);
972
- #if IBL_CDF_FILTERING
973
- vec2 T;T.x=texture2D(icdfSampler,vec2(Xi.x,0.)).x;T.y=texture2D(icdfSampler,vec2(T.x,Xi.y)).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));float NoL=dot(n,Ls);float NoV=dot(n,inputV);
974
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
975
- float LoV=dot (Ls,inputV);
976
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
977
- vec3 H=(inputV+Ls)*0.5;float VoH=dot(inputV,H);
978
1092
  #endif
979
- #else
980
- vec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);float NoL=Ls.z;
981
- vec3 V=tbnInverse*inputV;float NoV=V.z;
982
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
983
- float LoV=dot (Ls,V);
984
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
985
- vec3 H=(V+Ls)*0.5;float VoH=dot(V,H);
1093
+ #ifdef REFLECTIONMAP_PROJECTION
1094
+ return computeProjectionCoords(worldPos,view,reflectionMatrix);
986
1095
  #endif
1096
+ #ifdef REFLECTIONMAP_SKYBOX
1097
+ return computeSkyBoxCoords(vPositionUVW,reflectionMatrix);
987
1098
  #endif
988
- if (NoL>0.) {
989
- #if IBL_CDF_FILTERING
990
- float pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;
1099
+ #ifdef REFLECTIONMAP_EXPLICIT
1100
+ return vec3(0,0,0);
1101
+ #endif
1102
+ }
1103
+ #endif
1104
+ `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["reflectionFunction",0,{name:r,shader:a}],51215)},19491,20439,62149,34630,e=>{"use strict";var o=e.i(2342);let t="sceneFragmentDeclaration",i=`uniform mat4 viewProjection;
1105
+ #ifdef MULTIVIEW
1106
+ uniform mat4 viewProjectionR;
1107
+ #endif
1108
+ uniform mat4 view;uniform mat4 projection;uniform vec4 vEyePosition;uniform mat4 inverseProjection;
1109
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneFragmentDeclaration",0,{name:t,shader:i}],19491);let r="openpbrDielectricReflectance",a=`struct ReflectanceParams
1110
+ {float F0;float F90;vec3 coloredF0;vec3 coloredF90;};
1111
+ #define pbr_inline
1112
+ ReflectanceParams dielectricReflectance(
1113
+ in float insideIOR,in float outsideIOR,in vec3 specularColor,in float specularWeight
1114
+ )
1115
+ {ReflectanceParams outParams;float dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);float f90Scale=clamp(2.0*abs(insideIOR-outsideIOR),0.0,1.0);
1116
+ #if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)
1117
+ vec3 dielectricColorF90=specularColor.rgb*vec3(f90Scale);
991
1118
  #else
992
- float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);
993
- #ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
994
- CUSTOM_IRRADIANCE_FILTERING_FUNCTION
1119
+ vec3 dielectricColorF90=vec3(f90Scale);
1120
+ #endif
1121
+ #if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF
1122
+ float maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=dielectricF0*specularWeight*maxF0;
1123
+ #else
1124
+ outParams.F0=dielectricF0*specularWeight;
1125
+ #endif
1126
+ outParams.F90=f90Scale*specularWeight;outParams.coloredF0=vec3(dielectricF0*specularWeight)*specularColor.rgb;outParams.coloredF90=dielectricColorF90*vec3(specularWeight);return outParams;}
1127
+ `;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["openpbrDielectricReflectance",0,{name:r,shader:a}],20439);let n="openpbrGeometryInfo",l=`struct geometryInfoOutParams
1128
+ {float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;};struct geometryInfoAnisoOutParams
1129
+ {float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;mat3 TBN;};
1130
+ #define pbr_inline
1131
+ geometryInfoOutParams geometryInfo(
1132
+ in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
1133
+ )
1134
+ {geometryInfoOutParams outParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped);
1135
+ #if defined(ENVIRONMENTBRDF)
1136
+ outParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness);
995
1137
  #else
996
- vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
1138
+ outParams.environmentBrdf=vec3(0.0);
997
1139
  #endif
1140
+ outParams.horizonOcclusion=1.0;
1141
+ #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1142
+ #ifdef HORIZONOCCLUSION
1143
+ #if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)
1144
+ #ifdef REFLECTIONMAP_3D
1145
+ outParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
998
1146
  #endif
999
- #if GAMMA_INPUT
1000
- c=toLinearSpace(c);
1001
1147
  #endif
1002
- vec3 diffuseRoughnessTerm=vec3(1.0);
1003
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1004
- diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;
1005
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
1006
- diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
1007
1148
  #endif
1008
- #if IBL_CDF_FILTERING
1009
- vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;
1010
- #else
1011
- result+=c*diffuseRoughnessTerm;
1012
1149
  #endif
1013
- }}
1014
- result=result*NUM_SAMPLES_FLOAT_INVERSED;
1015
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1016
- result=result/clampedAlbedo;
1150
+ return outParams;}
1151
+ #define pbr_inline
1152
+ geometryInfoAnisoOutParams geometryInfoAniso(
1153
+ in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
1154
+ ,in vec3 vAnisotropy,in mat3 TBN
1155
+ )
1156
+ {geometryInfoOutParams geoInfo=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);geometryInfoAnisoOutParams outParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;}`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=l),e.s(["openpbrGeometryInfo",0,{name:n,shader:l}],62149);let c="openpbrIblFunctions",f=`#ifdef REFLECTION
1157
+ vec3 sampleIrradiance(
1158
+ in vec3 surfaceNormal
1159
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
1160
+ ,in vec3 vEnvironmentIrradianceSH
1017
1161
  #endif
1018
- return result;}
1019
- #define inline
1020
- vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
1021
- {vec3 n=normalize(inputN);vec3 c=textureCubeLodEXT(inputTexture,n,0.).rgb;
1022
- if (alphaG==0.) {
1023
- #if GAMMA_INPUT
1024
- c=toLinearSpace(c);
1162
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
1163
+ ,in mat4 iblMatrix
1025
1164
  #endif
1026
- return c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;
1027
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
1028
- for(uint i=0u; i<NUM_SAMPLES; ++i)
1165
+ #ifdef USEIRRADIANCEMAP
1166
+ #ifdef REFLECTIONMAP_3D
1167
+ ,in samplerCube irradianceSampler
1029
1168
  #else
1030
- for(int i=0; i<NUM_SAMPLES; ++i)
1169
+ ,in sampler2D irradianceSampler
1031
1170
  #endif
1032
- {vec2 Xi=hammersley(i,NUM_SAMPLES);vec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);float NoV=1.;float NoH=H.z;float NoH2=H.z*H.z;float NoL=2.*NoH2-1.;vec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);L=normalize(L);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;
1033
- #if GAMMA_INPUT
1034
- c=toLinearSpace(c);
1171
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
1172
+ ,in vec3 reflectionDominantDirection
1035
1173
  #endif
1036
- result+=c*NoL;}}
1037
- result=result/weight;return result;}}
1038
- #ifdef ANISOTROPIC
1039
- #define inline
1040
- vec3 radianceAnisotropic(
1041
- float alphaTangent,
1042
- float alphaBitangent,
1043
- samplerCube inputTexture,
1044
- vec3 inputView,
1045
- vec3 inputTangent,
1046
- vec3 inputBitangent,
1047
- vec3 inputNormal,
1048
- vec2 filteringInfo,
1049
- vec2 noiseInput,
1050
- bool isRefraction,
1051
- float ior
1052
- )
1053
- {vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float clampedAlphaT=max(alphaTangent,MINIMUMVARIANCE);float clampedAlphaB=max(alphaBitangent,MINIMUMVARIANCE);float effectiveDim=dim0*sqrt(clampedAlphaT*clampedAlphaB);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0f,0.0f,1.0f);float weight=0.;
1054
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
1055
- for(uint i=0u; i<NUM_SAMPLES; ++i)
1056
- #else
1057
- for(int i=0; i<NUM_SAMPLES; ++i)
1058
1174
  #endif
1059
- {vec2 Xi=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5f,0.015f,noiseScale));
1060
- vec3 H_tangent=hemisphereImportanceSampleDggxAnisotropic(Xi,clampedAlphaT,clampedAlphaB);vec3 H=normalize(H_tangent.x*T+H_tangent.y*B+H_tangent.z*N);vec3 L;if (isRefraction) {L=refract(-V,H,1.0/ior);} else {L=reflect(-V,H);}
1061
- float NoH=max(dot(N,H),0.001);float VoH=max(dot(V,H),0.001);float NoL=max(dot(N,L),0.001);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_BurleyGGX_Anisotropic(
1062
- H_tangent.z,H_tangent.x,H_tangent.y,vec2(clampedAlphaT,clampedAlphaB)
1063
- );float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,L,mipLevel).rgb;
1064
- #if GAMMA_INPUT
1065
- c=toLinearSpace(c);
1175
+ #ifdef REALTIME_FILTERING
1176
+ ,in vec2 vReflectionFilteringInfo
1177
+ #ifdef IBL_CDF_FILTERING
1178
+ ,in sampler2D icdfSampler
1066
1179
  #endif
1067
- result+=c*NoL;}}
1068
- result=result/weight;return result;}
1069
1180
  #endif
1181
+ ,in vec2 vReflectionInfos
1182
+ ,in vec3 viewDirectionW
1183
+ ,in float diffuseRoughness
1184
+ ,in vec3 surfaceAlbedo
1185
+ ) {vec3 environmentIrradiance=vec3(0.,0.,0.);
1186
+ #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
1187
+ vec3 irradianceVector=(iblMatrix*vec4(surfaceNormal,0)).xyz;vec3 irradianceView=(iblMatrix*vec4(viewDirectionW,0)).xyz;
1188
+ #if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)
1189
+ #if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY
1190
+ {float NdotV=max(dot(surfaceNormal,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);}
1070
1191
  #endif
1071
1192
  #endif
1072
- `;o.ShaderStore.IncludesShadersStore[m]||(o.ShaderStore.IncludesShadersStore[m]=g),e.s(["hdrFilteringFunctions",0,{name:m,shader:g}],86563);let E="pbrDirectLightingFunctions",p=`#define CLEARCOATREFLECTANCE90 1.0
1073
- struct lightingInfo
1074
- {vec3 diffuse;
1075
- #ifdef SS_TRANSLUCENCY
1076
- vec3 diffuseTransmission;
1193
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1194
+ irradianceVector.z*=-1.0;irradianceView.z*=-1.0;
1077
1195
  #endif
1078
- #ifdef SPECULARTERM
1079
- vec3 specular;
1196
+ #ifdef INVERTCUBICMAP
1197
+ irradianceVector.y*=-1.0;irradianceView.y*=-1.0;
1080
1198
  #endif
1081
- #ifdef CLEARCOAT
1082
- vec4 clearCoat;
1083
1199
  #endif
1084
- #ifdef SHEEN
1085
- vec3 sheen;
1200
+ #ifdef USESPHERICALFROMREFLECTIONMAP
1201
+ #if defined(NORMAL) && defined(USESPHERICALINVERTEX)
1202
+ environmentIrradiance=vEnvironmentIrradianceSH;
1203
+ #else
1204
+ #if defined(REALTIME_FILTERING)
1205
+ environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView
1206
+ #ifdef IBL_CDF_FILTERING
1207
+ ,icdfSampler
1086
1208
  #endif
1087
- };float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
1088
- #if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
1089
- float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;
1209
+ );
1090
1210
  #else
1091
- return roughness;
1211
+ environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
1092
1212
  #endif
1093
- }
1094
- vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}
1095
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1096
- vec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;}
1097
1213
  #endif
1098
- vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI);
1099
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
1100
- diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
1101
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
1102
- diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
1103
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1104
- vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
1214
+ #elif defined(USEIRRADIANCEMAP)
1215
+ #ifdef REFLECTIONMAP_3D
1216
+ vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,irradianceVector);
1217
+ #else
1218
+ vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,reflectionCoords);
1105
1219
  #endif
1106
- return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
1107
- #define inline
1108
- vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);}
1109
- #ifdef SS_TRANSLUCENCY
1110
- vec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped);
1111
- #ifndef SS_TRANSLUCENCY_LEGACY
1112
- if (info.NdotLUnclamped<0.0) {
1220
+ environmentIrradiance=environmentIrradianceFromTexture.rgb;
1221
+ #ifdef RGBDREFLECTION
1222
+ environmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture);
1113
1223
  #endif
1114
- float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);
1115
- #ifndef SS_TRANSLUCENCY_LEGACY
1116
- }
1117
- vec3 diffuseTerm=vec3(1.0/PI);
1118
- #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
1119
- diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
1120
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
1121
- diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
1122
- #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1123
- vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
1224
+ #ifdef GAMMAREFLECTION
1225
+ environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);
1124
1226
  #endif
1125
- #else
1126
- float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);
1227
+ #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
1228
+ vec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0);
1229
+ #if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
1230
+ float LoV=dot (Ls,irradianceView);float mag=length(reflectionDominantDirection)*2.0;vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0)));
1231
+ #elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
1232
+ vec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
1127
1233
  #endif
1128
- return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
1234
+ environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm;
1129
1235
  #endif
1130
- #ifdef SPECULARTERM
1131
- vec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 fresnel,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);
1132
- #ifdef IRIDESCENCE
1133
- fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
1134
1236
  #endif
1135
- float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
1136
- #ifdef BRDF_V_HEIGHT_CORRELATED
1137
- float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
1237
+ environmentIrradiance*=vReflectionInfos.x;return environmentIrradiance;}
1238
+ #define pbr_inline
1239
+ #ifdef REFLECTIONMAP_3D
1240
+ vec3 createReflectionCoords(
1138
1241
  #else
1139
- float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
1140
- #endif
1141
- vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
1142
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
1143
- vec3 computeAreaSpecularLighting(preLightingInfo info,vec3 specularColor,vec3 reflectance0,vec3 reflectance90) {vec3 fresnel=specularColor*info.areaLightFresnel.x*reflectance0+( vec3( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}
1242
+ vec2 createReflectionCoords(
1144
1243
  #endif
1244
+ in vec3 vPositionW
1245
+ ,in vec3 normalW
1246
+ )
1247
+ {vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
1248
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1249
+ reflectionVector.z*=-1.0;
1145
1250
  #endif
1146
- #ifdef FUZZ
1147
- float evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut)
1148
- {if (NdotL<=0.0 || NdotV<=0.0)
1149
- return 0.0;mat3 M=mat3(
1150
- vec3(ltcLut.r,0.0,0.0),
1151
- vec3(ltcLut.g,1.0,0.0),
1152
- vec3(0.0,0.0,1.0)
1153
- );vec3 Llocal=vec3(dot(L,T),dot(L,B),NdotL);vec3 Lwarp=normalize(M*Llocal);float cosThetaWarp=max(Lwarp.z,0.0);return cosThetaWarp*NdotL;}
1251
+ #ifdef REFLECTIONMAP_3D
1252
+ vec3 reflectionCoords=reflectionVector;
1253
+ #else
1254
+ vec2 reflectionCoords=reflectionVector.xy;
1255
+ #ifdef REFLECTIONMAP_PROJECTION
1256
+ reflectionCoords/=reflectionVector.z;
1154
1257
  #endif
1155
- #if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)
1156
- vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=vec3(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}
1157
- #elif defined(ANISOTROPIC)
1158
- vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
1159
- #ifdef IRIDESCENCE
1160
- fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
1258
+ reflectionCoords.y=1.0-reflectionCoords.y;
1161
1259
  #endif
1162
- float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
1260
+ return reflectionCoords;}
1261
+ #define pbr_inline
1262
+ #define inline
1263
+ vec3 sampleRadiance(
1264
+ in float alphaG
1265
+ ,in vec3 vReflectionMicrosurfaceInfos
1266
+ ,in vec2 vReflectionInfos
1267
+ ,in geometryInfoOutParams geoInfo
1268
+ #ifdef REFLECTIONMAP_3D
1269
+ ,in samplerCube reflectionSampler
1270
+ ,const vec3 reflectionCoords
1271
+ #else
1272
+ ,in sampler2D reflectionSampler
1273
+ ,const vec2 reflectionCoords
1163
1274
  #endif
1164
- #ifdef CLEARCOAT
1165
- vec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4(
1166
- clearCoatTerm*info.attenuation*NccdotL*lightColor,
1167
- 1.0-fresnel
1168
- );}
1169
- vec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}
1275
+ #ifdef REALTIME_FILTERING
1276
+ ,in vec2 vReflectionFilteringInfo
1170
1277
  #endif
1171
- #ifdef SHEEN
1172
- vec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER
1173
- float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
1174
- #else */
1175
- float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
1176
- float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
1278
+ )
1279
+ {vec4 environmentRadiance=vec4(0.,0.,0.,0.);
1280
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1281
+ float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
1282
+ #elif defined(LINEARSPECULARREFLECTION)
1283
+ float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
1284
+ #else
1285
+ float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
1177
1286
  #endif
1178
- `;o.ShaderStore.IncludesShadersStore[E]||(o.ShaderStore.IncludesShadersStore[E]=p),e.s(["pbrDirectLightingFunctions",0,{name:E,shader:p}],74188);let h="pbrBlockNormalGeometric",S=`vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
1179
- #ifdef NORMAL
1180
- vec3 normalW=normalize(vNormalW);
1287
+ reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
1288
+ #ifdef REALTIME_FILTERING
1289
+ environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
1181
1290
  #else
1182
- vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
1291
+ environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
1183
1292
  #endif
1184
- vec3 geometricNormalW=normalW;
1185
- #if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
1186
- geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
1293
+ #ifdef RGBDREFLECTION
1294
+ environmentRadiance.rgb=fromRGBD(environmentRadiance);
1187
1295
  #endif
1188
- `;o.ShaderStore.IncludesShadersStore[h]||(o.ShaderStore.IncludesShadersStore[h]=S),e.s(["pbrBlockNormalGeometric",0,{name:h,shader:S}],97657);let R="pbrBlockImageProcessing",I=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
1189
- #if !defined(SKIPFINALCOLORCLAMP)
1190
- finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
1296
+ #ifdef GAMMAREFLECTION
1297
+ environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);
1191
1298
  #endif
1299
+ environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
1300
+ #if defined(ANISOTROPIC)
1301
+ #define pbr_inline
1302
+ #define inline
1303
+ vec3 sampleRadianceAnisotropic(
1304
+ in float alphaG
1305
+ ,in vec3 vReflectionMicrosurfaceInfos
1306
+ ,in vec2 vReflectionInfos
1307
+ ,in geometryInfoAnisoOutParams geoInfo
1308
+ ,const vec3 normalW
1309
+ ,const vec3 viewDirectionW
1310
+ ,const vec3 positionW
1311
+ ,const vec3 noise
1312
+ ,bool isRefraction
1313
+ ,float ior
1314
+ #ifdef REFLECTIONMAP_3D
1315
+ ,in samplerCube reflectionSampler
1192
1316
  #else
1193
- finalColor=applyImageProcessing(finalColor);
1194
- #endif
1195
- finalColor.a*=visibility;
1196
- #ifdef PREMULTIPLYALPHA
1197
- finalColor.rgb*=finalColor.a;
1198
- #endif
1199
- `;o.ShaderStore.IncludesShadersStore[R]||(o.ShaderStore.IncludesShadersStore[R]=I),e.s(["pbrBlockImageProcessing",0,{name:R,shader:I}],10891);let L="pbrDebug",N=`#if DEBUGMODE>0
1200
- if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
1201
- #if DEBUGMODE==1
1202
- gl_FragColor.rgb=vPositionW.rgb;
1203
- #define DEBUGMODE_NORMALIZE
1204
- #elif DEBUGMODE==2 && defined(NORMAL)
1205
- gl_FragColor.rgb=vNormalW.rgb;
1206
- #define DEBUGMODE_NORMALIZE
1207
- #elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
1208
- gl_FragColor.rgb=TBN[0];
1209
- #define DEBUGMODE_NORMALIZE
1210
- #elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
1211
- gl_FragColor.rgb=TBN[1];
1212
- #define DEBUGMODE_NORMALIZE
1213
- #elif DEBUGMODE==5
1214
- gl_FragColor.rgb=normalW;
1215
- #define DEBUGMODE_NORMALIZE
1216
- #elif DEBUGMODE==6 && defined(MAINUV1)
1217
- gl_FragColor.rgb=vec3(vMainUV1,0.0);
1218
- #elif DEBUGMODE==7 && defined(MAINUV2)
1219
- gl_FragColor.rgb=vec3(vMainUV2,0.0);
1220
- #elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
1221
- gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
1222
- #define DEBUGMODE_NORMALIZE
1223
- #elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
1224
- gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
1225
- #define DEBUGMODE_NORMALIZE
1226
- #elif DEBUGMODE==10 && defined(CLEARCOAT)
1227
- gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
1228
- #define DEBUGMODE_NORMALIZE
1229
- #elif DEBUGMODE==11 && defined(ANISOTROPIC)
1230
- gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
1231
- #define DEBUGMODE_NORMALIZE
1232
- #elif DEBUGMODE==12 && defined(ANISOTROPIC)
1233
- gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
1234
- #define DEBUGMODE_NORMALIZE
1235
- #elif DEBUGMODE==13 && defined(ANISOTROPIC)
1236
- gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
1237
- #define DEBUGMODE_NORMALIZE
1238
- #elif DEBUGMODE==20 && defined(ALBEDO)
1239
- gl_FragColor.rgb=albedoTexture.rgb;
1240
- #ifndef GAMMAALBEDO
1241
- #define DEBUGMODE_GAMMA
1317
+ ,in sampler2D reflectionSampler
1242
1318
  #endif
1243
- #elif DEBUGMODE==21 && defined(AMBIENT)
1244
- gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
1245
- #elif DEBUGMODE==22 && defined(OPACITY)
1246
- gl_FragColor.rgb=opacityMap.rgb;
1247
- #elif DEBUGMODE==23 && defined(EMISSIVE)
1248
- gl_FragColor.rgb=emissiveColorTex.rgb;
1249
- #ifndef GAMMAEMISSIVE
1250
- #define DEBUGMODE_GAMMA
1319
+ #ifdef REALTIME_FILTERING
1320
+ ,in vec2 vReflectionFilteringInfo
1251
1321
  #endif
1252
- #elif DEBUGMODE==24 && defined(LIGHTMAP)
1253
- gl_FragColor.rgb=lightmapColor.rgb;
1254
- #ifndef GAMMALIGHTMAP
1255
- #define DEBUGMODE_GAMMA
1322
+ )
1323
+ {vec4 environmentRadiance=vec4(0.,0.,0.,0.);float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-geoInfo.anisotropy)*(1.0-geoInfo.anisotropy)));float alphaB=(1.0-geoInfo.anisotropy)*alphaT;alphaG=alphaB;
1324
+ #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
1325
+ float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
1326
+ #elif defined(LINEARSPECULARREFLECTION)
1327
+ float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
1328
+ #else
1329
+ float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
1256
1330
  #endif
1257
- #elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
1258
- gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
1259
- #elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
1260
- gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
1261
- #define DEBUGMODE_GAMMA
1262
- #elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
1263
- gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
1264
- #elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
1265
- gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
1266
- #elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
1267
- gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
1268
- #elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
1269
- gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
1270
- #elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
1271
- gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
1272
- #elif DEBUGMODE==32 && defined(BUMP)
1273
- gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;
1274
- #elif DEBUGMODE==40 && defined(SS_REFRACTION)
1275
- gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
1276
- #define DEBUGMODE_GAMMA
1277
- #elif DEBUGMODE==41 && defined(REFLECTION)
1278
- gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
1279
- #ifndef GAMMAREFLECTION
1280
- #define DEBUGMODE_GAMMA
1331
+ reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
1332
+ #ifdef REALTIME_FILTERING
1333
+ vec3 view=(reflectionMatrix*vec4(viewDirectionW,0.0)).xyz;vec3 tangent=(reflectionMatrix*vec4(geoInfo.anisotropicTangent,0.0)).xyz;vec3 bitangent=(reflectionMatrix*vec4(geoInfo.anisotropicBitangent,0.0)).xyz;vec3 normal=(reflectionMatrix*vec4(normalW,0.0)).xyz;
1334
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1335
+ view.z*=-1.0;tangent.z*=-1.0;bitangent.z*=-1.0;normal.z*=-1.0;
1281
1336
  #endif
1282
- #elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
1283
- gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
1284
- #define DEBUGMODE_GAMMA
1285
- #elif DEBUGMODE==50
1286
- gl_FragColor.rgb=diffuseBase.rgb;
1287
- #define DEBUGMODE_GAMMA
1288
- #elif DEBUGMODE==51 && defined(SPECULARTERM)
1289
- gl_FragColor.rgb=specularBase.rgb;
1290
- #define DEBUGMODE_GAMMA
1291
- #elif DEBUGMODE==52 && defined(CLEARCOAT)
1292
- gl_FragColor.rgb=clearCoatBase.rgb;
1293
- #define DEBUGMODE_GAMMA
1294
- #elif DEBUGMODE==53 && defined(SHEEN)
1295
- gl_FragColor.rgb=sheenBase.rgb;
1296
- #define DEBUGMODE_GAMMA
1297
- #elif DEBUGMODE==54 && defined(REFLECTION)
1298
- gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
1299
- #ifndef GAMMAREFLECTION
1300
- #define DEBUGMODE_GAMMA
1337
+ environmentRadiance=vec4(radianceAnisotropic(alphaT,alphaB,reflectionSampler,view,tangent,bitangent,normal,vReflectionFilteringInfo,noise.xy,isRefraction,ior),1.0);
1338
+ #else
1339
+ const int samples=16;vec4 radianceSample=vec4(0.0);vec3 reflectionCoords=vec3(0.0);float sample_weight=0.0;float total_weight=0.0;float step=1.0/float(max(samples-1,1));for (int i=0; i<samples; ++i) {float t=mix(-1.0,1.0,float(i)*step);t+=step*2.0*noise.x;sample_weight=max(1.0-abs(t),0.001);sample_weight*=sample_weight;t*=min(4.0*alphaT*geoInfo.anisotropy,1.0);vec3 bentNormal;if (t<0.0) {float blend=t+1.0;bentNormal=normalize(mix(-geoInfo.anisotropicTangent,normalW,blend));} else if (t>0.0) {float blend=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;}
1340
+ if (isRefraction) {reflectionCoords=double_refract(-viewDirectionW,bentNormal,ior);} else {reflectionCoords=reflect(-viewDirectionW,bentNormal);}
1341
+ reflectionCoords=vec3(reflectionMatrix*vec4(reflectionCoords,0));
1342
+ #ifdef REFLECTIONMAP_OPPOSITEZ
1343
+ reflectionCoords.z*=-1.0;
1301
1344
  #endif
1302
- #elif DEBUGMODE==60
1303
- gl_FragColor.rgb=surfaceAlbedo.rgb;
1304
- #define DEBUGMODE_GAMMA
1305
- #elif DEBUGMODE==61
1306
- gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
1307
- #define DEBUGMODE_GAMMA
1308
- #elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
1309
- gl_FragColor.rgb=vec3(reflectivityOut.metallic);
1310
- #elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
1311
- gl_FragColor.rgb=reflectivityOut.metallicF0;
1312
- #elif DEBUGMODE==63
1313
- gl_FragColor.rgb=vec3(roughness);
1314
- #elif DEBUGMODE==64
1315
- gl_FragColor.rgb=vec3(alphaG);
1316
- #elif DEBUGMODE==65
1317
- gl_FragColor.rgb=vec3(NdotV);
1318
- #elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
1319
- gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
1320
- #define DEBUGMODE_GAMMA
1321
- #elif DEBUGMODE==67 && defined(CLEARCOAT)
1322
- gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
1323
- #elif DEBUGMODE==68 && defined(CLEARCOAT)
1324
- gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
1325
- #elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
1326
- gl_FragColor.rgb=subSurfaceOut.transmittance;
1327
- #elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
1328
- gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
1329
- #elif DEBUGMODE==72
1330
- gl_FragColor.rgb=vec3(microSurface);
1331
- #elif DEBUGMODE==73
1332
- gl_FragColor.rgb=vAlbedoColor.rgb;
1333
- #define DEBUGMODE_GAMMA
1334
- #elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
1335
- gl_FragColor.rgb=vReflectivityColor.rgb;
1336
- #define DEBUGMODE_GAMMA
1337
- #elif DEBUGMODE==75
1338
- gl_FragColor.rgb=vEmissiveColor.rgb;
1339
- #define DEBUGMODE_GAMMA
1340
- #elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
1341
- gl_FragColor.rgb=vec3(seo);
1342
- #elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
1343
- gl_FragColor.rgb=vec3(eho);
1344
- #elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
1345
- gl_FragColor.rgb=vec3(energyConservationFactor);
1346
- #elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1347
- gl_FragColor.rgb=baseSpecularEnvironmentReflectance;
1348
- #define DEBUGMODE_GAMMA
1349
- #elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
1350
- gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
1351
- #define DEBUGMODE_GAMMA
1352
- #elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
1353
- gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
1354
- #define DEBUGMODE_GAMMA
1355
- #elif DEBUGMODE==86 && defined(ALPHABLEND)
1356
- gl_FragColor.rgb=vec3(luminanceOverAlpha);
1357
- #elif DEBUGMODE==87
1358
- gl_FragColor.rgb=vec3(alpha);
1359
- #elif DEBUGMODE==88 && defined(ALBEDO)
1360
- gl_FragColor.rgb=vec3(albedoTexture.a);
1361
- #elif DEBUGMODE==89
1362
- gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;
1345
+ radianceSample=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
1346
+ #ifdef RGBDREFLECTION
1347
+ environmentRadiance.rgb+=sample_weight*fromRGBD(radianceSample);
1348
+ #elif defined(GAMMAREFLECTION)
1349
+ environmentRadiance.rgb+=sample_weight*toLinearSpace(radianceSample.rgb);
1363
1350
  #else
1364
- float stripeWidth=30.;float stripePos=floor(gl_FragCoord.x/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor);
1351
+ environmentRadiance.rgb+=sample_weight*radianceSample.rgb;
1365
1352
  #endif
1366
- gl_FragColor.rgb*=vDebugMode.y;
1367
- #ifdef DEBUGMODE_NORMALIZE
1368
- gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
1353
+ total_weight+=sample_weight;}
1354
+ environmentRadiance=vec4(environmentRadiance.xyz/float(total_weight),1.0);
1369
1355
  #endif
1370
- #ifdef DEBUGMODE_GAMMA
1371
- gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
1356
+ environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
1372
1357
  #endif
1373
- gl_FragColor.a=1.0;
1374
- #ifdef PREPASS
1375
- gl_FragData[0]=toLinearSpace(gl_FragColor);
1376
- gl_FragData[1]=vec4(0.,0.,0.,0.);
1377
1358
  #endif
1378
- #ifdef DEBUGMODE_FORCERETURN
1379
- return;
1359
+ #if defined(ENVIRONMENTBRDF)
1360
+ #define pbr_inline
1361
+ float computeDielectricIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
1362
+ {float dielectricIblFresnel=getReflectanceFromBRDFLookup(vec3(reflectance.F0),vec3(reflectance.F90),environmentBrdf).r;float dielectricECF=1.0+reflectance.F0*(1.0/environmentBrdf.y-1.0);return clamp(dielectricIblFresnel*dielectricECF,0.0,1.0);}
1363
+ #define pbr_inline
1364
+ vec3 computeConductorIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
1365
+ {
1366
+ #if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) && defined(ENVIRONMENTBRDF)
1367
+ vec3 openPBRBrdf=vec3(environmentBrdf.xy,environmentBrdf.z/BRDF_Z_SCALE);vec3 b =getF82B(reflectance.coloredF0,reflectance.coloredF90);vec3 E_F82=getF82DirectionalAlbedo(reflectance.coloredF0,vec3(1.0),b,openPBRBrdf);vec3 F_avg=getF82AverageFresnel(reflectance.coloredF0,b);vec3 ECF =vec3(1.0)+F_avg*(vec3(1.0)/openPBRBrdf.y-vec3(1.0));return clamp(E_F82*ECF,vec3(0.0),vec3(1.0));
1368
+ #else
1369
+ return getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf);
1380
1370
  #endif
1381
1371
  }
1382
1372
  #endif
1383
- `;o.ShaderStore.IncludesShadersStore[L]||(o.ShaderStore.IncludesShadersStore[L]=N),e.s(["pbrDebug",0,{name:L,shader:N}],20904)}]);
1373
+ `;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["openpbrIblFunctions",0,{name:c,shader:f}],34630)},19831,e=>{"use strict";var o=e.i(2342);let t="sceneUboDeclaration",i=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
1374
+ #ifdef MULTIVIEW
1375
+ mat4 viewProjectionR;
1376
+ #endif
1377
+ mat4 view;mat4 projection;vec4 vEyePosition;mat4 inverseProjection;};
1378
+ `;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneUboDeclaration",0,{name:t,shader:i}])}]);