@babylonjs/viewer 7.41.0 → 7.41.1-alpha
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/assets/photoStudio.env +0 -0
- package/dist/babylon-viewer.esm.js +2 -0
- package/dist/babylon-viewer.esm.js.map +1 -0
- package/dist/babylon-viewer.esm.min.js +2 -0
- package/dist/babylon-viewer.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-BS2USlck.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_ies-BS2USlck.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-C-joQ5O4.esm.js +84 -0
- package/dist/chunks/EXT_lights_ies-C-joQ5O4.esm.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-C3wbbb5Z.esm.js +171 -0
- package/dist/chunks/EXT_lights_image_based-C3wbbb5Z.esm.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-DDdRDnM2.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_image_based-DDdRDnM2.esm.min.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-AXAnRQN7.esm.js +86 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-AXAnRQN7.esm.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-BcjPo6uC.esm.min.js +2 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-BcjPo6uC.esm.min.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-DlUkQB2P.esm.js +134 -0
- package/dist/chunks/EXT_meshopt_compression-DlUkQB2P.esm.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-yJ4OpORd.esm.min.js +2 -0
- package/dist/chunks/EXT_meshopt_compression-yJ4OpORd.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-BQWbvJfK.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_avif-BQWbvJfK.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-C0pGpnGv.esm.js +44 -0
- package/dist/chunks/EXT_texture_avif-C0pGpnGv.esm.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-Dd7Uqtmh.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_webp-Dd7Uqtmh.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-DehlrnW-.esm.js +43 -0
- package/dist/chunks/EXT_texture_webp-DehlrnW-.esm.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-C5NMuDj4.esm.js +64 -0
- package/dist/chunks/ExtrasAsMetadata-C5NMuDj4.esm.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-Cp3LHdoG.esm.min.js +2 -0
- package/dist/chunks/ExtrasAsMetadata-Cp3LHdoG.esm.min.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-DEBOwDXh.esm.min.js +2 -0
- package/dist/chunks/KHR_animation_pointer-DEBOwDXh.esm.min.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-Dx1OeG2b.esm.js +352 -0
- package/dist/chunks/KHR_animation_pointer-Dx1OeG2b.esm.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-Ch0QOlBL.esm.min.js +2 -0
- package/dist/chunks/KHR_draco_mesh_compression-Ch0QOlBL.esm.min.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-D59SFLyo.esm.js +610 -0
- package/dist/chunks/KHR_draco_mesh_compression-D59SFLyo.esm.js.map +1 -0
- package/dist/chunks/KHR_interactivity-Blj_9jts.esm.min.js +2 -0
- package/dist/chunks/KHR_interactivity-Blj_9jts.esm.min.js.map +1 -0
- package/dist/chunks/KHR_interactivity-CR0LYUa7.esm.js +4033 -0
- package/dist/chunks/KHR_interactivity-CR0LYUa7.esm.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual--w0a62AP.esm.js +581 -0
- package/dist/chunks/KHR_lights_punctual--w0a62AP.esm.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual-BojffBbG.esm.min.js +2 -0
- package/dist/chunks/KHR_lights_punctual-BojffBbG.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-BPtHWkOQ.esm.js +65 -0
- package/dist/chunks/KHR_materials_anisotropy-BPtHWkOQ.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-DU5_bnCL.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_anisotropy-DU5_bnCL.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-BBuRlPhc.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_clearcoat-BBuRlPhc.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-Eg0xbuWN.esm.js +96 -0
- package/dist/chunks/KHR_materials_clearcoat-Eg0xbuWN.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-Bkzk60Y5.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-Bkzk60Y5.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-C3DaLgRY.esm.js +97 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-C3DaLgRY.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-DL_XFhxj.esm.js +62 -0
- package/dist/chunks/KHR_materials_dispersion-DL_XFhxj.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-DbMQPBgM.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_dispersion-DbMQPBgM.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-BuHyjtBD.esm.js +55 -0
- package/dist/chunks/KHR_materials_emissive_strength-BuHyjtBD.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-Djlr_ul3.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_emissive_strength-Djlr_ul3.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-BIe6qBOo.esm.js +64 -0
- package/dist/chunks/KHR_materials_ior-BIe6qBOo.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-DOfaAmNY.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_ior-DOfaAmNY.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-BgElZgUu.esm.js +72 -0
- package/dist/chunks/KHR_materials_iridescence-BgElZgUu.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-lUeo07SZ.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_iridescence-lUeo07SZ.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-9ShQyhJ6.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-9ShQyhJ6.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE5LjLg6.esm.js +81 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE5LjLg6.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-BfZe6ZFu.esm.js +85 -0
- package/dist/chunks/KHR_materials_sheen-BfZe6ZFu.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-OWjuK2V4.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_sheen-OWjuK2V4.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-dowPxbW3.esm.js +75 -0
- package/dist/chunks/KHR_materials_specular-dowPxbW3.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-nWeBZu0R.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_specular-nWeBZu0R.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-BPNQkK0O.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_transmission-BPNQkK0O.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-CHr_yLLX.esm.js +307 -0
- package/dist/chunks/KHR_materials_transmission-CHr_yLLX.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-BYXpcsdj.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_unlit-BYXpcsdj.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-Cr7YsDHT.esm.js +74 -0
- package/dist/chunks/KHR_materials_unlit-Cr7YsDHT.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-BCVX3sJa.esm.js +262 -0
- package/dist/chunks/KHR_materials_variants-BCVX3sJa.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-BXzl6KpJ.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_variants-BXzl6KpJ.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-BD9KEaJz.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_volume-BD9KEaJz.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-DrqGUGW6.esm.js +87 -0
- package/dist/chunks/KHR_materials_volume-DrqGUGW6.esm.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-Dg22auJA.esm.min.js +2 -0
- package/dist/chunks/KHR_mesh_quantization-Dg22auJA.esm.min.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-hvxpvTbe.esm.js +26 -0
- package/dist/chunks/KHR_mesh_quantization-hvxpvTbe.esm.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-BDiqFmBB.esm.js +39 -0
- package/dist/chunks/KHR_node_hoverability-BDiqFmBB.esm.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-CumkOtZM.esm.min.js +2 -0
- package/dist/chunks/KHR_node_hoverability-CumkOtZM.esm.min.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-BKEa-Yfj.esm.min.js +2 -0
- package/dist/chunks/KHR_node_visibility-BKEa-Yfj.esm.min.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-K0fsD4Vv.esm.js +46 -0
- package/dist/chunks/KHR_node_visibility-K0fsD4Vv.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-8YVY1pKo.esm.js +43 -0
- package/dist/chunks/KHR_texture_basisu-8YVY1pKo.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-BM__NeSW.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_basisu-BM__NeSW.esm.min.js.map +1 -0
- package/dist/chunks/KHR_texture_transform--qxpdvRw.esm.js +63 -0
- package/dist/chunks/KHR_texture_transform--qxpdvRw.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_transform-C0MO-oJp.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_transform-C0MO-oJp.esm.min.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-D9FpHvJo.esm.js +51 -0
- package/dist/chunks/KHR_xmp_json_ld-D9FpHvJo.esm.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-DeXPWWQE.esm.min.js +2 -0
- package/dist/chunks/KHR_xmp_json_ld-DeXPWWQE.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-BbICSwFH.esm.min.js +2 -0
- package/dist/chunks/MSFT_audio_emitter-BbICSwFH.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-Dd5lbfUc.esm.js +2201 -0
- package/dist/chunks/MSFT_audio_emitter-Dd5lbfUc.esm.js.map +1 -0
- package/dist/chunks/MSFT_lod-B0zrRF3s.esm.js +337 -0
- package/dist/chunks/MSFT_lod-B0zrRF3s.esm.js.map +1 -0
- package/dist/chunks/MSFT_lod-Bd4znUfD.esm.min.js +2 -0
- package/dist/chunks/MSFT_lod-Bd4znUfD.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-CdIpMgsb.esm.min.js +2 -0
- package/dist/chunks/MSFT_minecraftMesh-CdIpMgsb.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-WFc8m_Ka.esm.js +46 -0
- package/dist/chunks/MSFT_minecraftMesh-WFc8m_Ka.esm.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-CTbtGna8.esm.js +47 -0
- package/dist/chunks/MSFT_sRGBFactors-CTbtGna8.esm.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-yTSoBQJx.esm.min.js +2 -0
- package/dist/chunks/MSFT_sRGBFactors-yTSoBQJx.esm.min.js.map +1 -0
- package/dist/chunks/animationGroup-8TJDgymS.esm.js +2482 -0
- package/dist/chunks/animationGroup-8TJDgymS.esm.js.map +1 -0
- package/dist/chunks/animationGroup-toXtd3a1.esm.min.js +2 -0
- package/dist/chunks/animationGroup-toXtd3a1.esm.min.js.map +1 -0
- package/dist/chunks/assetContainer-7pMDUaac.esm.min.js +2 -0
- package/dist/chunks/assetContainer-7pMDUaac.esm.min.js.map +1 -0
- package/dist/chunks/assetContainer-DYzO0AbX.esm.js +1720 -0
- package/dist/chunks/assetContainer-DYzO0AbX.esm.js.map +1 -0
- package/dist/chunks/audioEngine-Kz4HSEXd.esm.min.js +2 -0
- package/dist/chunks/audioEngine-Kz4HSEXd.esm.min.js.map +1 -0
- package/dist/chunks/audioEngine-peiGqjr6.esm.js +305 -0
- package/dist/chunks/audioEngine-peiGqjr6.esm.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-BZvcL01J.esm.min.js +2 -0
- package/dist/chunks/bakedVertexAnimation-BZvcL01J.esm.min.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-CPflSjER.esm.js +114 -0
- package/dist/chunks/bakedVertexAnimation-CPflSjER.esm.js.map +1 -0
- package/dist/chunks/basisTextureLoader-CR0XhSAg.esm.js +600 -0
- package/dist/chunks/basisTextureLoader-CR0XhSAg.esm.js.map +1 -0
- package/dist/chunks/basisTextureLoader-DVJdcB62.esm.min.js +2 -0
- package/dist/chunks/basisTextureLoader-DVJdcB62.esm.min.js.map +1 -0
- package/dist/chunks/dds-6EdM5O6M.esm.js +540 -0
- package/dist/chunks/dds-6EdM5O6M.esm.js.map +1 -0
- package/dist/chunks/dds-DVX_K9B3.esm.min.js +2 -0
- package/dist/chunks/dds-DVX_K9B3.esm.min.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-BAK7Ib2Z.esm.min.js +2 -0
- package/dist/chunks/ddsTextureLoader-BAK7Ib2Z.esm.min.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-_nktVxwZ.esm.js +88 -0
- package/dist/chunks/ddsTextureLoader-_nktVxwZ.esm.js.map +1 -0
- package/dist/chunks/decalFragment-C_Cews3-.esm.js +18 -0
- package/dist/chunks/decalFragment-C_Cews3-.esm.js.map +1 -0
- package/dist/chunks/decalFragment-Dmj88EX9.esm.min.js +2 -0
- package/dist/chunks/decalFragment-Dmj88EX9.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-Bv_nR7po.esm.min.js +2 -0
- package/dist/chunks/default.fragment-Bv_nR7po.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-CkZQyJVM.esm.min.js +2 -0
- package/dist/chunks/default.fragment-CkZQyJVM.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-CyFHDykY.esm.js +446 -0
- package/dist/chunks/default.fragment-CyFHDykY.esm.js.map +1 -0
- package/dist/chunks/default.fragment-ej-2z5tS.esm.js +515 -0
- package/dist/chunks/default.fragment-ej-2z5tS.esm.js.map +1 -0
- package/dist/chunks/default.vertex-16mVOFgT.esm.js +211 -0
- package/dist/chunks/default.vertex-16mVOFgT.esm.js.map +1 -0
- package/dist/chunks/default.vertex-D--q2At3.esm.min.js +2 -0
- package/dist/chunks/default.vertex-D--q2At3.esm.min.js.map +1 -0
- package/dist/chunks/default.vertex-DDlgZTrR.esm.js +190 -0
- package/dist/chunks/default.vertex-DDlgZTrR.esm.js.map +1 -0
- package/dist/chunks/default.vertex-_jqs3KiZ.esm.min.js +2 -0
- package/dist/chunks/default.vertex-_jqs3KiZ.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-8YG0iNg8.esm.js +15 -0
- package/dist/chunks/defaultUboDeclaration-8YG0iNg8.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-BoBSRTbi.esm.js +13 -0
- package/dist/chunks/defaultUboDeclaration-BoBSRTbi.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-Dt_5vo1d.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-Dt_5vo1d.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-R6gGjkAM.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-R6gGjkAM.esm.min.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +11 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +2 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +1 -0
- package/dist/chunks/dumpTools-Bhux0wvM.esm.js +200 -0
- package/dist/chunks/dumpTools-Bhux0wvM.esm.js.map +1 -0
- package/dist/chunks/dumpTools-CHCb2UkY.esm.min.js +2 -0
- package/dist/chunks/dumpTools-CHCb2UkY.esm.min.js.map +1 -0
- package/dist/chunks/engine-DF_zE4qj.esm.js +2213 -0
- package/dist/chunks/engine-DF_zE4qj.esm.js.map +1 -0
- package/dist/chunks/engine-DVmdDcyP.esm.min.js +2 -0
- package/dist/chunks/engine-DVmdDcyP.esm.min.js.map +1 -0
- package/dist/chunks/engine.common-CvOmoKru.esm.js +1162 -0
- package/dist/chunks/engine.common-CvOmoKru.esm.js.map +1 -0
- package/dist/chunks/engine.common-DpTzktQJ.esm.min.js +2 -0
- package/dist/chunks/engine.common-DpTzktQJ.esm.min.js.map +1 -0
- package/dist/chunks/envTextureLoader-4YxGm-Px.esm.js +64 -0
- package/dist/chunks/envTextureLoader-4YxGm-Px.esm.js.map +1 -0
- package/dist/chunks/envTextureLoader-DMQui088.esm.min.js +2 -0
- package/dist/chunks/envTextureLoader-DMQui088.esm.min.js.map +1 -0
- package/dist/chunks/environmentTextureTools-BPGrTBPI.esm.min.js +2 -0
- package/dist/chunks/environmentTextureTools-BPGrTBPI.esm.min.js.map +1 -0
- package/dist/chunks/environmentTextureTools-DvkpsqkN.esm.js +382 -0
- package/dist/chunks/environmentTextureTools-DvkpsqkN.esm.js.map +1 -0
- package/dist/chunks/exrTextureLoader-BRkB54sO.esm.js +1683 -0
- package/dist/chunks/exrTextureLoader-BRkB54sO.esm.js.map +1 -0
- package/dist/chunks/exrTextureLoader-BtN7_zst.esm.min.js +2 -0
- package/dist/chunks/exrTextureLoader-BtN7_zst.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-BrGGFaiu.esm.js +101 -0
- package/dist/chunks/fogFragment-BrGGFaiu.esm.js.map +1 -0
- package/dist/chunks/fogFragment-ByOwwQur.esm.min.js +2 -0
- package/dist/chunks/fogFragment-ByOwwQur.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-Chod24nu.esm.min.js +2 -0
- package/dist/chunks/fogFragment-Chod24nu.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-gZfybCpt.esm.js +102 -0
- package/dist/chunks/fogFragment-gZfybCpt.esm.js.map +1 -0
- package/dist/chunks/fresnelFunction-BdEia8ob.esm.min.js +2 -0
- package/dist/chunks/fresnelFunction-BdEia8ob.esm.min.js.map +1 -0
- package/dist/chunks/fresnelFunction-DBlxfmri.esm.js +12 -0
- package/dist/chunks/fresnelFunction-DBlxfmri.esm.js.map +1 -0
- package/dist/chunks/glTFLoader-D4C1IGb3.esm.min.js +2 -0
- package/dist/chunks/glTFLoader-D4C1IGb3.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoader-fUFiWvYb.esm.js +7693 -0
- package/dist/chunks/glTFLoader-fUFiWvYb.esm.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-BB_Vw079.esm.min.js +2 -0
- package/dist/chunks/glTFLoaderAnimation-BB_Vw079.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-CttmY50U.esm.js +77 -0
- package/dist/chunks/glTFLoaderAnimation-CttmY50U.esm.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-B0Rp1hEo.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-B0Rp1hEo.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-Cca_z552.esm.js +34 -0
- package/dist/chunks/harmonicsFunctions-Cca_z552.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-D4ID83NC.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-D4ID83NC.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-HJ5dbl0w.esm.js +35 -0
- package/dist/chunks/harmonicsFunctions-HJ5dbl0w.esm.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-C3kqy6YV.esm.js +253 -0
- package/dist/chunks/hdrTextureLoader-C3kqy6YV.esm.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-Dhlluz4z.esm.min.js +2 -0
- package/dist/chunks/hdrTextureLoader-Dhlluz4z.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-BJotVqUd.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-BJotVqUd.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-C66wRWtu.esm.js +110 -0
- package/dist/chunks/helperFunctions-C66wRWtu.esm.js.map +1 -0
- package/dist/chunks/helperFunctions-DwEZ9rqh.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-DwEZ9rqh.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-gnki_9Kj.esm.js +83 -0
- package/dist/chunks/helperFunctions-gnki_9Kj.esm.js.map +1 -0
- package/dist/chunks/iesTextureLoader-QDs2Cwy5.esm.js +189 -0
- package/dist/chunks/iesTextureLoader-QDs2Cwy5.esm.js.map +1 -0
- package/dist/chunks/iesTextureLoader-pwA6Q4HK.esm.min.js +2 -0
- package/dist/chunks/iesTextureLoader-pwA6Q4HK.esm.min.js.map +1 -0
- package/dist/chunks/index-C6hXZyZb.esm.js +74889 -0
- package/dist/chunks/index-C6hXZyZb.esm.js.map +1 -0
- package/dist/chunks/index-rZVkfTE6.esm.min.js +57 -0
- package/dist/chunks/index-rZVkfTE6.esm.min.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-jVu-Sj-0.esm.js +814 -0
- package/dist/chunks/ktxTextureLoader-jVu-Sj-0.esm.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-zG9azrZF.esm.min.js +2 -0
- package/dist/chunks/ktxTextureLoader-zG9azrZF.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-0cA1pTvQ.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration-0cA1pTvQ.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-CYxYhXIS.esm.js +11 -0
- package/dist/chunks/logDepthDeclaration-CYxYhXIS.esm.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-D4KGxdX-.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration-D4KGxdX-.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-DJlt2-H5.esm.js +35 -0
- package/dist/chunks/logDepthDeclaration-DJlt2-H5.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-BS2JEtXA.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-BS2JEtXA.esm.min.js.map +1 -0
- package/dist/chunks/logDepthVertex-DKPfA10X.esm.js +81 -0
- package/dist/chunks/logDepthVertex-DKPfA10X.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-ojTShW5I.esm.js +77 -0
- package/dist/chunks/logDepthVertex-ojTShW5I.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-v-0pHNc-.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-v-0pHNc-.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-BAzmbS0W.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-BAzmbS0W.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-Cnux1jkK.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-Cnux1jkK.esm.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-CwS0hUUZ.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-CwS0hUUZ.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-DCawby1A.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-DCawby1A.esm.js.map +1 -0
- package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js +119 -0
- package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js.map +1 -0
- package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js +2 -0
- package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js.map +1 -0
- package/dist/chunks/meshUboDeclaration-QvH0RgeZ.esm.js +26 -0
- package/dist/chunks/meshUboDeclaration-QvH0RgeZ.esm.js.map +1 -0
- package/dist/chunks/meshUboDeclaration-g2s_cYI1.esm.min.js +2 -0
- package/dist/chunks/meshUboDeclaration-g2s_cYI1.esm.min.js.map +1 -0
- package/dist/chunks/objFileLoader-BOutXdVR.esm.min.js +2 -0
- package/dist/chunks/objFileLoader-BOutXdVR.esm.min.js.map +1 -0
- package/dist/chunks/objFileLoader-BPwrX8RK.esm.js +1338 -0
- package/dist/chunks/objFileLoader-BPwrX8RK.esm.js.map +1 -0
- package/dist/chunks/oitFragment-CmcWUhsZ.esm.js +1240 -0
- package/dist/chunks/oitFragment-CmcWUhsZ.esm.js.map +1 -0
- package/dist/chunks/oitFragment-D8XBQ6Wa.esm.js +1078 -0
- package/dist/chunks/oitFragment-D8XBQ6Wa.esm.js.map +1 -0
- package/dist/chunks/oitFragment-DgAlmoHs.esm.min.js +2 -0
- package/dist/chunks/oitFragment-DgAlmoHs.esm.min.js.map +1 -0
- package/dist/chunks/oitFragment-DpJ5xGhy.esm.min.js +2 -0
- package/dist/chunks/oitFragment-DpJ5xGhy.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment--XRaXRhU.esm.js +15 -0
- package/dist/chunks/pass.fragment--XRaXRhU.esm.js.map +1 -0
- package/dist/chunks/pass.fragment-5Q3qXxDe.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-5Q3qXxDe.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-BBLiyU_i.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-BBLiyU_i.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-DI4ZYZJe.esm.js +15 -0
- package/dist/chunks/pass.fragment-DI4ZYZJe.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-C7xQS4ZJ.esm.js +3269 -0
- package/dist/chunks/pbr.fragment-C7xQS4ZJ.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-Ddxaik8T.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-Ddxaik8T.esm.min.js.map +1 -0
- package/dist/chunks/pbr.fragment-fky04gH_.esm.js +3222 -0
- package/dist/chunks/pbr.fragment-fky04gH_.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-ya1zai4w.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-ya1zai4w.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-BPEYHoRM.esm.js +223 -0
- package/dist/chunks/pbr.vertex-BPEYHoRM.esm.js.map +1 -0
- package/dist/chunks/pbr.vertex-BXcMYADF.esm.js +348 -0
- package/dist/chunks/pbr.vertex-BXcMYADF.esm.js.map +1 -0
- package/dist/chunks/pbr.vertex-BjA08auU.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-BjA08auU.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-Cx2V3lNf.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-Cx2V3lNf.esm.min.js.map +1 -0
- package/dist/chunks/postprocess.vertex-BHpQrNSx.esm.min.js +2 -0
- package/dist/chunks/postprocess.vertex-BHpQrNSx.esm.min.js.map +1 -0
- package/dist/chunks/postprocess.vertex-DnDbk0tq.esm.js +20 -0
- package/dist/chunks/postprocess.vertex-DnDbk0tq.esm.js.map +1 -0
- package/dist/chunks/rawTexture-CWiRIto8.esm.js +191 -0
- package/dist/chunks/rawTexture-CWiRIto8.esm.js.map +1 -0
- package/dist/chunks/rawTexture-DX8V9PEj.esm.min.js +2 -0
- package/dist/chunks/rawTexture-DX8V9PEj.esm.min.js.map +1 -0
- package/dist/chunks/ray-ix7SqYNQ.esm.min.js +2 -0
- package/dist/chunks/ray-ix7SqYNQ.esm.min.js.map +1 -0
- package/dist/chunks/ray-nTZBkOil.esm.js +946 -0
- package/dist/chunks/ray-nTZBkOil.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-Be3ofvlt.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-Be3ofvlt.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-C05QJpT2.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-C05QJpT2.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-D3SYBclQ.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-D3SYBclQ.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-DBG6KfKF.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-DBG6KfKF.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-BlhtohrO.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-BlhtohrO.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-BmJKYw6A.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-BmJKYw6A.esm.min.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-dr2kGjSO.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-dr2kGjSO.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-hXPzg1p5.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-hXPzg1p5.esm.min.js.map +1 -0
- package/dist/chunks/splatFileLoader-Bs42LtsP.esm.min.js +2 -0
- package/dist/chunks/splatFileLoader-Bs42LtsP.esm.min.js.map +1 -0
- package/dist/chunks/splatFileLoader-Dp33YOem.esm.js +3379 -0
- package/dist/chunks/splatFileLoader-Dp33YOem.esm.js.map +1 -0
- package/dist/chunks/spotLight-C0NmKeem.esm.js +701 -0
- package/dist/chunks/spotLight-C0NmKeem.esm.js.map +1 -0
- package/dist/chunks/spotLight-CcuCNdES.esm.min.js +2 -0
- package/dist/chunks/spotLight-CcuCNdES.esm.min.js.map +1 -0
- package/dist/chunks/standardMaterial-C1E5n_4w.esm.min.js +2 -0
- package/dist/chunks/standardMaterial-C1E5n_4w.esm.min.js.map +1 -0
- package/dist/chunks/standardMaterial-v_D8QA4q.esm.js +1807 -0
- package/dist/chunks/standardMaterial-v_D8QA4q.esm.js.map +1 -0
- package/dist/chunks/stlFileLoader-DC2IRQDj.esm.min.js +2 -0
- package/dist/chunks/stlFileLoader-DC2IRQDj.esm.min.js.map +1 -0
- package/dist/chunks/stlFileLoader-LRHEIFfU.esm.js +238 -0
- package/dist/chunks/stlFileLoader-LRHEIFfU.esm.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-2ekJC0En.esm.js +349 -0
- package/dist/chunks/tgaTextureLoader-2ekJC0En.esm.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-Clj6zUK-.esm.min.js +2 -0
- package/dist/chunks/tgaTextureLoader-Clj6zUK-.esm.min.js.map +1 -0
- package/dist/chunks/thinEngine-DksimP2U.esm.js +3848 -0
- package/dist/chunks/thinEngine-DksimP2U.esm.js.map +1 -0
- package/dist/chunks/thinEngine-tsALaFYH.esm.min.js +2 -0
- package/dist/chunks/thinEngine-tsALaFYH.esm.min.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-B8AW0Oa2.esm.js +314 -0
- package/dist/chunks/thinInstanceMesh-B8AW0Oa2.esm.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-kCGEJ0-e.esm.min.js +2 -0
- package/dist/chunks/thinInstanceMesh-kCGEJ0-e.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-Bjijk3lU.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-Bjijk3lU.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-D9917nJN.esm.js +428 -0
- package/dist/chunks/vertexColorMixing-D9917nJN.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-DgthWrKf.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-DgthWrKf.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-U1SA6UK3.esm.js +538 -0
- package/dist/chunks/vertexColorMixing-U1SA6UK3.esm.js.map +1 -0
- package/dist/chunks/webgpuEngine-BOGR1D8F.esm.min.js +2 -0
- package/dist/chunks/webgpuEngine-BOGR1D8F.esm.min.js.map +1 -0
- package/dist/chunks/webgpuEngine-BrzOpZ-2.esm.js +11533 -0
- package/dist/chunks/webgpuEngine-BrzOpZ-2.esm.js.map +1 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
- package/lib/index.d.ts +591 -0
- package/lib/index.js +2165 -0
- package/lib/index.js.map +1 -0
- package/package.json +19 -28
- package/readme.md +28 -28
- package/configuration/configuration.d.ts +0 -107
- package/configuration/configuration.js +0 -16
- package/configuration/configuration.js.map +0 -1
- package/configuration/configurationCompatibility.d.ts +0 -8
- package/configuration/configurationCompatibility.js +0 -66
- package/configuration/configurationCompatibility.js.map +0 -1
- package/configuration/configurationContainer.d.ts +0 -10
- package/configuration/configurationContainer.js +0 -10
- package/configuration/configurationContainer.js.map +0 -1
- package/configuration/globals.d.ts +0 -6
- package/configuration/globals.js +0 -18
- package/configuration/globals.js.map +0 -1
- package/configuration/index.d.ts +0 -2
- package/configuration/index.js +0 -4
- package/configuration/index.js.map +0 -1
- package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
- package/configuration/interfaces/cameraConfiguration.js +0 -2
- package/configuration/interfaces/cameraConfiguration.js.map +0 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
- package/configuration/interfaces/colorGradingConfiguration.js +0 -2
- package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
- package/configuration/interfaces/environmentMapConfiguration.js +0 -2
- package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
- package/configuration/interfaces/groundConfiguration.d.ts +0 -24
- package/configuration/interfaces/groundConfiguration.js +0 -2
- package/configuration/interfaces/groundConfiguration.js.map +0 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
- package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
- package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
- package/configuration/interfaces/index.d.ts +0 -15
- package/configuration/interfaces/index.js +0 -16
- package/configuration/interfaces/index.js.map +0 -1
- package/configuration/interfaces/lightConfiguration.d.ts +0 -60
- package/configuration/interfaces/lightConfiguration.js +0 -2
- package/configuration/interfaces/lightConfiguration.js.map +0 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
- package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
- package/configuration/interfaces/modelConfiguration.d.ts +0 -65
- package/configuration/interfaces/modelConfiguration.js +0 -2
- package/configuration/interfaces/modelConfiguration.js.map +0 -1
- package/configuration/interfaces/observersConfiguration.d.ts +0 -5
- package/configuration/interfaces/observersConfiguration.js +0 -2
- package/configuration/interfaces/observersConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
- package/configuration/interfaces/sceneConfiguration.js +0 -2
- package/configuration/interfaces/sceneConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
- package/configuration/interfaces/skyboxConfiguration.js +0 -2
- package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
- package/configuration/interfaces/templateConfiguration.d.ts +0 -67
- package/configuration/interfaces/templateConfiguration.js +0 -2
- package/configuration/interfaces/templateConfiguration.js.map +0 -1
- package/configuration/interfaces/vrConfiguration.d.ts +0 -16
- package/configuration/interfaces/vrConfiguration.js +0 -2
- package/configuration/interfaces/vrConfiguration.js.map +0 -1
- package/configuration/loader.d.ts +0 -4
- package/configuration/loader.js +0 -17
- package/configuration/loader.js.map +0 -1
- package/configuration/mappers.d.ts +0 -43
- package/configuration/mappers.js +0 -193
- package/configuration/mappers.js.map +0 -1
- package/configuration/renderOnlyLoader.d.ts +0 -33
- package/configuration/renderOnlyLoader.js +0 -162
- package/configuration/renderOnlyLoader.js.map +0 -1
- package/configuration/types/default.d.ts +0 -6
- package/configuration/types/default.js +0 -121
- package/configuration/types/default.js.map +0 -1
- package/configuration/types/environmentMap.d.ts +0 -5
- package/configuration/types/environmentMap.js +0 -14
- package/configuration/types/environmentMap.js.map +0 -1
- package/configuration/types/extended.d.ts +0 -6
- package/configuration/types/extended.js +0 -317
- package/configuration/types/extended.js.map +0 -1
- package/configuration/types/index.d.ts +0 -14
- package/configuration/types/index.js +0 -51
- package/configuration/types/index.js.map +0 -1
- package/configuration/types/minimal.d.ts +0 -6
- package/configuration/types/minimal.js +0 -43
- package/configuration/types/minimal.js.map +0 -1
- package/configuration/types/renderOnlyDefault.d.ts +0 -30
- package/configuration/types/renderOnlyDefault.js +0 -31
- package/configuration/types/renderOnlyDefault.js.map +0 -1
- package/configuration/types/shadowLight.d.ts +0 -9
- package/configuration/types/shadowLight.js +0 -64
- package/configuration/types/shadowLight.js.map +0 -1
- package/helper/index.d.ts +0 -29
- package/helper/index.js +0 -66
- package/helper/index.js.map +0 -1
- package/index.d.ts +0 -30
- package/index.js +0 -46
- package/index.js.map +0 -1
- package/initializer.d.ts +0 -11
- package/initializer.js +0 -35
- package/initializer.js.map +0 -1
- package/interfaces.d.ts +0 -5
- package/interfaces.js +0 -7
- package/interfaces.js.map +0 -1
- package/labs/environmentSerializer.d.ts +0 -126
- package/labs/environmentSerializer.js +0 -191
- package/labs/environmentSerializer.js.map +0 -1
- package/labs/texture.d.ts +0 -183
- package/labs/texture.js +0 -351
- package/labs/texture.js.map +0 -1
- package/labs/viewerLabs.d.ts +0 -51
- package/labs/viewerLabs.js +0 -134
- package/labs/viewerLabs.js.map +0 -1
- package/loader/modelLoader.d.ts +0 -56
- package/loader/modelLoader.js +0 -202
- package/loader/modelLoader.js.map +0 -1
- package/loader/plugins/applyMaterialConfig.d.ts +0 -12
- package/loader/plugins/applyMaterialConfig.js +0 -16
- package/loader/plugins/applyMaterialConfig.js.map +0 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
- package/loader/plugins/index.d.ts +0 -19
- package/loader/plugins/index.js +0 -44
- package/loader/plugins/index.js.map +0 -1
- package/loader/plugins/loaderPlugin.d.ts +0 -24
- package/loader/plugins/loaderPlugin.js +0 -2
- package/loader/plugins/loaderPlugin.js.map +0 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
- package/loader/plugins/msftLodLoaderPlugin.js +0 -21
- package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
- package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
- package/loader/plugins/telemetryLoaderPlugin.js +0 -36
- package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
- package/managers/observablesManager.d.ts +0 -66
- package/managers/observablesManager.js +0 -35
- package/managers/observablesManager.js.map +0 -1
- package/managers/sceneManager.d.ts +0 -245
- package/managers/sceneManager.js +0 -1375
- package/managers/sceneManager.js.map +0 -1
- package/managers/telemetryManager.d.ts +0 -78
- package/managers/telemetryManager.js +0 -117
- package/managers/telemetryManager.js.map +0 -1
- package/model/modelAnimation.d.ts +0 -215
- package/model/modelAnimation.js +0 -237
- package/model/modelAnimation.js.map +0 -1
- package/model/viewerModel.d.ts +0 -233
- package/model/viewerModel.js +0 -673
- package/model/viewerModel.js.map +0 -1
- package/optimizer/custom/extended.d.ts +0 -13
- package/optimizer/custom/extended.js +0 -101
- package/optimizer/custom/extended.js.map +0 -1
- package/optimizer/custom/index.d.ts +0 -9
- package/optimizer/custom/index.js +0 -26
- package/optimizer/custom/index.js.map +0 -1
- package/renderOnlyIndex.d.ts +0 -11
- package/renderOnlyIndex.js +0 -18
- package/renderOnlyIndex.js.map +0 -1
- package/templating/eventManager.d.ts +0 -35
- package/templating/eventManager.js +0 -66
- package/templating/eventManager.js.map +0 -1
- package/templating/plugins/hdButtonPlugin.d.ts +0 -9
- package/templating/plugins/hdButtonPlugin.js +0 -22
- package/templating/plugins/hdButtonPlugin.js.map +0 -1
- package/templating/plugins/printButton.d.ts +0 -9
- package/templating/plugins/printButton.js +0 -41
- package/templating/plugins/printButton.js.map +0 -1
- package/templating/templateManager.d.ts +0 -197
- package/templating/templateManager.js +0 -561
- package/templating/templateManager.js.map +0 -1
- package/templating/viewerTemplatePlugin.d.ts +0 -21
- package/templating/viewerTemplatePlugin.js +0 -69
- package/templating/viewerTemplatePlugin.js.map +0 -1
- package/viewer/defaultViewer.d.ts +0 -130
- package/viewer/defaultViewer.js +0 -672
- package/viewer/defaultViewer.js.map +0 -1
- package/viewer/renderOnlyViewer.d.ts +0 -9
- package/viewer/renderOnlyViewer.js +0 -46
- package/viewer/renderOnlyViewer.js.map +0 -1
- package/viewer/viewer.d.ts +0 -258
- package/viewer/viewer.js +0 -783
- package/viewer/viewer.js.map +0 -1
- package/viewer/viewerManager.d.ts +0 -58
- package/viewer/viewerManager.js +0 -91
- package/viewer/viewerManager.js.map +0 -1
- package/viewer/viewerWithTemplate.d.ts +0 -9
- package/viewer/viewerWithTemplate.js +0 -20
- package/viewer/viewerWithTemplate.js.map +0 -1
|
@@ -0,0 +1,3269 @@
|
|
|
1
|
+
import { i as ShaderStore } from './index-C6hXZyZb.esm.js';
|
|
2
|
+
import './oitFragment-CmcWUhsZ.esm.js';
|
|
3
|
+
import './harmonicsFunctions-HJ5dbl0w.esm.js';
|
|
4
|
+
import './mainUVVaryingDeclaration-Cnux1jkK.esm.js';
|
|
5
|
+
import './fogFragment-gZfybCpt.esm.js';
|
|
6
|
+
import './logDepthDeclaration-DJlt2-H5.esm.js';
|
|
7
|
+
import './helperFunctions-C66wRWtu.esm.js';
|
|
8
|
+
|
|
9
|
+
// Do not edit.
|
|
10
|
+
const name$A = "pbrFragmentDeclaration";
|
|
11
|
+
const shader$A = `uniform vec4 vEyePosition;uniform vec3 vReflectionColor;uniform vec4 vAlbedoColor;uniform vec4 vLightingIntensity;uniform vec4 vReflectivityColor;uniform vec4 vMetallicReflectanceFactors;uniform vec3 vEmissiveColor;uniform float visibility;uniform vec3 vAmbientColor;
|
|
12
|
+
#ifdef ALBEDO
|
|
13
|
+
uniform vec2 vAlbedoInfos;
|
|
14
|
+
#endif
|
|
15
|
+
#ifdef AMBIENT
|
|
16
|
+
uniform vec4 vAmbientInfos;
|
|
17
|
+
#endif
|
|
18
|
+
#ifdef BUMP
|
|
19
|
+
uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;
|
|
20
|
+
#endif
|
|
21
|
+
#ifdef OPACITY
|
|
22
|
+
uniform vec2 vOpacityInfos;
|
|
23
|
+
#endif
|
|
24
|
+
#ifdef EMISSIVE
|
|
25
|
+
uniform vec2 vEmissiveInfos;
|
|
26
|
+
#endif
|
|
27
|
+
#ifdef LIGHTMAP
|
|
28
|
+
uniform vec2 vLightmapInfos;
|
|
29
|
+
#endif
|
|
30
|
+
#ifdef REFLECTIVITY
|
|
31
|
+
uniform vec3 vReflectivityInfos;
|
|
32
|
+
#endif
|
|
33
|
+
#ifdef MICROSURFACEMAP
|
|
34
|
+
uniform vec2 vMicroSurfaceSamplerInfos;
|
|
35
|
+
#endif
|
|
36
|
+
#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)
|
|
37
|
+
uniform mat4 view;
|
|
38
|
+
#endif
|
|
39
|
+
#ifdef REFLECTION
|
|
40
|
+
uniform vec2 vReflectionInfos;
|
|
41
|
+
#ifdef REALTIME_FILTERING
|
|
42
|
+
uniform vec2 vReflectionFilteringInfo;
|
|
43
|
+
#endif
|
|
44
|
+
uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;
|
|
45
|
+
#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
|
|
46
|
+
uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
|
|
47
|
+
#endif
|
|
48
|
+
#endif
|
|
49
|
+
#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC)
|
|
50
|
+
uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;
|
|
51
|
+
#endif
|
|
52
|
+
#ifdef CLEARCOAT
|
|
53
|
+
uniform vec2 vClearCoatParams;uniform vec4 vClearCoatRefractionParams;
|
|
54
|
+
#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)
|
|
55
|
+
uniform vec4 vClearCoatInfos;
|
|
56
|
+
#endif
|
|
57
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
58
|
+
uniform mat4 clearCoatMatrix;
|
|
59
|
+
#endif
|
|
60
|
+
#ifdef CLEARCOAT_TEXTURE_ROUGHNESS
|
|
61
|
+
uniform mat4 clearCoatRoughnessMatrix;
|
|
62
|
+
#endif
|
|
63
|
+
#ifdef CLEARCOAT_BUMP
|
|
64
|
+
uniform vec2 vClearCoatBumpInfos;uniform vec2 vClearCoatTangentSpaceParams;uniform mat4 clearCoatBumpMatrix;
|
|
65
|
+
#endif
|
|
66
|
+
#ifdef CLEARCOAT_TINT
|
|
67
|
+
uniform vec4 vClearCoatTintParams;uniform float clearCoatColorAtDistance;
|
|
68
|
+
#ifdef CLEARCOAT_TINT_TEXTURE
|
|
69
|
+
uniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix;
|
|
70
|
+
#endif
|
|
71
|
+
#endif
|
|
72
|
+
#endif
|
|
73
|
+
#ifdef IRIDESCENCE
|
|
74
|
+
uniform vec4 vIridescenceParams;
|
|
75
|
+
#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)
|
|
76
|
+
uniform vec4 vIridescenceInfos;
|
|
77
|
+
#endif
|
|
78
|
+
#ifdef IRIDESCENCE_TEXTURE
|
|
79
|
+
uniform mat4 iridescenceMatrix;
|
|
80
|
+
#endif
|
|
81
|
+
#ifdef IRIDESCENCE_THICKNESS_TEXTURE
|
|
82
|
+
uniform mat4 iridescenceThicknessMatrix;
|
|
83
|
+
#endif
|
|
84
|
+
#endif
|
|
85
|
+
#ifdef ANISOTROPIC
|
|
86
|
+
uniform vec3 vAnisotropy;
|
|
87
|
+
#ifdef ANISOTROPIC_TEXTURE
|
|
88
|
+
uniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix;
|
|
89
|
+
#endif
|
|
90
|
+
#endif
|
|
91
|
+
#ifdef SHEEN
|
|
92
|
+
uniform vec4 vSheenColor;
|
|
93
|
+
#ifdef SHEEN_ROUGHNESS
|
|
94
|
+
uniform float vSheenRoughness;
|
|
95
|
+
#endif
|
|
96
|
+
#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)
|
|
97
|
+
uniform vec4 vSheenInfos;
|
|
98
|
+
#endif
|
|
99
|
+
#ifdef SHEEN_TEXTURE
|
|
100
|
+
uniform mat4 sheenMatrix;
|
|
101
|
+
#endif
|
|
102
|
+
#ifdef SHEEN_TEXTURE_ROUGHNESS
|
|
103
|
+
uniform mat4 sheenRoughnessMatrix;
|
|
104
|
+
#endif
|
|
105
|
+
#endif
|
|
106
|
+
#ifdef SUBSURFACE
|
|
107
|
+
#ifdef SS_REFRACTION
|
|
108
|
+
uniform vec4 vRefractionMicrosurfaceInfos;uniform vec4 vRefractionInfos;uniform mat4 refractionMatrix;
|
|
109
|
+
#ifdef REALTIME_FILTERING
|
|
110
|
+
uniform vec2 vRefractionFilteringInfo;
|
|
111
|
+
#endif
|
|
112
|
+
#ifdef SS_DISPERSION
|
|
113
|
+
uniform float dispersion;
|
|
114
|
+
#endif
|
|
115
|
+
#endif
|
|
116
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
117
|
+
uniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix;
|
|
118
|
+
#endif
|
|
119
|
+
#ifdef SS_REFRACTIONINTENSITY_TEXTURE
|
|
120
|
+
uniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix;
|
|
121
|
+
#endif
|
|
122
|
+
#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
|
|
123
|
+
uniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix;
|
|
124
|
+
#endif
|
|
125
|
+
uniform vec2 vThicknessParam;uniform vec3 vDiffusionDistance;uniform vec4 vTintColor;uniform vec3 vSubSurfaceIntensity;uniform vec4 vTranslucencyColor;
|
|
126
|
+
#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
|
|
127
|
+
uniform vec2 vTranslucencyColorInfos;uniform mat4 translucencyColorMatrix;
|
|
128
|
+
#endif
|
|
129
|
+
#endif
|
|
130
|
+
#ifdef PREPASS
|
|
131
|
+
#ifdef SS_SCATTERING
|
|
132
|
+
uniform float scatteringDiffusionProfile;
|
|
133
|
+
#endif
|
|
134
|
+
#endif
|
|
135
|
+
#if DEBUGMODE>0
|
|
136
|
+
uniform vec2 vDebugMode;
|
|
137
|
+
#endif
|
|
138
|
+
#ifdef DETAIL
|
|
139
|
+
uniform vec4 vDetailInfos;
|
|
140
|
+
#endif
|
|
141
|
+
#include<decalFragmentDeclaration>
|
|
142
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
143
|
+
#ifdef SPHERICAL_HARMONICS
|
|
144
|
+
uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;
|
|
145
|
+
#else
|
|
146
|
+
uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;
|
|
147
|
+
#endif
|
|
148
|
+
#endif
|
|
149
|
+
#define ADDITIONAL_FRAGMENT_DECLARATION
|
|
150
|
+
`;
|
|
151
|
+
// Sideeffect
|
|
152
|
+
ShaderStore.IncludesShadersStore[name$A] = shader$A;
|
|
153
|
+
|
|
154
|
+
// Do not edit.
|
|
155
|
+
const name$z = "pbrFragmentExtraDeclaration";
|
|
156
|
+
const shader$z = `varying vec3 vPositionW;
|
|
157
|
+
#if DEBUGMODE>0
|
|
158
|
+
varying vec4 vClipSpacePosition;
|
|
159
|
+
#endif
|
|
160
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
161
|
+
#ifdef NORMAL
|
|
162
|
+
varying vec3 vNormalW;
|
|
163
|
+
#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)
|
|
164
|
+
varying vec3 vEnvironmentIrradiance;
|
|
165
|
+
#endif
|
|
166
|
+
#endif
|
|
167
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
168
|
+
varying vec4 vColor;
|
|
169
|
+
#endif
|
|
170
|
+
`;
|
|
171
|
+
// Sideeffect
|
|
172
|
+
ShaderStore.IncludesShadersStore[name$z] = shader$z;
|
|
173
|
+
|
|
174
|
+
// Do not edit.
|
|
175
|
+
const name$y = "samplerFragmentAlternateDeclaration";
|
|
176
|
+
const shader$y = `#ifdef _DEFINENAME_
|
|
177
|
+
#if _DEFINENAME_DIRECTUV==1
|
|
178
|
+
#define v_VARYINGNAME_UV vMainUV1
|
|
179
|
+
#elif _DEFINENAME_DIRECTUV==2
|
|
180
|
+
#define v_VARYINGNAME_UV vMainUV2
|
|
181
|
+
#elif _DEFINENAME_DIRECTUV==3
|
|
182
|
+
#define v_VARYINGNAME_UV vMainUV3
|
|
183
|
+
#elif _DEFINENAME_DIRECTUV==4
|
|
184
|
+
#define v_VARYINGNAME_UV vMainUV4
|
|
185
|
+
#elif _DEFINENAME_DIRECTUV==5
|
|
186
|
+
#define v_VARYINGNAME_UV vMainUV5
|
|
187
|
+
#elif _DEFINENAME_DIRECTUV==6
|
|
188
|
+
#define v_VARYINGNAME_UV vMainUV6
|
|
189
|
+
#else
|
|
190
|
+
varying vec2 v_VARYINGNAME_UV;
|
|
191
|
+
#endif
|
|
192
|
+
#endif
|
|
193
|
+
`;
|
|
194
|
+
// Sideeffect
|
|
195
|
+
ShaderStore.IncludesShadersStore[name$y] = shader$y;
|
|
196
|
+
|
|
197
|
+
// Do not edit.
|
|
198
|
+
const name$x = "pbrFragmentSamplersDeclaration";
|
|
199
|
+
const shader$x = `#include<samplerFragmentDeclaration>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)
|
|
200
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
|
|
201
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
|
|
202
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
|
|
203
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
|
|
204
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)
|
|
205
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)
|
|
206
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)
|
|
207
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)
|
|
208
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
|
|
209
|
+
#ifdef CLEARCOAT
|
|
210
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)
|
|
211
|
+
#include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)
|
|
212
|
+
#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)
|
|
213
|
+
uniform sampler2D clearCoatRoughnessSampler;
|
|
214
|
+
#endif
|
|
215
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)
|
|
216
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)
|
|
217
|
+
#endif
|
|
218
|
+
#ifdef IRIDESCENCE
|
|
219
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)
|
|
220
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)
|
|
221
|
+
#endif
|
|
222
|
+
#ifdef SHEEN
|
|
223
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)
|
|
224
|
+
#include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)
|
|
225
|
+
#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS)
|
|
226
|
+
uniform sampler2D sheenRoughnessSampler;
|
|
227
|
+
#endif
|
|
228
|
+
#endif
|
|
229
|
+
#ifdef ANISOTROPIC
|
|
230
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)
|
|
231
|
+
#endif
|
|
232
|
+
#ifdef REFLECTION
|
|
233
|
+
#ifdef REFLECTIONMAP_3D
|
|
234
|
+
#define sampleReflection(s,c) textureCube(s,c)
|
|
235
|
+
uniform samplerCube reflectionSampler;
|
|
236
|
+
#ifdef LODBASEDMICROSFURACE
|
|
237
|
+
#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)
|
|
238
|
+
#else
|
|
239
|
+
uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;
|
|
240
|
+
#endif
|
|
241
|
+
#ifdef USEIRRADIANCEMAP
|
|
242
|
+
uniform samplerCube irradianceSampler;
|
|
243
|
+
#endif
|
|
244
|
+
#else
|
|
245
|
+
#define sampleReflection(s,c) texture2D(s,c)
|
|
246
|
+
uniform sampler2D reflectionSampler;
|
|
247
|
+
#ifdef LODBASEDMICROSFURACE
|
|
248
|
+
#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)
|
|
249
|
+
#else
|
|
250
|
+
uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;
|
|
251
|
+
#endif
|
|
252
|
+
#ifdef USEIRRADIANCEMAP
|
|
253
|
+
uniform sampler2D irradianceSampler;
|
|
254
|
+
#endif
|
|
255
|
+
#endif
|
|
256
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
257
|
+
varying vec3 vPositionUVW;
|
|
258
|
+
#else
|
|
259
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
260
|
+
varying vec3 vDirectionW;
|
|
261
|
+
#endif
|
|
262
|
+
#endif
|
|
263
|
+
#endif
|
|
264
|
+
#ifdef ENVIRONMENTBRDF
|
|
265
|
+
uniform sampler2D environmentBrdfSampler;
|
|
266
|
+
#endif
|
|
267
|
+
#ifdef SUBSURFACE
|
|
268
|
+
#ifdef SS_REFRACTION
|
|
269
|
+
#ifdef SS_REFRACTIONMAP_3D
|
|
270
|
+
#define sampleRefraction(s,c) textureCube(s,c)
|
|
271
|
+
uniform samplerCube refractionSampler;
|
|
272
|
+
#ifdef LODBASEDMICROSFURACE
|
|
273
|
+
#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)
|
|
274
|
+
#else
|
|
275
|
+
uniform samplerCube refractionSamplerLow;uniform samplerCube refractionSamplerHigh;
|
|
276
|
+
#endif
|
|
277
|
+
#else
|
|
278
|
+
#define sampleRefraction(s,c) texture2D(s,c)
|
|
279
|
+
uniform sampler2D refractionSampler;
|
|
280
|
+
#ifdef LODBASEDMICROSFURACE
|
|
281
|
+
#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)
|
|
282
|
+
#else
|
|
283
|
+
uniform sampler2D refractionSamplerLow;uniform sampler2D refractionSamplerHigh;
|
|
284
|
+
#endif
|
|
285
|
+
#endif
|
|
286
|
+
#endif
|
|
287
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)
|
|
288
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)
|
|
289
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)
|
|
290
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor)
|
|
291
|
+
#endif
|
|
292
|
+
#ifdef IBL_CDF_FILTERING
|
|
293
|
+
uniform sampler2D icdfSampler;
|
|
294
|
+
#endif
|
|
295
|
+
`;
|
|
296
|
+
// Sideeffect
|
|
297
|
+
ShaderStore.IncludesShadersStore[name$x] = shader$x;
|
|
298
|
+
|
|
299
|
+
// Do not edit.
|
|
300
|
+
const name$w = "subSurfaceScatteringFunctions";
|
|
301
|
+
const shader$w = `bool testLightingForSSS(float diffusionProfile)
|
|
302
|
+
{return diffusionProfile<1.;}`;
|
|
303
|
+
// Sideeffect
|
|
304
|
+
ShaderStore.IncludesShadersStore[name$w] = shader$w;
|
|
305
|
+
|
|
306
|
+
// Do not edit.
|
|
307
|
+
const name$v = "importanceSampling";
|
|
308
|
+
const shader$v = `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);}
|
|
309
|
+
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);}
|
|
310
|
+
vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {
|
|
311
|
+
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);}`;
|
|
312
|
+
// Sideeffect
|
|
313
|
+
ShaderStore.IncludesShadersStore[name$v] = shader$v;
|
|
314
|
+
|
|
315
|
+
// Do not edit.
|
|
316
|
+
const name$u = "pbrHelperFunctions";
|
|
317
|
+
const shader$u = `#define MINIMUMVARIANCE 0.0005
|
|
318
|
+
float convertRoughnessToAverageSlope(float roughness)
|
|
319
|
+
{return square(roughness)+MINIMUMVARIANCE;}
|
|
320
|
+
float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}
|
|
321
|
+
vec2 getAARoughnessFactors(vec3 normalVector) {
|
|
322
|
+
#ifdef SPECULARAA
|
|
323
|
+
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);
|
|
324
|
+
#else
|
|
325
|
+
return vec2(0.);
|
|
326
|
+
#endif
|
|
327
|
+
}
|
|
328
|
+
#ifdef ANISOTROPIC
|
|
329
|
+
#ifdef ANISOTROPIC_LEGACY
|
|
330
|
+
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);}
|
|
331
|
+
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;}
|
|
332
|
+
vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
|
|
333
|
+
#else
|
|
334
|
+
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);}
|
|
335
|
+
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;}
|
|
336
|
+
#endif
|
|
337
|
+
#endif
|
|
338
|
+
#if defined(CLEARCOAT) || defined(SS_REFRACTION)
|
|
339
|
+
vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}
|
|
340
|
+
vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
|
|
341
|
+
vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}
|
|
342
|
+
vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),
|
|
343
|
+
cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
|
|
344
|
+
clearCoatIntensity);return clearCoatAbsorption;}
|
|
345
|
+
#endif
|
|
346
|
+
#ifdef MICROSURFACEAUTOMATIC
|
|
347
|
+
float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
|
|
348
|
+
{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}
|
|
349
|
+
#endif
|
|
350
|
+
`;
|
|
351
|
+
// Sideeffect
|
|
352
|
+
ShaderStore.IncludesShadersStore[name$u] = shader$u;
|
|
353
|
+
|
|
354
|
+
// Do not edit.
|
|
355
|
+
const name$t = "pbrDirectLightingSetupFunctions";
|
|
356
|
+
const shader$t = `struct preLightingInfo
|
|
357
|
+
{vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float roughness;
|
|
358
|
+
#ifdef IRIDESCENCE
|
|
359
|
+
float iridescenceIntensity;
|
|
360
|
+
#endif
|
|
361
|
+
};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);return result;}
|
|
362
|
+
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);return result;}
|
|
363
|
+
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;
|
|
364
|
+
#ifdef SPECULARTERM
|
|
365
|
+
result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
|
|
366
|
+
#endif
|
|
367
|
+
return result;}`;
|
|
368
|
+
// Sideeffect
|
|
369
|
+
ShaderStore.IncludesShadersStore[name$t] = shader$t;
|
|
370
|
+
|
|
371
|
+
// Do not edit.
|
|
372
|
+
const name$s = "pbrDirectLightingFalloffFunctions";
|
|
373
|
+
const shader$s = `float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
|
|
374
|
+
{return max(0.,1.0-length(lightOffset)/range);}
|
|
375
|
+
float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
|
|
376
|
+
{return 1.0/maxEps(lightDistanceSquared);}
|
|
377
|
+
float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
|
|
378
|
+
{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
|
|
379
|
+
float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
|
|
380
|
+
{
|
|
381
|
+
#ifdef USEPHYSICALLIGHTFALLOFF
|
|
382
|
+
return computeDistanceLightFalloff_Physical(lightDistanceSquared);
|
|
383
|
+
#elif defined(USEGLTFLIGHTFALLOFF)
|
|
384
|
+
return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
|
|
385
|
+
#else
|
|
386
|
+
return computeDistanceLightFalloff_Standard(lightOffset,range);
|
|
387
|
+
#endif
|
|
388
|
+
}
|
|
389
|
+
float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
|
|
390
|
+
{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
|
|
391
|
+
{falloff=max(0.,pow(cosAngle,exponent));}
|
|
392
|
+
return falloff;}
|
|
393
|
+
float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
|
|
394
|
+
{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
|
|
395
|
+
float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
|
|
396
|
+
{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
|
|
397
|
+
float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
|
|
398
|
+
float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
|
|
399
|
+
{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
|
|
400
|
+
float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
|
|
401
|
+
{
|
|
402
|
+
#ifdef USEPHYSICALLIGHTFALLOFF
|
|
403
|
+
return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
|
|
404
|
+
#elif defined(USEGLTFLIGHTFALLOFF)
|
|
405
|
+
return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
|
|
406
|
+
#else
|
|
407
|
+
return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
|
|
408
|
+
#endif
|
|
409
|
+
}`;
|
|
410
|
+
// Sideeffect
|
|
411
|
+
ShaderStore.IncludesShadersStore[name$s] = shader$s;
|
|
412
|
+
|
|
413
|
+
// Do not edit.
|
|
414
|
+
const name$r = "pbrBRDFFunctions";
|
|
415
|
+
const shader$r = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
|
|
416
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
417
|
+
vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
|
|
418
|
+
#endif
|
|
419
|
+
#ifdef ENVIRONMENTBRDF
|
|
420
|
+
vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);
|
|
421
|
+
#ifdef ENVIRONMENTBRDF_RGBD
|
|
422
|
+
brdfLookup.rgb=fromRGBD(brdfLookup.rgba);
|
|
423
|
+
#endif
|
|
424
|
+
return brdfLookup.rgb;}
|
|
425
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {
|
|
426
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
427
|
+
vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
|
|
428
|
+
#else
|
|
429
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
|
|
430
|
+
#endif
|
|
431
|
+
return reflectance;}
|
|
432
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
|
|
433
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
434
|
+
vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
|
|
435
|
+
#else
|
|
436
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
|
|
437
|
+
#endif
|
|
438
|
+
return reflectance;}
|
|
439
|
+
#endif
|
|
440
|
+
/* NOT USED
|
|
441
|
+
#if defined(SHEEN) && defined(SHEEN_SOFTER)
|
|
442
|
+
float getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)
|
|
443
|
+
{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
|
|
444
|
+
#endif
|
|
445
|
+
*/
|
|
446
|
+
#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
|
|
447
|
+
vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
|
|
448
|
+
{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
|
|
449
|
+
#endif
|
|
450
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
451
|
+
/**
|
|
452
|
+
* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
|
|
453
|
+
* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
|
|
454
|
+
*/
|
|
455
|
+
vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
|
|
456
|
+
#endif
|
|
457
|
+
vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
|
|
458
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
459
|
+
float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)
|
|
460
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
461
|
+
#ifdef CLEARCOAT
|
|
462
|
+
vec3 getR0RemappedForClearCoat(vec3 f0) {
|
|
463
|
+
#ifdef CLEARCOAT_DEFAULTIOR
|
|
464
|
+
#ifdef MOBILE
|
|
465
|
+
return saturate(f0*(f0*0.526868+0.529324)-0.0482256);
|
|
466
|
+
#else
|
|
467
|
+
return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
|
|
468
|
+
#endif
|
|
469
|
+
#else
|
|
470
|
+
vec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);
|
|
471
|
+
#endif
|
|
472
|
+
}
|
|
473
|
+
#endif
|
|
474
|
+
#ifdef IRIDESCENCE
|
|
475
|
+
const mat3 XYZ_TO_REC709=mat3(
|
|
476
|
+
3.2404542,-0.9692660, 0.0556434,
|
|
477
|
+
-1.5371385, 1.8760108,-0.2040259,
|
|
478
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
479
|
+
);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
|
|
480
|
+
vec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}
|
|
481
|
+
float getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}
|
|
482
|
+
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;}
|
|
483
|
+
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;}
|
|
484
|
+
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));
|
|
485
|
+
vec3 R1=getR0fromIORs(baseIOR,iridescenceIOR);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)
|
|
486
|
+
{Cm*=r123;vec3 Sm=2.0*evalSensitivity(float(m)*opd,float(m)*phi);I+=Cm*Sm;}
|
|
487
|
+
return max(I,vec3(0.0));}
|
|
488
|
+
#endif
|
|
489
|
+
float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
|
|
490
|
+
{float a2=square(alphaG);float d=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
|
|
491
|
+
#ifdef SHEEN
|
|
492
|
+
float normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)
|
|
493
|
+
{float invR=1./alphaG;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
|
|
494
|
+
#endif
|
|
495
|
+
#ifdef ANISOTROPIC
|
|
496
|
+
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;}
|
|
497
|
+
#endif
|
|
498
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
499
|
+
float smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {
|
|
500
|
+
#ifdef MOBILE
|
|
501
|
+
float GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);float GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
|
|
502
|
+
#else
|
|
503
|
+
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);
|
|
504
|
+
#endif
|
|
505
|
+
}
|
|
506
|
+
#else
|
|
507
|
+
float smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)
|
|
508
|
+
{
|
|
509
|
+
#ifdef MOBILE
|
|
510
|
+
return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
|
|
511
|
+
#else
|
|
512
|
+
float alphaSquared=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
|
|
513
|
+
#endif
|
|
514
|
+
}
|
|
515
|
+
float smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)
|
|
516
|
+
{float visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
|
|
517
|
+
#endif
|
|
518
|
+
#ifdef ANISOTROPIC
|
|
519
|
+
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;}
|
|
520
|
+
#endif
|
|
521
|
+
#ifdef CLEARCOAT
|
|
522
|
+
float visibility_Kelemen(float VdotH) {return 0.25/(VdotH*VdotH); }
|
|
523
|
+
#endif
|
|
524
|
+
#ifdef SHEEN
|
|
525
|
+
float visibility_Ashikhmin(float NdotL,float NdotV)
|
|
526
|
+
{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
|
|
527
|
+
/* NOT USED
|
|
528
|
+
#ifdef SHEEN_SOFTER
|
|
529
|
+
float l(float x,float alphaG)
|
|
530
|
+
{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;}
|
|
531
|
+
float lambdaSheen(float cosTheta,float alphaG)
|
|
532
|
+
{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
|
|
533
|
+
float visibility_CharlieSheen(float NdotL,float NdotV,float alphaG)
|
|
534
|
+
{float G=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
|
|
535
|
+
#endif
|
|
536
|
+
*/
|
|
537
|
+
#endif
|
|
538
|
+
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 =
|
|
539
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
|
|
540
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
|
|
541
|
+
#ifdef SS_TRANSLUCENCY
|
|
542
|
+
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);}
|
|
543
|
+
float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}
|
|
544
|
+
#endif
|
|
545
|
+
`;
|
|
546
|
+
// Sideeffect
|
|
547
|
+
ShaderStore.IncludesShadersStore[name$r] = shader$r;
|
|
548
|
+
|
|
549
|
+
// Do not edit.
|
|
550
|
+
const name$q = "hdrFilteringFunctions";
|
|
551
|
+
const shader$q = `#ifdef NUM_SAMPLES
|
|
552
|
+
#if NUM_SAMPLES>0
|
|
553
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
554
|
+
float radicalInverse_VdC(uint bits)
|
|
555
|
+
{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; }
|
|
556
|
+
vec2 hammersley(uint i,uint N)
|
|
557
|
+
{return vec2(float(i)/float(N),radicalInverse_VdC(i));}
|
|
558
|
+
#else
|
|
559
|
+
float vanDerCorpus(int n,int base)
|
|
560
|
+
{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)
|
|
561
|
+
{if(n>0)
|
|
562
|
+
{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}
|
|
563
|
+
return result;}
|
|
564
|
+
vec2 hammersley(int i,int N)
|
|
565
|
+
{return vec2(float(i)/float(N),vanDerCorpus(i,2));}
|
|
566
|
+
#endif
|
|
567
|
+
float log4(float x) {return log2(x)/2.;}
|
|
568
|
+
vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.0*PI;float phi=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}
|
|
569
|
+
const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;
|
|
570
|
+
#define inline
|
|
571
|
+
vec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo
|
|
572
|
+
#ifdef IBL_CDF_FILTERING
|
|
573
|
+
,sampler2D icdfSampler
|
|
574
|
+
#endif
|
|
575
|
+
)
|
|
576
|
+
{vec3 n=normalize(inputN);vec3 result=vec3(0.0);
|
|
577
|
+
#ifndef IBL_CDF_FILTERING
|
|
578
|
+
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);
|
|
579
|
+
#endif
|
|
580
|
+
float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);
|
|
581
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
582
|
+
for(uint i=0u; i<NUM_SAMPLES; ++i)
|
|
583
|
+
#else
|
|
584
|
+
for(int i=0; i<NUM_SAMPLES; ++i)
|
|
585
|
+
#endif
|
|
586
|
+
{vec2 Xi=hammersley(i,NUM_SAMPLES);
|
|
587
|
+
#ifdef IBL_CDF_FILTERING
|
|
588
|
+
vec2 T;T.x=textureLod(icdfSampler,vec2(Xi.x,0.0),0.0).x;T.y=textureLod(icdfSampler,vec2(T.x,Xi.y),0.0).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));float NoL=dot(n,Ls);
|
|
589
|
+
#else
|
|
590
|
+
vec3 Ls=hemisphereCosSample(Xi);Ls=normalize(Ls);vec3 Ns=vec3(0.,0.,1.);float NoL=dot(Ns,Ls);
|
|
591
|
+
#endif
|
|
592
|
+
if (NoL>0.) {
|
|
593
|
+
#ifdef IBL_CDF_FILTERING
|
|
594
|
+
float pdf=textureLod(icdfSampler,T,0.0).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.0).rgb;
|
|
595
|
+
#else
|
|
596
|
+
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.0,maxLevel);vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;
|
|
597
|
+
#endif
|
|
598
|
+
#ifdef GAMMA_INPUT
|
|
599
|
+
c=toLinearSpace(c);
|
|
600
|
+
#endif
|
|
601
|
+
#ifdef IBL_CDF_FILTERING
|
|
602
|
+
vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*light;
|
|
603
|
+
#else
|
|
604
|
+
result+=c;
|
|
605
|
+
#endif
|
|
606
|
+
}}
|
|
607
|
+
result=result*NUM_SAMPLES_FLOAT_INVERSED;return result;}
|
|
608
|
+
#define inline
|
|
609
|
+
vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)
|
|
610
|
+
{vec3 n=normalize(inputN);vec3 c=textureCube(inputTexture,n).rgb;
|
|
611
|
+
if (alphaG==0.) {
|
|
612
|
+
#ifdef GAMMA_INPUT
|
|
613
|
+
c=toLinearSpace(c);
|
|
614
|
+
#endif
|
|
615
|
+
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.;
|
|
616
|
+
#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
|
|
617
|
+
for(uint i=0u; i<NUM_SAMPLES; ++i)
|
|
618
|
+
#else
|
|
619
|
+
for(int i=0; i<NUM_SAMPLES; ++i)
|
|
620
|
+
#endif
|
|
621
|
+
{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;
|
|
622
|
+
#ifdef GAMMA_INPUT
|
|
623
|
+
c=toLinearSpace(c);
|
|
624
|
+
#endif
|
|
625
|
+
result+=c*NoL;}}
|
|
626
|
+
result=result/weight;return result;}}
|
|
627
|
+
#endif
|
|
628
|
+
#endif
|
|
629
|
+
`;
|
|
630
|
+
// Sideeffect
|
|
631
|
+
ShaderStore.IncludesShadersStore[name$q] = shader$q;
|
|
632
|
+
|
|
633
|
+
// Do not edit.
|
|
634
|
+
const name$p = "pbrDirectLightingFunctions";
|
|
635
|
+
const shader$p = `#define CLEARCOATREFLECTANCE90 1.0
|
|
636
|
+
struct lightingInfo
|
|
637
|
+
{vec3 diffuse;
|
|
638
|
+
#ifdef SPECULARTERM
|
|
639
|
+
vec3 specular;
|
|
640
|
+
#endif
|
|
641
|
+
#ifdef CLEARCOAT
|
|
642
|
+
vec4 clearCoat;
|
|
643
|
+
#endif
|
|
644
|
+
#ifdef SHEEN
|
|
645
|
+
vec3 sheen;
|
|
646
|
+
#endif
|
|
647
|
+
};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
|
|
648
|
+
#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)
|
|
649
|
+
float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;
|
|
650
|
+
#else
|
|
651
|
+
return roughness;
|
|
652
|
+
#endif
|
|
653
|
+
}
|
|
654
|
+
vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}
|
|
655
|
+
vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {float diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
|
|
656
|
+
#define inline
|
|
657
|
+
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);}
|
|
658
|
+
#ifdef SS_TRANSLUCENCY
|
|
659
|
+
vec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {float NdotL=absEps(info.NdotLUnclamped);float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);vec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
|
|
660
|
+
#endif
|
|
661
|
+
#ifdef SPECULARTERM
|
|
662
|
+
vec3 computeSpecularLighting(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);vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
|
|
663
|
+
#ifdef IRIDESCENCE
|
|
664
|
+
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
|
|
665
|
+
#endif
|
|
666
|
+
float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
|
|
667
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
668
|
+
float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
|
|
669
|
+
#else
|
|
670
|
+
float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
|
|
671
|
+
#endif
|
|
672
|
+
vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
|
|
673
|
+
#endif
|
|
674
|
+
#ifdef ANISOTROPIC
|
|
675
|
+
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);
|
|
676
|
+
#ifdef IRIDESCENCE
|
|
677
|
+
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
|
|
678
|
+
#endif
|
|
679
|
+
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;}
|
|
680
|
+
#endif
|
|
681
|
+
#ifdef CLEARCOAT
|
|
682
|
+
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(
|
|
683
|
+
clearCoatTerm*info.attenuation*NccdotL*lightColor,
|
|
684
|
+
1.0-fresnel
|
|
685
|
+
);}
|
|
686
|
+
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;}
|
|
687
|
+
#endif
|
|
688
|
+
#ifdef SHEEN
|
|
689
|
+
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
|
|
690
|
+
float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
|
|
691
|
+
#else */
|
|
692
|
+
float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
|
|
693
|
+
float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
|
|
694
|
+
#endif
|
|
695
|
+
`;
|
|
696
|
+
// Sideeffect
|
|
697
|
+
ShaderStore.IncludesShadersStore[name$p] = shader$p;
|
|
698
|
+
|
|
699
|
+
// Do not edit.
|
|
700
|
+
const name$o = "pbrIBLFunctions";
|
|
701
|
+
const shader$o = `#if defined(REFLECTION) || defined(SS_REFRACTION)
|
|
702
|
+
float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}
|
|
703
|
+
float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}
|
|
704
|
+
#endif
|
|
705
|
+
#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)
|
|
706
|
+
float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}
|
|
707
|
+
#endif
|
|
708
|
+
#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)
|
|
709
|
+
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);}
|
|
710
|
+
#endif
|
|
711
|
+
#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)
|
|
712
|
+
#define UNPACK_LOD(x) (1.0-x)*255.0
|
|
713
|
+
float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}
|
|
714
|
+
#endif
|
|
715
|
+
`;
|
|
716
|
+
// Sideeffect
|
|
717
|
+
ShaderStore.IncludesShadersStore[name$o] = shader$o;
|
|
718
|
+
|
|
719
|
+
// Do not edit.
|
|
720
|
+
const name$n = "pbrBlockAlbedoOpacity";
|
|
721
|
+
const shader$n = `struct albedoOpacityOutParams
|
|
722
|
+
{vec3 surfaceAlbedo;float alpha;};
|
|
723
|
+
#define pbr_inline
|
|
724
|
+
albedoOpacityOutParams albedoOpacityBlock(
|
|
725
|
+
in vec4 vAlbedoColor
|
|
726
|
+
#ifdef ALBEDO
|
|
727
|
+
,in vec4 albedoTexture
|
|
728
|
+
,in vec2 albedoInfos
|
|
729
|
+
#endif
|
|
730
|
+
#ifdef OPACITY
|
|
731
|
+
,in vec4 opacityMap
|
|
732
|
+
,in vec2 vOpacityInfos
|
|
733
|
+
#endif
|
|
734
|
+
#ifdef DETAIL
|
|
735
|
+
,in vec4 detailColor
|
|
736
|
+
,in vec4 vDetailInfos
|
|
737
|
+
#endif
|
|
738
|
+
#ifdef DECAL
|
|
739
|
+
,in vec4 decalColor
|
|
740
|
+
,in vec4 vDecalInfos
|
|
741
|
+
#endif
|
|
742
|
+
)
|
|
743
|
+
{albedoOpacityOutParams outParams;vec3 surfaceAlbedo=vAlbedoColor.rgb;float alpha=vAlbedoColor.a;
|
|
744
|
+
#ifdef ALBEDO
|
|
745
|
+
#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)
|
|
746
|
+
alpha*=albedoTexture.a;
|
|
747
|
+
#endif
|
|
748
|
+
#ifdef GAMMAALBEDO
|
|
749
|
+
surfaceAlbedo*=toLinearSpace(albedoTexture.rgb);
|
|
750
|
+
#else
|
|
751
|
+
surfaceAlbedo*=albedoTexture.rgb;
|
|
752
|
+
#endif
|
|
753
|
+
surfaceAlbedo*=albedoInfos.y;
|
|
754
|
+
#endif
|
|
755
|
+
#ifndef DECAL_AFTER_DETAIL
|
|
756
|
+
#include<decalFragment>
|
|
757
|
+
#endif
|
|
758
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
759
|
+
surfaceAlbedo*=vColor.rgb;
|
|
760
|
+
#endif
|
|
761
|
+
#ifdef DETAIL
|
|
762
|
+
float detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;
|
|
763
|
+
#endif
|
|
764
|
+
#ifdef DECAL_AFTER_DETAIL
|
|
765
|
+
#include<decalFragment>
|
|
766
|
+
#endif
|
|
767
|
+
#define CUSTOM_FRAGMENT_UPDATE_ALBEDO
|
|
768
|
+
#ifdef OPACITY
|
|
769
|
+
#ifdef OPACITYRGB
|
|
770
|
+
alpha=getLuminance(opacityMap.rgb);
|
|
771
|
+
#else
|
|
772
|
+
alpha*=opacityMap.a;
|
|
773
|
+
#endif
|
|
774
|
+
alpha*=vOpacityInfos.y;
|
|
775
|
+
#endif
|
|
776
|
+
#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
777
|
+
alpha*=vColor.a;
|
|
778
|
+
#endif
|
|
779
|
+
#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)
|
|
780
|
+
#ifdef ALPHATEST
|
|
781
|
+
#if DEBUGMODE != 88
|
|
782
|
+
if (alpha<ALPHATESTVALUE)
|
|
783
|
+
discard;
|
|
784
|
+
#endif
|
|
785
|
+
#ifndef ALPHABLEND
|
|
786
|
+
alpha=1.0;
|
|
787
|
+
#endif
|
|
788
|
+
#endif
|
|
789
|
+
#endif
|
|
790
|
+
outParams.surfaceAlbedo=surfaceAlbedo;outParams.alpha=alpha;return outParams;}
|
|
791
|
+
`;
|
|
792
|
+
// Sideeffect
|
|
793
|
+
ShaderStore.IncludesShadersStore[name$n] = shader$n;
|
|
794
|
+
|
|
795
|
+
// Do not edit.
|
|
796
|
+
const name$m = "pbrBlockReflectivity";
|
|
797
|
+
const shader$m = `struct reflectivityOutParams
|
|
798
|
+
{float microSurface;float roughness;vec3 surfaceReflectivityColor;
|
|
799
|
+
#ifdef METALLICWORKFLOW
|
|
800
|
+
vec3 surfaceAlbedo;
|
|
801
|
+
#endif
|
|
802
|
+
#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
|
|
803
|
+
vec3 ambientOcclusionColor;
|
|
804
|
+
#endif
|
|
805
|
+
#if DEBUGMODE>0
|
|
806
|
+
#ifdef METALLICWORKFLOW
|
|
807
|
+
vec2 metallicRoughness;
|
|
808
|
+
#ifdef REFLECTIVITY
|
|
809
|
+
vec4 surfaceMetallicColorMap;
|
|
810
|
+
#endif
|
|
811
|
+
#ifndef FROSTBITE_REFLECTANCE
|
|
812
|
+
vec3 metallicF0;
|
|
813
|
+
#endif
|
|
814
|
+
#else
|
|
815
|
+
#ifdef REFLECTIVITY
|
|
816
|
+
vec4 surfaceReflectivityColorMap;
|
|
817
|
+
#endif
|
|
818
|
+
#endif
|
|
819
|
+
#endif
|
|
820
|
+
};
|
|
821
|
+
#define pbr_inline
|
|
822
|
+
reflectivityOutParams reflectivityBlock(
|
|
823
|
+
in vec4 vReflectivityColor
|
|
824
|
+
#ifdef METALLICWORKFLOW
|
|
825
|
+
,in vec3 surfaceAlbedo
|
|
826
|
+
,in vec4 metallicReflectanceFactors
|
|
827
|
+
#endif
|
|
828
|
+
#ifdef REFLECTIVITY
|
|
829
|
+
,in vec3 reflectivityInfos
|
|
830
|
+
,in vec4 surfaceMetallicOrReflectivityColorMap
|
|
831
|
+
#endif
|
|
832
|
+
#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
|
|
833
|
+
,in vec3 ambientOcclusionColorIn
|
|
834
|
+
#endif
|
|
835
|
+
#ifdef MICROSURFACEMAP
|
|
836
|
+
,in vec4 microSurfaceTexel
|
|
837
|
+
#endif
|
|
838
|
+
#ifdef DETAIL
|
|
839
|
+
,in vec4 detailColor
|
|
840
|
+
,in vec4 vDetailInfos
|
|
841
|
+
#endif
|
|
842
|
+
)
|
|
843
|
+
{reflectivityOutParams outParams;float microSurface=vReflectivityColor.a;vec3 surfaceReflectivityColor=vReflectivityColor.rgb;
|
|
844
|
+
#ifdef METALLICWORKFLOW
|
|
845
|
+
vec2 metallicRoughness=surfaceReflectivityColor.rg;
|
|
846
|
+
#ifdef REFLECTIVITY
|
|
847
|
+
#if DEBUGMODE>0
|
|
848
|
+
outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;
|
|
849
|
+
#endif
|
|
850
|
+
#ifdef AOSTOREINMETALMAPRED
|
|
851
|
+
vec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);
|
|
852
|
+
#endif
|
|
853
|
+
#ifdef METALLNESSSTOREINMETALMAPBLUE
|
|
854
|
+
metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;
|
|
855
|
+
#else
|
|
856
|
+
metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;
|
|
857
|
+
#endif
|
|
858
|
+
#ifdef ROUGHNESSSTOREINMETALMAPALPHA
|
|
859
|
+
metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;
|
|
860
|
+
#else
|
|
861
|
+
#ifdef ROUGHNESSSTOREINMETALMAPGREEN
|
|
862
|
+
metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;
|
|
863
|
+
#endif
|
|
864
|
+
#endif
|
|
865
|
+
#endif
|
|
866
|
+
#ifdef DETAIL
|
|
867
|
+
float detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);float loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);float hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));
|
|
868
|
+
#endif
|
|
869
|
+
#ifdef MICROSURFACEMAP
|
|
870
|
+
metallicRoughness.g*=microSurfaceTexel.r;
|
|
871
|
+
#endif
|
|
872
|
+
#if DEBUGMODE>0
|
|
873
|
+
outParams.metallicRoughness=metallicRoughness;
|
|
874
|
+
#endif
|
|
875
|
+
#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS
|
|
876
|
+
microSurface=1.0-metallicRoughness.g;vec3 baseColor=surfaceAlbedo;
|
|
877
|
+
#ifdef FROSTBITE_REFLECTANCE
|
|
878
|
+
outParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);surfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);
|
|
879
|
+
#else
|
|
880
|
+
vec3 metallicF0=metallicReflectanceFactors.rgb;
|
|
881
|
+
#if DEBUGMODE>0
|
|
882
|
+
outParams.metallicF0=metallicF0;
|
|
883
|
+
#endif
|
|
884
|
+
outParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);surfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);
|
|
885
|
+
#endif
|
|
886
|
+
#else
|
|
887
|
+
#ifdef REFLECTIVITY
|
|
888
|
+
surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;
|
|
889
|
+
#if DEBUGMODE>0
|
|
890
|
+
outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;
|
|
891
|
+
#endif
|
|
892
|
+
#ifdef MICROSURFACEFROMREFLECTIVITYMAP
|
|
893
|
+
microSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z;
|
|
894
|
+
#else
|
|
895
|
+
#ifdef MICROSURFACEAUTOMATIC
|
|
896
|
+
microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
|
|
897
|
+
#endif
|
|
898
|
+
#ifdef MICROSURFACEMAP
|
|
899
|
+
microSurface*=microSurfaceTexel.r;
|
|
900
|
+
#endif
|
|
901
|
+
#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE
|
|
902
|
+
#endif
|
|
903
|
+
#endif
|
|
904
|
+
#endif
|
|
905
|
+
microSurface=saturate(microSurface);float roughness=1.-microSurface;outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.surfaceReflectivityColor=surfaceReflectivityColor;return outParams;}
|
|
906
|
+
`;
|
|
907
|
+
// Sideeffect
|
|
908
|
+
ShaderStore.IncludesShadersStore[name$m] = shader$m;
|
|
909
|
+
|
|
910
|
+
// Do not edit.
|
|
911
|
+
const name$l = "pbrBlockAmbientOcclusion";
|
|
912
|
+
const shader$l = `struct ambientOcclusionOutParams
|
|
913
|
+
{vec3 ambientOcclusionColor;
|
|
914
|
+
#if DEBUGMODE>0 && defined(AMBIENT)
|
|
915
|
+
vec3 ambientOcclusionColorMap;
|
|
916
|
+
#endif
|
|
917
|
+
};ambientOcclusionOutParams ambientOcclusionBlock(
|
|
918
|
+
#ifdef AMBIENT
|
|
919
|
+
in vec3 ambientOcclusionColorMap_,
|
|
920
|
+
in vec4 vAmbientInfos
|
|
921
|
+
#endif
|
|
922
|
+
)
|
|
923
|
+
{ambientOcclusionOutParams outParams;vec3 ambientOcclusionColor=vec3(1.,1.,1.);
|
|
924
|
+
#ifdef AMBIENT
|
|
925
|
+
vec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;
|
|
926
|
+
#ifdef AMBIENTINGRAYSCALE
|
|
927
|
+
ambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);
|
|
928
|
+
#endif
|
|
929
|
+
ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);
|
|
930
|
+
#if DEBUGMODE>0
|
|
931
|
+
outParams.ambientOcclusionColorMap=ambientOcclusionColorMap;
|
|
932
|
+
#endif
|
|
933
|
+
#endif
|
|
934
|
+
outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;}
|
|
935
|
+
`;
|
|
936
|
+
// Sideeffect
|
|
937
|
+
ShaderStore.IncludesShadersStore[name$l] = shader$l;
|
|
938
|
+
|
|
939
|
+
// Do not edit.
|
|
940
|
+
const name$k = "pbrBlockAlphaFresnel";
|
|
941
|
+
const shader$k = `#ifdef ALPHAFRESNEL
|
|
942
|
+
#if defined(ALPHATEST) || defined(ALPHABLEND)
|
|
943
|
+
struct alphaFresnelOutParams
|
|
944
|
+
{float alpha;};
|
|
945
|
+
#define pbr_inline
|
|
946
|
+
alphaFresnelOutParams alphaFresnelBlock(
|
|
947
|
+
in vec3 normalW,
|
|
948
|
+
in vec3 viewDirectionW,
|
|
949
|
+
in float alpha,
|
|
950
|
+
in float microSurface
|
|
951
|
+
)
|
|
952
|
+
{alphaFresnelOutParams outParams;float opacityPerceptual=alpha;
|
|
953
|
+
#ifdef LINEARALPHAFRESNEL
|
|
954
|
+
float opacity0=opacityPerceptual;
|
|
955
|
+
#else
|
|
956
|
+
float opacity0=opacityPerceptual*opacityPerceptual;
|
|
957
|
+
#endif
|
|
958
|
+
float opacity90=fresnelGrazingReflectance(opacity0);vec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;
|
|
959
|
+
#ifdef ALPHATEST
|
|
960
|
+
if (outParams.alpha<ALPHATESTVALUE)
|
|
961
|
+
discard;
|
|
962
|
+
#ifndef ALPHABLEND
|
|
963
|
+
outParams.alpha=1.0;
|
|
964
|
+
#endif
|
|
965
|
+
#endif
|
|
966
|
+
return outParams;}
|
|
967
|
+
#endif
|
|
968
|
+
#endif
|
|
969
|
+
`;
|
|
970
|
+
// Sideeffect
|
|
971
|
+
ShaderStore.IncludesShadersStore[name$k] = shader$k;
|
|
972
|
+
|
|
973
|
+
// Do not edit.
|
|
974
|
+
const name$j = "pbrBlockAnisotropic";
|
|
975
|
+
const shader$j = `#ifdef ANISOTROPIC
|
|
976
|
+
struct anisotropicOutParams
|
|
977
|
+
{float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;vec3 anisotropicNormal;
|
|
978
|
+
#if DEBUGMODE>0 && defined(ANISOTROPIC_TEXTURE)
|
|
979
|
+
vec3 anisotropyMapData;
|
|
980
|
+
#endif
|
|
981
|
+
};
|
|
982
|
+
#define pbr_inline
|
|
983
|
+
anisotropicOutParams anisotropicBlock(
|
|
984
|
+
in vec3 vAnisotropy,
|
|
985
|
+
in float roughness,
|
|
986
|
+
#ifdef ANISOTROPIC_TEXTURE
|
|
987
|
+
in vec3 anisotropyMapData,
|
|
988
|
+
#endif
|
|
989
|
+
in mat3 TBN,
|
|
990
|
+
in vec3 normalW,
|
|
991
|
+
in vec3 viewDirectionW
|
|
992
|
+
)
|
|
993
|
+
{anisotropicOutParams outParams;float anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);
|
|
994
|
+
#ifdef ANISOTROPIC_TEXTURE
|
|
995
|
+
anisotropy*=anisotropyMapData.b;
|
|
996
|
+
#if DEBUGMODE>0
|
|
997
|
+
outParams.anisotropyMapData=anisotropyMapData;
|
|
998
|
+
#endif
|
|
999
|
+
anisotropyMapData.rg=anisotropyMapData.rg*2.0-1.0;
|
|
1000
|
+
#ifdef ANISOTROPIC_LEGACY
|
|
1001
|
+
anisotropyDirection.rg*=anisotropyMapData.rg;
|
|
1002
|
+
#else
|
|
1003
|
+
anisotropyDirection.xy=mat2(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(anisotropyMapData.rg);
|
|
1004
|
+
#endif
|
|
1005
|
+
#endif
|
|
1006
|
+
mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));vec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);vec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));outParams.anisotropy=anisotropy;outParams.anisotropicTangent=anisotropicTangent;outParams.anisotropicBitangent=anisotropicBitangent;outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy,roughness);return outParams;}
|
|
1007
|
+
#endif
|
|
1008
|
+
`;
|
|
1009
|
+
// Sideeffect
|
|
1010
|
+
ShaderStore.IncludesShadersStore[name$j] = shader$j;
|
|
1011
|
+
|
|
1012
|
+
// Do not edit.
|
|
1013
|
+
const name$i = "pbrBlockReflection";
|
|
1014
|
+
const shader$i = `#ifdef REFLECTION
|
|
1015
|
+
struct reflectionOutParams
|
|
1016
|
+
{vec4 environmentRadiance;vec3 environmentIrradiance;
|
|
1017
|
+
#ifdef REFLECTIONMAP_3D
|
|
1018
|
+
vec3 reflectionCoords;
|
|
1019
|
+
#else
|
|
1020
|
+
vec2 reflectionCoords;
|
|
1021
|
+
#endif
|
|
1022
|
+
#ifdef SS_TRANSLUCENCY
|
|
1023
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
1024
|
+
#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
|
|
1025
|
+
vec3 irradianceVector;
|
|
1026
|
+
#endif
|
|
1027
|
+
#endif
|
|
1028
|
+
#endif
|
|
1029
|
+
};
|
|
1030
|
+
#define pbr_inline
|
|
1031
|
+
void createReflectionCoords(
|
|
1032
|
+
in vec3 vPositionW,
|
|
1033
|
+
in vec3 normalW,
|
|
1034
|
+
#ifdef ANISOTROPIC
|
|
1035
|
+
in anisotropicOutParams anisotropicOut,
|
|
1036
|
+
#endif
|
|
1037
|
+
#ifdef REFLECTIONMAP_3D
|
|
1038
|
+
out vec3 reflectionCoords
|
|
1039
|
+
#else
|
|
1040
|
+
out vec2 reflectionCoords
|
|
1041
|
+
#endif
|
|
1042
|
+
)
|
|
1043
|
+
{
|
|
1044
|
+
#ifdef ANISOTROPIC
|
|
1045
|
+
vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);
|
|
1046
|
+
#else
|
|
1047
|
+
vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
|
|
1048
|
+
#endif
|
|
1049
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
1050
|
+
reflectionVector.z*=-1.0;
|
|
1051
|
+
#endif
|
|
1052
|
+
#ifdef REFLECTIONMAP_3D
|
|
1053
|
+
reflectionCoords=reflectionVector;
|
|
1054
|
+
#else
|
|
1055
|
+
reflectionCoords=reflectionVector.xy;
|
|
1056
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
1057
|
+
reflectionCoords/=reflectionVector.z;
|
|
1058
|
+
#endif
|
|
1059
|
+
reflectionCoords.y=1.0-reflectionCoords.y;
|
|
1060
|
+
#endif
|
|
1061
|
+
}
|
|
1062
|
+
#define pbr_inline
|
|
1063
|
+
#define inline
|
|
1064
|
+
void sampleReflectionTexture(
|
|
1065
|
+
in float alphaG,
|
|
1066
|
+
in vec3 vReflectionMicrosurfaceInfos,
|
|
1067
|
+
in vec2 vReflectionInfos,
|
|
1068
|
+
in vec3 vReflectionColor,
|
|
1069
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1070
|
+
in float NdotVUnclamped,
|
|
1071
|
+
#endif
|
|
1072
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
1073
|
+
in float roughness,
|
|
1074
|
+
#endif
|
|
1075
|
+
#ifdef REFLECTIONMAP_3D
|
|
1076
|
+
in samplerCube reflectionSampler,
|
|
1077
|
+
const vec3 reflectionCoords,
|
|
1078
|
+
#else
|
|
1079
|
+
in sampler2D reflectionSampler,
|
|
1080
|
+
const vec2 reflectionCoords,
|
|
1081
|
+
#endif
|
|
1082
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1083
|
+
#ifdef REFLECTIONMAP_3D
|
|
1084
|
+
in samplerCube reflectionSamplerLow,
|
|
1085
|
+
in samplerCube reflectionSamplerHigh,
|
|
1086
|
+
#else
|
|
1087
|
+
in sampler2D reflectionSamplerLow,
|
|
1088
|
+
in sampler2D reflectionSamplerHigh,
|
|
1089
|
+
#endif
|
|
1090
|
+
#endif
|
|
1091
|
+
#ifdef REALTIME_FILTERING
|
|
1092
|
+
in vec2 vReflectionFilteringInfo,
|
|
1093
|
+
#endif
|
|
1094
|
+
out vec4 environmentRadiance
|
|
1095
|
+
)
|
|
1096
|
+
{
|
|
1097
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1098
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);
|
|
1099
|
+
#elif defined(LINEARSPECULARREFLECTION)
|
|
1100
|
+
float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);
|
|
1101
|
+
#else
|
|
1102
|
+
float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);
|
|
1103
|
+
#endif
|
|
1104
|
+
#ifdef LODBASEDMICROSFURACE
|
|
1105
|
+
reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;
|
|
1106
|
+
#ifdef LODINREFLECTIONALPHA
|
|
1107
|
+
float automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);float requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);
|
|
1108
|
+
#else
|
|
1109
|
+
float requestedReflectionLOD=reflectionLOD;
|
|
1110
|
+
#endif
|
|
1111
|
+
#ifdef REALTIME_FILTERING
|
|
1112
|
+
environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);
|
|
1113
|
+
#else
|
|
1114
|
+
environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);
|
|
1115
|
+
#endif
|
|
1116
|
+
#else
|
|
1117
|
+
float lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;vec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);if (lodReflectionNormalizedDoubled<1.0){environmentRadiance=mix(
|
|
1118
|
+
sampleReflection(reflectionSamplerHigh,reflectionCoords),
|
|
1119
|
+
environmentMid,
|
|
1120
|
+
lodReflectionNormalizedDoubled
|
|
1121
|
+
);} else {environmentRadiance=mix(
|
|
1122
|
+
environmentMid,
|
|
1123
|
+
sampleReflection(reflectionSamplerLow,reflectionCoords),
|
|
1124
|
+
lodReflectionNormalizedDoubled-1.0
|
|
1125
|
+
);}
|
|
1126
|
+
#endif
|
|
1127
|
+
#ifdef RGBDREFLECTION
|
|
1128
|
+
environmentRadiance.rgb=fromRGBD(environmentRadiance);
|
|
1129
|
+
#endif
|
|
1130
|
+
#ifdef GAMMAREFLECTION
|
|
1131
|
+
environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);
|
|
1132
|
+
#endif
|
|
1133
|
+
environmentRadiance.rgb*=vReflectionInfos.x;environmentRadiance.rgb*=vReflectionColor.rgb;}
|
|
1134
|
+
#define pbr_inline
|
|
1135
|
+
#define inline
|
|
1136
|
+
reflectionOutParams reflectionBlock(
|
|
1137
|
+
in vec3 vPositionW
|
|
1138
|
+
,in vec3 normalW
|
|
1139
|
+
,in float alphaG
|
|
1140
|
+
,in vec3 vReflectionMicrosurfaceInfos
|
|
1141
|
+
,in vec2 vReflectionInfos
|
|
1142
|
+
,in vec3 vReflectionColor
|
|
1143
|
+
#ifdef ANISOTROPIC
|
|
1144
|
+
,in anisotropicOutParams anisotropicOut
|
|
1145
|
+
#endif
|
|
1146
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1147
|
+
,in float NdotVUnclamped
|
|
1148
|
+
#endif
|
|
1149
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
1150
|
+
,in float roughness
|
|
1151
|
+
#endif
|
|
1152
|
+
#ifdef REFLECTIONMAP_3D
|
|
1153
|
+
,in samplerCube reflectionSampler
|
|
1154
|
+
#else
|
|
1155
|
+
,in sampler2D reflectionSampler
|
|
1156
|
+
#endif
|
|
1157
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
1158
|
+
,in vec3 vEnvironmentIrradiance
|
|
1159
|
+
#endif
|
|
1160
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
1161
|
+
#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
|
|
1162
|
+
,in mat4 reflectionMatrix
|
|
1163
|
+
#endif
|
|
1164
|
+
#endif
|
|
1165
|
+
#ifdef USEIRRADIANCEMAP
|
|
1166
|
+
#ifdef REFLECTIONMAP_3D
|
|
1167
|
+
,in samplerCube irradianceSampler
|
|
1168
|
+
#else
|
|
1169
|
+
,in sampler2D irradianceSampler
|
|
1170
|
+
#endif
|
|
1171
|
+
#endif
|
|
1172
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1173
|
+
#ifdef REFLECTIONMAP_3D
|
|
1174
|
+
,in samplerCube reflectionSamplerLow
|
|
1175
|
+
,in samplerCube reflectionSamplerHigh
|
|
1176
|
+
#else
|
|
1177
|
+
,in sampler2D reflectionSamplerLow
|
|
1178
|
+
,in sampler2D reflectionSamplerHigh
|
|
1179
|
+
#endif
|
|
1180
|
+
#endif
|
|
1181
|
+
#ifdef REALTIME_FILTERING
|
|
1182
|
+
,in vec2 vReflectionFilteringInfo
|
|
1183
|
+
#ifdef IBL_CDF_FILTERING
|
|
1184
|
+
,in sampler2D icdfSampler
|
|
1185
|
+
#endif
|
|
1186
|
+
#endif
|
|
1187
|
+
)
|
|
1188
|
+
{reflectionOutParams outParams;vec4 environmentRadiance=vec4(0.,0.,0.,0.);
|
|
1189
|
+
#ifdef REFLECTIONMAP_3D
|
|
1190
|
+
vec3 reflectionCoords=vec3(0.);
|
|
1191
|
+
#else
|
|
1192
|
+
vec2 reflectionCoords=vec2(0.);
|
|
1193
|
+
#endif
|
|
1194
|
+
createReflectionCoords(
|
|
1195
|
+
vPositionW,
|
|
1196
|
+
normalW,
|
|
1197
|
+
#ifdef ANISOTROPIC
|
|
1198
|
+
anisotropicOut,
|
|
1199
|
+
#endif
|
|
1200
|
+
reflectionCoords
|
|
1201
|
+
);sampleReflectionTexture(
|
|
1202
|
+
alphaG,
|
|
1203
|
+
vReflectionMicrosurfaceInfos,
|
|
1204
|
+
vReflectionInfos,
|
|
1205
|
+
vReflectionColor,
|
|
1206
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1207
|
+
NdotVUnclamped,
|
|
1208
|
+
#endif
|
|
1209
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
1210
|
+
roughness,
|
|
1211
|
+
#endif
|
|
1212
|
+
#ifdef REFLECTIONMAP_3D
|
|
1213
|
+
reflectionSampler,
|
|
1214
|
+
reflectionCoords,
|
|
1215
|
+
#else
|
|
1216
|
+
reflectionSampler,
|
|
1217
|
+
reflectionCoords,
|
|
1218
|
+
#endif
|
|
1219
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1220
|
+
reflectionSamplerLow,
|
|
1221
|
+
reflectionSamplerHigh,
|
|
1222
|
+
#endif
|
|
1223
|
+
#ifdef REALTIME_FILTERING
|
|
1224
|
+
vReflectionFilteringInfo,
|
|
1225
|
+
#endif
|
|
1226
|
+
environmentRadiance
|
|
1227
|
+
);vec3 environmentIrradiance=vec3(0.,0.,0.);
|
|
1228
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
1229
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
1230
|
+
environmentIrradiance=vEnvironmentIrradiance;
|
|
1231
|
+
#else
|
|
1232
|
+
#ifdef ANISOTROPIC
|
|
1233
|
+
vec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;
|
|
1234
|
+
#else
|
|
1235
|
+
vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;
|
|
1236
|
+
#endif
|
|
1237
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
1238
|
+
irradianceVector.z*=-1.0;
|
|
1239
|
+
#endif
|
|
1240
|
+
#ifdef INVERTCUBICMAP
|
|
1241
|
+
irradianceVector.y*=-1.0;
|
|
1242
|
+
#endif
|
|
1243
|
+
#if defined(REALTIME_FILTERING)
|
|
1244
|
+
environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo
|
|
1245
|
+
#ifdef IBL_CDF_FILTERING
|
|
1246
|
+
,icdfSampler
|
|
1247
|
+
#endif
|
|
1248
|
+
);
|
|
1249
|
+
#else
|
|
1250
|
+
environmentIrradiance=computeEnvironmentIrradiance(irradianceVector);
|
|
1251
|
+
#endif
|
|
1252
|
+
#ifdef SS_TRANSLUCENCY
|
|
1253
|
+
outParams.irradianceVector=irradianceVector;
|
|
1254
|
+
#endif
|
|
1255
|
+
#endif
|
|
1256
|
+
#elif defined(USEIRRADIANCEMAP)
|
|
1257
|
+
vec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);environmentIrradiance=environmentIrradiance4.rgb;
|
|
1258
|
+
#ifdef RGBDREFLECTION
|
|
1259
|
+
environmentIrradiance.rgb=fromRGBD(environmentIrradiance4);
|
|
1260
|
+
#endif
|
|
1261
|
+
#ifdef GAMMAREFLECTION
|
|
1262
|
+
environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);
|
|
1263
|
+
#endif
|
|
1264
|
+
#endif
|
|
1265
|
+
environmentIrradiance*=vReflectionColor.rgb;outParams.environmentRadiance=environmentRadiance;outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;return outParams;}
|
|
1266
|
+
#endif
|
|
1267
|
+
`;
|
|
1268
|
+
// Sideeffect
|
|
1269
|
+
ShaderStore.IncludesShadersStore[name$i] = shader$i;
|
|
1270
|
+
|
|
1271
|
+
// Do not edit.
|
|
1272
|
+
const name$h = "pbrBlockSheen";
|
|
1273
|
+
const shader$h = `#ifdef SHEEN
|
|
1274
|
+
struct sheenOutParams
|
|
1275
|
+
{float sheenIntensity;vec3 sheenColor;float sheenRoughness;
|
|
1276
|
+
#ifdef SHEEN_LINKWITHALBEDO
|
|
1277
|
+
vec3 surfaceAlbedo;
|
|
1278
|
+
#endif
|
|
1279
|
+
#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
|
|
1280
|
+
float sheenAlbedoScaling;
|
|
1281
|
+
#endif
|
|
1282
|
+
#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
1283
|
+
vec3 finalSheenRadianceScaled;
|
|
1284
|
+
#endif
|
|
1285
|
+
#if DEBUGMODE>0
|
|
1286
|
+
#ifdef SHEEN_TEXTURE
|
|
1287
|
+
vec4 sheenMapData;
|
|
1288
|
+
#endif
|
|
1289
|
+
#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
1290
|
+
vec3 sheenEnvironmentReflectance;
|
|
1291
|
+
#endif
|
|
1292
|
+
#endif
|
|
1293
|
+
};
|
|
1294
|
+
#define pbr_inline
|
|
1295
|
+
#define inline
|
|
1296
|
+
sheenOutParams sheenBlock(
|
|
1297
|
+
in vec4 vSheenColor
|
|
1298
|
+
#ifdef SHEEN_ROUGHNESS
|
|
1299
|
+
,in float vSheenRoughness
|
|
1300
|
+
#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
1301
|
+
,in vec4 sheenMapRoughnessData
|
|
1302
|
+
#endif
|
|
1303
|
+
#endif
|
|
1304
|
+
,in float roughness
|
|
1305
|
+
#ifdef SHEEN_TEXTURE
|
|
1306
|
+
,in vec4 sheenMapData
|
|
1307
|
+
,in float sheenMapLevel
|
|
1308
|
+
#endif
|
|
1309
|
+
,in float reflectance
|
|
1310
|
+
#ifdef SHEEN_LINKWITHALBEDO
|
|
1311
|
+
,in vec3 baseColor
|
|
1312
|
+
,in vec3 surfaceAlbedo
|
|
1313
|
+
#endif
|
|
1314
|
+
#ifdef ENVIRONMENTBRDF
|
|
1315
|
+
,in float NdotV
|
|
1316
|
+
,in vec3 environmentBrdf
|
|
1317
|
+
#endif
|
|
1318
|
+
#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
1319
|
+
,in vec2 AARoughnessFactors
|
|
1320
|
+
,in vec3 vReflectionMicrosurfaceInfos
|
|
1321
|
+
,in vec2 vReflectionInfos
|
|
1322
|
+
,in vec3 vReflectionColor
|
|
1323
|
+
,in vec4 vLightingIntensity
|
|
1324
|
+
#ifdef REFLECTIONMAP_3D
|
|
1325
|
+
,in samplerCube reflectionSampler
|
|
1326
|
+
,in vec3 reflectionCoords
|
|
1327
|
+
#else
|
|
1328
|
+
,in sampler2D reflectionSampler
|
|
1329
|
+
,in vec2 reflectionCoords
|
|
1330
|
+
#endif
|
|
1331
|
+
,in float NdotVUnclamped
|
|
1332
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1333
|
+
#ifdef REFLECTIONMAP_3D
|
|
1334
|
+
,in samplerCube reflectionSamplerLow
|
|
1335
|
+
,in samplerCube reflectionSamplerHigh
|
|
1336
|
+
#else
|
|
1337
|
+
,in sampler2D reflectionSamplerLow
|
|
1338
|
+
,in sampler2D reflectionSamplerHigh
|
|
1339
|
+
#endif
|
|
1340
|
+
#endif
|
|
1341
|
+
#ifdef REALTIME_FILTERING
|
|
1342
|
+
,in vec2 vReflectionFilteringInfo
|
|
1343
|
+
#endif
|
|
1344
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
|
|
1345
|
+
,in float seo
|
|
1346
|
+
#endif
|
|
1347
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
|
|
1348
|
+
,in float eho
|
|
1349
|
+
#endif
|
|
1350
|
+
#endif
|
|
1351
|
+
)
|
|
1352
|
+
{sheenOutParams outParams;float sheenIntensity=vSheenColor.a;
|
|
1353
|
+
#ifdef SHEEN_TEXTURE
|
|
1354
|
+
#if DEBUGMODE>0
|
|
1355
|
+
outParams.sheenMapData=sheenMapData;
|
|
1356
|
+
#endif
|
|
1357
|
+
#endif
|
|
1358
|
+
#ifdef SHEEN_LINKWITHALBEDO
|
|
1359
|
+
float sheenFactor=pow5(1.0-sheenIntensity);vec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);float sheenRoughness=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;
|
|
1360
|
+
#ifdef SHEEN_TEXTURE
|
|
1361
|
+
sheenIntensity*=sheenMapData.a;
|
|
1362
|
+
#endif
|
|
1363
|
+
#else
|
|
1364
|
+
vec3 sheenColor=vSheenColor.rgb;
|
|
1365
|
+
#ifdef SHEEN_TEXTURE
|
|
1366
|
+
#ifdef SHEEN_GAMMATEXTURE
|
|
1367
|
+
sheenColor.rgb*=toLinearSpace(sheenMapData.rgb);
|
|
1368
|
+
#else
|
|
1369
|
+
sheenColor.rgb*=sheenMapData.rgb;
|
|
1370
|
+
#endif
|
|
1371
|
+
sheenColor.rgb*=sheenMapLevel;
|
|
1372
|
+
#endif
|
|
1373
|
+
#ifdef SHEEN_ROUGHNESS
|
|
1374
|
+
float sheenRoughness=vSheenRoughness;
|
|
1375
|
+
#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE
|
|
1376
|
+
#if defined(SHEEN_TEXTURE)
|
|
1377
|
+
sheenRoughness*=sheenMapData.a;
|
|
1378
|
+
#endif
|
|
1379
|
+
#elif defined(SHEEN_TEXTURE_ROUGHNESS)
|
|
1380
|
+
sheenRoughness*=sheenMapRoughnessData.a;
|
|
1381
|
+
#endif
|
|
1382
|
+
#else
|
|
1383
|
+
float sheenRoughness=roughness;
|
|
1384
|
+
#ifdef SHEEN_TEXTURE
|
|
1385
|
+
sheenIntensity*=sheenMapData.a;
|
|
1386
|
+
#endif
|
|
1387
|
+
#endif
|
|
1388
|
+
#if !defined(SHEEN_ALBEDOSCALING)
|
|
1389
|
+
sheenIntensity*=(1.-reflectance);
|
|
1390
|
+
#endif
|
|
1391
|
+
sheenColor*=sheenIntensity;
|
|
1392
|
+
#endif
|
|
1393
|
+
#ifdef ENVIRONMENTBRDF
|
|
1394
|
+
/*#ifdef SHEEN_SOFTER
|
|
1395
|
+
vec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));
|
|
1396
|
+
#else*/
|
|
1397
|
+
#ifdef SHEEN_ROUGHNESS
|
|
1398
|
+
vec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);
|
|
1399
|
+
#else
|
|
1400
|
+
vec3 environmentSheenBrdf=environmentBrdf;
|
|
1401
|
+
#endif
|
|
1402
|
+
/*#endif*/
|
|
1403
|
+
#endif
|
|
1404
|
+
#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
1405
|
+
float sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);
|
|
1406
|
+
#ifdef SPECULARAA
|
|
1407
|
+
sheenAlphaG+=AARoughnessFactors.y;
|
|
1408
|
+
#endif
|
|
1409
|
+
vec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);sampleReflectionTexture(
|
|
1410
|
+
sheenAlphaG,
|
|
1411
|
+
vReflectionMicrosurfaceInfos,
|
|
1412
|
+
vReflectionInfos,
|
|
1413
|
+
vReflectionColor,
|
|
1414
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1415
|
+
NdotVUnclamped,
|
|
1416
|
+
#endif
|
|
1417
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
1418
|
+
sheenRoughness,
|
|
1419
|
+
#endif
|
|
1420
|
+
reflectionSampler,
|
|
1421
|
+
reflectionCoords,
|
|
1422
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1423
|
+
reflectionSamplerLow,
|
|
1424
|
+
reflectionSamplerHigh,
|
|
1425
|
+
#endif
|
|
1426
|
+
#ifdef REALTIME_FILTERING
|
|
1427
|
+
vReflectionFilteringInfo,
|
|
1428
|
+
#endif
|
|
1429
|
+
environmentSheenRadiance
|
|
1430
|
+
);vec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);
|
|
1431
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
|
|
1432
|
+
sheenEnvironmentReflectance*=seo;
|
|
1433
|
+
#endif
|
|
1434
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
|
|
1435
|
+
sheenEnvironmentReflectance*=eho;
|
|
1436
|
+
#endif
|
|
1437
|
+
#if DEBUGMODE>0
|
|
1438
|
+
outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;
|
|
1439
|
+
#endif
|
|
1440
|
+
outParams.finalSheenRadianceScaled=
|
|
1441
|
+
environmentSheenRadiance.rgb *
|
|
1442
|
+
sheenEnvironmentReflectance *
|
|
1443
|
+
vLightingIntensity.z;
|
|
1444
|
+
#endif
|
|
1445
|
+
#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
|
|
1446
|
+
outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;
|
|
1447
|
+
#endif
|
|
1448
|
+
outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;}
|
|
1449
|
+
#endif
|
|
1450
|
+
`;
|
|
1451
|
+
// Sideeffect
|
|
1452
|
+
ShaderStore.IncludesShadersStore[name$h] = shader$h;
|
|
1453
|
+
|
|
1454
|
+
// Do not edit.
|
|
1455
|
+
const name$g = "pbrBlockClearcoat";
|
|
1456
|
+
const shader$g = `struct clearcoatOutParams
|
|
1457
|
+
{vec3 specularEnvironmentR0;float conservationFactor;vec3 clearCoatNormalW;vec2 clearCoatAARoughnessFactors;float clearCoatIntensity;float clearCoatRoughness;
|
|
1458
|
+
#ifdef REFLECTION
|
|
1459
|
+
vec3 finalClearCoatRadianceScaled;
|
|
1460
|
+
#endif
|
|
1461
|
+
#ifdef CLEARCOAT_TINT
|
|
1462
|
+
vec3 absorption;float clearCoatNdotVRefract;vec3 clearCoatColor;float clearCoatThickness;
|
|
1463
|
+
#endif
|
|
1464
|
+
#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
1465
|
+
vec3 energyConservationFactorClearCoat;
|
|
1466
|
+
#endif
|
|
1467
|
+
#if DEBUGMODE>0
|
|
1468
|
+
#ifdef CLEARCOAT_BUMP
|
|
1469
|
+
mat3 TBNClearCoat;
|
|
1470
|
+
#endif
|
|
1471
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
1472
|
+
vec2 clearCoatMapData;
|
|
1473
|
+
#endif
|
|
1474
|
+
#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
|
|
1475
|
+
vec4 clearCoatTintMapData;
|
|
1476
|
+
#endif
|
|
1477
|
+
#ifdef REFLECTION
|
|
1478
|
+
vec4 environmentClearCoatRadiance;vec3 clearCoatEnvironmentReflectance;
|
|
1479
|
+
#endif
|
|
1480
|
+
float clearCoatNdotV;
|
|
1481
|
+
#endif
|
|
1482
|
+
};
|
|
1483
|
+
#ifdef CLEARCOAT
|
|
1484
|
+
#define pbr_inline
|
|
1485
|
+
#define inline
|
|
1486
|
+
clearcoatOutParams clearcoatBlock(
|
|
1487
|
+
in vec3 vPositionW
|
|
1488
|
+
,in vec3 geometricNormalW
|
|
1489
|
+
,in vec3 viewDirectionW
|
|
1490
|
+
,in vec2 vClearCoatParams
|
|
1491
|
+
#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
1492
|
+
,in vec4 clearCoatMapRoughnessData
|
|
1493
|
+
#endif
|
|
1494
|
+
,in vec3 specularEnvironmentR0
|
|
1495
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
1496
|
+
,in vec2 clearCoatMapData
|
|
1497
|
+
#endif
|
|
1498
|
+
#ifdef CLEARCOAT_TINT
|
|
1499
|
+
,in vec4 vClearCoatTintParams
|
|
1500
|
+
,in float clearCoatColorAtDistance
|
|
1501
|
+
,in vec4 vClearCoatRefractionParams
|
|
1502
|
+
#ifdef CLEARCOAT_TINT_TEXTURE
|
|
1503
|
+
,in vec4 clearCoatTintMapData
|
|
1504
|
+
#endif
|
|
1505
|
+
#endif
|
|
1506
|
+
#ifdef CLEARCOAT_BUMP
|
|
1507
|
+
,in vec2 vClearCoatBumpInfos
|
|
1508
|
+
,in vec4 clearCoatBumpMapData
|
|
1509
|
+
,in vec2 vClearCoatBumpUV
|
|
1510
|
+
#if defined(TANGENT) && defined(NORMAL)
|
|
1511
|
+
,in mat3 vTBN
|
|
1512
|
+
#else
|
|
1513
|
+
,in vec2 vClearCoatTangentSpaceParams
|
|
1514
|
+
#endif
|
|
1515
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
1516
|
+
,in mat4 normalMatrix
|
|
1517
|
+
#endif
|
|
1518
|
+
#endif
|
|
1519
|
+
#if defined(FORCENORMALFORWARD) && defined(NORMAL)
|
|
1520
|
+
,in vec3 faceNormal
|
|
1521
|
+
#endif
|
|
1522
|
+
#ifdef REFLECTION
|
|
1523
|
+
,in vec3 vReflectionMicrosurfaceInfos
|
|
1524
|
+
,in vec2 vReflectionInfos
|
|
1525
|
+
,in vec3 vReflectionColor
|
|
1526
|
+
,in vec4 vLightingIntensity
|
|
1527
|
+
#ifdef REFLECTIONMAP_3D
|
|
1528
|
+
,in samplerCube reflectionSampler
|
|
1529
|
+
#else
|
|
1530
|
+
,in sampler2D reflectionSampler
|
|
1531
|
+
#endif
|
|
1532
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1533
|
+
#ifdef REFLECTIONMAP_3D
|
|
1534
|
+
,in samplerCube reflectionSamplerLow
|
|
1535
|
+
,in samplerCube reflectionSamplerHigh
|
|
1536
|
+
#else
|
|
1537
|
+
,in sampler2D reflectionSamplerLow
|
|
1538
|
+
,in sampler2D reflectionSamplerHigh
|
|
1539
|
+
#endif
|
|
1540
|
+
#endif
|
|
1541
|
+
#ifdef REALTIME_FILTERING
|
|
1542
|
+
,in vec2 vReflectionFilteringInfo
|
|
1543
|
+
#endif
|
|
1544
|
+
#endif
|
|
1545
|
+
#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
|
|
1546
|
+
,in float frontFacingMultiplier
|
|
1547
|
+
#endif
|
|
1548
|
+
)
|
|
1549
|
+
{clearcoatOutParams outParams;float clearCoatIntensity=vClearCoatParams.x;float clearCoatRoughness=vClearCoatParams.y;
|
|
1550
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
1551
|
+
clearCoatIntensity*=clearCoatMapData.x;
|
|
1552
|
+
#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE
|
|
1553
|
+
clearCoatRoughness*=clearCoatMapData.y;
|
|
1554
|
+
#endif
|
|
1555
|
+
#if DEBUGMODE>0
|
|
1556
|
+
outParams.clearCoatMapData=clearCoatMapData;
|
|
1557
|
+
#endif
|
|
1558
|
+
#endif
|
|
1559
|
+
#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
1560
|
+
clearCoatRoughness*=clearCoatMapRoughnessData.y;
|
|
1561
|
+
#endif
|
|
1562
|
+
outParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness;
|
|
1563
|
+
#ifdef CLEARCOAT_TINT
|
|
1564
|
+
vec3 clearCoatColor=vClearCoatTintParams.rgb;float clearCoatThickness=vClearCoatTintParams.a;
|
|
1565
|
+
#ifdef CLEARCOAT_TINT_TEXTURE
|
|
1566
|
+
#ifdef CLEARCOAT_TINT_GAMMATEXTURE
|
|
1567
|
+
clearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);
|
|
1568
|
+
#else
|
|
1569
|
+
clearCoatColor*=clearCoatTintMapData.rgb;
|
|
1570
|
+
#endif
|
|
1571
|
+
clearCoatThickness*=clearCoatTintMapData.a;
|
|
1572
|
+
#if DEBUGMODE>0
|
|
1573
|
+
outParams.clearCoatTintMapData=clearCoatTintMapData;
|
|
1574
|
+
#endif
|
|
1575
|
+
#endif
|
|
1576
|
+
outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness;
|
|
1577
|
+
#endif
|
|
1578
|
+
#ifdef CLEARCOAT_REMAP_F0
|
|
1579
|
+
vec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);
|
|
1580
|
+
#else
|
|
1581
|
+
vec3 specularEnvironmentR0Updated=specularEnvironmentR0;
|
|
1582
|
+
#endif
|
|
1583
|
+
outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);vec3 clearCoatNormalW=geometricNormalW;
|
|
1584
|
+
#ifdef CLEARCOAT_BUMP
|
|
1585
|
+
#ifdef NORMALXYSCALE
|
|
1586
|
+
float clearCoatNormalScale=1.0;
|
|
1587
|
+
#else
|
|
1588
|
+
float clearCoatNormalScale=vClearCoatBumpInfos.y;
|
|
1589
|
+
#endif
|
|
1590
|
+
#if defined(TANGENT) && defined(NORMAL)
|
|
1591
|
+
mat3 TBNClearCoat=vTBN;
|
|
1592
|
+
#else
|
|
1593
|
+
vec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;mat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);
|
|
1594
|
+
#endif
|
|
1595
|
+
#if DEBUGMODE>0
|
|
1596
|
+
outParams.TBNClearCoat=TBNClearCoat;
|
|
1597
|
+
#endif
|
|
1598
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
1599
|
+
clearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);
|
|
1600
|
+
#else
|
|
1601
|
+
clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);
|
|
1602
|
+
#endif
|
|
1603
|
+
#endif
|
|
1604
|
+
#if defined(FORCENORMALFORWARD) && defined(NORMAL)
|
|
1605
|
+
clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));
|
|
1606
|
+
#endif
|
|
1607
|
+
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
1608
|
+
clearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;
|
|
1609
|
+
#endif
|
|
1610
|
+
outParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);float clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);float clearCoatNdotV=absEps(clearCoatNdotVUnclamped);
|
|
1611
|
+
#if DEBUGMODE>0
|
|
1612
|
+
outParams.clearCoatNdotV=clearCoatNdotV;
|
|
1613
|
+
#endif
|
|
1614
|
+
#ifdef CLEARCOAT_TINT
|
|
1615
|
+
vec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));
|
|
1616
|
+
#endif
|
|
1617
|
+
#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))
|
|
1618
|
+
vec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);
|
|
1619
|
+
#endif
|
|
1620
|
+
#if defined(REFLECTION)
|
|
1621
|
+
float clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);
|
|
1622
|
+
#ifdef SPECULARAA
|
|
1623
|
+
clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;
|
|
1624
|
+
#endif
|
|
1625
|
+
vec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);vec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);
|
|
1626
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
1627
|
+
clearCoatReflectionVector.z*=-1.0;
|
|
1628
|
+
#endif
|
|
1629
|
+
#ifdef REFLECTIONMAP_3D
|
|
1630
|
+
vec3 clearCoatReflectionCoords=clearCoatReflectionVector;
|
|
1631
|
+
#else
|
|
1632
|
+
vec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;
|
|
1633
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
1634
|
+
clearCoatReflectionCoords/=clearCoatReflectionVector.z;
|
|
1635
|
+
#endif
|
|
1636
|
+
clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;
|
|
1637
|
+
#endif
|
|
1638
|
+
sampleReflectionTexture(
|
|
1639
|
+
clearCoatAlphaG,
|
|
1640
|
+
vReflectionMicrosurfaceInfos,
|
|
1641
|
+
vReflectionInfos,
|
|
1642
|
+
vReflectionColor,
|
|
1643
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1644
|
+
clearCoatNdotVUnclamped,
|
|
1645
|
+
#endif
|
|
1646
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
1647
|
+
clearCoatRoughness,
|
|
1648
|
+
#endif
|
|
1649
|
+
reflectionSampler,
|
|
1650
|
+
clearCoatReflectionCoords,
|
|
1651
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1652
|
+
reflectionSamplerLow,
|
|
1653
|
+
reflectionSamplerHigh,
|
|
1654
|
+
#endif
|
|
1655
|
+
#ifdef REALTIME_FILTERING
|
|
1656
|
+
vReflectionFilteringInfo,
|
|
1657
|
+
#endif
|
|
1658
|
+
environmentClearCoatRadiance
|
|
1659
|
+
);
|
|
1660
|
+
#if DEBUGMODE>0
|
|
1661
|
+
outParams.environmentClearCoatRadiance=environmentClearCoatRadiance;
|
|
1662
|
+
#endif
|
|
1663
|
+
#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
1664
|
+
vec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);
|
|
1665
|
+
#ifdef HORIZONOCCLUSION
|
|
1666
|
+
#ifdef BUMP
|
|
1667
|
+
#ifdef REFLECTIONMAP_3D
|
|
1668
|
+
float clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho;
|
|
1669
|
+
#endif
|
|
1670
|
+
#endif
|
|
1671
|
+
#endif
|
|
1672
|
+
#else
|
|
1673
|
+
vec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));
|
|
1674
|
+
#endif
|
|
1675
|
+
clearCoatEnvironmentReflectance*=clearCoatIntensity;
|
|
1676
|
+
#if DEBUGMODE>0
|
|
1677
|
+
outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;
|
|
1678
|
+
#endif
|
|
1679
|
+
outParams.finalClearCoatRadianceScaled=
|
|
1680
|
+
environmentClearCoatRadiance.rgb *
|
|
1681
|
+
clearCoatEnvironmentReflectance *
|
|
1682
|
+
vLightingIntensity.z;
|
|
1683
|
+
#endif
|
|
1684
|
+
#if defined(CLEARCOAT_TINT)
|
|
1685
|
+
outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);
|
|
1686
|
+
#endif
|
|
1687
|
+
float fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat);
|
|
1688
|
+
#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
1689
|
+
outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);
|
|
1690
|
+
#endif
|
|
1691
|
+
return outParams;}
|
|
1692
|
+
#endif
|
|
1693
|
+
`;
|
|
1694
|
+
// Sideeffect
|
|
1695
|
+
ShaderStore.IncludesShadersStore[name$g] = shader$g;
|
|
1696
|
+
|
|
1697
|
+
// Do not edit.
|
|
1698
|
+
const name$f = "pbrBlockIridescence";
|
|
1699
|
+
const shader$f = `struct iridescenceOutParams
|
|
1700
|
+
{float iridescenceIntensity;float iridescenceIOR;float iridescenceThickness;vec3 specularEnvironmentR0;};
|
|
1701
|
+
#ifdef IRIDESCENCE
|
|
1702
|
+
#define pbr_inline
|
|
1703
|
+
#define inline
|
|
1704
|
+
iridescenceOutParams iridescenceBlock(
|
|
1705
|
+
in vec4 vIridescenceParams
|
|
1706
|
+
,in float viewAngle
|
|
1707
|
+
,in vec3 specularEnvironmentR0
|
|
1708
|
+
#ifdef IRIDESCENCE_TEXTURE
|
|
1709
|
+
,in vec2 iridescenceMapData
|
|
1710
|
+
#endif
|
|
1711
|
+
#ifdef IRIDESCENCE_THICKNESS_TEXTURE
|
|
1712
|
+
,in vec2 iridescenceThicknessMapData
|
|
1713
|
+
#endif
|
|
1714
|
+
#ifdef CLEARCOAT
|
|
1715
|
+
,in float NdotVUnclamped
|
|
1716
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
1717
|
+
,in vec2 clearCoatMapData
|
|
1718
|
+
#endif
|
|
1719
|
+
#endif
|
|
1720
|
+
)
|
|
1721
|
+
{iridescenceOutParams outParams;float iridescenceIntensity=vIridescenceParams.x;float iridescenceIOR=vIridescenceParams.y;float iridescenceThicknessMin=vIridescenceParams.z;float iridescenceThicknessMax=vIridescenceParams.w;float iridescenceThicknessWeight=1.;
|
|
1722
|
+
#ifdef IRIDESCENCE_TEXTURE
|
|
1723
|
+
iridescenceIntensity*=iridescenceMapData.x;
|
|
1724
|
+
#endif
|
|
1725
|
+
#if defined(IRIDESCENCE_THICKNESS_TEXTURE)
|
|
1726
|
+
iridescenceThicknessWeight=iridescenceThicknessMapData.g;
|
|
1727
|
+
#endif
|
|
1728
|
+
float iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);float topIor=1.;
|
|
1729
|
+
#ifdef CLEARCOAT
|
|
1730
|
+
float clearCoatIntensity=vClearCoatParams.x;
|
|
1731
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
1732
|
+
clearCoatIntensity*=clearCoatMapData.x;
|
|
1733
|
+
#endif
|
|
1734
|
+
topIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0));
|
|
1735
|
+
#endif
|
|
1736
|
+
vec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);outParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);outParams.iridescenceIntensity=iridescenceIntensity;outParams.iridescenceThickness=iridescenceThickness;outParams.iridescenceIOR=iridescenceIOR;return outParams;}
|
|
1737
|
+
#endif
|
|
1738
|
+
`;
|
|
1739
|
+
// Sideeffect
|
|
1740
|
+
ShaderStore.IncludesShadersStore[name$f] = shader$f;
|
|
1741
|
+
|
|
1742
|
+
// Do not edit.
|
|
1743
|
+
const name$e = "pbrBlockSubSurface";
|
|
1744
|
+
const shader$e = `struct subSurfaceOutParams
|
|
1745
|
+
{vec3 specularEnvironmentReflectance;
|
|
1746
|
+
#ifdef SS_REFRACTION
|
|
1747
|
+
vec3 finalRefraction;vec3 surfaceAlbedo;
|
|
1748
|
+
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
|
|
1749
|
+
float alpha;
|
|
1750
|
+
#endif
|
|
1751
|
+
#ifdef REFLECTION
|
|
1752
|
+
float refractionFactorForIrradiance;
|
|
1753
|
+
#endif
|
|
1754
|
+
#endif
|
|
1755
|
+
#ifdef SS_TRANSLUCENCY
|
|
1756
|
+
vec3 transmittance;float translucencyIntensity;
|
|
1757
|
+
#ifdef REFLECTION
|
|
1758
|
+
vec3 refractionIrradiance;
|
|
1759
|
+
#endif
|
|
1760
|
+
#endif
|
|
1761
|
+
#if DEBUGMODE>0
|
|
1762
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
1763
|
+
vec4 thicknessMap;
|
|
1764
|
+
#endif
|
|
1765
|
+
#ifdef SS_REFRACTION
|
|
1766
|
+
vec4 environmentRefraction;vec3 refractionTransmittance;
|
|
1767
|
+
#endif
|
|
1768
|
+
#endif
|
|
1769
|
+
};
|
|
1770
|
+
#ifdef SUBSURFACE
|
|
1771
|
+
#ifdef SS_REFRACTION
|
|
1772
|
+
#define pbr_inline
|
|
1773
|
+
#define inline
|
|
1774
|
+
vec4 sampleEnvironmentRefraction(
|
|
1775
|
+
in float ior
|
|
1776
|
+
,in float thickness
|
|
1777
|
+
,in float refractionLOD
|
|
1778
|
+
,in vec3 normalW
|
|
1779
|
+
,in vec3 vPositionW
|
|
1780
|
+
,in vec3 viewDirectionW
|
|
1781
|
+
,in mat4 view
|
|
1782
|
+
,in vec4 vRefractionInfos
|
|
1783
|
+
,in mat4 refractionMatrix
|
|
1784
|
+
,in vec4 vRefractionMicrosurfaceInfos
|
|
1785
|
+
,in float alphaG
|
|
1786
|
+
#ifdef SS_REFRACTIONMAP_3D
|
|
1787
|
+
,in samplerCube refractionSampler
|
|
1788
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1789
|
+
,in samplerCube refractionSamplerLow
|
|
1790
|
+
,in samplerCube refractionSamplerHigh
|
|
1791
|
+
#endif
|
|
1792
|
+
#else
|
|
1793
|
+
,in sampler2D refractionSampler
|
|
1794
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1795
|
+
,in sampler2D refractionSamplerLow
|
|
1796
|
+
,in sampler2D refractionSamplerHigh
|
|
1797
|
+
#endif
|
|
1798
|
+
#endif
|
|
1799
|
+
#ifdef ANISOTROPIC
|
|
1800
|
+
,in anisotropicOutParams anisotropicOut
|
|
1801
|
+
#endif
|
|
1802
|
+
#ifdef REALTIME_FILTERING
|
|
1803
|
+
,in vec2 vRefractionFilteringInfo
|
|
1804
|
+
#endif
|
|
1805
|
+
#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
1806
|
+
,in vec3 refractionPosition
|
|
1807
|
+
,in vec3 refractionSize
|
|
1808
|
+
#endif
|
|
1809
|
+
) {vec4 environmentRefraction=vec4(0.,0.,0.,0.);
|
|
1810
|
+
#ifdef ANISOTROPIC
|
|
1811
|
+
vec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior);
|
|
1812
|
+
#else
|
|
1813
|
+
vec3 refractionVector=refract(-viewDirectionW,normalW,ior);
|
|
1814
|
+
#endif
|
|
1815
|
+
#ifdef SS_REFRACTIONMAP_OPPOSITEZ
|
|
1816
|
+
refractionVector.z*=-1.0;
|
|
1817
|
+
#endif
|
|
1818
|
+
#ifdef SS_REFRACTIONMAP_3D
|
|
1819
|
+
#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
1820
|
+
refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);
|
|
1821
|
+
#endif
|
|
1822
|
+
refractionVector.y=refractionVector.y*vRefractionInfos.w;vec3 refractionCoords=refractionVector;refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));
|
|
1823
|
+
#else
|
|
1824
|
+
#ifdef SS_USE_THICKNESS_AS_DEPTH
|
|
1825
|
+
vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));
|
|
1826
|
+
#else
|
|
1827
|
+
vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));
|
|
1828
|
+
#endif
|
|
1829
|
+
vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;
|
|
1830
|
+
#endif
|
|
1831
|
+
#ifdef LODBASEDMICROSFURACE
|
|
1832
|
+
refractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;
|
|
1833
|
+
#ifdef SS_LODINREFRACTIONALPHA
|
|
1834
|
+
float automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);
|
|
1835
|
+
#else
|
|
1836
|
+
float requestedRefractionLOD=refractionLOD;
|
|
1837
|
+
#endif
|
|
1838
|
+
#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)
|
|
1839
|
+
environmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);
|
|
1840
|
+
#else
|
|
1841
|
+
environmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);
|
|
1842
|
+
#endif
|
|
1843
|
+
#else
|
|
1844
|
+
float lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix(
|
|
1845
|
+
sampleRefraction(refractionSamplerHigh,refractionCoords),
|
|
1846
|
+
environmentRefractionMid,
|
|
1847
|
+
lodRefractionNormalizedDoubled
|
|
1848
|
+
);} else {environmentRefraction=mix(
|
|
1849
|
+
environmentRefractionMid,
|
|
1850
|
+
sampleRefraction(refractionSamplerLow,refractionCoords),
|
|
1851
|
+
lodRefractionNormalizedDoubled-1.0
|
|
1852
|
+
);}
|
|
1853
|
+
#endif
|
|
1854
|
+
#ifdef SS_RGBDREFRACTION
|
|
1855
|
+
environmentRefraction.rgb=fromRGBD(environmentRefraction);
|
|
1856
|
+
#endif
|
|
1857
|
+
#ifdef SS_GAMMAREFRACTION
|
|
1858
|
+
environmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);
|
|
1859
|
+
#endif
|
|
1860
|
+
return environmentRefraction;}
|
|
1861
|
+
#endif
|
|
1862
|
+
#define pbr_inline
|
|
1863
|
+
#define inline
|
|
1864
|
+
subSurfaceOutParams subSurfaceBlock(
|
|
1865
|
+
in vec3 vSubSurfaceIntensity
|
|
1866
|
+
,in vec2 vThicknessParam
|
|
1867
|
+
,in vec4 vTintColor
|
|
1868
|
+
,in vec3 normalW
|
|
1869
|
+
,in vec3 specularEnvironmentReflectance
|
|
1870
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
1871
|
+
,in vec4 thicknessMap
|
|
1872
|
+
#endif
|
|
1873
|
+
#ifdef SS_REFRACTIONINTENSITY_TEXTURE
|
|
1874
|
+
,in vec4 refractionIntensityMap
|
|
1875
|
+
#endif
|
|
1876
|
+
#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
|
|
1877
|
+
,in vec4 translucencyIntensityMap
|
|
1878
|
+
#endif
|
|
1879
|
+
#ifdef REFLECTION
|
|
1880
|
+
#ifdef SS_TRANSLUCENCY
|
|
1881
|
+
,in mat4 reflectionMatrix
|
|
1882
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
1883
|
+
#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
|
|
1884
|
+
,in vec3 irradianceVector_
|
|
1885
|
+
#endif
|
|
1886
|
+
#if defined(REALTIME_FILTERING)
|
|
1887
|
+
,in samplerCube reflectionSampler
|
|
1888
|
+
,in vec2 vReflectionFilteringInfo
|
|
1889
|
+
#ifdef IBL_CDF_FILTERING
|
|
1890
|
+
,in sampler2D icdfSampler
|
|
1891
|
+
#endif
|
|
1892
|
+
#endif
|
|
1893
|
+
#endif
|
|
1894
|
+
#ifdef USEIRRADIANCEMAP
|
|
1895
|
+
#ifdef REFLECTIONMAP_3D
|
|
1896
|
+
,in samplerCube irradianceSampler
|
|
1897
|
+
#else
|
|
1898
|
+
,in sampler2D irradianceSampler
|
|
1899
|
+
#endif
|
|
1900
|
+
#endif
|
|
1901
|
+
#endif
|
|
1902
|
+
#endif
|
|
1903
|
+
#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
|
|
1904
|
+
,in vec3 surfaceAlbedo
|
|
1905
|
+
#endif
|
|
1906
|
+
#ifdef SS_REFRACTION
|
|
1907
|
+
,in vec3 vPositionW
|
|
1908
|
+
,in vec3 viewDirectionW
|
|
1909
|
+
,in mat4 view
|
|
1910
|
+
,in vec4 vRefractionInfos
|
|
1911
|
+
,in mat4 refractionMatrix
|
|
1912
|
+
,in vec4 vRefractionMicrosurfaceInfos
|
|
1913
|
+
,in vec4 vLightingIntensity
|
|
1914
|
+
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
|
|
1915
|
+
,in float alpha
|
|
1916
|
+
#endif
|
|
1917
|
+
#ifdef SS_LODINREFRACTIONALPHA
|
|
1918
|
+
,in float NdotVUnclamped
|
|
1919
|
+
#endif
|
|
1920
|
+
#ifdef SS_LINEARSPECULARREFRACTION
|
|
1921
|
+
,in float roughness
|
|
1922
|
+
#endif
|
|
1923
|
+
,in float alphaG
|
|
1924
|
+
#ifdef SS_REFRACTIONMAP_3D
|
|
1925
|
+
,in samplerCube refractionSampler
|
|
1926
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1927
|
+
,in samplerCube refractionSamplerLow
|
|
1928
|
+
,in samplerCube refractionSamplerHigh
|
|
1929
|
+
#endif
|
|
1930
|
+
#else
|
|
1931
|
+
,in sampler2D refractionSampler
|
|
1932
|
+
#ifndef LODBASEDMICROSFURACE
|
|
1933
|
+
,in sampler2D refractionSamplerLow
|
|
1934
|
+
,in sampler2D refractionSamplerHigh
|
|
1935
|
+
#endif
|
|
1936
|
+
#endif
|
|
1937
|
+
#ifdef ANISOTROPIC
|
|
1938
|
+
,in anisotropicOutParams anisotropicOut
|
|
1939
|
+
#endif
|
|
1940
|
+
#ifdef REALTIME_FILTERING
|
|
1941
|
+
,in vec2 vRefractionFilteringInfo
|
|
1942
|
+
#endif
|
|
1943
|
+
#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
1944
|
+
,in vec3 refractionPosition
|
|
1945
|
+
,in vec3 refractionSize
|
|
1946
|
+
#endif
|
|
1947
|
+
#ifdef SS_DISPERSION
|
|
1948
|
+
,in float dispersion
|
|
1949
|
+
#endif
|
|
1950
|
+
#endif
|
|
1951
|
+
#ifdef SS_TRANSLUCENCY
|
|
1952
|
+
,in vec3 vDiffusionDistance
|
|
1953
|
+
,in vec4 vTranslucencyColor
|
|
1954
|
+
#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
|
|
1955
|
+
,in vec4 translucencyColorMap
|
|
1956
|
+
#endif
|
|
1957
|
+
#endif
|
|
1958
|
+
)
|
|
1959
|
+
{subSurfaceOutParams outParams;outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;
|
|
1960
|
+
#ifdef SS_REFRACTION
|
|
1961
|
+
float refractionIntensity=vSubSurfaceIntensity.x;
|
|
1962
|
+
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
|
|
1963
|
+
refractionIntensity*=(1.0-alpha);outParams.alpha=1.0;
|
|
1964
|
+
#endif
|
|
1965
|
+
#endif
|
|
1966
|
+
#ifdef SS_TRANSLUCENCY
|
|
1967
|
+
float translucencyIntensity=vSubSurfaceIntensity.y;
|
|
1968
|
+
#endif
|
|
1969
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
1970
|
+
#ifdef SS_USE_GLTF_TEXTURES
|
|
1971
|
+
float thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;
|
|
1972
|
+
#else
|
|
1973
|
+
float thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;
|
|
1974
|
+
#endif
|
|
1975
|
+
#if DEBUGMODE>0
|
|
1976
|
+
outParams.thicknessMap=thicknessMap;
|
|
1977
|
+
#endif
|
|
1978
|
+
#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS)
|
|
1979
|
+
#ifdef SS_USE_GLTF_TEXTURES
|
|
1980
|
+
refractionIntensity*=thicknessMap.r;
|
|
1981
|
+
#else
|
|
1982
|
+
refractionIntensity*=thicknessMap.g;
|
|
1983
|
+
#endif
|
|
1984
|
+
#endif
|
|
1985
|
+
#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS)
|
|
1986
|
+
#ifdef SS_USE_GLTF_TEXTURES
|
|
1987
|
+
translucencyIntensity*=thicknessMap.a;
|
|
1988
|
+
#else
|
|
1989
|
+
translucencyIntensity*=thicknessMap.b;
|
|
1990
|
+
#endif
|
|
1991
|
+
#endif
|
|
1992
|
+
#else
|
|
1993
|
+
float thickness=vThicknessParam.y;
|
|
1994
|
+
#endif
|
|
1995
|
+
#if defined(SS_REFRACTION) && defined(SS_REFRACTIONINTENSITY_TEXTURE)
|
|
1996
|
+
#ifdef SS_USE_GLTF_TEXTURES
|
|
1997
|
+
refractionIntensity*=refractionIntensityMap.r;
|
|
1998
|
+
#else
|
|
1999
|
+
refractionIntensity*=refractionIntensityMap.g;
|
|
2000
|
+
#endif
|
|
2001
|
+
#endif
|
|
2002
|
+
#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCYINTENSITY_TEXTURE)
|
|
2003
|
+
#ifdef SS_USE_GLTF_TEXTURES
|
|
2004
|
+
translucencyIntensity*=translucencyIntensityMap.a;
|
|
2005
|
+
#else
|
|
2006
|
+
translucencyIntensity*=translucencyIntensityMap.b;
|
|
2007
|
+
#endif
|
|
2008
|
+
#endif
|
|
2009
|
+
#ifdef SS_TRANSLUCENCY
|
|
2010
|
+
thickness=maxEps(thickness);vec4 translucencyColor=vTranslucencyColor;
|
|
2011
|
+
#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
|
|
2012
|
+
translucencyColor*=translucencyColorMap;
|
|
2013
|
+
#endif
|
|
2014
|
+
vec3 transmittance=transmittanceBRDF_Burley(translucencyColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;
|
|
2015
|
+
#endif
|
|
2016
|
+
#ifdef SS_REFRACTION
|
|
2017
|
+
vec4 environmentRefraction=vec4(0.,0.,0.,0.);
|
|
2018
|
+
#ifdef SS_HAS_THICKNESS
|
|
2019
|
+
float ior=vRefractionInfos.y;
|
|
2020
|
+
#else
|
|
2021
|
+
float ior=vRefractionMicrosurfaceInfos.w;
|
|
2022
|
+
#endif
|
|
2023
|
+
#ifdef SS_LODINREFRACTIONALPHA
|
|
2024
|
+
float refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);
|
|
2025
|
+
#elif defined(SS_LINEARSPECULARREFRACTION)
|
|
2026
|
+
float refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);
|
|
2027
|
+
#else
|
|
2028
|
+
float refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);
|
|
2029
|
+
#endif
|
|
2030
|
+
float refraction_ior=vRefractionInfos.y;
|
|
2031
|
+
#ifdef SS_DISPERSION
|
|
2032
|
+
float realIOR=1.0/refraction_ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {refraction_ior=iors[i];
|
|
2033
|
+
#endif
|
|
2034
|
+
vec4 envSample=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG
|
|
2035
|
+
#ifdef SS_REFRACTIONMAP_3D
|
|
2036
|
+
,refractionSampler
|
|
2037
|
+
#ifndef LODBASEDMICROSFURACE
|
|
2038
|
+
,refractionSamplerLow
|
|
2039
|
+
,refractionSamplerHigh
|
|
2040
|
+
#endif
|
|
2041
|
+
#else
|
|
2042
|
+
,refractionSampler
|
|
2043
|
+
#ifndef LODBASEDMICROSFURACE
|
|
2044
|
+
,refractionSamplerLow
|
|
2045
|
+
,refractionSamplerHigh
|
|
2046
|
+
#endif
|
|
2047
|
+
#endif
|
|
2048
|
+
#ifdef ANISOTROPIC
|
|
2049
|
+
,anisotropicOut
|
|
2050
|
+
#endif
|
|
2051
|
+
#ifdef REALTIME_FILTERING
|
|
2052
|
+
,vRefractionFilteringInfo
|
|
2053
|
+
#endif
|
|
2054
|
+
#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
2055
|
+
,refractionPosition
|
|
2056
|
+
,refractionSize
|
|
2057
|
+
#endif
|
|
2058
|
+
);
|
|
2059
|
+
#ifdef SS_DISPERSION
|
|
2060
|
+
environmentRefraction[i]=envSample[i];}
|
|
2061
|
+
#else
|
|
2062
|
+
environmentRefraction=envSample;
|
|
2063
|
+
#endif
|
|
2064
|
+
environmentRefraction.rgb*=vRefractionInfos.x;
|
|
2065
|
+
#endif
|
|
2066
|
+
#ifdef SS_REFRACTION
|
|
2067
|
+
vec3 refractionTransmittance=vec3(refractionIntensity);
|
|
2068
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
2069
|
+
vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,thickness);
|
|
2070
|
+
#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)
|
|
2071
|
+
float maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);environmentRefraction.rgb*=volumeAlbedo;
|
|
2072
|
+
#else
|
|
2073
|
+
vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);
|
|
2074
|
+
#endif
|
|
2075
|
+
#ifdef SS_ALBEDOFORREFRACTIONTINT
|
|
2076
|
+
environmentRefraction.rgb*=surfaceAlbedo.rgb;
|
|
2077
|
+
#endif
|
|
2078
|
+
outParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);
|
|
2079
|
+
#ifdef REFLECTION
|
|
2080
|
+
outParams.refractionFactorForIrradiance=(1.-refractionIntensity);
|
|
2081
|
+
#endif
|
|
2082
|
+
#ifdef UNUSED_MULTIPLEBOUNCES
|
|
2083
|
+
vec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);
|
|
2084
|
+
#endif
|
|
2085
|
+
refractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;
|
|
2086
|
+
#if DEBUGMODE>0
|
|
2087
|
+
outParams.refractionTransmittance=refractionTransmittance;
|
|
2088
|
+
#endif
|
|
2089
|
+
outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;
|
|
2090
|
+
#if DEBUGMODE>0
|
|
2091
|
+
outParams.environmentRefraction=environmentRefraction;
|
|
2092
|
+
#endif
|
|
2093
|
+
#endif
|
|
2094
|
+
#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)
|
|
2095
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)
|
|
2096
|
+
vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;
|
|
2097
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
2098
|
+
irradianceVector.z*=-1.0;
|
|
2099
|
+
#endif
|
|
2100
|
+
#ifdef INVERTCUBICMAP
|
|
2101
|
+
irradianceVector.y*=-1.0;
|
|
2102
|
+
#endif
|
|
2103
|
+
#else
|
|
2104
|
+
vec3 irradianceVector=irradianceVector_;
|
|
2105
|
+
#endif
|
|
2106
|
+
#if defined(USESPHERICALFROMREFLECTIONMAP)
|
|
2107
|
+
#if defined(REALTIME_FILTERING)
|
|
2108
|
+
vec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo
|
|
2109
|
+
#ifdef IBL_CDF_FILTERING
|
|
2110
|
+
,icdfSampler
|
|
2111
|
+
#endif
|
|
2112
|
+
);
|
|
2113
|
+
#else
|
|
2114
|
+
vec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);
|
|
2115
|
+
#endif
|
|
2116
|
+
#elif defined(USEIRRADIANCEMAP)
|
|
2117
|
+
#ifdef REFLECTIONMAP_3D
|
|
2118
|
+
vec3 irradianceCoords=irradianceVector;
|
|
2119
|
+
#else
|
|
2120
|
+
vec2 irradianceCoords=irradianceVector.xy;
|
|
2121
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
2122
|
+
irradianceCoords/=irradianceVector.z;
|
|
2123
|
+
#endif
|
|
2124
|
+
irradianceCoords.y=1.0-irradianceCoords.y;
|
|
2125
|
+
#endif
|
|
2126
|
+
vec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);
|
|
2127
|
+
#ifdef RGBDREFLECTION
|
|
2128
|
+
refractionIrradiance.rgb=fromRGBD(refractionIrradiance);
|
|
2129
|
+
#endif
|
|
2130
|
+
#ifdef GAMMAREFLECTION
|
|
2131
|
+
refractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);
|
|
2132
|
+
#endif
|
|
2133
|
+
#else
|
|
2134
|
+
vec4 refractionIrradiance=vec4(0.);
|
|
2135
|
+
#endif
|
|
2136
|
+
refractionIrradiance.rgb*=transmittance;
|
|
2137
|
+
#ifdef SS_ALBEDOFORTRANSLUCENCYTINT
|
|
2138
|
+
refractionIrradiance.rgb*=surfaceAlbedo.rgb;
|
|
2139
|
+
#endif
|
|
2140
|
+
outParams.refractionIrradiance=refractionIrradiance.rgb;
|
|
2141
|
+
#endif
|
|
2142
|
+
return outParams;}
|
|
2143
|
+
#endif
|
|
2144
|
+
`;
|
|
2145
|
+
// Sideeffect
|
|
2146
|
+
ShaderStore.IncludesShadersStore[name$e] = shader$e;
|
|
2147
|
+
|
|
2148
|
+
// Do not edit.
|
|
2149
|
+
const name$d = "pbrBlockNormalGeometric";
|
|
2150
|
+
const shader$d = `vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
|
2151
|
+
#ifdef NORMAL
|
|
2152
|
+
vec3 normalW=normalize(vNormalW);
|
|
2153
|
+
#else
|
|
2154
|
+
vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
|
|
2155
|
+
#endif
|
|
2156
|
+
vec3 geometricNormalW=normalW;
|
|
2157
|
+
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
2158
|
+
geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
|
|
2159
|
+
#endif
|
|
2160
|
+
`;
|
|
2161
|
+
// Sideeffect
|
|
2162
|
+
ShaderStore.IncludesShadersStore[name$d] = shader$d;
|
|
2163
|
+
|
|
2164
|
+
// Do not edit.
|
|
2165
|
+
const name$c = "pbrBlockNormalFinal";
|
|
2166
|
+
const shader$c = `#if defined(FORCENORMALFORWARD) && defined(NORMAL)
|
|
2167
|
+
vec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
|
|
2168
|
+
#if defined(TWOSIDEDLIGHTING)
|
|
2169
|
+
faceNormal=gl_FrontFacing ? faceNormal : -faceNormal;
|
|
2170
|
+
#endif
|
|
2171
|
+
normalW*=sign(dot(normalW,faceNormal));
|
|
2172
|
+
#endif
|
|
2173
|
+
#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
|
|
2174
|
+
normalW=gl_FrontFacing ? normalW : -normalW;
|
|
2175
|
+
#endif
|
|
2176
|
+
`;
|
|
2177
|
+
// Sideeffect
|
|
2178
|
+
ShaderStore.IncludesShadersStore[name$c] = shader$c;
|
|
2179
|
+
|
|
2180
|
+
// Do not edit.
|
|
2181
|
+
const name$b = "pbrBlockLightmapInit";
|
|
2182
|
+
const shader$b = `#ifdef LIGHTMAP
|
|
2183
|
+
vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);
|
|
2184
|
+
#ifdef RGBDLIGHTMAP
|
|
2185
|
+
lightmapColor.rgb=fromRGBD(lightmapColor);
|
|
2186
|
+
#endif
|
|
2187
|
+
#ifdef GAMMALIGHTMAP
|
|
2188
|
+
lightmapColor.rgb=toLinearSpace(lightmapColor.rgb);
|
|
2189
|
+
#endif
|
|
2190
|
+
lightmapColor.rgb*=vLightmapInfos.y;
|
|
2191
|
+
#endif
|
|
2192
|
+
`;
|
|
2193
|
+
// Sideeffect
|
|
2194
|
+
ShaderStore.IncludesShadersStore[name$b] = shader$b;
|
|
2195
|
+
|
|
2196
|
+
// Do not edit.
|
|
2197
|
+
const name$a = "pbrBlockGeometryInfo";
|
|
2198
|
+
const shader$a = `float NdotVUnclamped=dot(normalW,viewDirectionW);float NdotV=absEps(NdotVUnclamped);float alphaG=convertRoughnessToAverageSlope(roughness);vec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);
|
|
2199
|
+
#ifdef SPECULARAA
|
|
2200
|
+
alphaG+=AARoughnessFactors.y;
|
|
2201
|
+
#endif
|
|
2202
|
+
#if defined(ENVIRONMENTBRDF)
|
|
2203
|
+
vec3 environmentBrdf=getBRDFLookup(NdotV,roughness);
|
|
2204
|
+
#endif
|
|
2205
|
+
#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
2206
|
+
#ifdef RADIANCEOCCLUSION
|
|
2207
|
+
#ifdef AMBIENTINGRAYSCALE
|
|
2208
|
+
float ambientMonochrome=aoOut.ambientOcclusionColor.r;
|
|
2209
|
+
#else
|
|
2210
|
+
float ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);
|
|
2211
|
+
#endif
|
|
2212
|
+
float seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);
|
|
2213
|
+
#endif
|
|
2214
|
+
#ifdef HORIZONOCCLUSION
|
|
2215
|
+
#ifdef BUMP
|
|
2216
|
+
#ifdef REFLECTIONMAP_3D
|
|
2217
|
+
float eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);
|
|
2218
|
+
#endif
|
|
2219
|
+
#endif
|
|
2220
|
+
#endif
|
|
2221
|
+
#endif
|
|
2222
|
+
`;
|
|
2223
|
+
// Sideeffect
|
|
2224
|
+
ShaderStore.IncludesShadersStore[name$a] = shader$a;
|
|
2225
|
+
|
|
2226
|
+
// Do not edit.
|
|
2227
|
+
const name$9 = "pbrBlockReflectance0";
|
|
2228
|
+
const shader$9 = `float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);vec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;
|
|
2229
|
+
#ifdef METALLICWORKFLOW
|
|
2230
|
+
vec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);
|
|
2231
|
+
#else
|
|
2232
|
+
vec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);
|
|
2233
|
+
#endif
|
|
2234
|
+
#ifdef ALPHAFRESNEL
|
|
2235
|
+
float reflectance90=fresnelGrazingReflectance(reflectance);specularEnvironmentR90=specularEnvironmentR90*reflectance90;
|
|
2236
|
+
#endif
|
|
2237
|
+
`;
|
|
2238
|
+
// Sideeffect
|
|
2239
|
+
ShaderStore.IncludesShadersStore[name$9] = shader$9;
|
|
2240
|
+
|
|
2241
|
+
// Do not edit.
|
|
2242
|
+
const name$8 = "pbrBlockReflectance";
|
|
2243
|
+
const shader$8 = `#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
2244
|
+
vec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);
|
|
2245
|
+
#ifdef RADIANCEOCCLUSION
|
|
2246
|
+
specularEnvironmentReflectance*=seo;
|
|
2247
|
+
#endif
|
|
2248
|
+
#ifdef HORIZONOCCLUSION
|
|
2249
|
+
#ifdef BUMP
|
|
2250
|
+
#ifdef REFLECTIONMAP_3D
|
|
2251
|
+
specularEnvironmentReflectance*=eho;
|
|
2252
|
+
#endif
|
|
2253
|
+
#endif
|
|
2254
|
+
#endif
|
|
2255
|
+
#else
|
|
2256
|
+
vec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));
|
|
2257
|
+
#endif
|
|
2258
|
+
#ifdef CLEARCOAT
|
|
2259
|
+
specularEnvironmentReflectance*=clearcoatOut.conservationFactor;
|
|
2260
|
+
#if defined(CLEARCOAT_TINT)
|
|
2261
|
+
specularEnvironmentReflectance*=clearcoatOut.absorption;
|
|
2262
|
+
#endif
|
|
2263
|
+
#endif
|
|
2264
|
+
`;
|
|
2265
|
+
// Sideeffect
|
|
2266
|
+
ShaderStore.IncludesShadersStore[name$8] = shader$8;
|
|
2267
|
+
|
|
2268
|
+
// Do not edit.
|
|
2269
|
+
const name$7 = "pbrBlockDirectLighting";
|
|
2270
|
+
const shader$7 = `vec3 diffuseBase=vec3(0.,0.,0.);
|
|
2271
|
+
#ifdef SPECULARTERM
|
|
2272
|
+
vec3 specularBase=vec3(0.,0.,0.);
|
|
2273
|
+
#endif
|
|
2274
|
+
#ifdef CLEARCOAT
|
|
2275
|
+
vec3 clearCoatBase=vec3(0.,0.,0.);
|
|
2276
|
+
#endif
|
|
2277
|
+
#ifdef SHEEN
|
|
2278
|
+
vec3 sheenBase=vec3(0.,0.,0.);
|
|
2279
|
+
#endif
|
|
2280
|
+
preLightingInfo preInfo;lightingInfo info;float shadow=1.;
|
|
2281
|
+
float aggShadow=0.;float numLights=0.;
|
|
2282
|
+
#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
|
|
2283
|
+
vec3 absorption=vec3(0.);
|
|
2284
|
+
#endif
|
|
2285
|
+
`;
|
|
2286
|
+
// Sideeffect
|
|
2287
|
+
ShaderStore.IncludesShadersStore[name$7] = shader$7;
|
|
2288
|
+
|
|
2289
|
+
// Do not edit.
|
|
2290
|
+
const name$6 = "pbrBlockFinalLitComponents";
|
|
2291
|
+
const shader$6 = `aggShadow=aggShadow/numLights;
|
|
2292
|
+
#if defined(ENVIRONMENTBRDF)
|
|
2293
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
2294
|
+
vec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);
|
|
2295
|
+
#endif
|
|
2296
|
+
#endif
|
|
2297
|
+
#ifndef METALLICWORKFLOW
|
|
2298
|
+
#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION
|
|
2299
|
+
surfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;
|
|
2300
|
+
#endif
|
|
2301
|
+
#endif
|
|
2302
|
+
#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)
|
|
2303
|
+
surfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;
|
|
2304
|
+
#endif
|
|
2305
|
+
#ifdef REFLECTION
|
|
2306
|
+
vec3 finalIrradiance=reflectionOut.environmentIrradiance;
|
|
2307
|
+
#if defined(CLEARCOAT)
|
|
2308
|
+
finalIrradiance*=clearcoatOut.conservationFactor;
|
|
2309
|
+
#if defined(CLEARCOAT_TINT)
|
|
2310
|
+
finalIrradiance*=clearcoatOut.absorption;
|
|
2311
|
+
#endif
|
|
2312
|
+
#endif
|
|
2313
|
+
#if defined(SS_REFRACTION)
|
|
2314
|
+
finalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;
|
|
2315
|
+
#endif
|
|
2316
|
+
#if defined(SS_TRANSLUCENCY)
|
|
2317
|
+
finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;
|
|
2318
|
+
#endif
|
|
2319
|
+
finalIrradiance*=surfaceAlbedo.rgb;finalIrradiance*=vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;
|
|
2320
|
+
#endif
|
|
2321
|
+
#ifdef SPECULARTERM
|
|
2322
|
+
vec3 finalSpecular=specularBase;finalSpecular=max(finalSpecular,0.0);vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;
|
|
2323
|
+
#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
2324
|
+
finalSpecularScaled*=energyConservationFactor;
|
|
2325
|
+
#endif
|
|
2326
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
|
|
2327
|
+
finalSpecularScaled*=sheenOut.sheenAlbedoScaling;
|
|
2328
|
+
#endif
|
|
2329
|
+
#endif
|
|
2330
|
+
#ifdef REFLECTION
|
|
2331
|
+
vec3 finalRadiance=reflectionOut.environmentRadiance.rgb;finalRadiance*=subSurfaceOut.specularEnvironmentReflectance;vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;
|
|
2332
|
+
#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
2333
|
+
finalRadianceScaled*=energyConservationFactor;
|
|
2334
|
+
#endif
|
|
2335
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)
|
|
2336
|
+
finalRadianceScaled*=sheenOut.sheenAlbedoScaling;
|
|
2337
|
+
#endif
|
|
2338
|
+
#endif
|
|
2339
|
+
#ifdef SHEEN
|
|
2340
|
+
vec3 finalSheen=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,0.0);vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;
|
|
2341
|
+
#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
2342
|
+
sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;
|
|
2343
|
+
#if defined(CLEARCOAT_TINT)
|
|
2344
|
+
sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;
|
|
2345
|
+
#endif
|
|
2346
|
+
#endif
|
|
2347
|
+
#endif
|
|
2348
|
+
#ifdef CLEARCOAT
|
|
2349
|
+
vec3 finalClearCoat=clearCoatBase;finalClearCoat=max(finalClearCoat,0.0);vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;
|
|
2350
|
+
#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
2351
|
+
finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;
|
|
2352
|
+
#endif
|
|
2353
|
+
#ifdef SS_REFRACTION
|
|
2354
|
+
subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;
|
|
2355
|
+
#ifdef CLEARCOAT_TINT
|
|
2356
|
+
subSurfaceOut.finalRefraction*=clearcoatOut.absorption;
|
|
2357
|
+
#endif
|
|
2358
|
+
#endif
|
|
2359
|
+
#endif
|
|
2360
|
+
#ifdef ALPHABLEND
|
|
2361
|
+
float luminanceOverAlpha=0.0;
|
|
2362
|
+
#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)
|
|
2363
|
+
luminanceOverAlpha+=getLuminance(finalRadianceScaled);
|
|
2364
|
+
#if defined(CLEARCOAT)
|
|
2365
|
+
luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);
|
|
2366
|
+
#endif
|
|
2367
|
+
#endif
|
|
2368
|
+
#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)
|
|
2369
|
+
luminanceOverAlpha+=getLuminance(finalSpecularScaled);
|
|
2370
|
+
#endif
|
|
2371
|
+
#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)
|
|
2372
|
+
luminanceOverAlpha+=getLuminance(finalClearCoatScaled);
|
|
2373
|
+
#endif
|
|
2374
|
+
#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)
|
|
2375
|
+
alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);
|
|
2376
|
+
#endif
|
|
2377
|
+
#endif
|
|
2378
|
+
`;
|
|
2379
|
+
// Sideeffect
|
|
2380
|
+
ShaderStore.IncludesShadersStore[name$6] = shader$6;
|
|
2381
|
+
|
|
2382
|
+
// Do not edit.
|
|
2383
|
+
const name$5 = "pbrBlockFinalUnlitComponents";
|
|
2384
|
+
const shader$5 = `vec3 finalDiffuse=diffuseBase;finalDiffuse*=surfaceAlbedo.rgb;finalDiffuse=max(finalDiffuse,0.0);finalDiffuse*=vLightingIntensity.x;vec3 finalAmbient=vAmbientColor;finalAmbient*=surfaceAlbedo.rgb;vec3 finalEmissive=vEmissiveColor;
|
|
2385
|
+
#ifdef EMISSIVE
|
|
2386
|
+
vec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;
|
|
2387
|
+
#ifdef GAMMAEMISSIVE
|
|
2388
|
+
finalEmissive*=toLinearSpace(emissiveColorTex.rgb);
|
|
2389
|
+
#else
|
|
2390
|
+
finalEmissive*=emissiveColorTex.rgb;
|
|
2391
|
+
#endif
|
|
2392
|
+
finalEmissive*= vEmissiveInfos.y;
|
|
2393
|
+
#endif
|
|
2394
|
+
finalEmissive*=vLightingIntensity.y;
|
|
2395
|
+
#ifdef AMBIENT
|
|
2396
|
+
vec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);
|
|
2397
|
+
#else
|
|
2398
|
+
vec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;
|
|
2399
|
+
#endif
|
|
2400
|
+
finalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse;
|
|
2401
|
+
`;
|
|
2402
|
+
// Sideeffect
|
|
2403
|
+
ShaderStore.IncludesShadersStore[name$5] = shader$5;
|
|
2404
|
+
|
|
2405
|
+
// Do not edit.
|
|
2406
|
+
const name$4 = "pbrBlockFinalColorComposition";
|
|
2407
|
+
const shader$4 = `vec4 finalColor=vec4(
|
|
2408
|
+
#ifndef UNLIT
|
|
2409
|
+
#ifdef REFLECTION
|
|
2410
|
+
finalIrradiance +
|
|
2411
|
+
#endif
|
|
2412
|
+
#ifdef SPECULARTERM
|
|
2413
|
+
finalSpecularScaled +
|
|
2414
|
+
#endif
|
|
2415
|
+
#ifdef SHEEN
|
|
2416
|
+
finalSheenScaled +
|
|
2417
|
+
#endif
|
|
2418
|
+
#ifdef CLEARCOAT
|
|
2419
|
+
finalClearCoatScaled +
|
|
2420
|
+
#endif
|
|
2421
|
+
#ifdef REFLECTION
|
|
2422
|
+
finalRadianceScaled +
|
|
2423
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
2424
|
+
sheenOut.finalSheenRadianceScaled +
|
|
2425
|
+
#endif
|
|
2426
|
+
#ifdef CLEARCOAT
|
|
2427
|
+
clearcoatOut.finalClearCoatRadianceScaled +
|
|
2428
|
+
#endif
|
|
2429
|
+
#endif
|
|
2430
|
+
#ifdef SS_REFRACTION
|
|
2431
|
+
subSurfaceOut.finalRefraction +
|
|
2432
|
+
#endif
|
|
2433
|
+
#endif
|
|
2434
|
+
finalAmbient +
|
|
2435
|
+
finalDiffuse,
|
|
2436
|
+
alpha);
|
|
2437
|
+
#ifdef LIGHTMAP
|
|
2438
|
+
#ifndef LIGHTMAPEXCLUDED
|
|
2439
|
+
#ifdef USELIGHTMAPASSHADOWMAP
|
|
2440
|
+
finalColor.rgb*=lightmapColor.rgb;
|
|
2441
|
+
#else
|
|
2442
|
+
finalColor.rgb+=lightmapColor.rgb;
|
|
2443
|
+
#endif
|
|
2444
|
+
#endif
|
|
2445
|
+
#endif
|
|
2446
|
+
finalColor.rgb+=finalEmissive;
|
|
2447
|
+
#define CUSTOM_FRAGMENT_BEFORE_FOG
|
|
2448
|
+
finalColor=max(finalColor,0.0);
|
|
2449
|
+
`;
|
|
2450
|
+
// Sideeffect
|
|
2451
|
+
ShaderStore.IncludesShadersStore[name$4] = shader$4;
|
|
2452
|
+
|
|
2453
|
+
// Do not edit.
|
|
2454
|
+
const name$3 = "pbrBlockImageProcessing";
|
|
2455
|
+
const shader$3 = `#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)
|
|
2456
|
+
#if !defined(SKIPFINALCOLORCLAMP)
|
|
2457
|
+
finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
|
|
2458
|
+
#endif
|
|
2459
|
+
#else
|
|
2460
|
+
finalColor=applyImageProcessing(finalColor);
|
|
2461
|
+
#endif
|
|
2462
|
+
finalColor.a*=visibility;
|
|
2463
|
+
#ifdef PREMULTIPLYALPHA
|
|
2464
|
+
finalColor.rgb*=finalColor.a;
|
|
2465
|
+
#endif
|
|
2466
|
+
`;
|
|
2467
|
+
// Sideeffect
|
|
2468
|
+
ShaderStore.IncludesShadersStore[name$3] = shader$3;
|
|
2469
|
+
|
|
2470
|
+
// Do not edit.
|
|
2471
|
+
const name$2 = "pbrBlockPrePass";
|
|
2472
|
+
const shader$2 = `float writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;
|
|
2473
|
+
#ifdef PREPASS_POSITION
|
|
2474
|
+
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
2475
|
+
#endif
|
|
2476
|
+
#ifdef PREPASS_LOCAL_POSITION
|
|
2477
|
+
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
2478
|
+
#endif
|
|
2479
|
+
#if defined(PREPASS_VELOCITY)
|
|
2480
|
+
vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
|
|
2481
|
+
#elif defined(PREPASS_VELOCITY_LINEAR)
|
|
2482
|
+
vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
|
|
2483
|
+
#endif
|
|
2484
|
+
#ifdef PREPASS_ALBEDO
|
|
2485
|
+
gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(surfaceAlbedo,writeGeometryInfo);
|
|
2486
|
+
#endif
|
|
2487
|
+
#ifdef PREPASS_ALBEDO_SQRT
|
|
2488
|
+
vec3 sqAlbedo=sqrt(surfaceAlbedo);
|
|
2489
|
+
#endif
|
|
2490
|
+
#ifdef PREPASS_IRRADIANCE
|
|
2491
|
+
vec3 irradiance=finalDiffuse;
|
|
2492
|
+
#ifndef UNLIT
|
|
2493
|
+
#ifdef REFLECTION
|
|
2494
|
+
irradiance+=finalIrradiance;
|
|
2495
|
+
#endif
|
|
2496
|
+
#endif
|
|
2497
|
+
#ifdef SS_SCATTERING
|
|
2498
|
+
#ifdef PREPASS_COLOR
|
|
2499
|
+
gl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb-irradiance,finalColor.a);
|
|
2500
|
+
#endif
|
|
2501
|
+
irradiance/=sqAlbedo;
|
|
2502
|
+
#else
|
|
2503
|
+
#ifdef PREPASS_COLOR
|
|
2504
|
+
gl_FragData[PREPASS_COLOR_INDEX]=finalColor;
|
|
2505
|
+
#endif
|
|
2506
|
+
float scatteringDiffusionProfile=255.;
|
|
2507
|
+
#endif
|
|
2508
|
+
gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.);
|
|
2509
|
+
#elif defined(PREPASS_COLOR)
|
|
2510
|
+
gl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a);
|
|
2511
|
+
#endif
|
|
2512
|
+
#ifdef PREPASS_DEPTH
|
|
2513
|
+
gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo);
|
|
2514
|
+
#endif
|
|
2515
|
+
#ifdef PREPASS_SCREENSPACE_DEPTH
|
|
2516
|
+
gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);
|
|
2517
|
+
#endif
|
|
2518
|
+
#ifdef PREPASS_NORMAL
|
|
2519
|
+
#ifdef PREPASS_NORMAL_WORLDSPACE
|
|
2520
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);
|
|
2521
|
+
#else
|
|
2522
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);
|
|
2523
|
+
#endif
|
|
2524
|
+
#endif
|
|
2525
|
+
#ifdef PREPASS_WORLD_NORMAL
|
|
2526
|
+
gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);
|
|
2527
|
+
#endif
|
|
2528
|
+
#ifdef PREPASS_ALBEDO_SQRT
|
|
2529
|
+
gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo);
|
|
2530
|
+
#endif
|
|
2531
|
+
#ifdef PREPASS_REFLECTIVITY
|
|
2532
|
+
#ifndef UNLIT
|
|
2533
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;
|
|
2534
|
+
#else
|
|
2535
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;
|
|
2536
|
+
#endif
|
|
2537
|
+
#endif
|
|
2538
|
+
`;
|
|
2539
|
+
// Sideeffect
|
|
2540
|
+
ShaderStore.IncludesShadersStore[name$2] = shader$2;
|
|
2541
|
+
|
|
2542
|
+
// Do not edit.
|
|
2543
|
+
const name$1 = "pbrDebug";
|
|
2544
|
+
const shader$1 = `#if DEBUGMODE>0
|
|
2545
|
+
if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
|
|
2546
|
+
#if DEBUGMODE==1
|
|
2547
|
+
gl_FragColor.rgb=vPositionW.rgb;
|
|
2548
|
+
#define DEBUGMODE_NORMALIZE
|
|
2549
|
+
#elif DEBUGMODE==2 && defined(NORMAL)
|
|
2550
|
+
gl_FragColor.rgb=vNormalW.rgb;
|
|
2551
|
+
#define DEBUGMODE_NORMALIZE
|
|
2552
|
+
#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)
|
|
2553
|
+
gl_FragColor.rgb=TBN[0];
|
|
2554
|
+
#define DEBUGMODE_NORMALIZE
|
|
2555
|
+
#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)
|
|
2556
|
+
gl_FragColor.rgb=TBN[1];
|
|
2557
|
+
#define DEBUGMODE_NORMALIZE
|
|
2558
|
+
#elif DEBUGMODE==5
|
|
2559
|
+
gl_FragColor.rgb=normalW;
|
|
2560
|
+
#define DEBUGMODE_NORMALIZE
|
|
2561
|
+
#elif DEBUGMODE==6 && defined(MAINUV1)
|
|
2562
|
+
gl_FragColor.rgb=vec3(vMainUV1,0.0);
|
|
2563
|
+
#elif DEBUGMODE==7 && defined(MAINUV2)
|
|
2564
|
+
gl_FragColor.rgb=vec3(vMainUV2,0.0);
|
|
2565
|
+
#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
|
|
2566
|
+
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
|
|
2567
|
+
#define DEBUGMODE_NORMALIZE
|
|
2568
|
+
#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)
|
|
2569
|
+
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
|
|
2570
|
+
#define DEBUGMODE_NORMALIZE
|
|
2571
|
+
#elif DEBUGMODE==10 && defined(CLEARCOAT)
|
|
2572
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
|
|
2573
|
+
#define DEBUGMODE_NORMALIZE
|
|
2574
|
+
#elif DEBUGMODE==11 && defined(ANISOTROPIC)
|
|
2575
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
|
|
2576
|
+
#define DEBUGMODE_NORMALIZE
|
|
2577
|
+
#elif DEBUGMODE==12 && defined(ANISOTROPIC)
|
|
2578
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
|
|
2579
|
+
#define DEBUGMODE_NORMALIZE
|
|
2580
|
+
#elif DEBUGMODE==13 && defined(ANISOTROPIC)
|
|
2581
|
+
gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
|
|
2582
|
+
#define DEBUGMODE_NORMALIZE
|
|
2583
|
+
#elif DEBUGMODE==20 && defined(ALBEDO)
|
|
2584
|
+
gl_FragColor.rgb=albedoTexture.rgb;
|
|
2585
|
+
#ifndef GAMMAALBEDO
|
|
2586
|
+
#define DEBUGMODE_GAMMA
|
|
2587
|
+
#endif
|
|
2588
|
+
#elif DEBUGMODE==21 && defined(AMBIENT)
|
|
2589
|
+
gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
|
|
2590
|
+
#elif DEBUGMODE==22 && defined(OPACITY)
|
|
2591
|
+
gl_FragColor.rgb=opacityMap.rgb;
|
|
2592
|
+
#elif DEBUGMODE==23 && defined(EMISSIVE)
|
|
2593
|
+
gl_FragColor.rgb=emissiveColorTex.rgb;
|
|
2594
|
+
#ifndef GAMMAEMISSIVE
|
|
2595
|
+
#define DEBUGMODE_GAMMA
|
|
2596
|
+
#endif
|
|
2597
|
+
#elif DEBUGMODE==24 && defined(LIGHTMAP)
|
|
2598
|
+
gl_FragColor.rgb=lightmapColor.rgb;
|
|
2599
|
+
#ifndef GAMMALIGHTMAP
|
|
2600
|
+
#define DEBUGMODE_GAMMA
|
|
2601
|
+
#endif
|
|
2602
|
+
#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)
|
|
2603
|
+
gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
|
|
2604
|
+
#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)
|
|
2605
|
+
gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
|
|
2606
|
+
#define DEBUGMODE_GAMMA
|
|
2607
|
+
#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)
|
|
2608
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
|
|
2609
|
+
#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
|
|
2610
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
|
|
2611
|
+
#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)
|
|
2612
|
+
gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
|
|
2613
|
+
#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)
|
|
2614
|
+
gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
|
|
2615
|
+
#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)
|
|
2616
|
+
gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
|
|
2617
|
+
#elif DEBUGMODE==32 && defined(BUMP)
|
|
2618
|
+
gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;
|
|
2619
|
+
#elif DEBUGMODE==40 && defined(SS_REFRACTION)
|
|
2620
|
+
gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
|
|
2621
|
+
#define DEBUGMODE_GAMMA
|
|
2622
|
+
#elif DEBUGMODE==41 && defined(REFLECTION)
|
|
2623
|
+
gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
|
|
2624
|
+
#ifndef GAMMAREFLECTION
|
|
2625
|
+
#define DEBUGMODE_GAMMA
|
|
2626
|
+
#endif
|
|
2627
|
+
#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)
|
|
2628
|
+
gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
|
|
2629
|
+
#define DEBUGMODE_GAMMA
|
|
2630
|
+
#elif DEBUGMODE==50
|
|
2631
|
+
gl_FragColor.rgb=diffuseBase.rgb;
|
|
2632
|
+
#define DEBUGMODE_GAMMA
|
|
2633
|
+
#elif DEBUGMODE==51 && defined(SPECULARTERM)
|
|
2634
|
+
gl_FragColor.rgb=specularBase.rgb;
|
|
2635
|
+
#define DEBUGMODE_GAMMA
|
|
2636
|
+
#elif DEBUGMODE==52 && defined(CLEARCOAT)
|
|
2637
|
+
gl_FragColor.rgb=clearCoatBase.rgb;
|
|
2638
|
+
#define DEBUGMODE_GAMMA
|
|
2639
|
+
#elif DEBUGMODE==53 && defined(SHEEN)
|
|
2640
|
+
gl_FragColor.rgb=sheenBase.rgb;
|
|
2641
|
+
#define DEBUGMODE_GAMMA
|
|
2642
|
+
#elif DEBUGMODE==54 && defined(REFLECTION)
|
|
2643
|
+
gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
|
|
2644
|
+
#ifndef GAMMAREFLECTION
|
|
2645
|
+
#define DEBUGMODE_GAMMA
|
|
2646
|
+
#endif
|
|
2647
|
+
#elif DEBUGMODE==60
|
|
2648
|
+
gl_FragColor.rgb=surfaceAlbedo.rgb;
|
|
2649
|
+
#define DEBUGMODE_GAMMA
|
|
2650
|
+
#elif DEBUGMODE==61
|
|
2651
|
+
gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
|
|
2652
|
+
#define DEBUGMODE_GAMMA
|
|
2653
|
+
#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)
|
|
2654
|
+
gl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);
|
|
2655
|
+
#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)
|
|
2656
|
+
gl_FragColor.rgb=reflectivityOut.metallicF0;
|
|
2657
|
+
#elif DEBUGMODE==63
|
|
2658
|
+
gl_FragColor.rgb=vec3(roughness);
|
|
2659
|
+
#elif DEBUGMODE==64
|
|
2660
|
+
gl_FragColor.rgb=vec3(alphaG);
|
|
2661
|
+
#elif DEBUGMODE==65
|
|
2662
|
+
gl_FragColor.rgb=vec3(NdotV);
|
|
2663
|
+
#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)
|
|
2664
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
|
|
2665
|
+
#define DEBUGMODE_GAMMA
|
|
2666
|
+
#elif DEBUGMODE==67 && defined(CLEARCOAT)
|
|
2667
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
|
|
2668
|
+
#elif DEBUGMODE==68 && defined(CLEARCOAT)
|
|
2669
|
+
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
|
|
2670
|
+
#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)
|
|
2671
|
+
gl_FragColor.rgb=subSurfaceOut.transmittance;
|
|
2672
|
+
#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)
|
|
2673
|
+
gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
|
|
2674
|
+
#elif DEBUGMODE==72
|
|
2675
|
+
gl_FragColor.rgb=vec3(microSurface);
|
|
2676
|
+
#elif DEBUGMODE==73
|
|
2677
|
+
gl_FragColor.rgb=vAlbedoColor.rgb;
|
|
2678
|
+
#define DEBUGMODE_GAMMA
|
|
2679
|
+
#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)
|
|
2680
|
+
gl_FragColor.rgb=vReflectivityColor.rgb;
|
|
2681
|
+
#define DEBUGMODE_GAMMA
|
|
2682
|
+
#elif DEBUGMODE==75
|
|
2683
|
+
gl_FragColor.rgb=vEmissiveColor.rgb;
|
|
2684
|
+
#define DEBUGMODE_GAMMA
|
|
2685
|
+
#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)
|
|
2686
|
+
gl_FragColor.rgb=vec3(seo);
|
|
2687
|
+
#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
|
|
2688
|
+
gl_FragColor.rgb=vec3(eho);
|
|
2689
|
+
#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)
|
|
2690
|
+
gl_FragColor.rgb=vec3(energyConservationFactor);
|
|
2691
|
+
#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
2692
|
+
gl_FragColor.rgb=specularEnvironmentReflectance;
|
|
2693
|
+
#define DEBUGMODE_GAMMA
|
|
2694
|
+
#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)
|
|
2695
|
+
gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
|
|
2696
|
+
#define DEBUGMODE_GAMMA
|
|
2697
|
+
#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)
|
|
2698
|
+
gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
|
|
2699
|
+
#define DEBUGMODE_GAMMA
|
|
2700
|
+
#elif DEBUGMODE==86 && defined(ALPHABLEND)
|
|
2701
|
+
gl_FragColor.rgb=vec3(luminanceOverAlpha);
|
|
2702
|
+
#elif DEBUGMODE==87
|
|
2703
|
+
gl_FragColor.rgb=vec3(alpha);
|
|
2704
|
+
#elif DEBUGMODE==88 && defined(ALBEDO)
|
|
2705
|
+
gl_FragColor.rgb=vec3(albedoTexture.a);
|
|
2706
|
+
#elif DEBUGMODE==89
|
|
2707
|
+
gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;
|
|
2708
|
+
#else
|
|
2709
|
+
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);
|
|
2710
|
+
#endif
|
|
2711
|
+
gl_FragColor.rgb*=vDebugMode.y;
|
|
2712
|
+
#ifdef DEBUGMODE_NORMALIZE
|
|
2713
|
+
gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
|
|
2714
|
+
#endif
|
|
2715
|
+
#ifdef DEBUGMODE_GAMMA
|
|
2716
|
+
gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
|
|
2717
|
+
#endif
|
|
2718
|
+
gl_FragColor.a=1.0;
|
|
2719
|
+
#ifdef PREPASS
|
|
2720
|
+
gl_FragData[0]=toLinearSpace(gl_FragColor);
|
|
2721
|
+
gl_FragData[1]=vec4(0.,0.,0.,0.);
|
|
2722
|
+
#endif
|
|
2723
|
+
#ifdef DEBUGMODE_FORCERETURN
|
|
2724
|
+
return;
|
|
2725
|
+
#endif
|
|
2726
|
+
}
|
|
2727
|
+
#endif
|
|
2728
|
+
`;
|
|
2729
|
+
// Sideeffect
|
|
2730
|
+
ShaderStore.IncludesShadersStore[name$1] = shader$1;
|
|
2731
|
+
|
|
2732
|
+
// Do not edit.
|
|
2733
|
+
const name = "pbrPixelShader";
|
|
2734
|
+
const shader = `#define CUSTOM_FRAGMENT_EXTENSION
|
|
2735
|
+
#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)
|
|
2736
|
+
#extension GL_OES_standard_derivatives : enable
|
|
2737
|
+
#endif
|
|
2738
|
+
#ifdef LODBASEDMICROSFURACE
|
|
2739
|
+
#extension GL_EXT_shader_texture_lod : enable
|
|
2740
|
+
#endif
|
|
2741
|
+
#define CUSTOM_FRAGMENT_BEGIN
|
|
2742
|
+
#ifdef LOGARITHMICDEPTH
|
|
2743
|
+
#extension GL_EXT_frag_depth : enable
|
|
2744
|
+
#endif
|
|
2745
|
+
#include<prePassDeclaration>[SCENE_MRT_COUNT]
|
|
2746
|
+
precision highp float;
|
|
2747
|
+
#include<oitDeclaration>
|
|
2748
|
+
#ifndef FROMLINEARSPACE
|
|
2749
|
+
#define FROMLINEARSPACE
|
|
2750
|
+
#endif
|
|
2751
|
+
#include<__decl__pbrFragment>
|
|
2752
|
+
#include<pbrFragmentExtraDeclaration>
|
|
2753
|
+
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
|
2754
|
+
#include<pbrFragmentSamplersDeclaration>
|
|
2755
|
+
#include<imageProcessingDeclaration>
|
|
2756
|
+
#include<clipPlaneFragmentDeclaration>
|
|
2757
|
+
#include<logDepthDeclaration>
|
|
2758
|
+
#include<fogFragmentDeclaration>
|
|
2759
|
+
#include<helperFunctions>
|
|
2760
|
+
#include<subSurfaceScatteringFunctions>
|
|
2761
|
+
#include<importanceSampling>
|
|
2762
|
+
#include<pbrHelperFunctions>
|
|
2763
|
+
#include<imageProcessingFunctions>
|
|
2764
|
+
#include<shadowsFragmentFunctions>
|
|
2765
|
+
#include<harmonicsFunctions>
|
|
2766
|
+
#include<pbrDirectLightingSetupFunctions>
|
|
2767
|
+
#include<pbrDirectLightingFalloffFunctions>
|
|
2768
|
+
#include<pbrBRDFFunctions>
|
|
2769
|
+
#include<hdrFilteringFunctions>
|
|
2770
|
+
#include<pbrDirectLightingFunctions>
|
|
2771
|
+
#include<pbrIBLFunctions>
|
|
2772
|
+
#include<bumpFragmentMainFunctions>
|
|
2773
|
+
#include<bumpFragmentFunctions>
|
|
2774
|
+
#ifdef REFLECTION
|
|
2775
|
+
#include<reflectionFunction>
|
|
2776
|
+
#endif
|
|
2777
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
2778
|
+
#include<pbrBlockAlbedoOpacity>
|
|
2779
|
+
#include<pbrBlockReflectivity>
|
|
2780
|
+
#include<pbrBlockAmbientOcclusion>
|
|
2781
|
+
#include<pbrBlockAlphaFresnel>
|
|
2782
|
+
#include<pbrBlockAnisotropic>
|
|
2783
|
+
#include<pbrBlockReflection>
|
|
2784
|
+
#include<pbrBlockSheen>
|
|
2785
|
+
#include<pbrBlockClearcoat>
|
|
2786
|
+
#include<pbrBlockIridescence>
|
|
2787
|
+
#include<pbrBlockSubSurface>
|
|
2788
|
+
void main(void) {
|
|
2789
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
2790
|
+
#include<clipPlaneFragment>
|
|
2791
|
+
#include<pbrBlockNormalGeometric>
|
|
2792
|
+
#include<bumpFragment>
|
|
2793
|
+
#include<pbrBlockNormalFinal>
|
|
2794
|
+
albedoOpacityOutParams albedoOpacityOut;
|
|
2795
|
+
#ifdef ALBEDO
|
|
2796
|
+
vec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);
|
|
2797
|
+
#endif
|
|
2798
|
+
#ifdef OPACITY
|
|
2799
|
+
vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
|
|
2800
|
+
#endif
|
|
2801
|
+
#ifdef DECAL
|
|
2802
|
+
vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);
|
|
2803
|
+
#endif
|
|
2804
|
+
albedoOpacityOut=albedoOpacityBlock(
|
|
2805
|
+
vAlbedoColor
|
|
2806
|
+
#ifdef ALBEDO
|
|
2807
|
+
,albedoTexture
|
|
2808
|
+
,vAlbedoInfos
|
|
2809
|
+
#endif
|
|
2810
|
+
#ifdef OPACITY
|
|
2811
|
+
,opacityMap
|
|
2812
|
+
,vOpacityInfos
|
|
2813
|
+
#endif
|
|
2814
|
+
#ifdef DETAIL
|
|
2815
|
+
,detailColor
|
|
2816
|
+
,vDetailInfos
|
|
2817
|
+
#endif
|
|
2818
|
+
#ifdef DECAL
|
|
2819
|
+
,decalColor
|
|
2820
|
+
,vDecalInfos
|
|
2821
|
+
#endif
|
|
2822
|
+
);vec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;float alpha=albedoOpacityOut.alpha;
|
|
2823
|
+
#define CUSTOM_FRAGMENT_UPDATE_ALPHA
|
|
2824
|
+
#include<depthPrePass>
|
|
2825
|
+
#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
|
|
2826
|
+
ambientOcclusionOutParams aoOut;
|
|
2827
|
+
#ifdef AMBIENT
|
|
2828
|
+
vec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;
|
|
2829
|
+
#endif
|
|
2830
|
+
aoOut=ambientOcclusionBlock(
|
|
2831
|
+
#ifdef AMBIENT
|
|
2832
|
+
ambientOcclusionColorMap,
|
|
2833
|
+
vAmbientInfos
|
|
2834
|
+
#endif
|
|
2835
|
+
);
|
|
2836
|
+
#include<pbrBlockLightmapInit>
|
|
2837
|
+
#ifdef UNLIT
|
|
2838
|
+
vec3 diffuseBase=vec3(1.,1.,1.);
|
|
2839
|
+
#else
|
|
2840
|
+
vec3 baseColor=surfaceAlbedo;reflectivityOutParams reflectivityOut;
|
|
2841
|
+
#if defined(REFLECTIVITY)
|
|
2842
|
+
vec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);vec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;
|
|
2843
|
+
#ifndef METALLICWORKFLOW
|
|
2844
|
+
#ifdef REFLECTIVITY_GAMMA
|
|
2845
|
+
surfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);
|
|
2846
|
+
#endif
|
|
2847
|
+
surfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;
|
|
2848
|
+
#endif
|
|
2849
|
+
#endif
|
|
2850
|
+
#if defined(MICROSURFACEMAP)
|
|
2851
|
+
vec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;
|
|
2852
|
+
#endif
|
|
2853
|
+
#ifdef METALLICWORKFLOW
|
|
2854
|
+
vec4 metallicReflectanceFactors=vMetallicReflectanceFactors;
|
|
2855
|
+
#ifdef REFLECTANCE
|
|
2856
|
+
vec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset);
|
|
2857
|
+
#ifdef REFLECTANCE_GAMMA
|
|
2858
|
+
reflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap);
|
|
2859
|
+
#endif
|
|
2860
|
+
metallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb;
|
|
2861
|
+
#endif
|
|
2862
|
+
#ifdef METALLIC_REFLECTANCE
|
|
2863
|
+
vec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);
|
|
2864
|
+
#ifdef METALLIC_REFLECTANCE_GAMMA
|
|
2865
|
+
metallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);
|
|
2866
|
+
#endif
|
|
2867
|
+
#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY
|
|
2868
|
+
metallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb;
|
|
2869
|
+
#endif
|
|
2870
|
+
metallicReflectanceFactors*=metallicReflectanceFactorsMap.a;
|
|
2871
|
+
#endif
|
|
2872
|
+
#endif
|
|
2873
|
+
reflectivityOut=reflectivityBlock(
|
|
2874
|
+
vReflectivityColor
|
|
2875
|
+
#ifdef METALLICWORKFLOW
|
|
2876
|
+
,surfaceAlbedo
|
|
2877
|
+
,metallicReflectanceFactors
|
|
2878
|
+
#endif
|
|
2879
|
+
#ifdef REFLECTIVITY
|
|
2880
|
+
,vReflectivityInfos
|
|
2881
|
+
,surfaceMetallicOrReflectivityColorMap
|
|
2882
|
+
#endif
|
|
2883
|
+
#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
|
|
2884
|
+
,aoOut.ambientOcclusionColor
|
|
2885
|
+
#endif
|
|
2886
|
+
#ifdef MICROSURFACEMAP
|
|
2887
|
+
,microSurfaceTexel
|
|
2888
|
+
#endif
|
|
2889
|
+
#ifdef DETAIL
|
|
2890
|
+
,detailColor
|
|
2891
|
+
,vDetailInfos
|
|
2892
|
+
#endif
|
|
2893
|
+
);float microSurface=reflectivityOut.microSurface;float roughness=reflectivityOut.roughness;
|
|
2894
|
+
#ifdef METALLICWORKFLOW
|
|
2895
|
+
surfaceAlbedo=reflectivityOut.surfaceAlbedo;
|
|
2896
|
+
#endif
|
|
2897
|
+
#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
|
|
2898
|
+
aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;
|
|
2899
|
+
#endif
|
|
2900
|
+
#ifdef ALPHAFRESNEL
|
|
2901
|
+
#if defined(ALPHATEST) || defined(ALPHABLEND)
|
|
2902
|
+
alphaFresnelOutParams alphaFresnelOut;alphaFresnelOut=alphaFresnelBlock(
|
|
2903
|
+
normalW,
|
|
2904
|
+
viewDirectionW,
|
|
2905
|
+
alpha,
|
|
2906
|
+
microSurface
|
|
2907
|
+
);alpha=alphaFresnelOut.alpha;
|
|
2908
|
+
#endif
|
|
2909
|
+
#endif
|
|
2910
|
+
#include<pbrBlockGeometryInfo>
|
|
2911
|
+
#ifdef ANISOTROPIC
|
|
2912
|
+
anisotropicOutParams anisotropicOut;
|
|
2913
|
+
#ifdef ANISOTROPIC_TEXTURE
|
|
2914
|
+
vec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;
|
|
2915
|
+
#endif
|
|
2916
|
+
anisotropicOut=anisotropicBlock(
|
|
2917
|
+
vAnisotropy,
|
|
2918
|
+
roughness,
|
|
2919
|
+
#ifdef ANISOTROPIC_TEXTURE
|
|
2920
|
+
anisotropyMapData,
|
|
2921
|
+
#endif
|
|
2922
|
+
TBN,
|
|
2923
|
+
normalW,
|
|
2924
|
+
viewDirectionW
|
|
2925
|
+
);
|
|
2926
|
+
#endif
|
|
2927
|
+
#ifdef REFLECTION
|
|
2928
|
+
reflectionOutParams reflectionOut;
|
|
2929
|
+
#ifndef USE_CUSTOM_REFLECTION
|
|
2930
|
+
reflectionOut=reflectionBlock(
|
|
2931
|
+
vPositionW
|
|
2932
|
+
,normalW
|
|
2933
|
+
,alphaG
|
|
2934
|
+
,vReflectionMicrosurfaceInfos
|
|
2935
|
+
,vReflectionInfos
|
|
2936
|
+
,vReflectionColor
|
|
2937
|
+
#ifdef ANISOTROPIC
|
|
2938
|
+
,anisotropicOut
|
|
2939
|
+
#endif
|
|
2940
|
+
#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
|
|
2941
|
+
,NdotVUnclamped
|
|
2942
|
+
#endif
|
|
2943
|
+
#ifdef LINEARSPECULARREFLECTION
|
|
2944
|
+
,roughness
|
|
2945
|
+
#endif
|
|
2946
|
+
,reflectionSampler
|
|
2947
|
+
#if defined(NORMAL) && defined(USESPHERICALINVERTEX)
|
|
2948
|
+
,vEnvironmentIrradiance
|
|
2949
|
+
#endif
|
|
2950
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
2951
|
+
#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
|
|
2952
|
+
,reflectionMatrix
|
|
2953
|
+
#endif
|
|
2954
|
+
#endif
|
|
2955
|
+
#ifdef USEIRRADIANCEMAP
|
|
2956
|
+
,irradianceSampler
|
|
2957
|
+
#endif
|
|
2958
|
+
#ifndef LODBASEDMICROSFURACE
|
|
2959
|
+
,reflectionSamplerLow
|
|
2960
|
+
,reflectionSamplerHigh
|
|
2961
|
+
#endif
|
|
2962
|
+
#ifdef REALTIME_FILTERING
|
|
2963
|
+
,vReflectionFilteringInfo
|
|
2964
|
+
#ifdef IBL_CDF_FILTERING
|
|
2965
|
+
,icdfSampler
|
|
2966
|
+
#endif
|
|
2967
|
+
#endif
|
|
2968
|
+
);
|
|
2969
|
+
#else
|
|
2970
|
+
#define CUSTOM_REFLECTION
|
|
2971
|
+
#endif
|
|
2972
|
+
#endif
|
|
2973
|
+
#include<pbrBlockReflectance0>
|
|
2974
|
+
#ifdef SHEEN
|
|
2975
|
+
sheenOutParams sheenOut;
|
|
2976
|
+
#ifdef SHEEN_TEXTURE
|
|
2977
|
+
vec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset);
|
|
2978
|
+
#endif
|
|
2979
|
+
#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
2980
|
+
vec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;
|
|
2981
|
+
#endif
|
|
2982
|
+
sheenOut=sheenBlock(
|
|
2983
|
+
vSheenColor
|
|
2984
|
+
#ifdef SHEEN_ROUGHNESS
|
|
2985
|
+
,vSheenRoughness
|
|
2986
|
+
#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
2987
|
+
,sheenMapRoughnessData
|
|
2988
|
+
#endif
|
|
2989
|
+
#endif
|
|
2990
|
+
,roughness
|
|
2991
|
+
#ifdef SHEEN_TEXTURE
|
|
2992
|
+
,sheenMapData
|
|
2993
|
+
,vSheenInfos.y
|
|
2994
|
+
#endif
|
|
2995
|
+
,reflectance
|
|
2996
|
+
#ifdef SHEEN_LINKWITHALBEDO
|
|
2997
|
+
,baseColor
|
|
2998
|
+
,surfaceAlbedo
|
|
2999
|
+
#endif
|
|
3000
|
+
#ifdef ENVIRONMENTBRDF
|
|
3001
|
+
,NdotV
|
|
3002
|
+
,environmentBrdf
|
|
3003
|
+
#endif
|
|
3004
|
+
#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)
|
|
3005
|
+
,AARoughnessFactors
|
|
3006
|
+
,vReflectionMicrosurfaceInfos
|
|
3007
|
+
,vReflectionInfos
|
|
3008
|
+
,vReflectionColor
|
|
3009
|
+
,vLightingIntensity
|
|
3010
|
+
,reflectionSampler
|
|
3011
|
+
,reflectionOut.reflectionCoords
|
|
3012
|
+
,NdotVUnclamped
|
|
3013
|
+
#ifndef LODBASEDMICROSFURACE
|
|
3014
|
+
,reflectionSamplerLow
|
|
3015
|
+
,reflectionSamplerHigh
|
|
3016
|
+
#endif
|
|
3017
|
+
#ifdef REALTIME_FILTERING
|
|
3018
|
+
,vReflectionFilteringInfo
|
|
3019
|
+
#endif
|
|
3020
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
|
|
3021
|
+
,seo
|
|
3022
|
+
#endif
|
|
3023
|
+
#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)
|
|
3024
|
+
,eho
|
|
3025
|
+
#endif
|
|
3026
|
+
#endif
|
|
3027
|
+
);
|
|
3028
|
+
#ifdef SHEEN_LINKWITHALBEDO
|
|
3029
|
+
surfaceAlbedo=sheenOut.surfaceAlbedo;
|
|
3030
|
+
#endif
|
|
3031
|
+
#endif
|
|
3032
|
+
#ifdef CLEARCOAT
|
|
3033
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
3034
|
+
vec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;
|
|
3035
|
+
#endif
|
|
3036
|
+
#endif
|
|
3037
|
+
#ifdef IRIDESCENCE
|
|
3038
|
+
iridescenceOutParams iridescenceOut;
|
|
3039
|
+
#ifdef IRIDESCENCE_TEXTURE
|
|
3040
|
+
vec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;
|
|
3041
|
+
#endif
|
|
3042
|
+
#ifdef IRIDESCENCE_THICKNESS_TEXTURE
|
|
3043
|
+
vec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;
|
|
3044
|
+
#endif
|
|
3045
|
+
iridescenceOut=iridescenceBlock(
|
|
3046
|
+
vIridescenceParams
|
|
3047
|
+
,NdotV
|
|
3048
|
+
,specularEnvironmentR0
|
|
3049
|
+
#ifdef IRIDESCENCE_TEXTURE
|
|
3050
|
+
,iridescenceMapData
|
|
3051
|
+
#endif
|
|
3052
|
+
#ifdef IRIDESCENCE_THICKNESS_TEXTURE
|
|
3053
|
+
,iridescenceThicknessMapData
|
|
3054
|
+
#endif
|
|
3055
|
+
#ifdef CLEARCOAT
|
|
3056
|
+
,NdotVUnclamped
|
|
3057
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
3058
|
+
,clearCoatMapData
|
|
3059
|
+
#endif
|
|
3060
|
+
#endif
|
|
3061
|
+
);float iridescenceIntensity=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0;
|
|
3062
|
+
#endif
|
|
3063
|
+
clearcoatOutParams clearcoatOut;
|
|
3064
|
+
#ifdef CLEARCOAT
|
|
3065
|
+
#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
3066
|
+
vec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;
|
|
3067
|
+
#endif
|
|
3068
|
+
#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)
|
|
3069
|
+
vec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset);
|
|
3070
|
+
#endif
|
|
3071
|
+
#ifdef CLEARCOAT_BUMP
|
|
3072
|
+
vec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);
|
|
3073
|
+
#endif
|
|
3074
|
+
clearcoatOut=clearcoatBlock(
|
|
3075
|
+
vPositionW
|
|
3076
|
+
,geometricNormalW
|
|
3077
|
+
,viewDirectionW
|
|
3078
|
+
,vClearCoatParams
|
|
3079
|
+
#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)
|
|
3080
|
+
,clearCoatMapRoughnessData
|
|
3081
|
+
#endif
|
|
3082
|
+
,specularEnvironmentR0
|
|
3083
|
+
#ifdef CLEARCOAT_TEXTURE
|
|
3084
|
+
,clearCoatMapData
|
|
3085
|
+
#endif
|
|
3086
|
+
#ifdef CLEARCOAT_TINT
|
|
3087
|
+
,vClearCoatTintParams
|
|
3088
|
+
,clearCoatColorAtDistance
|
|
3089
|
+
,vClearCoatRefractionParams
|
|
3090
|
+
#ifdef CLEARCOAT_TINT_TEXTURE
|
|
3091
|
+
,clearCoatTintMapData
|
|
3092
|
+
#endif
|
|
3093
|
+
#endif
|
|
3094
|
+
#ifdef CLEARCOAT_BUMP
|
|
3095
|
+
,vClearCoatBumpInfos
|
|
3096
|
+
,clearCoatBumpMapData
|
|
3097
|
+
,vClearCoatBumpUV
|
|
3098
|
+
#if defined(TANGENT) && defined(NORMAL)
|
|
3099
|
+
,vTBN
|
|
3100
|
+
#else
|
|
3101
|
+
,vClearCoatTangentSpaceParams
|
|
3102
|
+
#endif
|
|
3103
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
3104
|
+
,normalMatrix
|
|
3105
|
+
#endif
|
|
3106
|
+
#endif
|
|
3107
|
+
#if defined(FORCENORMALFORWARD) && defined(NORMAL)
|
|
3108
|
+
,faceNormal
|
|
3109
|
+
#endif
|
|
3110
|
+
#ifdef REFLECTION
|
|
3111
|
+
,vReflectionMicrosurfaceInfos
|
|
3112
|
+
,vReflectionInfos
|
|
3113
|
+
,vReflectionColor
|
|
3114
|
+
,vLightingIntensity
|
|
3115
|
+
,reflectionSampler
|
|
3116
|
+
#ifndef LODBASEDMICROSFURACE
|
|
3117
|
+
,reflectionSamplerLow
|
|
3118
|
+
,reflectionSamplerHigh
|
|
3119
|
+
#endif
|
|
3120
|
+
#ifdef REALTIME_FILTERING
|
|
3121
|
+
,vReflectionFilteringInfo
|
|
3122
|
+
#endif
|
|
3123
|
+
#endif
|
|
3124
|
+
#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)
|
|
3125
|
+
,(gl_FrontFacing ? 1. : -1.)
|
|
3126
|
+
#endif
|
|
3127
|
+
);
|
|
3128
|
+
#else
|
|
3129
|
+
clearcoatOut.specularEnvironmentR0=specularEnvironmentR0;
|
|
3130
|
+
#endif
|
|
3131
|
+
#include<pbrBlockReflectance>
|
|
3132
|
+
subSurfaceOutParams subSurfaceOut;
|
|
3133
|
+
#ifdef SUBSURFACE
|
|
3134
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
3135
|
+
vec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);
|
|
3136
|
+
#endif
|
|
3137
|
+
#ifdef SS_REFRACTIONINTENSITY_TEXTURE
|
|
3138
|
+
vec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset);
|
|
3139
|
+
#endif
|
|
3140
|
+
#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
|
|
3141
|
+
vec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset);
|
|
3142
|
+
#endif
|
|
3143
|
+
#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
|
|
3144
|
+
vec4 translucencyColorMap=texture2D(translucencyColorSampler,vTranslucencyColorUV+uvOffset);
|
|
3145
|
+
#endif
|
|
3146
|
+
subSurfaceOut=subSurfaceBlock(
|
|
3147
|
+
vSubSurfaceIntensity
|
|
3148
|
+
,vThicknessParam
|
|
3149
|
+
,vTintColor
|
|
3150
|
+
,normalW
|
|
3151
|
+
,specularEnvironmentReflectance
|
|
3152
|
+
#ifdef SS_THICKNESSANDMASK_TEXTURE
|
|
3153
|
+
,thicknessMap
|
|
3154
|
+
#endif
|
|
3155
|
+
#ifdef SS_REFRACTIONINTENSITY_TEXTURE
|
|
3156
|
+
,refractionIntensityMap
|
|
3157
|
+
#endif
|
|
3158
|
+
#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE
|
|
3159
|
+
,translucencyIntensityMap
|
|
3160
|
+
#endif
|
|
3161
|
+
#ifdef REFLECTION
|
|
3162
|
+
#ifdef SS_TRANSLUCENCY
|
|
3163
|
+
,reflectionMatrix
|
|
3164
|
+
#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
3165
|
+
#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)
|
|
3166
|
+
,reflectionOut.irradianceVector
|
|
3167
|
+
#endif
|
|
3168
|
+
#if defined(REALTIME_FILTERING)
|
|
3169
|
+
,reflectionSampler
|
|
3170
|
+
,vReflectionFilteringInfo
|
|
3171
|
+
#ifdef IBL_CDF_FILTERING
|
|
3172
|
+
,icdfSampler
|
|
3173
|
+
#endif
|
|
3174
|
+
#endif
|
|
3175
|
+
#endif
|
|
3176
|
+
#ifdef USEIRRADIANCEMAP
|
|
3177
|
+
,irradianceSampler
|
|
3178
|
+
#endif
|
|
3179
|
+
#endif
|
|
3180
|
+
#endif
|
|
3181
|
+
#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)
|
|
3182
|
+
,surfaceAlbedo
|
|
3183
|
+
#endif
|
|
3184
|
+
#ifdef SS_REFRACTION
|
|
3185
|
+
,vPositionW
|
|
3186
|
+
,viewDirectionW
|
|
3187
|
+
,view
|
|
3188
|
+
,vRefractionInfos
|
|
3189
|
+
,refractionMatrix
|
|
3190
|
+
,vRefractionMicrosurfaceInfos
|
|
3191
|
+
,vLightingIntensity
|
|
3192
|
+
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
|
|
3193
|
+
,alpha
|
|
3194
|
+
#endif
|
|
3195
|
+
#ifdef SS_LODINREFRACTIONALPHA
|
|
3196
|
+
,NdotVUnclamped
|
|
3197
|
+
#endif
|
|
3198
|
+
#ifdef SS_LINEARSPECULARREFRACTION
|
|
3199
|
+
,roughness
|
|
3200
|
+
#endif
|
|
3201
|
+
,alphaG
|
|
3202
|
+
,refractionSampler
|
|
3203
|
+
#ifndef LODBASEDMICROSFURACE
|
|
3204
|
+
,refractionSamplerLow
|
|
3205
|
+
,refractionSamplerHigh
|
|
3206
|
+
#endif
|
|
3207
|
+
#ifdef ANISOTROPIC
|
|
3208
|
+
,anisotropicOut
|
|
3209
|
+
#endif
|
|
3210
|
+
#ifdef REALTIME_FILTERING
|
|
3211
|
+
,vRefractionFilteringInfo
|
|
3212
|
+
#endif
|
|
3213
|
+
#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
3214
|
+
,vRefractionPosition
|
|
3215
|
+
,vRefractionSize
|
|
3216
|
+
#endif
|
|
3217
|
+
#ifdef SS_DISPERSION
|
|
3218
|
+
,dispersion
|
|
3219
|
+
#endif
|
|
3220
|
+
#endif
|
|
3221
|
+
#ifdef SS_TRANSLUCENCY
|
|
3222
|
+
,vDiffusionDistance
|
|
3223
|
+
,vTranslucencyColor
|
|
3224
|
+
#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE
|
|
3225
|
+
,translucencyColorMap
|
|
3226
|
+
#endif
|
|
3227
|
+
#endif
|
|
3228
|
+
);
|
|
3229
|
+
#ifdef SS_REFRACTION
|
|
3230
|
+
surfaceAlbedo=subSurfaceOut.surfaceAlbedo;
|
|
3231
|
+
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
|
|
3232
|
+
alpha=subSurfaceOut.alpha;
|
|
3233
|
+
#endif
|
|
3234
|
+
#endif
|
|
3235
|
+
#else
|
|
3236
|
+
subSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;
|
|
3237
|
+
#endif
|
|
3238
|
+
#include<pbrBlockDirectLighting>
|
|
3239
|
+
#include<lightFragment>[0..maxSimultaneousLights]
|
|
3240
|
+
#include<pbrBlockFinalLitComponents>
|
|
3241
|
+
#endif
|
|
3242
|
+
#include<pbrBlockFinalUnlitComponents>
|
|
3243
|
+
#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION
|
|
3244
|
+
#include<pbrBlockFinalColorComposition>
|
|
3245
|
+
#include<logDepthFragment>
|
|
3246
|
+
#include<fogFragment>(color,finalColor)
|
|
3247
|
+
#include<pbrBlockImageProcessing>
|
|
3248
|
+
#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
|
|
3249
|
+
#ifdef PREPASS
|
|
3250
|
+
#include<pbrBlockPrePass>
|
|
3251
|
+
#endif
|
|
3252
|
+
#if !defined(PREPASS) || defined(WEBGL2)
|
|
3253
|
+
gl_FragColor=finalColor;
|
|
3254
|
+
#endif
|
|
3255
|
+
#include<oitFragment>
|
|
3256
|
+
#if ORDER_INDEPENDENT_TRANSPARENCY
|
|
3257
|
+
if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}
|
|
3258
|
+
#endif
|
|
3259
|
+
#include<pbrDebug>
|
|
3260
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
3261
|
+
}
|
|
3262
|
+
`;
|
|
3263
|
+
// Sideeffect
|
|
3264
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
3265
|
+
/** @internal */
|
|
3266
|
+
const pbrPixelShader = { name, shader };
|
|
3267
|
+
|
|
3268
|
+
export { pbrPixelShader };
|
|
3269
|
+
//# sourceMappingURL=pbr.fragment-C7xQS4ZJ.esm.js.map
|