@uptimizr/dashboard 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/__next.__PAGE__.txt +4 -4
- package/out/__next._full.txt +11 -11
- package/out/__next._head.txt +4 -4
- package/out/__next._index.txt +4 -4
- package/out/__next._tree.txt +2 -2
- package/out/_next/static/chunks/002cjeoit6-up.js +1 -0
- package/out/_next/static/chunks/02n1uiltexy3w.js +1 -0
- package/out/_next/static/chunks/03ab2khhe8-x5.js +1 -0
- package/out/_next/static/chunks/04_yytpc2paxy.js +1 -0
- package/out/_next/static/chunks/06qot1qvlsqaz.js +1 -0
- package/out/_next/static/chunks/07eeopuufsqp-.js +1501 -0
- package/out/_next/static/chunks/08a5xek662n8n.js +1 -0
- package/out/_next/static/chunks/08wuc9--s8zn_.js +1 -0
- package/out/_next/static/chunks/0927l-ygd5c8d.js +1 -0
- package/out/_next/static/chunks/09510356f0lad.js +1 -0
- package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
- package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
- package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
- package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
- package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
- package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
- package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
- package/out/_next/static/chunks/0g_v2zswo4l6f.js +1 -0
- package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
- package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
- package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
- package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
- package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
- package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
- package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
- package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
- package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
- package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
- package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
- package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
- package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
- package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
- package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
- package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
- package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
- package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
- package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
- package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
- package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
- package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
- package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
- package/out/_next/static/chunks/137xbvd4nd41j.js +3 -0
- package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
- package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
- package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
- package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
- package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
- package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
- package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
- package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
- package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
- package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
- package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
- package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
- package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
- package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
- package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
- package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
- package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
- package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
- package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
- package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
- package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
- package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
- package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
- package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
- package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
- package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
- package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
- package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
- package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
- package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
- package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
- package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
- package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
- package/out/_next/static/chunks/1tta1a064979p.js +1 -0
- package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
- package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
- package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
- package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
- package/out/_next/static/chunks/{1flb8adpj6_2o.js → 1xpwp4m1tqugp.js} +1 -1
- package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
- package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
- package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
- package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
- package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
- package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
- package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
- package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
- package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
- package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
- package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
- package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
- package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
- package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
- package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
- package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
- package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
- package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
- package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
- package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
- package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
- package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
- package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
- package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
- package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
- package/out/_next/static/chunks/2mdbvf1b5h00_.css +3 -0
- package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
- package/out/_next/static/chunks/2our10fwtj87e.js +1 -0
- package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
- package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
- package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
- package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
- package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
- package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
- package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
- package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
- package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
- package/out/_next/static/chunks/2x-00glogc485.js +1 -0
- package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
- package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
- package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
- package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
- package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
- package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
- package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
- package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
- package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
- package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
- package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
- package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
- package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
- package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
- package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
- package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
- package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
- package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
- package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
- package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
- package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
- package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
- package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
- package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
- package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
- package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
- package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
- package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
- package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
- package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
- package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
- package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
- package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
- package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
- package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
- package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
- package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
- package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
- package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
- package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
- package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
- package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
- package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
- package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
- package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
- package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
- package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
- package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
- package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
- package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
- package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
- package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
- package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
- package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
- package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
- package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
- package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
- package/out/_not-found/__next._full.txt +9 -9
- package/out/_not-found/__next._head.txt +4 -4
- package/out/_not-found/__next._index.txt +4 -4
- package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/out/_not-found/__next._not-found.txt +3 -3
- package/out/_not-found/__next._tree.txt +2 -2
- package/out/_not-found.html +1 -1
- package/out/_not-found.txt +9 -9
- package/out/index.html +1 -1
- package/out/index.txt +11 -11
- package/package.json +5 -4
- package/out/_next/static/chunks/068j6934u8j16.js +0 -1
- package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
- package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
- package/out/_next/static/chunks/0aznt7717miff.js +0 -1
- package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
- package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
- package/out/_next/static/chunks/0gg-ii7i6d_p6.js +0 -1
- package/out/_next/static/chunks/0tx1j_ghpz7rc.css +0 -3
- package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
- package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
- package/out/_next/static/chunks/0wwkrsvxwi57d.js +0 -1
- package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
- package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
- package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
- package/out/_next/static/chunks/123xxske5c9na.js +0 -1
- package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
- package/out/_next/static/chunks/157d9euci08yu.js +0 -1
- package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
- package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
- package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
- package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
- package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
- package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
- package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
- package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
- package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
- package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
- package/out/_next/static/chunks/2clzipqap01hp.js +0 -1
- package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
- package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
- package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
- package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
- package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
- package/out/_next/static/chunks/2z5eqx5do5std.js +0 -1
- package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
- package/out/_next/static/chunks/3aqbf_wkg2sih.js +0 -3
- package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
- package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
- package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
- package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
- package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
- package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
- package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
- package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_buildManifest.js +0 -0
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,1450 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29981,69838,e=>{"use strict";var o=e.i(12423);let t="clipPlaneFragmentDeclaration",i=`#ifdef CLIPPLANE
|
|
2
|
+
varying float fClipDistance;
|
|
3
|
+
#endif
|
|
4
|
+
#ifdef CLIPPLANE2
|
|
5
|
+
varying float fClipDistance2;
|
|
6
|
+
#endif
|
|
7
|
+
#ifdef CLIPPLANE3
|
|
8
|
+
varying float fClipDistance3;
|
|
9
|
+
#endif
|
|
10
|
+
#ifdef CLIPPLANE4
|
|
11
|
+
varying float fClipDistance4;
|
|
12
|
+
#endif
|
|
13
|
+
#ifdef CLIPPLANE5
|
|
14
|
+
varying float fClipDistance5;
|
|
15
|
+
#endif
|
|
16
|
+
#ifdef CLIPPLANE6
|
|
17
|
+
varying float fClipDistance6;
|
|
18
|
+
#endif
|
|
19
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["clipPlaneFragmentDeclaration",0,{name:t,shader:i}],29981);let r="clipPlaneFragment",a=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
|
|
20
|
+
if (false) {}
|
|
21
|
+
#endif
|
|
22
|
+
#ifdef CLIPPLANE
|
|
23
|
+
else if (fClipDistance>0.0)
|
|
24
|
+
{discard;}
|
|
25
|
+
#endif
|
|
26
|
+
#ifdef CLIPPLANE2
|
|
27
|
+
else if (fClipDistance2>0.0)
|
|
28
|
+
{discard;}
|
|
29
|
+
#endif
|
|
30
|
+
#ifdef CLIPPLANE3
|
|
31
|
+
else if (fClipDistance3>0.0)
|
|
32
|
+
{discard;}
|
|
33
|
+
#endif
|
|
34
|
+
#ifdef CLIPPLANE4
|
|
35
|
+
else if (fClipDistance4>0.0)
|
|
36
|
+
{discard;}
|
|
37
|
+
#endif
|
|
38
|
+
#ifdef CLIPPLANE5
|
|
39
|
+
else if (fClipDistance5>0.0)
|
|
40
|
+
{discard;}
|
|
41
|
+
#endif
|
|
42
|
+
#ifdef CLIPPLANE6
|
|
43
|
+
else if (fClipDistance6>0.0)
|
|
44
|
+
{discard;}
|
|
45
|
+
#endif
|
|
46
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["clipPlaneFragment",0,{name:r,shader:a}],69838)},56770,40671,e=>{"use strict";var o=e.i(12423);let t="fogFragmentDeclaration",i=`#ifdef FOG
|
|
47
|
+
#define FOGMODE_NONE 0.
|
|
48
|
+
#define FOGMODE_EXP 1.
|
|
49
|
+
#define FOGMODE_EXP2 2.
|
|
50
|
+
#define FOGMODE_LINEAR 3.
|
|
51
|
+
#define E 2.71828
|
|
52
|
+
uniform vec4 vFogInfos;uniform vec3 vFogColor;varying vec3 vFogDistance;float CalcFogFactor()
|
|
53
|
+
{float fogCoeff=1.0;float fogStart=vFogInfos.y;float fogEnd=vFogInfos.z;float fogDensity=vFogInfos.w;float fogDistance=length(vFogDistance);if (FOGMODE_LINEAR==vFogInfos.x)
|
|
54
|
+
{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}
|
|
55
|
+
else if (FOGMODE_EXP==vFogInfos.x)
|
|
56
|
+
{fogCoeff=1.0/pow(E,fogDistance*fogDensity);}
|
|
57
|
+
else if (FOGMODE_EXP2==vFogInfos.x)
|
|
58
|
+
{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}
|
|
59
|
+
return clamp(fogCoeff,0.0,1.0);}
|
|
60
|
+
#endif
|
|
61
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["fogFragmentDeclaration",0,{name:t,shader:i}],56770);let r="fogFragment",a=`#ifdef FOG
|
|
62
|
+
float fog=CalcFogFactor();
|
|
63
|
+
#ifdef PBR
|
|
64
|
+
fog=toLinearSpace(fog);
|
|
65
|
+
#endif
|
|
66
|
+
color.rgb=mix(vFogColor,color.rgb,fog);
|
|
67
|
+
#endif
|
|
68
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["fogFragment",0,{name:r,shader:a}],40671)},65296,e=>{"use strict";var o=e.i(12423);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;
|
|
69
|
+
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;
|
|
70
|
+
#define saturate(x) clamp(x,0.0,1.0)
|
|
71
|
+
#define absEps(x) abs(x)+Epsilon
|
|
72
|
+
#define maxEps(x) max(x,Epsilon)
|
|
73
|
+
#define saturateEps(x) clamp(x,Epsilon,1.0)
|
|
74
|
+
mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(
|
|
75
|
+
vec3(i0.x,i1.x,i2.x),
|
|
76
|
+
vec3(i0.y,i1.y,i2.y),
|
|
77
|
+
vec3(i0.z,i1.z,i2.z)
|
|
78
|
+
);return outMatrix;}
|
|
79
|
+
mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),
|
|
80
|
+
b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),
|
|
81
|
+
b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}
|
|
82
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
83
|
+
vec3 toLinearSpaceExact(vec3 color)
|
|
84
|
+
{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));
|
|
85
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
86
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));
|
|
87
|
+
#else
|
|
88
|
+
return
|
|
89
|
+
vec3(
|
|
90
|
+
color.r<=0.04045 ? nearZeroSection.r : remainingSection.r,
|
|
91
|
+
color.g<=0.04045 ? nearZeroSection.g : remainingSection.g,
|
|
92
|
+
color.b<=0.04045 ? nearZeroSection.b : remainingSection.b);
|
|
93
|
+
#endif
|
|
94
|
+
}
|
|
95
|
+
vec3 toGammaSpaceExact(vec3 color)
|
|
96
|
+
{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);
|
|
97
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
98
|
+
return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));
|
|
99
|
+
#else
|
|
100
|
+
return
|
|
101
|
+
vec3(
|
|
102
|
+
color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,
|
|
103
|
+
color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,
|
|
104
|
+
color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);
|
|
105
|
+
#endif
|
|
106
|
+
}
|
|
107
|
+
#endif
|
|
108
|
+
float toLinearSpace(float color)
|
|
109
|
+
{
|
|
110
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
111
|
+
float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;
|
|
112
|
+
#else
|
|
113
|
+
return pow(color,LinearEncodePowerApprox);
|
|
114
|
+
#endif
|
|
115
|
+
}
|
|
116
|
+
vec3 toLinearSpace(vec3 color)
|
|
117
|
+
{
|
|
118
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
119
|
+
return toLinearSpaceExact(color);
|
|
120
|
+
#else
|
|
121
|
+
return pow(color,vec3(LinearEncodePowerApprox));
|
|
122
|
+
#endif
|
|
123
|
+
}
|
|
124
|
+
vec4 toLinearSpace(vec4 color)
|
|
125
|
+
{
|
|
126
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
127
|
+
return vec4(toLinearSpaceExact(color.rgb),color.a);
|
|
128
|
+
#else
|
|
129
|
+
return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);
|
|
130
|
+
#endif
|
|
131
|
+
}
|
|
132
|
+
float toGammaSpace(float color)
|
|
133
|
+
{
|
|
134
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
135
|
+
float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;
|
|
136
|
+
#else
|
|
137
|
+
return pow(color,GammaEncodePowerApprox);
|
|
138
|
+
#endif
|
|
139
|
+
}
|
|
140
|
+
vec3 toGammaSpace(vec3 color)
|
|
141
|
+
{
|
|
142
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
143
|
+
return toGammaSpaceExact(color);
|
|
144
|
+
#else
|
|
145
|
+
return pow(color,vec3(GammaEncodePowerApprox));
|
|
146
|
+
#endif
|
|
147
|
+
}
|
|
148
|
+
vec4 toGammaSpace(vec4 color)
|
|
149
|
+
{
|
|
150
|
+
#if USE_EXACT_SRGB_CONVERSIONS
|
|
151
|
+
return vec4(toGammaSpaceExact(color.rgb),color.a);
|
|
152
|
+
#else
|
|
153
|
+
return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);
|
|
154
|
+
#endif
|
|
155
|
+
}
|
|
156
|
+
float square(float value)
|
|
157
|
+
{return value*value;}
|
|
158
|
+
vec3 square(vec3 value)
|
|
159
|
+
{return value*value;}
|
|
160
|
+
float pow5(float value) {float sq=value*value;return sq*sq*value;}
|
|
161
|
+
vec3 double_refract(vec3 I,vec3 N,float eta) {vec3 Tfront=refract(I,N,1.0/eta);vec3 Nback=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);}
|
|
162
|
+
float getLuminanceUnclamped(vec3 color)
|
|
163
|
+
{return dot(color,LuminanceEncodeApprox);}
|
|
164
|
+
float getLuminance(vec3 color)
|
|
165
|
+
{return saturate(getLuminanceUnclamped(color));}
|
|
166
|
+
float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}
|
|
167
|
+
float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}
|
|
168
|
+
const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);}
|
|
169
|
+
vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}
|
|
170
|
+
vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}
|
|
171
|
+
vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}
|
|
172
|
+
float sqrtClamped(float value) {return sqrt(max(value,0.));}
|
|
173
|
+
float avg(vec3 value) {return dot(value,vec3(0.333333333));}
|
|
174
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
175
|
+
uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<<width)-1u);}
|
|
176
|
+
int onlyBitPosition(uint value) {return (floatBitsToInt(float(value))>>23)-0x7f;}
|
|
177
|
+
vec3 singleScatterToMultiScatterAlbedo(vec3 rho_ss) {vec3 s=sqrt(max(vec3(1.0)-rho_ss,vec3(0.0)));return (vec3(1.0)-s)*(vec3(1.0)-vec3(0.139)*s)/(vec3(1.0)+vec3(1.17)*s);}
|
|
178
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return 1.0-s*s;}
|
|
179
|
+
vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms,float aniso) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return (1.0-s*s)/maxEps(1.0-aniso*s*s);}
|
|
180
|
+
float min3(vec3 v) {return min(v.x,min(v.y,v.z));}
|
|
181
|
+
float max3(vec3 v) {return max(v.x,max(v.y,v.z));}
|
|
182
|
+
float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}
|
|
183
|
+
vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),
|
|
184
|
+
uint2float(rstate*2447445414u));}
|
|
185
|
+
#endif
|
|
186
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["helperFunctions",0,{name:t,shader:i}])},85668,e=>{"use strict";var o=e.i(12423);let t="sceneUboDeclaration",i=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
|
|
187
|
+
#ifdef MULTIVIEW
|
|
188
|
+
mat4 viewProjectionR;
|
|
189
|
+
#endif
|
|
190
|
+
mat4 view;mat4 projection;vec4 vEyePosition;mat4 inverseProjection;};
|
|
191
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneUboDeclaration",0,{name:t,shader:i}])},6232,92692,97226,e=>{"use strict";var o=e.i(12423);let t="meshUboDeclaration",i=`#ifdef WEBGL2
|
|
192
|
+
uniform mat4 world;uniform float visibility;
|
|
193
|
+
#else
|
|
194
|
+
layout(std140,column_major) uniform;uniform Mesh
|
|
195
|
+
{mat4 world;float visibility;};
|
|
196
|
+
#endif
|
|
197
|
+
#define WORLD_UBO
|
|
198
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["meshUboDeclaration",0,{name:t,shader:i}],6232);let r="mainUVVaryingDeclaration",a=`#ifdef MAINUV{X}
|
|
199
|
+
varying vec2 vMainUV{X};
|
|
200
|
+
#endif
|
|
201
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["mainUVVaryingDeclaration",0,{name:r,shader:a}],92692);let n="logDepthDeclaration",l=`#ifdef LOGARITHMICDEPTH
|
|
202
|
+
uniform float logarithmicDepthConstant;varying float vFragmentDepth;
|
|
203
|
+
#endif
|
|
204
|
+
`;o.ShaderStore.IncludesShadersStore[n]||(o.ShaderStore.IncludesShadersStore[n]=l),e.s(["logDepthDeclaration",0,{name:n,shader:l}],97226)},50438,e=>{"use strict";var o=e.i(12423);let t="harmonicsFunctions",i=`#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
205
|
+
#ifdef SPHERICAL_HARMONICS
|
|
206
|
+
vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00
|
|
207
|
+
+ vSphericalL1_1*(normal.y)
|
|
208
|
+
+ vSphericalL10*(normal.z)
|
|
209
|
+
+ vSphericalL11*(normal.x)
|
|
210
|
+
+ vSphericalL2_2*(normal.y*normal.x)
|
|
211
|
+
+ vSphericalL2_1*(normal.y*normal.z)
|
|
212
|
+
+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)
|
|
213
|
+
+ vSphericalL21*(normal.z*normal.x)
|
|
214
|
+
+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
|
|
215
|
+
#else
|
|
216
|
+
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;}
|
|
217
|
+
#endif
|
|
218
|
+
#endif
|
|
219
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["harmonicsFunctions",0,{name:t,shader:i}])},60990,e=>{"use strict";var o=e.i(12423);let t="pbrBRDFFunctions",i=`#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
|
|
220
|
+
#define BRDF_DIFFUSE_MODEL_EON 0
|
|
221
|
+
#define BRDF_DIFFUSE_MODEL_BURLEY 1
|
|
222
|
+
#define BRDF_DIFFUSE_MODEL_LAMBERT 2
|
|
223
|
+
#define BRDF_DIFFUSE_MODEL_LEGACY 3
|
|
224
|
+
#define DIELECTRIC_SPECULAR_MODEL_GLTF 0
|
|
225
|
+
#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1
|
|
226
|
+
#define CONDUCTOR_SPECULAR_MODEL_GLTF 0
|
|
227
|
+
#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1
|
|
228
|
+
#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER)
|
|
229
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
230
|
+
vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
|
|
231
|
+
#endif
|
|
232
|
+
#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR
|
|
233
|
+
#define F82_COS_THETA_MAX 0.142857143
|
|
234
|
+
#define F82_ONE_MINUS_CTM_POW5 0.462664366
|
|
235
|
+
#define F82_ONE_MINUS_CTM_POW6 0.396569457
|
|
236
|
+
#define F82_B_DENOMINATOR_RECIP 17.6512785
|
|
237
|
+
#define BRDF_Z_SCALE 16.0
|
|
238
|
+
vec3 getF82Specular(float NdotV,vec3 F0,vec3 edgeTint,float roughness) {vec3 white_minus_F0=vec3(1.0)-F0;vec3 b=(F0+white_minus_F0*F82_ONE_MINUS_CTM_POW5)*(vec3(1.0)-edgeTint)*F82_B_DENOMINATOR_RECIP;float cos_theta=max(roughness,NdotV);float one_minus_cos_theta=1.0-cos_theta;vec3 offset_from_F0=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0);return clamp(F0+offset_from_F0,0.0,1.0);}
|
|
239
|
+
vec3 getF82B(vec3 F0,vec3 edgeTint) {return (F0+(vec3(1.0)-F0)*F82_ONE_MINUS_CTM_POW5)*(vec3(1.0)-edgeTint)*F82_B_DENOMINATOR_RECIP;}
|
|
240
|
+
vec3 getF82DirectionalAlbedo(vec3 F0,vec3 F90,vec3 b,vec3 environmentBrdf) {return (F90-F0)*environmentBrdf.x+F0*environmentBrdf.y-b*environmentBrdf.z;}
|
|
241
|
+
vec3 getF82AverageFresnel(vec3 F0,vec3 b) {return F0+(vec3(1.0)-F0)/21.0-b/126.0;}
|
|
242
|
+
#endif
|
|
243
|
+
#ifdef FUZZENVIRONMENTBRDF
|
|
244
|
+
vec3 getFuzzBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(perceptualRoughness,NdotV);vec4 brdfLookup=texture2D(environmentFuzzBrdfSampler,UV);const vec2 RiRange=vec2(0.0,0.75);const vec2 ARange =vec2(0.005,0.88);const vec2 BRange =vec2(-0.18,0.002);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;}
|
|
245
|
+
#endif
|
|
246
|
+
#ifdef ENVIRONMENTBRDF
|
|
247
|
+
vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);
|
|
248
|
+
#ifdef ENVIRONMENTBRDF_RGBD
|
|
249
|
+
brdfLookup.rgb=fromRGBD(brdfLookup.rgba);
|
|
250
|
+
#endif
|
|
251
|
+
return brdfLookup.rgb;}
|
|
252
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {
|
|
253
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
254
|
+
vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
|
|
255
|
+
#else
|
|
256
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
|
|
257
|
+
#endif
|
|
258
|
+
return reflectance;}
|
|
259
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
|
|
260
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
261
|
+
vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
|
|
262
|
+
#else
|
|
263
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
|
|
264
|
+
#endif
|
|
265
|
+
return reflectance;}
|
|
266
|
+
#endif
|
|
267
|
+
/* NOT USED
|
|
268
|
+
#if defined(SHEEN) && defined(SHEEN_SOFTER)
|
|
269
|
+
float getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)
|
|
270
|
+
{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
|
|
271
|
+
#endif
|
|
272
|
+
*/
|
|
273
|
+
#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
|
|
274
|
+
vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
|
|
275
|
+
{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
|
|
276
|
+
#endif
|
|
277
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
278
|
+
/**
|
|
279
|
+
* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
|
|
280
|
+
* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
|
|
281
|
+
*/
|
|
282
|
+
vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
|
|
283
|
+
#endif
|
|
284
|
+
vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
|
|
285
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
286
|
+
float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)
|
|
287
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
288
|
+
#ifdef CLEARCOAT
|
|
289
|
+
vec3 getR0RemappedForClearCoat(vec3 f0) {
|
|
290
|
+
#ifdef CLEARCOAT_DEFAULTIOR
|
|
291
|
+
#ifdef MOBILE
|
|
292
|
+
return saturate(f0*(f0*0.526868+0.529324)-0.0482256);
|
|
293
|
+
#else
|
|
294
|
+
return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
|
|
295
|
+
#endif
|
|
296
|
+
#else
|
|
297
|
+
vec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);
|
|
298
|
+
#endif
|
|
299
|
+
}
|
|
300
|
+
#endif
|
|
301
|
+
#ifdef IRIDESCENCE
|
|
302
|
+
const mat3 XYZ_TO_REC709=mat3(
|
|
303
|
+
3.2404542,-0.9692660, 0.0556434,
|
|
304
|
+
-1.5371385, 1.8760108,-0.2040259,
|
|
305
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
306
|
+
);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
|
|
307
|
+
vec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}
|
|
308
|
+
float getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}
|
|
309
|
+
vec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}
|
|
310
|
+
vec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}
|
|
311
|
+
float cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR<outsideIOR) phi12=PI;float phi21=PI-phi12;vec3 baseIOR=getIORTfromAirToSurfaceR0(clamp(baseF0,0.0,0.9999));
|
|
312
|
+
vec3 R1=getR0fromIORs(baseIOR,iridescenceIOR);float maxR1=max(R1.r,max(R1.g,R1.b));if (maxR1<1e-6) {return max(vec3(R12),vec3(0.0));}
|
|
313
|
+
vec3 R23=fresnelSchlickGGX(cosTheta2,R1,vec3(1.));vec3 phi23=vec3(0.0);if (baseIOR[0]<iridescenceIOR) phi23[0]=PI;if (baseIOR[1]<iridescenceIOR) phi23[1]=PI;if (baseIOR[2]<iridescenceIOR) phi23[2]=PI;float opd=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;vec3 phi=vec3(phi21)+phi23;vec3 R123=clamp(R12*R23,1e-5,0.9999);vec3 r123=sqrt(R123);vec3 Rs=square(T121)*R23/(vec3(1.0)-R123);vec3 C0=R12+Rs;I=C0;vec3 Cm=Rs-T121;for (int m=1; m<=2; ++m)
|
|
314
|
+
{Cm*=r123;vec3 Sm=2.0*evalSensitivity(float(m)*opd,float(m)*phi);I+=Cm*Sm;}
|
|
315
|
+
return max(I,vec3(0.0));}
|
|
316
|
+
#endif
|
|
317
|
+
float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
|
|
318
|
+
{float a2=square(alphaG);float d=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
|
|
319
|
+
#ifdef SHEEN
|
|
320
|
+
float normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)
|
|
321
|
+
{float invR=1./alphaG;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
|
|
322
|
+
#endif
|
|
323
|
+
#ifdef ANISOTROPIC
|
|
324
|
+
float normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {float a2=alphaTB.x*alphaTB.y;vec3 v=vec3(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);float v2=dot(v,v);float w2=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}
|
|
325
|
+
#endif
|
|
326
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
327
|
+
float smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {
|
|
328
|
+
#ifdef MOBILE
|
|
329
|
+
float GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);float GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
|
|
330
|
+
#else
|
|
331
|
+
float a2=alphaG*alphaG;float GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);float GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);
|
|
332
|
+
#endif
|
|
333
|
+
}
|
|
334
|
+
#else
|
|
335
|
+
float smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)
|
|
336
|
+
{
|
|
337
|
+
#ifdef MOBILE
|
|
338
|
+
return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
|
|
339
|
+
#else
|
|
340
|
+
float alphaSquared=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
|
|
341
|
+
#endif
|
|
342
|
+
}
|
|
343
|
+
float smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)
|
|
344
|
+
{float visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
|
|
345
|
+
#endif
|
|
346
|
+
#ifdef ANISOTROPIC
|
|
347
|
+
float smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {float lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));float lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));float v=0.5/(lambdaV+lambdaL);return v;}
|
|
348
|
+
#endif
|
|
349
|
+
#ifdef CLEARCOAT
|
|
350
|
+
float visibility_Kelemen(float VdotH) {return 0.25/(VdotH*VdotH); }
|
|
351
|
+
#endif
|
|
352
|
+
#ifdef SHEEN
|
|
353
|
+
float visibility_Ashikhmin(float NdotL,float NdotV)
|
|
354
|
+
{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
|
|
355
|
+
/* NOT USED
|
|
356
|
+
#ifdef SHEEN_SOFTER
|
|
357
|
+
float l(float x,float alphaG)
|
|
358
|
+
{float oneMinusAlphaSq=(1.0-alphaG)*(1.0-alphaG);float a=mix(21.5473,25.3245,oneMinusAlphaSq);float b=mix(3.82987,3.32435,oneMinusAlphaSq);float c=mix(0.19823,0.16801,oneMinusAlphaSq);float d=mix(-1.97760,-1.27393,oneMinusAlphaSq);float e=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}
|
|
359
|
+
float lambdaSheen(float cosTheta,float alphaG)
|
|
360
|
+
{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
|
|
361
|
+
float visibility_CharlieSheen(float NdotL,float NdotV,float alphaG)
|
|
362
|
+
{float G=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
|
|
363
|
+
#endif
|
|
364
|
+
*/
|
|
365
|
+
#endif
|
|
366
|
+
float diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {float diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));float diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));float diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;float fresnel =
|
|
367
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
|
|
368
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
|
|
369
|
+
const float constant1_FON=0.5-2.0/(3.0*PI);const float constant2_FON=2.0/3.0-28.0/(15.0*PI);float E_FON_approx(float mu,float roughness)
|
|
370
|
+
{float sigma=roughness;
|
|
371
|
+
float mucomp=1.0-mu;float mucomp2=mucomp*mucomp;const mat2 Gcoeffs=mat2(0.0571085289,-0.332181442,
|
|
372
|
+
0.491881867,0.0714429953);float GoverPi=dot(Gcoeffs*vec2(mucomp,mucomp2),vec2(1.0,mucomp2));return (1.0+sigma*GoverPi)/(1.0+constant1_FON*sigma);}
|
|
373
|
+
vec3 diffuseBRDF_EON(vec3 albedo,float roughness,float NdotL,float NdotV,float LdotV)
|
|
374
|
+
{vec3 rho=albedo;float sigma=roughness;
|
|
375
|
+
float mu_i=NdotL;
|
|
376
|
+
float mu_o=NdotV;
|
|
377
|
+
float s=LdotV-mu_i*mu_o;
|
|
378
|
+
float sovertF=s>0.0 ? s/max(mu_i,mu_o) : s;
|
|
379
|
+
float AF=1.0/(1.0+constant1_FON*sigma);
|
|
380
|
+
vec3 f_ss=(rho*RECIPROCAL_PI)*AF*(1.0+sigma*sovertF);
|
|
381
|
+
float EFo=E_FON_approx(mu_o,sigma);
|
|
382
|
+
float EFi=E_FON_approx(mu_i,sigma);
|
|
383
|
+
float avgEF=AF*(1.0+constant2_FON*sigma);
|
|
384
|
+
vec3 rho_ms=(rho*rho)*avgEF/(vec3(1.0)-rho*(1.0-avgEF));const float eps=1.0e-7;vec3 f_ms=(rho_ms*RECIPROCAL_PI)*max(eps,1.0-EFo)
|
|
385
|
+
* max(eps,1.0-EFi)
|
|
386
|
+
/ max(eps,1.0-avgEF);return (f_ss+f_ms);}
|
|
387
|
+
#ifdef SS_TRANSLUCENCY
|
|
388
|
+
vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {vec3 S=1./maxEps(diffusionDistance);vec3 temp=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}
|
|
389
|
+
float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}
|
|
390
|
+
#endif
|
|
391
|
+
#endif
|
|
392
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrBRDFFunctions",0,{name:t,shader:i}])},14469,e=>{"use strict";var o=e.i(12423);e.i(85668),e.i(6232);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;
|
|
393
|
+
#define ADDITIONAL_UBO_DECLARATION
|
|
394
|
+
};
|
|
395
|
+
#include<sceneUboDeclaration>
|
|
396
|
+
#include<meshUboDeclaration>
|
|
397
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrUboDeclaration",0,{name:t,shader:i}])},80825,9275,e=>{"use strict";var o=e.i(12423);let t="samplerFragmentDeclaration",i=`#ifdef _DEFINENAME_
|
|
398
|
+
#if _DEFINENAME_DIRECTUV==1
|
|
399
|
+
#define v_VARYINGNAME_UV vMainUV1
|
|
400
|
+
#elif _DEFINENAME_DIRECTUV==2
|
|
401
|
+
#define v_VARYINGNAME_UV vMainUV2
|
|
402
|
+
#elif _DEFINENAME_DIRECTUV==3
|
|
403
|
+
#define v_VARYINGNAME_UV vMainUV3
|
|
404
|
+
#elif _DEFINENAME_DIRECTUV==4
|
|
405
|
+
#define v_VARYINGNAME_UV vMainUV4
|
|
406
|
+
#elif _DEFINENAME_DIRECTUV==5
|
|
407
|
+
#define v_VARYINGNAME_UV vMainUV5
|
|
408
|
+
#elif _DEFINENAME_DIRECTUV==6
|
|
409
|
+
#define v_VARYINGNAME_UV vMainUV6
|
|
410
|
+
#else
|
|
411
|
+
varying vec2 v_VARYINGNAME_UV;
|
|
412
|
+
#endif
|
|
413
|
+
uniform sampler2D _SAMPLERNAME_Sampler;
|
|
414
|
+
#endif
|
|
415
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["samplerFragmentDeclaration",0,{name:t,shader:i}],80825);let r="reflectionFunction",a=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
|
|
416
|
+
{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); }
|
|
417
|
+
vec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
|
|
418
|
+
{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); }
|
|
419
|
+
vec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
|
|
420
|
+
{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);}
|
|
421
|
+
vec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)
|
|
422
|
+
{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);}
|
|
423
|
+
vec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
|
|
424
|
+
{vec3 viewDir=worldPos.xyz-eyePosition;vec3 coords=normalize(reflect(viewDir,worldNormal));return vec3(reflectionMatrix*vec4(coords,1));}
|
|
425
|
+
vec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)
|
|
426
|
+
{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=vec3(reflectionMatrix*vec4(coords,0));
|
|
427
|
+
#ifdef INVERTCUBICMAP
|
|
428
|
+
coords.y*=-1.0;
|
|
429
|
+
#endif
|
|
430
|
+
return coords;}
|
|
431
|
+
vec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)
|
|
432
|
+
{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=vec3(reflectionMatrix*vec4(coords,0));
|
|
433
|
+
#ifdef INVERTCUBICMAP
|
|
434
|
+
coords.y*=-1.0;
|
|
435
|
+
#endif
|
|
436
|
+
return coords;}
|
|
437
|
+
vec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)
|
|
438
|
+
{return vec3(reflectionMatrix*(view*worldPos));}
|
|
439
|
+
vec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)
|
|
440
|
+
{return vec3(reflectionMatrix*vec4(positionW,1.));}
|
|
441
|
+
#ifdef REFLECTION
|
|
442
|
+
vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)
|
|
443
|
+
{
|
|
444
|
+
#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
|
|
445
|
+
vec3 direction=normalize(vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);
|
|
446
|
+
#endif
|
|
447
|
+
#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
|
|
448
|
+
vec3 direction=normalize(vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction);
|
|
449
|
+
#endif
|
|
450
|
+
#ifdef REFLECTIONMAP_EQUIRECTANGULAR
|
|
451
|
+
return computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
|
|
452
|
+
#endif
|
|
453
|
+
#ifdef REFLECTIONMAP_SPHERICAL
|
|
454
|
+
return computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);
|
|
455
|
+
#endif
|
|
456
|
+
#ifdef REFLECTIONMAP_PLANAR
|
|
457
|
+
return computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
|
|
458
|
+
#endif
|
|
459
|
+
#ifdef REFLECTIONMAP_CUBIC
|
|
460
|
+
#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC
|
|
461
|
+
return computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);
|
|
462
|
+
#else
|
|
463
|
+
return computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);
|
|
464
|
+
#endif
|
|
465
|
+
#endif
|
|
466
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
467
|
+
return computeProjectionCoords(worldPos,view,reflectionMatrix);
|
|
468
|
+
#endif
|
|
469
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
470
|
+
return computeSkyBoxCoords(vPositionUVW,reflectionMatrix);
|
|
471
|
+
#endif
|
|
472
|
+
#ifdef REFLECTIONMAP_EXPLICIT
|
|
473
|
+
return vec3(0,0,0);
|
|
474
|
+
#endif
|
|
475
|
+
}
|
|
476
|
+
#endif
|
|
477
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["reflectionFunction",0,{name:r,shader:a}],9275)},66437,93263,e=>{"use strict";var o=e.i(12423);let t="pbrFragmentReflectionDeclaration",i=`#ifdef REFLECTION
|
|
478
|
+
#ifdef REFLECTIONMAP_3D
|
|
479
|
+
#define sampleReflection(s,c) textureCube(s,c)
|
|
480
|
+
uniform samplerCube reflectionSampler;
|
|
481
|
+
#ifdef LODBASEDMICROSFURACE
|
|
482
|
+
#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
|
|
483
|
+
#else
|
|
484
|
+
uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;
|
|
485
|
+
#endif
|
|
486
|
+
#ifdef USEIRRADIANCEMAP
|
|
487
|
+
uniform samplerCube irradianceSampler;
|
|
488
|
+
#endif
|
|
489
|
+
#else
|
|
490
|
+
#define sampleReflection(s,c) texture2D(s,c)
|
|
491
|
+
uniform sampler2D reflectionSampler;
|
|
492
|
+
#ifdef LODBASEDMICROSFURACE
|
|
493
|
+
#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
|
|
494
|
+
#else
|
|
495
|
+
uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;
|
|
496
|
+
#endif
|
|
497
|
+
#ifdef USEIRRADIANCEMAP
|
|
498
|
+
uniform sampler2D irradianceSampler;
|
|
499
|
+
#endif
|
|
500
|
+
#endif
|
|
501
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
502
|
+
varying vec3 vPositionUVW;
|
|
503
|
+
#else
|
|
504
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
505
|
+
varying vec3 vDirectionW;
|
|
506
|
+
#endif
|
|
507
|
+
#endif
|
|
508
|
+
#endif
|
|
509
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentReflectionDeclaration",0,{name:t,shader:i}],66437);let r="pbrIBLFunctions",a=`#if defined(REFLECTION) || defined(SS_REFRACTION)
|
|
510
|
+
float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}
|
|
511
|
+
float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}
|
|
512
|
+
#endif
|
|
513
|
+
#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
|
|
514
|
+
float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}
|
|
515
|
+
#endif
|
|
516
|
+
#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
|
|
517
|
+
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);}
|
|
518
|
+
#endif
|
|
519
|
+
#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
|
|
520
|
+
#define UNPACK_LOD(x) (1.0-x)*255.0
|
|
521
|
+
float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
|
|
522
|
+
#endif
|
|
523
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["pbrIBLFunctions",0,{name:r,shader:a}],93263)},28189,74545,22633,50898,e=>{"use strict";var o=e.i(12423);let t="sceneFragmentDeclaration",i=`uniform mat4 viewProjection;
|
|
524
|
+
#ifdef MULTIVIEW
|
|
525
|
+
uniform mat4 viewProjectionR;
|
|
526
|
+
#endif
|
|
527
|
+
uniform mat4 view;uniform mat4 projection;uniform vec4 vEyePosition;uniform mat4 inverseProjection;
|
|
528
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["sceneFragmentDeclaration",0,{name:t,shader:i}],28189);let r="openpbrDielectricReflectance",a=`struct ReflectanceParams
|
|
529
|
+
{float F0;float F90;vec3 coloredF0;vec3 coloredF90;};
|
|
530
|
+
#define pbr_inline
|
|
531
|
+
ReflectanceParams dielectricReflectance(
|
|
532
|
+
in float insideIOR,in float outsideIOR,in vec3 specularColor,in float specularWeight
|
|
533
|
+
)
|
|
534
|
+
{ReflectanceParams outParams;float dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);float dielectricF0_NoSpec=pow((1.0-outsideIOR)/(1.0+outsideIOR),2.0);float f90Scale=clamp(2.0*abs(insideIOR-outsideIOR),0.0,1.0);float f90Scale_NoSpec=clamp(2.0*abs(1.0-outsideIOR),0.0,1.0);
|
|
535
|
+
#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)
|
|
536
|
+
vec3 dielectricColorF90=specularColor.rgb*vec3(f90Scale);vec3 dielectricColorF90_NoSpec=specularColor.rgb*vec3(f90Scale_NoSpec);
|
|
537
|
+
#else
|
|
538
|
+
vec3 dielectricColorF90=vec3(f90Scale);vec3 dielectricColorF90_NoSpec=vec3(f90Scale_NoSpec);
|
|
539
|
+
#endif
|
|
540
|
+
#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF
|
|
541
|
+
float maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight)*maxF0;
|
|
542
|
+
#else
|
|
543
|
+
outParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight);
|
|
544
|
+
#endif
|
|
545
|
+
outParams.F90=mix(f90Scale_NoSpec,f90Scale,specularWeight);outParams.coloredF0=mix(vec3(dielectricF0_NoSpec),vec3(dielectricF0),specularWeight)*specularColor.rgb;outParams.coloredF90=mix(dielectricColorF90_NoSpec,dielectricColorF90,specularWeight);return outParams;}
|
|
546
|
+
`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["openpbrDielectricReflectance",0,{name:r,shader:a}],74545);let n="openpbrGeometryInfo",l=`struct geometryInfoOutParams
|
|
547
|
+
{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;};struct geometryInfoAnisoOutParams
|
|
548
|
+
{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;mat3 TBN;};
|
|
549
|
+
#define pbr_inline
|
|
550
|
+
geometryInfoOutParams geometryInfo(
|
|
551
|
+
in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
|
|
552
|
+
)
|
|
553
|
+
{geometryInfoOutParams outParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped);
|
|
554
|
+
#if defined(ENVIRONMENTBRDF)
|
|
555
|
+
outParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness);
|
|
556
|
+
#else
|
|
557
|
+
outParams.environmentBrdf=vec3(0.0);
|
|
558
|
+
#endif
|
|
559
|
+
outParams.horizonOcclusion=1.0;
|
|
560
|
+
#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
561
|
+
#ifdef HORIZONOCCLUSION
|
|
562
|
+
#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)
|
|
563
|
+
#ifdef REFLECTIONMAP_3D
|
|
564
|
+
outParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
|
|
565
|
+
#endif
|
|
566
|
+
#endif
|
|
567
|
+
#endif
|
|
568
|
+
#endif
|
|
569
|
+
return outParams;}
|
|
570
|
+
#define pbr_inline
|
|
571
|
+
geometryInfoAnisoOutParams geometryInfoAniso(
|
|
572
|
+
in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW
|
|
573
|
+
,in vec3 vAnisotropy,in mat3 TBN
|
|
574
|
+
)
|
|
575
|
+
{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}],22633);let c="openpbrIblFunctions",f=`#ifdef REFLECTION
|
|
576
|
+
vec3 sampleIrradiance(
|
|
577
|
+
in vec3 surfaceNormal
|
|
578
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
579
|
+
,in vec3 vEnvironmentIrradianceSH
|
|
580
|
+
#endif
|
|
581
|
+
#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
|
|
582
|
+
,in mat4 iblMatrix
|
|
583
|
+
#endif
|
|
584
|
+
#ifdef USEIRRADIANCEMAP
|
|
585
|
+
#ifdef REFLECTIONMAP_3D
|
|
586
|
+
,in samplerCube irradianceSampler
|
|
587
|
+
#else
|
|
588
|
+
,in sampler2D irradianceSampler
|
|
589
|
+
#endif
|
|
590
|
+
#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
|
|
591
|
+
,in vec3 reflectionDominantDirection
|
|
592
|
+
#endif
|
|
593
|
+
#endif
|
|
594
|
+
#ifdef REALTIME_FILTERING
|
|
595
|
+
,in vec2 vReflectionFilteringInfo
|
|
596
|
+
#ifdef IBL_CDF_FILTERING
|
|
597
|
+
,in sampler2D icdfSampler
|
|
598
|
+
#endif
|
|
599
|
+
#endif
|
|
600
|
+
,in vec2 vReflectionInfos
|
|
601
|
+
,in vec3 viewDirectionW
|
|
602
|
+
,in float diffuseRoughness
|
|
603
|
+
,in vec3 surfaceAlbedo
|
|
604
|
+
) {vec3 environmentIrradiance=vec3(0.,0.,0.);
|
|
605
|
+
#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))
|
|
606
|
+
vec3 irradianceVector=(iblMatrix*vec4(surfaceNormal,0)).xyz;vec3 irradianceView=(iblMatrix*vec4(viewDirectionW,0)).xyz;
|
|
607
|
+
#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)
|
|
608
|
+
#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY
|
|
609
|
+
{float NdotV=max(dot(surfaceNormal,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);}
|
|
610
|
+
#endif
|
|
611
|
+
#endif
|
|
612
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
613
|
+
irradianceVector.z*=-1.0;irradianceView.z*=-1.0;
|
|
614
|
+
#endif
|
|
615
|
+
#ifdef INVERTCUBICMAP
|
|
616
|
+
irradianceVector.y*=-1.0;irradianceView.y*=-1.0;
|
|
617
|
+
#endif
|
|
618
|
+
#endif
|
|
619
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
620
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
621
|
+
environmentIrradiance=vEnvironmentIrradianceSH;
|
|
622
|
+
#else
|
|
623
|
+
#if defined(REALTIME_FILTERING)
|
|
624
|
+
environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView
|
|
625
|
+
#ifdef IBL_CDF_FILTERING
|
|
626
|
+
,icdfSampler
|
|
627
|
+
#endif
|
|
628
|
+
);
|
|
629
|
+
#else
|
|
630
|
+
environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
|
|
631
|
+
#endif
|
|
632
|
+
#endif
|
|
633
|
+
#elif defined(USEIRRADIANCEMAP)
|
|
634
|
+
#ifdef REFLECTIONMAP_3D
|
|
635
|
+
vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,irradianceVector);
|
|
636
|
+
#else
|
|
637
|
+
vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,reflectionCoords);
|
|
638
|
+
#endif
|
|
639
|
+
environmentIrradiance=environmentIrradianceFromTexture.rgb;
|
|
640
|
+
#ifdef RGBDREFLECTION
|
|
641
|
+
environmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture);
|
|
642
|
+
#endif
|
|
643
|
+
#ifdef GAMMAREFLECTION
|
|
644
|
+
environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);
|
|
645
|
+
#endif
|
|
646
|
+
#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION
|
|
647
|
+
vec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0);
|
|
648
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
649
|
+
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)));
|
|
650
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
651
|
+
vec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
|
|
652
|
+
#endif
|
|
653
|
+
environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm;
|
|
654
|
+
#endif
|
|
655
|
+
#endif
|
|
656
|
+
environmentIrradiance*=vReflectionInfos.x;return environmentIrradiance;}
|
|
657
|
+
#define pbr_inline
|
|
658
|
+
#ifdef REFLECTIONMAP_3D
|
|
659
|
+
vec3 createReflectionCoords(
|
|
660
|
+
#else
|
|
661
|
+
vec2 createReflectionCoords(
|
|
662
|
+
#endif
|
|
663
|
+
in vec3 vPositionW
|
|
664
|
+
,in vec3 normalW
|
|
665
|
+
)
|
|
666
|
+
{vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
|
|
667
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
668
|
+
reflectionVector.z*=-1.0;
|
|
669
|
+
#endif
|
|
670
|
+
#ifdef REFLECTIONMAP_3D
|
|
671
|
+
vec3 reflectionCoords=reflectionVector;
|
|
672
|
+
#else
|
|
673
|
+
vec2 reflectionCoords=reflectionVector.xy;
|
|
674
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
675
|
+
reflectionCoords/=reflectionVector.z;
|
|
676
|
+
#endif
|
|
677
|
+
reflectionCoords.y=1.0-reflectionCoords.y;
|
|
678
|
+
#endif
|
|
679
|
+
return reflectionCoords;}
|
|
680
|
+
#define pbr_inline
|
|
681
|
+
#define inline
|
|
682
|
+
vec3 sampleRadiance(
|
|
683
|
+
in float alphaG
|
|
684
|
+
,in vec3 vReflectionMicrosurfaceInfos
|
|
685
|
+
,in vec2 vReflectionInfos
|
|
686
|
+
,in geometryInfoOutParams geoInfo
|
|
687
|
+
#ifdef REFLECTIONMAP_3D
|
|
688
|
+
,in samplerCube reflectionSampler
|
|
689
|
+
,const vec3 reflectionCoords
|
|
690
|
+
#else
|
|
691
|
+
,in sampler2D reflectionSampler
|
|
692
|
+
,const vec2 reflectionCoords
|
|
693
|
+
#endif
|
|
694
|
+
#ifdef REALTIME_FILTERING
|
|
695
|
+
,in vec2 vReflectionFilteringInfo
|
|
696
|
+
#endif
|
|
697
|
+
)
|
|
698
|
+
{vec4 environmentRadiance=vec4(0.,0.,0.,0.);
|
|
699
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
700
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
|
|
701
|
+
#elif defined(LINEARSPECULARREFLECTION)
|
|
702
|
+
float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
|
|
703
|
+
#else
|
|
704
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
|
|
705
|
+
#endif
|
|
706
|
+
reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
|
|
707
|
+
#ifdef REALTIME_FILTERING
|
|
708
|
+
environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
|
|
709
|
+
#else
|
|
710
|
+
environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
|
|
711
|
+
#endif
|
|
712
|
+
#ifdef RGBDREFLECTION
|
|
713
|
+
environmentRadiance.rgb=fromRGBD(environmentRadiance);
|
|
714
|
+
#endif
|
|
715
|
+
#ifdef GAMMAREFLECTION
|
|
716
|
+
environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);
|
|
717
|
+
#endif
|
|
718
|
+
environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
|
|
719
|
+
#if defined(ANISOTROPIC)
|
|
720
|
+
#define pbr_inline
|
|
721
|
+
#define inline
|
|
722
|
+
vec3 sampleRadianceAnisotropic(
|
|
723
|
+
in float alphaG
|
|
724
|
+
,in vec3 vReflectionMicrosurfaceInfos
|
|
725
|
+
,in vec2 vReflectionInfos
|
|
726
|
+
,in geometryInfoAnisoOutParams geoInfo
|
|
727
|
+
,const vec3 normalW
|
|
728
|
+
,const vec3 viewDirectionW
|
|
729
|
+
,const vec3 positionW
|
|
730
|
+
,const vec3 noise
|
|
731
|
+
,bool isRefraction
|
|
732
|
+
,float ior
|
|
733
|
+
#ifdef REFLECTIONMAP_3D
|
|
734
|
+
,in samplerCube reflectionSampler
|
|
735
|
+
#else
|
|
736
|
+
,in sampler2D reflectionSampler
|
|
737
|
+
#endif
|
|
738
|
+
#ifdef REALTIME_FILTERING
|
|
739
|
+
,in vec2 vReflectionFilteringInfo
|
|
740
|
+
#endif
|
|
741
|
+
)
|
|
742
|
+
{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;
|
|
743
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
744
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);
|
|
745
|
+
#elif defined(LINEARSPECULARREFLECTION)
|
|
746
|
+
float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
|
|
747
|
+
#else
|
|
748
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
|
|
749
|
+
#endif
|
|
750
|
+
reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
|
|
751
|
+
#ifdef REALTIME_FILTERING
|
|
752
|
+
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;
|
|
753
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
754
|
+
view.z*=-1.0;tangent.z*=-1.0;bitangent.z*=-1.0;normal.z*=-1.0;
|
|
755
|
+
#endif
|
|
756
|
+
environmentRadiance =
|
|
757
|
+
vec4(radianceAnisotropic(alphaT,alphaB,reflectionSampler,
|
|
758
|
+
view,tangent,
|
|
759
|
+
bitangent,normal,
|
|
760
|
+
vReflectionFilteringInfo,noise.xy,isRefraction,ior),
|
|
761
|
+
1.0);
|
|
762
|
+
#else
|
|
763
|
+
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;}
|
|
764
|
+
if (isRefraction) {reflectionCoords=double_refract(-viewDirectionW,bentNormal,ior);} else {reflectionCoords=reflect(-viewDirectionW,bentNormal);}
|
|
765
|
+
reflectionCoords=vec3(reflectionMatrix*vec4(reflectionCoords,0));
|
|
766
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
767
|
+
reflectionCoords.z*=-1.0;
|
|
768
|
+
#endif
|
|
769
|
+
radianceSample=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
|
|
770
|
+
#ifdef RGBDREFLECTION
|
|
771
|
+
environmentRadiance.rgb+=sample_weight*fromRGBD(radianceSample);
|
|
772
|
+
#elif defined(GAMMAREFLECTION)
|
|
773
|
+
environmentRadiance.rgb+=sample_weight*toLinearSpace(radianceSample.rgb);
|
|
774
|
+
#else
|
|
775
|
+
environmentRadiance.rgb+=sample_weight*radianceSample.rgb;
|
|
776
|
+
#endif
|
|
777
|
+
total_weight+=sample_weight;}
|
|
778
|
+
environmentRadiance=vec4(environmentRadiance.xyz/float(total_weight),1.0);
|
|
779
|
+
#endif
|
|
780
|
+
environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}
|
|
781
|
+
#endif
|
|
782
|
+
#endif
|
|
783
|
+
#if defined(ENVIRONMENTBRDF)
|
|
784
|
+
#define pbr_inline
|
|
785
|
+
float computeDielectricIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
|
|
786
|
+
{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);}
|
|
787
|
+
#define pbr_inline
|
|
788
|
+
vec3 computeConductorIblFresnel(in ReflectanceParams reflectance,in vec3 environmentBrdf)
|
|
789
|
+
{
|
|
790
|
+
#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) && defined(ENVIRONMENTBRDF)
|
|
791
|
+
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));
|
|
792
|
+
#else
|
|
793
|
+
return getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf);
|
|
794
|
+
#endif
|
|
795
|
+
}
|
|
796
|
+
#endif
|
|
797
|
+
`;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["openpbrIblFunctions",0,{name:c,shader:f}],50898)},17796,e=>{"use strict";var o=e.i(12423);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;
|
|
798
|
+
#ifdef TRANSMISSION_WEIGHT
|
|
799
|
+
vec4 transmissionWeightFromTexture=TEXRD(transmissionWeightSampler,vTransmissionWeightUV+uvOffset);
|
|
800
|
+
#endif
|
|
801
|
+
#ifdef TRANSMISSION_COLOR
|
|
802
|
+
vec4 transmissionColorFromTexture=TEXRD(transmissionColorSampler,vTransmissionColorUV+uvOffset);
|
|
803
|
+
#endif
|
|
804
|
+
#ifdef TRANSMISSION_DEPTH
|
|
805
|
+
vec4 transmissionDepthFromTexture=TEXRD(transmissionDepthSampler,vTransmissionDepthUV+uvOffset);
|
|
806
|
+
#endif
|
|
807
|
+
#ifdef TRANSMISSION_SCATTER
|
|
808
|
+
vec4 transmissionScatterFromTexture=TEXRD(transmissionScatterSampler,vTransmissionScatterUV+uvOffset);
|
|
809
|
+
#endif
|
|
810
|
+
#ifdef TRANSMISSION_DISPERSION_SCALE
|
|
811
|
+
vec4 transmissionDispersionScaleFromTexture=TEXRD(transmissionDispersionScaleSampler,vTransmissionDispersionScaleUV+uvOffset);
|
|
812
|
+
#endif
|
|
813
|
+
#ifdef TRANSMISSION_WEIGHT
|
|
814
|
+
transmission_weight*=transmissionWeightFromTexture.r;
|
|
815
|
+
#endif
|
|
816
|
+
#ifdef TRANSMISSION_COLOR
|
|
817
|
+
#ifdef TRANSMISSION_COLOR_GAMMA
|
|
818
|
+
transmission_color*=toLinearSpace(transmissionColorFromTexture.rgb);
|
|
819
|
+
#else
|
|
820
|
+
transmission_color*=transmissionColorFromTexture.rgb;
|
|
821
|
+
#endif
|
|
822
|
+
transmission_color*=vTransmissionColorInfos.y;
|
|
823
|
+
#endif
|
|
824
|
+
#ifdef TRANSMISSION_DEPTH
|
|
825
|
+
transmission_depth*=transmissionDepthFromTexture.r;
|
|
826
|
+
#endif
|
|
827
|
+
#ifdef TRANSMISSION_SCATTER
|
|
828
|
+
transmission_scatter*=transmissionScatterFromTexture.rgb;
|
|
829
|
+
#endif
|
|
830
|
+
#ifdef TRANSMISSION_DISPERSION_SCALE
|
|
831
|
+
transmission_dispersion_scale*=transmissionDispersionScaleFromTexture.r;
|
|
832
|
+
#endif
|
|
833
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrTransmissionLayerData",0,{name:t,shader:i}])},16630,e=>{"use strict";var o=e.i(12423);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);
|
|
834
|
+
#ifdef SUBSURFACE_WEIGHT
|
|
835
|
+
vec4 subsurfaceWeightFromTexture=TEXRD(subsurfaceWeightSampler,vSubsurfaceWeightUV+uvOffset);
|
|
836
|
+
#endif
|
|
837
|
+
#ifdef SUBSURFACE_COLOR
|
|
838
|
+
vec4 subsurfaceColorFromTexture=TEXRD(subsurfaceColorSampler,vSubsurfaceColorUV+uvOffset);
|
|
839
|
+
#endif
|
|
840
|
+
#ifdef SUBSURFACE_RADIUS_SCALE
|
|
841
|
+
vec4 subsurfaceRadiusScaleFromTexture=TEXRD(subsurfaceRadiusScaleSampler,vSubsurfaceRadiusScaleUV+uvOffset);
|
|
842
|
+
#endif
|
|
843
|
+
#ifdef SUBSURFACE_WEIGHT
|
|
844
|
+
#ifdef SUBSURFACE_WEIGHT_FROM_TEXTURE_ALPHA
|
|
845
|
+
subsurface_weight*=subsurfaceWeightFromTexture.a;
|
|
846
|
+
#else
|
|
847
|
+
subsurface_weight*=subsurfaceWeightFromTexture.r;
|
|
848
|
+
#endif
|
|
849
|
+
#endif
|
|
850
|
+
#ifdef SUBSURFACE_COLOR
|
|
851
|
+
#ifdef SUBSURFACE_COLOR_GAMMA
|
|
852
|
+
subsurface_color*=toLinearSpace(subsurfaceColorFromTexture.rgb);
|
|
853
|
+
#else
|
|
854
|
+
subsurface_color*=subsurfaceColorFromTexture.rgb;
|
|
855
|
+
#endif
|
|
856
|
+
subsurface_color*=vSubsurfaceColorInfos.y;
|
|
857
|
+
#endif
|
|
858
|
+
#ifdef SUBSURFACE_RADIUS_SCALE
|
|
859
|
+
subsurface_radius_scale*=subsurfaceRadiusScaleFromTexture.rgb;
|
|
860
|
+
#endif
|
|
861
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["openpbrSubsurfaceLayerData",0,{name:t,shader:i}])},84449,60070,43249,69100,98333,74239,3921,56072,26873,53251,3291,e=>{"use strict";var o=e.i(12423);e.i(92692);let t="pbrFragmentExtraDeclaration",i=`varying vec3 vPositionW;
|
|
862
|
+
#if DEBUGMODE>0
|
|
863
|
+
varying vec4 vClipSpacePosition;
|
|
864
|
+
#endif
|
|
865
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
866
|
+
#ifdef NORMAL
|
|
867
|
+
varying vec3 vNormalW;
|
|
868
|
+
#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
|
|
869
|
+
varying vec3 vEnvironmentIrradiance;
|
|
870
|
+
#endif
|
|
871
|
+
#endif
|
|
872
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
873
|
+
varying vec4 vColor;
|
|
874
|
+
#endif
|
|
875
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
876
|
+
varying float vViewDepth;
|
|
877
|
+
#endif
|
|
878
|
+
`;o.ShaderStore.IncludesShadersStore[t]||(o.ShaderStore.IncludesShadersStore[t]=i),e.s(["pbrFragmentExtraDeclaration",0,{name:t,shader:i}],84449);let r="subSurfaceScatteringFunctions",a=`bool testLightingForSSS(float diffusionProfile)
|
|
879
|
+
{return diffusionProfile<1.;}`;o.ShaderStore.IncludesShadersStore[r]||(o.ShaderStore.IncludesShadersStore[r]=a),e.s(["subSurfaceScatteringFunctions",0,{name:r,shader:a}],60070);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);}
|
|
880
|
+
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);}
|
|
881
|
+
vec3 hemisphereImportanceSampleDggxAnisotropic(vec2 Xi,float alphaTangent,float alphaBitangent)
|
|
882
|
+
{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;
|
|
883
|
+
float cosPhi=cos(phi);float sinPhi=sin(phi);float alpha2=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) +
|
|
884
|
+
(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);}
|
|
885
|
+
vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {
|
|
886
|
+
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}],43249);let c="pbrHelperFunctions",f=`#define MINIMUMVARIANCE 0.0005
|
|
887
|
+
#ifndef TEXRD_DEFINED
|
|
888
|
+
#define TEXRD(s,uv) texture2D(s,uv)
|
|
889
|
+
#define TEXRD_DEFINED
|
|
890
|
+
#endif
|
|
891
|
+
float convertRoughnessToAverageSlope(float roughness)
|
|
892
|
+
{return square(roughness)+MINIMUMVARIANCE;}
|
|
893
|
+
float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}
|
|
894
|
+
vec2 getAARoughnessFactors(vec3 normalVector) {
|
|
895
|
+
#ifdef SPECULARAA
|
|
896
|
+
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
|
+
#else
|
|
898
|
+
return vec2(0.);
|
|
899
|
+
#endif
|
|
900
|
+
}
|
|
901
|
+
#ifdef ANISOTROPIC
|
|
902
|
+
#ifdef ANISOTROPIC_LEGACY
|
|
903
|
+
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);}
|
|
904
|
+
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;}
|
|
905
|
+
vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
|
|
906
|
+
#elif ANISOTROPIC_OPENPBR
|
|
907
|
+
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);}
|
|
908
|
+
#else
|
|
909
|
+
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);}
|
|
910
|
+
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;}
|
|
911
|
+
#endif
|
|
912
|
+
#endif
|
|
913
|
+
#if defined(CLEARCOAT) || defined(SS_REFRACTION)
|
|
914
|
+
vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}
|
|
915
|
+
vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
|
|
916
|
+
vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}
|
|
917
|
+
vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),
|
|
918
|
+
cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
|
|
919
|
+
clearCoatIntensity);return clearCoatAbsorption;}
|
|
920
|
+
#endif
|
|
921
|
+
#ifdef MICROSURFACEAUTOMATIC
|
|
922
|
+
float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
|
|
923
|
+
{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}
|
|
924
|
+
#endif
|
|
925
|
+
`;o.ShaderStore.IncludesShadersStore[c]||(o.ShaderStore.IncludesShadersStore[c]=f),e.s(["pbrHelperFunctions",0,{name:c,shader:f}],69100),e.i(41932);let s="pbrDirectLightingSetupFunctions",d=`struct preLightingInfo
|
|
926
|
+
{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;
|
|
927
|
+
#ifdef IRIDESCENCE
|
|
928
|
+
float iridescenceIntensity;
|
|
929
|
+
#endif
|
|
930
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
931
|
+
vec3 areaLightDiffuse;
|
|
932
|
+
#ifdef SPECULARTERM
|
|
933
|
+
vec3 areaLightSpecular;vec4 areaLightFresnel;
|
|
934
|
+
#endif
|
|
935
|
+
#endif
|
|
936
|
+
};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;}
|
|
937
|
+
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;}
|
|
938
|
+
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;
|
|
939
|
+
#ifdef SPECULARTERM
|
|
940
|
+
result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
|
|
941
|
+
#endif
|
|
942
|
+
result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
|
|
943
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
944
|
+
#include<ltcHelperFunctions>
|
|
945
|
+
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 )
|
|
946
|
+
{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);
|
|
947
|
+
#ifdef SPECULARTERM
|
|
948
|
+
result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
|
|
949
|
+
#endif
|
|
950
|
+
result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
|
|
951
|
+
preLightingInfo computeAreaPreLightingInfoWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
|
|
952
|
+
{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);
|
|
953
|
+
#ifdef SPECULARTERM
|
|
954
|
+
result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
|
|
955
|
+
#endif
|
|
956
|
+
result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
|
|
957
|
+
#endif
|
|
958
|
+
`;o.ShaderStore.IncludesShadersStore[s]||(o.ShaderStore.IncludesShadersStore[s]=d),e.s(["pbrDirectLightingSetupFunctions",0,{name:s,shader:d}],98333);let u="pbrDirectLightingFalloffFunctions",v=`float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
|
|
959
|
+
{return max(0.,1.0-length(lightOffset)/range);}
|
|
960
|
+
float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
|
|
961
|
+
{return 1.0/maxEps(lightDistanceSquared);}
|
|
962
|
+
float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
|
|
963
|
+
{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
|
|
964
|
+
float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
|
|
965
|
+
{
|
|
966
|
+
#ifdef USEPHYSICALLIGHTFALLOFF
|
|
967
|
+
return computeDistanceLightFalloff_Physical(lightDistanceSquared);
|
|
968
|
+
#elif defined(USEGLTFLIGHTFALLOFF)
|
|
969
|
+
return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
|
|
970
|
+
#else
|
|
971
|
+
return computeDistanceLightFalloff_Standard(lightOffset,range);
|
|
972
|
+
#endif
|
|
973
|
+
}
|
|
974
|
+
float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
|
|
975
|
+
{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
|
|
976
|
+
{falloff=max(0.,pow(cosAngle,exponent));}
|
|
977
|
+
return falloff;}
|
|
978
|
+
float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
|
|
979
|
+
{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
|
|
980
|
+
float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
|
|
981
|
+
{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
|
|
982
|
+
float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
|
|
983
|
+
float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
|
|
984
|
+
{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
|
|
985
|
+
float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
|
|
986
|
+
{
|
|
987
|
+
#ifdef USEPHYSICALLIGHTFALLOFF
|
|
988
|
+
return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
|
|
989
|
+
#elif defined(USEGLTFLIGHTFALLOFF)
|
|
990
|
+
return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
|
|
991
|
+
#else
|
|
992
|
+
return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
|
|
993
|
+
#endif
|
|
994
|
+
}`;o.ShaderStore.IncludesShadersStore[u]||(o.ShaderStore.IncludesShadersStore[u]=v),e.s(["pbrDirectLightingFalloffFunctions",0,{name:u,shader:v}],74239);let m="hdrFilteringFunctions",g=`#if NUM_SAMPLES
|
|
995
|
+
#if NUM_SAMPLES>0
|
|
996
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
997
|
+
float radicalInverse_VdC(uint bits)
|
|
998
|
+
{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; }
|
|
999
|
+
vec2 hammersley(uint i,uint N)
|
|
1000
|
+
{return vec2(float(i)/float(N),radicalInverse_VdC(i));}
|
|
1001
|
+
#else
|
|
1002
|
+
float vanDerCorpus(int n,int base)
|
|
1003
|
+
{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)
|
|
1004
|
+
{if(n>0)
|
|
1005
|
+
{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}
|
|
1006
|
+
return result;}
|
|
1007
|
+
vec2 hammersley(int i,int N)
|
|
1008
|
+
{return vec2(float(i)/float(N),vanDerCorpus(i,2));}
|
|
1009
|
+
#endif
|
|
1010
|
+
float log4(float x) {return log2(x)/2.;}
|
|
1011
|
+
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;}
|
|
1012
|
+
const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;
|
|
1013
|
+
#define inline
|
|
1014
|
+
vec3 irradiance(
|
|
1015
|
+
#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT
|
|
1016
|
+
CUSTOM_IRRADIANCE_FILTERING_INPUT
|
|
1017
|
+
#else
|
|
1018
|
+
samplerCube inputTexture,
|
|
1019
|
+
#endif
|
|
1020
|
+
vec3 inputN,vec2 filteringInfo,
|
|
1021
|
+
float diffuseRoughness,
|
|
1022
|
+
vec3 surfaceAlbedo,
|
|
1023
|
+
vec3 inputV
|
|
1024
|
+
#if IBL_CDF_FILTERING
|
|
1025
|
+
,sampler2D icdfSampler
|
|
1026
|
+
#endif
|
|
1027
|
+
)
|
|
1028
|
+
{vec3 n=normalize(inputN);vec3 result=vec3(0.);
|
|
1029
|
+
#ifndef IBL_CDF_FILTERING
|
|
1030
|
+
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);
|
|
1031
|
+
#endif
|
|
1032
|
+
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));
|
|
1033
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
1034
|
+
for(uint i=0u; i<NUM_SAMPLES; ++i)
|
|
1035
|
+
#else
|
|
1036
|
+
for(int i=0; i<NUM_SAMPLES; ++i)
|
|
1037
|
+
#endif
|
|
1038
|
+
{vec2 Xi=hammersley(i,NUM_SAMPLES);
|
|
1039
|
+
#if IBL_CDF_FILTERING
|
|
1040
|
+
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);
|
|
1041
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1042
|
+
float LoV=dot (Ls,inputV);
|
|
1043
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
1044
|
+
vec3 H=(inputV+Ls)*0.5;float VoH=dot(inputV,H);
|
|
1045
|
+
#endif
|
|
1046
|
+
#else
|
|
1047
|
+
vec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);float NoL=Ls.z;
|
|
1048
|
+
vec3 V=tbnInverse*inputV;float NoV=V.z;
|
|
1049
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1050
|
+
float LoV=dot (Ls,V);
|
|
1051
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
1052
|
+
vec3 H=(V+Ls)*0.5;float VoH=dot(V,H);
|
|
1053
|
+
#endif
|
|
1054
|
+
#endif
|
|
1055
|
+
if (NoL>0.) {
|
|
1056
|
+
#if IBL_CDF_FILTERING
|
|
1057
|
+
float pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;
|
|
1058
|
+
#else
|
|
1059
|
+
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);
|
|
1060
|
+
#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION
|
|
1061
|
+
CUSTOM_IRRADIANCE_FILTERING_FUNCTION
|
|
1062
|
+
#else
|
|
1063
|
+
vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
|
|
1064
|
+
#endif
|
|
1065
|
+
#endif
|
|
1066
|
+
#if GAMMA_INPUT
|
|
1067
|
+
c=toLinearSpace(c);
|
|
1068
|
+
#endif
|
|
1069
|
+
vec3 diffuseRoughnessTerm=vec3(1.0);
|
|
1070
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1071
|
+
diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;
|
|
1072
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
1073
|
+
diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);
|
|
1074
|
+
#endif
|
|
1075
|
+
#if IBL_CDF_FILTERING
|
|
1076
|
+
vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;
|
|
1077
|
+
#else
|
|
1078
|
+
result+=c*diffuseRoughnessTerm;
|
|
1079
|
+
#endif
|
|
1080
|
+
}}
|
|
1081
|
+
result=result*NUM_SAMPLES_FLOAT_INVERSED;
|
|
1082
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1083
|
+
result=result/clampedAlbedo;
|
|
1084
|
+
#endif
|
|
1085
|
+
return result;}
|
|
1086
|
+
#define inline
|
|
1087
|
+
vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
|
|
1088
|
+
{vec3 n=normalize(inputN);vec3 c=textureCubeLodEXT(inputTexture,n,0.).rgb;
|
|
1089
|
+
if (alphaG==0.) {
|
|
1090
|
+
#if GAMMA_INPUT
|
|
1091
|
+
c=toLinearSpace(c);
|
|
1092
|
+
#endif
|
|
1093
|
+
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.;
|
|
1094
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
1095
|
+
for(uint i=0u; i<NUM_SAMPLES; ++i)
|
|
1096
|
+
#else
|
|
1097
|
+
for(int i=0; i<NUM_SAMPLES; ++i)
|
|
1098
|
+
#endif
|
|
1099
|
+
{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;
|
|
1100
|
+
#if GAMMA_INPUT
|
|
1101
|
+
c=toLinearSpace(c);
|
|
1102
|
+
#endif
|
|
1103
|
+
result+=c*NoL;}}
|
|
1104
|
+
result=result/weight;return result;}}
|
|
1105
|
+
#ifdef ANISOTROPIC
|
|
1106
|
+
#define inline
|
|
1107
|
+
vec3 radianceAnisotropic(
|
|
1108
|
+
float alphaTangent,
|
|
1109
|
+
float alphaBitangent,
|
|
1110
|
+
samplerCube inputTexture,
|
|
1111
|
+
vec3 inputView,
|
|
1112
|
+
vec3 inputTangent,
|
|
1113
|
+
vec3 inputBitangent,
|
|
1114
|
+
vec3 inputNormal,
|
|
1115
|
+
vec2 filteringInfo,
|
|
1116
|
+
vec2 noiseInput,
|
|
1117
|
+
bool isRefraction,
|
|
1118
|
+
float ior
|
|
1119
|
+
)
|
|
1120
|
+
{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.;
|
|
1121
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
1122
|
+
for(uint i=0u; i<NUM_SAMPLES; ++i)
|
|
1123
|
+
#else
|
|
1124
|
+
for(int i=0; i<NUM_SAMPLES; ++i)
|
|
1125
|
+
#endif
|
|
1126
|
+
{vec2 Xi=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5f,0.015f,noiseScale));
|
|
1127
|
+
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);}
|
|
1128
|
+
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(
|
|
1129
|
+
H_tangent.z,H_tangent.x,H_tangent.y,vec2(clampedAlphaT,clampedAlphaB)
|
|
1130
|
+
);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;
|
|
1131
|
+
#if GAMMA_INPUT
|
|
1132
|
+
c=toLinearSpace(c);
|
|
1133
|
+
#endif
|
|
1134
|
+
result+=c*NoL;}}
|
|
1135
|
+
result=result/weight;return result;}
|
|
1136
|
+
#endif
|
|
1137
|
+
#endif
|
|
1138
|
+
#endif
|
|
1139
|
+
`;o.ShaderStore.IncludesShadersStore[m]||(o.ShaderStore.IncludesShadersStore[m]=g),e.s(["hdrFilteringFunctions",0,{name:m,shader:g}],3921);let E="pbrDirectLightingFunctions",p=`#define CLEARCOATREFLECTANCE90 1.0
|
|
1140
|
+
struct lightingInfo
|
|
1141
|
+
{vec3 diffuse;
|
|
1142
|
+
#ifdef SS_TRANSLUCENCY
|
|
1143
|
+
vec3 diffuseTransmission;
|
|
1144
|
+
#endif
|
|
1145
|
+
#ifdef SPECULARTERM
|
|
1146
|
+
vec3 specular;
|
|
1147
|
+
#endif
|
|
1148
|
+
#ifdef CLEARCOAT
|
|
1149
|
+
vec4 clearCoat;
|
|
1150
|
+
#endif
|
|
1151
|
+
#ifdef SHEEN
|
|
1152
|
+
vec3 sheen;
|
|
1153
|
+
#endif
|
|
1154
|
+
};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
|
|
1155
|
+
#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
|
|
1156
|
+
float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;
|
|
1157
|
+
#else
|
|
1158
|
+
return roughness;
|
|
1159
|
+
#endif
|
|
1160
|
+
}
|
|
1161
|
+
vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}
|
|
1162
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
1163
|
+
vec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;}
|
|
1164
|
+
#endif
|
|
1165
|
+
vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI);
|
|
1166
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
|
|
1167
|
+
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
|
|
1168
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
1169
|
+
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
|
|
1170
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1171
|
+
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;
|
|
1172
|
+
#endif
|
|
1173
|
+
return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
|
|
1174
|
+
#define inline
|
|
1175
|
+
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);}
|
|
1176
|
+
#ifdef SS_TRANSLUCENCY
|
|
1177
|
+
vec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped);
|
|
1178
|
+
#ifndef SS_TRANSLUCENCY_LEGACY
|
|
1179
|
+
if (info.NdotLUnclamped<0.0) {
|
|
1180
|
+
#endif
|
|
1181
|
+
float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);
|
|
1182
|
+
#ifndef SS_TRANSLUCENCY_LEGACY
|
|
1183
|
+
}
|
|
1184
|
+
vec3 diffuseTerm=vec3(1.0/PI);
|
|
1185
|
+
#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY
|
|
1186
|
+
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
|
|
1187
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY
|
|
1188
|
+
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
|
|
1189
|
+
#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON
|
|
1190
|
+
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;
|
|
1191
|
+
#endif
|
|
1192
|
+
#else
|
|
1193
|
+
float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);
|
|
1194
|
+
#endif
|
|
1195
|
+
return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
|
|
1196
|
+
#endif
|
|
1197
|
+
#ifdef SPECULARTERM
|
|
1198
|
+
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);
|
|
1199
|
+
#ifdef IRIDESCENCE
|
|
1200
|
+
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
|
|
1201
|
+
#endif
|
|
1202
|
+
float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
|
|
1203
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
1204
|
+
float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
|
|
1205
|
+
#else
|
|
1206
|
+
float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
|
|
1207
|
+
#endif
|
|
1208
|
+
vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
|
|
1209
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
1210
|
+
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;}
|
|
1211
|
+
#endif
|
|
1212
|
+
#endif
|
|
1213
|
+
#ifdef FUZZ
|
|
1214
|
+
float evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut)
|
|
1215
|
+
{if (NdotL<=0.0 || NdotV<=0.0)
|
|
1216
|
+
return 0.0;mat3 M=mat3(
|
|
1217
|
+
vec3(ltcLut.r,0.0,0.0),
|
|
1218
|
+
vec3(ltcLut.g,1.0,0.0),
|
|
1219
|
+
vec3(0.0,0.0,1.0)
|
|
1220
|
+
);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;}
|
|
1221
|
+
#endif
|
|
1222
|
+
#if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)
|
|
1223
|
+
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;}
|
|
1224
|
+
#elif defined(ANISOTROPIC)
|
|
1225
|
+
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);
|
|
1226
|
+
#ifdef IRIDESCENCE
|
|
1227
|
+
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
|
|
1228
|
+
#endif
|
|
1229
|
+
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;}
|
|
1230
|
+
#endif
|
|
1231
|
+
#ifdef CLEARCOAT
|
|
1232
|
+
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(
|
|
1233
|
+
clearCoatTerm*info.attenuation*NccdotL*lightColor,
|
|
1234
|
+
1.0-fresnel
|
|
1235
|
+
);}
|
|
1236
|
+
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;}
|
|
1237
|
+
#endif
|
|
1238
|
+
#ifdef SHEEN
|
|
1239
|
+
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
|
|
1240
|
+
float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
|
|
1241
|
+
#else */
|
|
1242
|
+
float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
|
|
1243
|
+
float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
|
|
1244
|
+
#endif
|
|
1245
|
+
`;o.ShaderStore.IncludesShadersStore[E]||(o.ShaderStore.IncludesShadersStore[E]=p),e.s(["pbrDirectLightingFunctions",0,{name:E,shader:p}],56072);let h="pbrBlockNormalGeometric",S=`vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
|
1246
|
+
#ifdef NORMAL
|
|
1247
|
+
vec3 normalW=normalize(vNormalW);
|
|
1248
|
+
#else
|
|
1249
|
+
vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
|
|
1250
|
+
#endif
|
|
1251
|
+
vec3 geometricNormalW=normalW;
|
|
1252
|
+
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
1253
|
+
geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
|
|
1254
|
+
#endif
|
|
1255
|
+
`;o.ShaderStore.IncludesShadersStore[h]||(o.ShaderStore.IncludesShadersStore[h]=S),e.s(["pbrBlockNormalGeometric",0,{name:h,shader:S}],26873);let R="pbrBlockImageProcessing",I=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
|
|
1256
|
+
#if !defined(SKIPFINALCOLORCLAMP)
|
|
1257
|
+
finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
|
|
1258
|
+
#endif
|
|
1259
|
+
#else
|
|
1260
|
+
finalColor=applyImageProcessing(finalColor);
|
|
1261
|
+
#endif
|
|
1262
|
+
finalColor.a*=visibility;
|
|
1263
|
+
#ifdef PREMULTIPLYALPHA
|
|
1264
|
+
finalColor.rgb*=finalColor.a;
|
|
1265
|
+
#endif
|
|
1266
|
+
`;o.ShaderStore.IncludesShadersStore[R]||(o.ShaderStore.IncludesShadersStore[R]=I),e.s(["pbrBlockImageProcessing",0,{name:R,shader:I}],53251);let L="pbrDebug",N=`#if DEBUGMODE>0
|
|
1267
|
+
if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
|
|
1268
|
+
#if DEBUGMODE==1
|
|
1269
|
+
gl_FragColor.rgb=vPositionW.rgb;
|
|
1270
|
+
#define DEBUGMODE_NORMALIZE
|
|
1271
|
+
#elif DEBUGMODE==2 && defined(NORMAL)
|
|
1272
|
+
gl_FragColor.rgb=vNormalW.rgb;
|
|
1273
|
+
#define DEBUGMODE_NORMALIZE
|
|
1274
|
+
#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
|
|
1275
|
+
gl_FragColor.rgb=TBN[0];
|
|
1276
|
+
#define DEBUGMODE_NORMALIZE
|
|
1277
|
+
#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
|
|
1278
|
+
gl_FragColor.rgb=TBN[1];
|
|
1279
|
+
#define DEBUGMODE_NORMALIZE
|
|
1280
|
+
#elif DEBUGMODE==5
|
|
1281
|
+
gl_FragColor.rgb=normalW;
|
|
1282
|
+
#define DEBUGMODE_NORMALIZE
|
|
1283
|
+
#elif DEBUGMODE==6 && defined(MAINUV1)
|
|
1284
|
+
gl_FragColor.rgb=vec3(vMainUV1,0.0);
|
|
1285
|
+
#elif DEBUGMODE==7 && defined(MAINUV2)
|
|
1286
|
+
gl_FragColor.rgb=vec3(vMainUV2,0.0);
|
|
1287
|
+
#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
|
|
1288
|
+
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
|
|
1289
|
+
#define DEBUGMODE_NORMALIZE
|
|
1290
|
+
#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
|
|
1291
|
+
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
|
|
1292
|
+
#define DEBUGMODE_NORMALIZE
|
|
1293
|
+
#elif DEBUGMODE==10 && defined(CLEARCOAT)
|
|
1294
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
|
|
1295
|
+
#define DEBUGMODE_NORMALIZE
|
|
1296
|
+
#elif DEBUGMODE==11 && defined(ANISOTROPIC)
|
|
1297
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
|
|
1298
|
+
#define DEBUGMODE_NORMALIZE
|
|
1299
|
+
#elif DEBUGMODE==12 && defined(ANISOTROPIC)
|
|
1300
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
|
|
1301
|
+
#define DEBUGMODE_NORMALIZE
|
|
1302
|
+
#elif DEBUGMODE==13 && defined(ANISOTROPIC)
|
|
1303
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
|
|
1304
|
+
#define DEBUGMODE_NORMALIZE
|
|
1305
|
+
#elif DEBUGMODE==20 && defined(ALBEDO)
|
|
1306
|
+
gl_FragColor.rgb=albedoTexture.rgb;
|
|
1307
|
+
#ifndef GAMMAALBEDO
|
|
1308
|
+
#define DEBUGMODE_GAMMA
|
|
1309
|
+
#endif
|
|
1310
|
+
#elif DEBUGMODE==21 && defined(AMBIENT)
|
|
1311
|
+
gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
|
|
1312
|
+
#elif DEBUGMODE==22 && defined(OPACITY)
|
|
1313
|
+
gl_FragColor.rgb=opacityMap.rgb;
|
|
1314
|
+
#elif DEBUGMODE==23 && defined(EMISSIVE)
|
|
1315
|
+
gl_FragColor.rgb=emissiveColorTex.rgb;
|
|
1316
|
+
#ifndef GAMMAEMISSIVE
|
|
1317
|
+
#define DEBUGMODE_GAMMA
|
|
1318
|
+
#endif
|
|
1319
|
+
#elif DEBUGMODE==24 && defined(LIGHTMAP)
|
|
1320
|
+
gl_FragColor.rgb=lightmapColor.rgb;
|
|
1321
|
+
#ifndef GAMMALIGHTMAP
|
|
1322
|
+
#define DEBUGMODE_GAMMA
|
|
1323
|
+
#endif
|
|
1324
|
+
#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
|
|
1325
|
+
gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
|
|
1326
|
+
#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
|
|
1327
|
+
gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
|
|
1328
|
+
#define DEBUGMODE_GAMMA
|
|
1329
|
+
#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
|
|
1330
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
|
|
1331
|
+
#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
|
|
1332
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
|
|
1333
|
+
#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
|
|
1334
|
+
gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
|
|
1335
|
+
#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
|
|
1336
|
+
gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
|
|
1337
|
+
#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
|
|
1338
|
+
gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
|
|
1339
|
+
#elif DEBUGMODE==32 && defined(BUMP)
|
|
1340
|
+
gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;
|
|
1341
|
+
#elif DEBUGMODE==40 && defined(SS_REFRACTION)
|
|
1342
|
+
gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
|
|
1343
|
+
#define DEBUGMODE_GAMMA
|
|
1344
|
+
#elif DEBUGMODE==41 && defined(REFLECTION)
|
|
1345
|
+
gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
|
|
1346
|
+
#ifndef GAMMAREFLECTION
|
|
1347
|
+
#define DEBUGMODE_GAMMA
|
|
1348
|
+
#endif
|
|
1349
|
+
#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
|
|
1350
|
+
gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
|
|
1351
|
+
#define DEBUGMODE_GAMMA
|
|
1352
|
+
#elif DEBUGMODE==50
|
|
1353
|
+
gl_FragColor.rgb=diffuseBase.rgb;
|
|
1354
|
+
#define DEBUGMODE_GAMMA
|
|
1355
|
+
#elif DEBUGMODE==51 && defined(SPECULARTERM)
|
|
1356
|
+
gl_FragColor.rgb=specularBase.rgb;
|
|
1357
|
+
#define DEBUGMODE_GAMMA
|
|
1358
|
+
#elif DEBUGMODE==52 && defined(CLEARCOAT)
|
|
1359
|
+
gl_FragColor.rgb=clearCoatBase.rgb;
|
|
1360
|
+
#define DEBUGMODE_GAMMA
|
|
1361
|
+
#elif DEBUGMODE==53 && defined(SHEEN)
|
|
1362
|
+
gl_FragColor.rgb=sheenBase.rgb;
|
|
1363
|
+
#define DEBUGMODE_GAMMA
|
|
1364
|
+
#elif DEBUGMODE==54 && defined(REFLECTION)
|
|
1365
|
+
gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
|
|
1366
|
+
#ifndef GAMMAREFLECTION
|
|
1367
|
+
#define DEBUGMODE_GAMMA
|
|
1368
|
+
#endif
|
|
1369
|
+
#elif DEBUGMODE==60
|
|
1370
|
+
gl_FragColor.rgb=surfaceAlbedo.rgb;
|
|
1371
|
+
#define DEBUGMODE_GAMMA
|
|
1372
|
+
#elif DEBUGMODE==61
|
|
1373
|
+
gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
|
|
1374
|
+
#define DEBUGMODE_GAMMA
|
|
1375
|
+
#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
|
|
1376
|
+
gl_FragColor.rgb=vec3(reflectivityOut.metallic);
|
|
1377
|
+
#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
|
|
1378
|
+
gl_FragColor.rgb=reflectivityOut.metallicF0;
|
|
1379
|
+
#elif DEBUGMODE==63
|
|
1380
|
+
gl_FragColor.rgb=vec3(roughness);
|
|
1381
|
+
#elif DEBUGMODE==64
|
|
1382
|
+
gl_FragColor.rgb=vec3(alphaG);
|
|
1383
|
+
#elif DEBUGMODE==65
|
|
1384
|
+
gl_FragColor.rgb=vec3(NdotV);
|
|
1385
|
+
#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
|
|
1386
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
|
|
1387
|
+
#define DEBUGMODE_GAMMA
|
|
1388
|
+
#elif DEBUGMODE==67 && defined(CLEARCOAT)
|
|
1389
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
|
|
1390
|
+
#elif DEBUGMODE==68 && defined(CLEARCOAT)
|
|
1391
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
|
|
1392
|
+
#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
|
|
1393
|
+
gl_FragColor.rgb=subSurfaceOut.transmittance;
|
|
1394
|
+
#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
|
|
1395
|
+
gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
|
|
1396
|
+
#elif DEBUGMODE==72
|
|
1397
|
+
gl_FragColor.rgb=vec3(microSurface);
|
|
1398
|
+
#elif DEBUGMODE==73
|
|
1399
|
+
gl_FragColor.rgb=vAlbedoColor.rgb;
|
|
1400
|
+
#define DEBUGMODE_GAMMA
|
|
1401
|
+
#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
|
|
1402
|
+
gl_FragColor.rgb=vReflectivityColor.rgb;
|
|
1403
|
+
#define DEBUGMODE_GAMMA
|
|
1404
|
+
#elif DEBUGMODE==75
|
|
1405
|
+
gl_FragColor.rgb=vEmissiveColor.rgb;
|
|
1406
|
+
#define DEBUGMODE_GAMMA
|
|
1407
|
+
#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
|
|
1408
|
+
gl_FragColor.rgb=vec3(seo);
|
|
1409
|
+
#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
|
|
1410
|
+
gl_FragColor.rgb=vec3(eho);
|
|
1411
|
+
#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
1412
|
+
gl_FragColor.rgb=vec3(energyConservationFactor);
|
|
1413
|
+
#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1414
|
+
gl_FragColor.rgb=baseSpecularEnvironmentReflectance;
|
|
1415
|
+
#define DEBUGMODE_GAMMA
|
|
1416
|
+
#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1417
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
|
|
1418
|
+
#define DEBUGMODE_GAMMA
|
|
1419
|
+
#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
|
|
1420
|
+
gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
|
|
1421
|
+
#define DEBUGMODE_GAMMA
|
|
1422
|
+
#elif DEBUGMODE==86 && defined(ALPHABLEND)
|
|
1423
|
+
gl_FragColor.rgb=vec3(luminanceOverAlpha);
|
|
1424
|
+
#elif DEBUGMODE==87
|
|
1425
|
+
gl_FragColor.rgb=vec3(alpha);
|
|
1426
|
+
#elif DEBUGMODE==88 && defined(ALBEDO)
|
|
1427
|
+
gl_FragColor.rgb=vec3(albedoTexture.a);
|
|
1428
|
+
#elif DEBUGMODE==89
|
|
1429
|
+
gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;
|
|
1430
|
+
#else
|
|
1431
|
+
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);
|
|
1432
|
+
#endif
|
|
1433
|
+
gl_FragColor.rgb*=vDebugMode.y;
|
|
1434
|
+
#ifdef DEBUGMODE_NORMALIZE
|
|
1435
|
+
gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
|
|
1436
|
+
#endif
|
|
1437
|
+
#ifdef DEBUGMODE_GAMMA
|
|
1438
|
+
gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
|
|
1439
|
+
#endif
|
|
1440
|
+
gl_FragColor.a=1.0;
|
|
1441
|
+
#ifdef PREPASS
|
|
1442
|
+
gl_FragData[0]=toLinearSpace(gl_FragColor);
|
|
1443
|
+
gl_FragData[1]=vec4(0.,0.,0.,0.);
|
|
1444
|
+
#endif
|
|
1445
|
+
#ifdef DEBUGMODE_FORCERETURN
|
|
1446
|
+
return;
|
|
1447
|
+
#endif
|
|
1448
|
+
}
|
|
1449
|
+
#endif
|
|
1450
|
+
`;o.ShaderStore.IncludesShadersStore[L]||(o.ShaderStore.IncludesShadersStore[L]=N),e.s(["pbrDebug",0,{name:L,shader:N}],3291)}]);
|