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