@zephyr3d/scene 0.9.26 → 0.10.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/README.md +60 -27
- package/dist/animation/animation_bank.js +634 -0
- package/dist/animation/animation_bank.js.map +1 -0
- package/dist/animation/animation_bank_gpu.js +256 -0
- package/dist/animation/animation_bank_gpu.js.map +1 -0
- package/dist/animation/animationset.js +146 -30
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/cloth/gpu_cloth_component.js +406 -0
- package/dist/animation/cloth/gpu_cloth_component.js.map +1 -0
- package/dist/animation/cloth/gpu_cloth_system.js +332 -202
- package/dist/animation/cloth/gpu_cloth_system.js.map +1 -1
- package/dist/animation/gpu_animation_driver.js +289 -0
- package/dist/animation/gpu_animation_driver.js.map +1 -0
- package/dist/animation/joint_dynamics/collision.js +112 -1
- package/dist/animation/joint_dynamics/collision.js.map +1 -1
- package/dist/animation/joint_dynamics/controller.js +6 -0
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +11 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
- package/dist/animation/joint_dynamics/solver.js +50 -12
- package/dist/animation/joint_dynamics/solver.js.map +1 -1
- package/dist/animation/joint_dynamics/types.js.map +1 -1
- package/dist/animation/skeleton.js +300 -56
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skin_palette_atlas.js +252 -0
- package/dist/animation/skin_palette_atlas.js.map +1 -0
- package/dist/animation/spring/multi_chain_spring_system.js +298 -38
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
- package/dist/animation/spring/spring_chain.js +2 -0
- package/dist/animation/spring/spring_chain.js.map +1 -1
- package/dist/animation/spring/spring_collider.js +159 -21
- package/dist/animation/spring/spring_collider.js.map +1 -1
- package/dist/animation/spring/spring_particle.js +1 -0
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_solver.js +173 -0
- package/dist/animation/spring/spring_solver.js.map +1 -0
- package/dist/animation/spring/spring_system.js +249 -24
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring_modifier.js +32 -1
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/app/app.js +26 -0
- package/dist/app/app.js.map +1 -1
- package/dist/app/engine.js +86 -15
- package/dist/app/engine.js.map +1 -1
- package/dist/app/gamepad.js +191 -0
- package/dist/app/gamepad.js.map +1 -0
- package/dist/app/inputactions.js +271 -0
- package/dist/app/inputactions.js.map +1 -0
- package/dist/app/inputmgr.js +331 -22
- package/dist/app/inputmgr.js.map +1 -1
- package/dist/app/loading.js +138 -0
- package/dist/app/loading.js.map +1 -0
- package/dist/app/pipelinecache.js +209 -0
- package/dist/app/pipelinecache.js.map +1 -0
- package/dist/app/runtimescript.js +25 -0
- package/dist/app/runtimescript.js.map +1 -1
- package/dist/app/scriptingsystem.js +54 -0
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +7 -2
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/asset_manifest.js +59 -0
- package/dist/asset/asset_manifest.js.map +1 -0
- package/dist/asset/asset_preload.js +258 -0
- package/dist/asset/asset_preload.js.map +1 -0
- package/dist/asset/assetmanager.js +117 -65
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/ktx2/basis/LICENSE +201 -0
- package/dist/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
- package/dist/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
- package/dist/asset/loaders/ktx2/basis_location.js +17 -0
- package/dist/asset/loaders/ktx2/basis_location.js.map +1 -0
- package/dist/asset/loaders/ktx2/ktx2_loader.js +88 -0
- package/dist/asset/loaders/ktx2/ktx2_loader.js.map +1 -0
- package/dist/asset/loaders/ktx2/ktx2_targets.js +118 -0
- package/dist/asset/loaders/ktx2/ktx2_targets.js.map +1 -0
- package/dist/asset/loaders/ktx2/transcoder_pool.js +259 -0
- package/dist/asset/loaders/ktx2/transcoder_pool.js.map +1 -0
- package/dist/asset/mesh_lod_builder.js +104 -0
- package/dist/asset/mesh_lod_builder.js.map +1 -0
- package/dist/asset/mesh_settings.js +111 -0
- package/dist/asset/mesh_settings.js.map +1 -0
- package/dist/asset/meshopt_decoder.js +18 -0
- package/dist/asset/meshopt_decoder.js.map +1 -0
- package/dist/asset/meshopt_simplifier.js +26 -0
- package/dist/asset/meshopt_simplifier.js.map +1 -0
- package/dist/asset/model.js +177 -3
- package/dist/asset/model.js.map +1 -1
- package/dist/asset/texture_settings.js +231 -0
- package/dist/asset/texture_settings.js.map +1 -0
- package/dist/asset/zmsh_binary.js +131 -0
- package/dist/asset/zmsh_binary.js.map +1 -0
- package/dist/asset/zsdf_binary.js +111 -0
- package/dist/asset/zsdf_binary.js.map +1 -0
- package/dist/blitter/bilateralblur.js +1 -2
- package/dist/blitter/bilateralblur.js.map +1 -1
- package/dist/blitter/gaussianblur.js +1 -6
- package/dist/blitter/gaussianblur.js.map +1 -1
- package/dist/camera/base.js +31 -10
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +178 -200
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/follow.js +342 -0
- package/dist/camera/follow.js.map +1 -0
- package/dist/camera/fps.js +9 -7
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +46 -19
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +30475 -19865
- package/dist/index.js +67 -12
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +3 -0
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/eye.js +1 -1
- package/dist/material/eye.js.map +1 -1
- package/dist/material/hair.js +2 -3
- package/dist/material/hair.js.map +1 -1
- package/dist/material/hairstrand.js +235 -235
- package/dist/material/hairstrand.js.map +1 -1
- package/dist/material/lambert.js +4 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +362 -300
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +118 -45
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +1 -1
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +34 -61
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +16 -2
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +2 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +223 -83
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +31 -206
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mtoon.js +1 -1
- package/dist/material/mtoon.js.map +1 -1
- package/dist/material/pbrmr.js +3 -0
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/pbrsg.js +3 -0
- package/dist/material/pbrsg.js.map +1 -1
- package/dist/material/sdf_debug.js +78 -0
- package/dist/material/sdf_debug.js.map +1 -0
- package/dist/material/shader/helper.js +733 -190
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/shader/terrain_blend.js +204 -43
- package/dist/material/shader/terrain_blend.js.map +1 -1
- package/dist/material/skin.js +331 -297
- package/dist/material/skin.js.map +1 -1
- package/dist/material/skinprofile.js +1058 -0
- package/dist/material/skinprofile.js.map +1 -0
- package/dist/material/sss.js +353 -0
- package/dist/material/sss.js.map +1 -0
- package/dist/material/sss_kernel.js +265 -0
- package/dist/material/sss_kernel.js.map +1 -0
- package/dist/material/sssprofile.js +879 -0
- package/dist/material/sssprofile.js.map +1 -0
- package/dist/material/subsurfaceprofile.js +4 -8
- package/dist/material/subsurfaceprofile.js.map +1 -1
- package/dist/material/terrain-cm.js +464 -188
- package/dist/material/terrain-cm.js.map +1 -1
- package/dist/material/unlit.js +3 -0
- package/dist/material/unlit.js.map +1 -1
- package/dist/material/water.js +2009 -201
- package/dist/material/water.js.map +1 -1
- package/dist/node_modules/meshoptimizer/LICENSE +21 -0
- package/dist/node_modules/meshoptimizer/meshopt_decoder.js +197 -0
- package/dist/node_modules/meshoptimizer/meshopt_decoder.js.map +1 -0
- package/dist/node_modules/meshoptimizer/meshopt_simplifier.js +677 -0
- package/dist/node_modules/meshoptimizer/meshopt_simplifier.js.map +1 -0
- package/dist/physics/character.js +226 -0
- package/dist/physics/character.js.map +1 -0
- package/dist/physics/collider.js +209 -0
- package/dist/physics/collider.js.map +1 -0
- package/dist/physics/events.js +79 -0
- package/dist/physics/events.js.map +1 -0
- package/dist/physics/joint.js +272 -0
- package/dist/physics/joint.js.map +1 -0
- package/dist/physics/node_physics.js +234 -0
- package/dist/physics/node_physics.js.map +1 -0
- package/dist/physics/part.js +91 -0
- package/dist/physics/part.js.map +1 -0
- package/dist/physics/rigid_body.js +379 -0
- package/dist/physics/rigid_body.js.map +1 -0
- package/dist/physics/vehicle.js +335 -0
- package/dist/physics/vehicle.js.map +1 -0
- package/dist/physics/world.js +25 -0
- package/dist/physics/world.js.map +1 -0
- package/dist/posteffect/bloom.js +49 -14
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/motionblur.js +668 -63
- package/dist/posteffect/motionblur.js.map +1 -1
- package/dist/posteffect/posteffect.js +12 -1
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/postsss.js +572 -0
- package/dist/posteffect/postsss.js.map +1 -0
- package/dist/posteffect/sao.js +48 -50
- package/dist/posteffect/sao.js.map +1 -1
- package/dist/posteffect/skinsss.js +605 -355
- package/dist/posteffect/skinsss.js.map +1 -1
- package/dist/posteffect/ssgi.js +91 -162
- package/dist/posteffect/ssgi.js.map +1 -1
- package/dist/posteffect/ssr.js +3 -11
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/sss.js +34 -15
- package/dist/posteffect/sss.js.map +1 -1
- package/dist/posteffect/taa.js +1 -0
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/abuffer_oit.js +40 -39
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/clipmap.js +328 -62
- package/dist/render/clipmap.js.map +1 -1
- package/dist/render/cluster_light.js +958 -224
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/cull_visitor.js +26 -5
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/debug_views.js +37 -0
- package/dist/render/debug_views.js.map +1 -0
- package/dist/render/depthpass.js +5 -1
- package/dist/render/depthpass.js.map +1 -1
- package/dist/render/drawable_mixin.js +53 -6
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/dualdepthpeeling_oit.js +53 -53
- package/dist/render/dualdepthpeeling_oit.js.map +1 -1
- package/dist/render/envlight.js +196 -113
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +8 -13
- package/dist/render/fbm_wavegenerator.js.map +1 -1
- package/dist/render/fft_wavegenerator.js +268 -136
- package/dist/render/fft_wavegenerator.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +113 -28
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/gi/probe_volume.js +1334 -0
- package/dist/render/gi/probe_volume.js.map +1 -0
- package/dist/render/gi/scene_gi.js +282 -0
- package/dist/render/gi/scene_gi.js.map +1 -0
- package/dist/render/gi/voxel_atlas.js +198 -0
- package/dist/render/gi/voxel_atlas.js.map +1 -0
- package/dist/render/gi/voxel_lighting.js +652 -0
- package/dist/render/gi/voxel_lighting.js.map +1 -0
- package/dist/render/gi/voxel_scene.js +642 -0
- package/dist/render/gi/voxel_scene.js.map +1 -0
- package/dist/render/gi/voxelize_pass.js +223 -0
- package/dist/render/gi/voxelize_pass.js.map +1 -0
- package/dist/render/globalbindgroup_allocator.js +3 -2
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/gpu_picking.js +9 -36
- package/dist/render/gpu_picking.js.map +1 -1
- package/dist/render/hzb.js +80 -22
- package/dist/render/hzb.js.map +1 -1
- package/dist/render/instance_culling.js +499 -0
- package/dist/render/instance_culling.js.map +1 -0
- package/dist/render/lightpass.js +23 -9
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/lod.js +46 -0
- package/dist/render/lod.js.map +1 -0
- package/dist/render/oit.js +11 -11
- package/dist/render/oit.js.map +1 -1
- package/dist/render/primitive.js +301 -9
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/primitive_readback.js +209 -0
- package/dist/render/primitive_readback.js.map +1 -0
- package/dist/render/render_queue.js +198 -11
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +14 -7
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/blackboard.js +15 -1
- package/dist/render/rendergraph/blackboard.js.map +1 -1
- package/dist/render/rendergraph/executor.js +136 -0
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +585 -59
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/frame_resource_requirements.js +1 -0
- package/dist/render/rendergraph/frame_resource_requirements.js.map +1 -1
- package/dist/render/rendergraph/history_resources.js +8 -1
- package/dist/render/rendergraph/history_resources.js.map +1 -1
- package/dist/render/rendergraph/scene_render_context.js +31 -2
- package/dist/render/rendergraph/scene_render_context.js.map +1 -1
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/renderpass.js +28 -5
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/sdf/box_allocator.js +98 -0
- package/dist/render/sdf/box_allocator.js.map +1 -0
- package/dist/render/sdf/global_sdf.js +865 -0
- package/dist/render/sdf/global_sdf.js.map +1 -0
- package/dist/render/sdf/scene_sdf.js +562 -0
- package/dist/render/sdf/scene_sdf.js.map +1 -0
- package/dist/render/sdf/sdf_atlas.js +227 -0
- package/dist/render/sdf/sdf_atlas.js.map +1 -0
- package/dist/render/sdf/sdf_programs.js +42 -0
- package/dist/render/sdf/sdf_programs.js.map +1 -0
- package/dist/render/sdf/sdf_view.js +199 -0
- package/dist/render/sdf/sdf_view.js.map +1 -0
- package/dist/render/sdf/waterline.js +610 -0
- package/dist/render/sdf/waterline.js.map +1 -0
- package/dist/render/shadow_mask_pass.js +142 -25
- package/dist/render/shadow_mask_pass.js.map +1 -1
- package/dist/render/shore_wave_generator.js +1193 -0
- package/dist/render/shore_wave_generator.js.map +1 -0
- package/dist/render/sky.js +516 -86
- package/dist/render/sky.js.map +1 -1
- package/dist/render/transmission_thickness_pass.js +477 -0
- package/dist/render/transmission_thickness_pass.js.map +1 -0
- package/dist/render/underwater.js +524 -0
- package/dist/render/underwater.js.map +1 -0
- package/dist/render/virtualtexture/virtual_texture.js +1214 -0
- package/dist/render/virtualtexture/virtual_texture.js.map +1 -0
- package/dist/render/volumetric_cloud/cloud_common.js +472 -0
- package/dist/render/volumetric_cloud/cloud_common.js.map +1 -0
- package/dist/render/volumetric_cloud/cloud_noise.js +189 -0
- package/dist/render/volumetric_cloud/cloud_noise.js.map +1 -0
- package/dist/render/volumetric_cloud/debug_view.js +131 -0
- package/dist/render/volumetric_cloud/debug_view.js.map +1 -0
- package/dist/render/volumetric_cloud/resources.js +380 -0
- package/dist/render/volumetric_cloud/resources.js.map +1 -0
- package/dist/render/volumetric_cloud/sky_cache.js +380 -0
- package/dist/render/volumetric_cloud/sky_cache.js.map +1 -0
- package/dist/render/volumetric_cloud/volumetric_cloud.js +318 -0
- package/dist/render/volumetric_cloud/volumetric_cloud.js.map +1 -0
- package/dist/render/water_caustics.js +1195 -0
- package/dist/render/water_caustics.js.map +1 -0
- package/dist/render/water_foam.js +627 -0
- package/dist/render/water_foam.js.map +1 -0
- package/dist/render/water_interaction.js +1795 -0
- package/dist/render/water_interaction.js.map +1 -0
- package/dist/render/weightedblended_oit.js +36 -36
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/basesprite.js +9 -4
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +108 -12
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +28 -7
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/foliage.js +1020 -0
- package/dist/scene/foliage.js.map +1 -0
- package/dist/scene/foliage_buckets.js +147 -0
- package/dist/scene/foliage_buckets.js.map +1 -0
- package/dist/scene/foliage_mask.js +358 -0
- package/dist/scene/foliage_mask.js.map +1 -0
- package/dist/scene/hair.js +15 -4
- package/dist/scene/hair.js.map +1 -1
- package/dist/scene/light.js +179 -13
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +327 -45
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/meshdrawable.js +6 -0
- package/dist/scene/meshdrawable.js.map +1 -1
- package/dist/scene/msdftext.js +9 -3
- package/dist/scene/msdftext.js.map +1 -1
- package/dist/scene/msdftextsprite.js +9 -3
- package/dist/scene/msdftextsprite.js.map +1 -1
- package/dist/scene/particlesys.js +8 -2
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/physics_settings.js +157 -0
- package/dist/scene/physics_settings.js.map +1 -0
- package/dist/scene/scene.js +190 -44
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +147 -6
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/terrain-cm/bladegrassmaterial.js +735 -0
- package/dist/scene/terrain-cm/bladegrassmaterial.js.map +1 -0
- package/dist/scene/terrain-cm/grass.js +881 -42
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/grass_gpu.js +929 -0
- package/dist/scene/terrain-cm/grass_gpu.js.map +1 -0
- package/dist/scene/terrain-cm/grassmaterial.js +180 -9
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +465 -36
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/terrain-cm/terrain_gi_albedo.js +257 -0
- package/dist/scene/terrain-cm/terrain_gi_albedo.js.map +1 -0
- package/dist/scene/terrain-cm/terrain_rvt.js +395 -0
- package/dist/scene/terrain-cm/terrain_rvt.js.map +1 -0
- package/dist/scene/update_queue.js +54 -0
- package/dist/scene/update_queue.js.map +1 -0
- package/dist/scene/water.js +997 -96
- package/dist/scene/water.js.map +1 -1
- package/dist/scene/water_surface_sampler.js +324 -0
- package/dist/scene/water_surface_sampler.js.map +1 -0
- package/dist/scene/wind.js +317 -0
- package/dist/scene/wind.js.map +1 -0
- package/dist/shaders/atmosphere.js +388 -166
- package/dist/shaders/atmosphere.js.map +1 -1
- package/dist/shaders/fog.js +100 -32
- package/dist/shaders/fog.js.map +1 -1
- package/dist/shaders/gi.js +365 -0
- package/dist/shaders/gi.js.map +1 -0
- package/dist/shaders/ltc_rect.js +202 -0
- package/dist/shaders/ltc_rect.js.map +1 -0
- package/dist/shaders/misc.js +1 -10
- package/dist/shaders/misc.js.map +1 -1
- package/dist/shaders/noise.js +5 -1
- package/dist/shaders/noise.js.map +1 -1
- package/dist/shaders/probes.js +309 -0
- package/dist/shaders/probes.js.map +1 -0
- package/dist/shaders/sdf.js +537 -0
- package/dist/shaders/sdf.js.map +1 -0
- package/dist/shaders/shadow.js +104 -70
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shaders/skin_brdf.js +243 -0
- package/dist/shaders/skin_brdf.js.map +1 -0
- package/dist/shaders/ssr.js +6 -159
- package/dist/shaders/ssr.js.map +1 -1
- package/dist/shaders/temporal.js +38 -27
- package/dist/shaders/temporal.js.map +1 -1
- package/dist/shaders/water.js +40 -87
- package/dist/shaders/water.js.map +1 -1
- package/dist/shaders/water_medium.js +42 -0
- package/dist/shaders/water_medium.js.map +1 -0
- package/dist/shadow/dom.js +110 -19
- package/dist/shadow/dom.js.map +1 -1
- package/dist/shadow/esm.js +3 -3
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +15 -48
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +15 -53
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/pcss.js +34 -9
- package/dist/shadow/pcss.js.map +1 -1
- package/dist/shadow/shadow_impl.js +3 -8
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadow_region.js +87 -49
- package/dist/shadow/shadow_region.js.map +1 -1
- package/dist/shadow/shadowmapper.js +93 -53
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/ssm.js +18 -72
- package/dist/shadow/ssm.js.map +1 -1
- package/dist/shadow/vsm.js +3 -3
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/shapes/shape.js +44 -1
- package/dist/shapes/shape.js.map +1 -1
- package/dist/utility/buoyancy.js +287 -0
- package/dist/utility/buoyancy.js.map +1 -0
- package/dist/utility/physical.js +10 -1
- package/dist/utility/physical.js.map +1 -1
- package/dist/utility/pmrem.js +17 -43
- package/dist/utility/pmrem.js.map +1 -1
- package/dist/utility/sdf/bake.js +435 -0
- package/dist/utility/sdf/bake.js.map +1 -0
- package/dist/utility/sdf/bvh.js +576 -0
- package/dist/utility/sdf/bvh.js.map +1 -0
- package/dist/utility/serialization/manager.js +36 -6
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +77 -7
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +11 -4
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +140 -279
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/cloth.js +25 -0
- package/dist/utility/serialization/scene/cloth.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +14 -6
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/foliage.js +821 -0
- package/dist/utility/serialization/scene/foliage.js.map +1 -0
- package/dist/utility/serialization/scene/hair.js +11 -4
- package/dist/utility/serialization/scene/hair.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +115 -7
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +388 -220
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +69 -4
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +140 -5
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/node_physics.js +1318 -0
- package/dist/utility/serialization/scene/node_physics.js.map +1 -0
- package/dist/utility/serialization/scene/particle.js +11 -4
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/physics.js +120 -0
- package/dist/utility/serialization/scene/physics.js.map +1 -0
- package/dist/utility/serialization/scene/primitive.js +124 -10
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +1687 -51
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +11 -4
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +163 -33
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/text.js +11 -4
- package/dist/utility/serialization/scene/text.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +2473 -114
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/utility/shprojector.js +97 -109
- package/dist/utility/shprojector.js.map +1 -1
- package/dist/utility/textures/foam.js +170 -0
- package/dist/utility/textures/foam.js.map +1 -0
- package/dist/utility/textures/ggxlut.js +17 -43
- package/dist/utility/textures/ggxlut.js.map +1 -1
- package/dist/utility/textures/ltcdata.js +4 -4
- package/dist/utility/textures/ltcdata.js.map +1 -1
- package/dist/utility/textures/ltclut.js +16 -6
- package/dist/utility/textures/ltclut.js.map +1 -1
- package/dist/utility/unsupported.js +24 -0
- package/dist/utility/unsupported.js.map +1 -0
- package/dist/values.js +13 -1
- package/dist/values.js.map +1 -1
- package/package.json +25 -12
- package/src/asset/loaders/ktx2/basis/LICENSE +201 -0
- package/src/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
- package/src/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
- package/src/asset/meshoptimizer/LICENSE +21 -0
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { Vector2, Vector4, DEPTH_FARTHEST } from '@zephyr3d/base';
|
|
2
|
+
import { ShaderHelper } from '../material/shader/helper.js';
|
|
3
|
+
import '../material/lambert.js';
|
|
4
|
+
import '../material/blinn.js';
|
|
5
|
+
import '../material/unlit.js';
|
|
6
|
+
import '../material/meshmaterial.js';
|
|
7
|
+
import '../material/particle.js';
|
|
8
|
+
import '../material/subsurfaceprofile.js';
|
|
9
|
+
import { SSSProfile } from '../material/sssprofile.js';
|
|
10
|
+
import '../material/sss.js';
|
|
11
|
+
import '../material/eye.js';
|
|
12
|
+
import '@zephyr3d/device';
|
|
13
|
+
import '../values.js';
|
|
14
|
+
import '../material/hair.js';
|
|
15
|
+
import '../material/hairstrand.js';
|
|
16
|
+
import '../material/grassmaterial.js';
|
|
17
|
+
import '../material/terrain-cm.js';
|
|
18
|
+
import '../material/pbrmr.js';
|
|
19
|
+
import '../material/pbrsg.js';
|
|
20
|
+
import '../material/mtoon.js';
|
|
21
|
+
import '../material/pbrblueprint.js';
|
|
22
|
+
import '../material/sprite.js';
|
|
23
|
+
import '../material/sprite_std.js';
|
|
24
|
+
import '../utility/blueprint/material/texture.js';
|
|
25
|
+
import { hash21 } from '../shaders/noise.js';
|
|
26
|
+
import { linearToGamma } from '../shaders/misc.js';
|
|
27
|
+
import { fetchSampler } from '../utility/misc.js';
|
|
28
|
+
import { AbstractPostEffect, PostEffectLayer } from './posteffect.js';
|
|
29
|
+
import { warnUnsupported } from '../utility/unsupported.js';
|
|
30
|
+
|
|
31
|
+
const SKIN_SSS_DEBUG_OUTPUTS = [
|
|
32
|
+
'none',
|
|
33
|
+
'diffusible',
|
|
34
|
+
'diffuseAmount',
|
|
35
|
+
'profileId',
|
|
36
|
+
'normal',
|
|
37
|
+
'diffusionDistance',
|
|
38
|
+
'sampleRadius',
|
|
39
|
+
'weight',
|
|
40
|
+
'acceptance',
|
|
41
|
+
'centerWeight',
|
|
42
|
+
'diffused',
|
|
43
|
+
'thickness'
|
|
44
|
+
];
|
|
45
|
+
/** Radial-disc sample count. */ const DEFAULT_SAMPLE_COUNT = 64;
|
|
46
|
+
/**
|
|
47
|
+
* Screen-space skin scattering.
|
|
48
|
+
*
|
|
49
|
+
* WebGPU only.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/ class PostSSS extends AbstractPostEffect {
|
|
53
|
+
static _burleyProgram = null;
|
|
54
|
+
static _bvarProgram = null;
|
|
55
|
+
static _recombineProgram = null;
|
|
56
|
+
_burleyBindGroup;
|
|
57
|
+
_bvarBindGroup;
|
|
58
|
+
_recombineBindGroup;
|
|
59
|
+
_profile;
|
|
60
|
+
_debugOutput;
|
|
61
|
+
_debugExposure;
|
|
62
|
+
_sampleCount;
|
|
63
|
+
_projScale;
|
|
64
|
+
_profileParams;
|
|
65
|
+
_targetSize;
|
|
66
|
+
_cameraNearFar;
|
|
67
|
+
constructor(){
|
|
68
|
+
super();
|
|
69
|
+
this._layer = PostEffectLayer.opaque;
|
|
70
|
+
this._burleyBindGroup = null;
|
|
71
|
+
this._bvarBindGroup = null;
|
|
72
|
+
this._recombineBindGroup = null;
|
|
73
|
+
this._profile = null;
|
|
74
|
+
this._debugOutput = 'none';
|
|
75
|
+
this._debugExposure = 1;
|
|
76
|
+
this._sampleCount = DEFAULT_SAMPLE_COUNT;
|
|
77
|
+
this._projScale = new Vector2();
|
|
78
|
+
this._profileParams = new Vector4();
|
|
79
|
+
this._targetSize = new Vector4();
|
|
80
|
+
this._cameraNearFar = new Vector2();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fallback profile for pixels whose id is not in the table.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* Scattering parameters normally come from the per-pixel profile id the skin
|
|
87
|
+
* material writes, so this only applies when that lookup misses.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/ get profile() {
|
|
91
|
+
return this._profile;
|
|
92
|
+
}
|
|
93
|
+
set profile(val) {
|
|
94
|
+
this._profile = val ?? null;
|
|
95
|
+
}
|
|
96
|
+
get sampleCount() {
|
|
97
|
+
return this._sampleCount;
|
|
98
|
+
}
|
|
99
|
+
set sampleCount(val) {
|
|
100
|
+
this._sampleCount = Math.max(8, Math.min(64, Math.round(val ?? DEFAULT_SAMPLE_COUNT)));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Multiplier applied to whatever {@link PostSSS.debugOutput} renders.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* Defaults to 1. Several intermediates sit in a narrow band that reads as a
|
|
107
|
+
* flat tone at unit exposure, so raising this is how "no variation" is told
|
|
108
|
+
* apart from "variation too small to see". No effect unless a debug output is
|
|
109
|
+
* selected.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/ get debugExposure() {
|
|
113
|
+
return this._debugExposure;
|
|
114
|
+
}
|
|
115
|
+
set debugExposure(val) {
|
|
116
|
+
this._debugExposure = Math.max(0, val ?? 1);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Intermediate quantity to render instead of the shaded result.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* Defaults to `'none'`. See {@link SSSDebugOutput}.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/ get debugOutput() {
|
|
126
|
+
return this._debugOutput;
|
|
127
|
+
}
|
|
128
|
+
set debugOutput(val) {
|
|
129
|
+
this._debugOutput = SKIN_SSS_DEBUG_OUTPUTS.includes(val) ? val : 'none';
|
|
130
|
+
}
|
|
131
|
+
requireLinearDepthTexture() {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
apply(ctx, inputColorTexture, sceneDepthTexture, srgbOutput) {
|
|
135
|
+
if (ctx.SSSMaskTexture && ctx.SSSProfileIdTexture && ctx.device.type !== 'webgpu') {
|
|
136
|
+
warnUnsupported('Screen-space subsurface diffusion (SSSMaterial)', 'WebGPU', 'skin is lit without diffusion, transmission still applies');
|
|
137
|
+
}
|
|
138
|
+
if (!ctx.SSSMaskTexture || !ctx.SSSProfileIdTexture || ctx.device.type !== 'webgpu') {
|
|
139
|
+
this.passThrough(ctx, inputColorTexture, srgbOutput);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const device = ctx.device;
|
|
143
|
+
const outputFramebuffer = device.getFramebuffer();
|
|
144
|
+
const maskTex = ctx.SSSMaskTexture;
|
|
145
|
+
const profileIdTex = ctx.SSSProfileIdTexture;
|
|
146
|
+
const width = inputColorTexture.width;
|
|
147
|
+
const height = inputColorTexture.height;
|
|
148
|
+
const scatterFormat = ctx.colorFormat;
|
|
149
|
+
const profileTable = SSSProfile.getTable(device);
|
|
150
|
+
if (!profileTable) {
|
|
151
|
+
this.passThrough(ctx, inputColorTexture, srgbOutput);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const fallback = this._profile ?? SSSProfile.getDefault();
|
|
155
|
+
const projMatrix = ctx.camera.getProjectionMatrix();
|
|
156
|
+
this._projScale.setXY(// x: world length at unit depth, in horizontal UV
|
|
157
|
+
0.5 * projMatrix.m00, // y: world length at unit depth, in vertical UV
|
|
158
|
+
0.5 * projMatrix.m11);
|
|
159
|
+
// Row of the fallback profile, used when a pixel's id is missing.
|
|
160
|
+
this._profileParams.setXYZW(fallback.encodedId, 1 / SSSProfile.tableColumns, 1 / SSSProfile.tableRows, SSSProfile.tableRows);
|
|
161
|
+
this._targetSize.setXYZW(width, height, 1 / width, 1 / height);
|
|
162
|
+
this._cameraNearFar.setXY(ctx.camera.getNearPlane(), ctx.camera.getFarPlane());
|
|
163
|
+
if (!PostSSS._burleyProgram) {
|
|
164
|
+
PostSSS._burleyProgram = this.createBurleyProgram(ctx);
|
|
165
|
+
}
|
|
166
|
+
if (!PostSSS._bvarProgram) {
|
|
167
|
+
PostSSS._bvarProgram = this.createBVarProgram(ctx);
|
|
168
|
+
}
|
|
169
|
+
if (!PostSSS._recombineProgram) {
|
|
170
|
+
PostSSS._recombineProgram = this.createRecombineProgram(ctx);
|
|
171
|
+
}
|
|
172
|
+
const diffusedFB = device.pool.fetchTemporalFramebuffer(false, width, height, scatterFormat, null, false);
|
|
173
|
+
const bvarFB = device.pool.fetchTemporalFramebuffer(false, width, height, scatterFormat, null, false);
|
|
174
|
+
// --- Pass 1: Burley diffusion ---
|
|
175
|
+
device.pushDeviceStates();
|
|
176
|
+
try {
|
|
177
|
+
if (!this._burleyBindGroup) {
|
|
178
|
+
this._burleyBindGroup = device.createBindGroup(PostSSS._burleyProgram.bindGroupLayouts[0]);
|
|
179
|
+
}
|
|
180
|
+
const bg = this._burleyBindGroup;
|
|
181
|
+
bg.setTexture('sceneTex', inputColorTexture, fetchSampler('clamp_linear'));
|
|
182
|
+
bg.setTexture('maskTex', maskTex, fetchSampler('clamp_linear'));
|
|
183
|
+
// Nearest only: the id is a table row, and an interpolated one addresses a
|
|
184
|
+
// profile neither neighbour has.
|
|
185
|
+
bg.setTexture('profileIdTex', profileIdTex, fetchSampler('clamp_nearest_nomip'));
|
|
186
|
+
bg.setTexture('depthTex', sceneDepthTexture, fetchSampler('clamp_nearest_nomip'));
|
|
187
|
+
bg.setValue('cameraNearFar', this._cameraNearFar);
|
|
188
|
+
bg.setValue('targetSize', this._targetSize);
|
|
189
|
+
bg.setValue('projScale', this._projScale);
|
|
190
|
+
bg.setValue('perspective', ctx.camera.isPerspective() ? 1 : 0);
|
|
191
|
+
bg.setValue('profileParams', this._profileParams);
|
|
192
|
+
bg.setTexture('profileTex', profileTable, fetchSampler('clamp_nearest_nomip'));
|
|
193
|
+
bg.setTexture('thicknessTex', ctx.transmissionThicknessTexture ?? ShaderHelper.getDummyTransmissionThickness(device), fetchSampler('clamp_nearest'));
|
|
194
|
+
bg.setValue('sampleCount', this._sampleCount);
|
|
195
|
+
bg.setValue('debugMode', SKIN_SSS_DEBUG_OUTPUTS.indexOf(this._debugOutput));
|
|
196
|
+
bg.setValue('debugExposure', this._debugExposure);
|
|
197
|
+
// Intermediate passes always render into a texture, so on WebGPU they flip
|
|
198
|
+
// unconditionally. `needFlip` cannot be used: it reports whatever target is
|
|
199
|
+
// bound at the time, and these values are set before the pass binds its own.
|
|
200
|
+
bg.setValue('flip', device.type === 'webgpu' ? 1 : 0);
|
|
201
|
+
device.setProgram(PostSSS._burleyProgram);
|
|
202
|
+
device.setBindGroup(0, bg);
|
|
203
|
+
device.setFramebuffer(diffusedFB);
|
|
204
|
+
this.drawFullscreenQuad();
|
|
205
|
+
} finally{
|
|
206
|
+
device.popDeviceStates();
|
|
207
|
+
}
|
|
208
|
+
// --- Pass 2: BVar transmission ---
|
|
209
|
+
device.pushDeviceStates();
|
|
210
|
+
try {
|
|
211
|
+
if (!this._bvarBindGroup) {
|
|
212
|
+
this._bvarBindGroup = device.createBindGroup(PostSSS._bvarProgram.bindGroupLayouts[0]);
|
|
213
|
+
}
|
|
214
|
+
const bg = this._bvarBindGroup;
|
|
215
|
+
bg.setTexture('diffusedTex', diffusedFB.getColorAttachments()[0], fetchSampler('clamp_linear'));
|
|
216
|
+
bg.setTexture('depthTex', sceneDepthTexture, fetchSampler('clamp_nearest_nomip'));
|
|
217
|
+
bg.setValue('targetSize', this._targetSize);
|
|
218
|
+
bg.setValue('cameraNearFar', this._cameraNearFar);
|
|
219
|
+
bg.setValue('flip', device.type === 'webgpu' ? 1 : 0);
|
|
220
|
+
device.setProgram(PostSSS._bvarProgram);
|
|
221
|
+
device.setBindGroup(0, bg);
|
|
222
|
+
device.setFramebuffer(bvarFB);
|
|
223
|
+
this.drawFullscreenQuad();
|
|
224
|
+
} finally{
|
|
225
|
+
device.popDeviceStates();
|
|
226
|
+
}
|
|
227
|
+
// --- Pass 3: Recombine ---
|
|
228
|
+
device.setFramebuffer(outputFramebuffer);
|
|
229
|
+
if (!this._recombineBindGroup) {
|
|
230
|
+
this._recombineBindGroup = device.createBindGroup(PostSSS._recombineProgram.bindGroupLayouts[0]);
|
|
231
|
+
}
|
|
232
|
+
const rbg = this._recombineBindGroup;
|
|
233
|
+
rbg.setTexture('colorTex', inputColorTexture, fetchSampler('clamp_linear'));
|
|
234
|
+
rbg.setTexture('maskTex', maskTex, fetchSampler('clamp_linear'));
|
|
235
|
+
rbg.setTexture('bvarTex', bvarFB.getColorAttachments()[0], fetchSampler('clamp_linear'));
|
|
236
|
+
rbg.setTexture('depthTex', sceneDepthTexture, fetchSampler('clamp_nearest_nomip'));
|
|
237
|
+
rbg.setValue('cameraNearFar', this._cameraNearFar);
|
|
238
|
+
rbg.setValue('targetSize', this._targetSize);
|
|
239
|
+
rbg.setValue('debugMode', SKIN_SSS_DEBUG_OUTPUTS.indexOf(this._debugOutput));
|
|
240
|
+
rbg.setValue('flip', this.needFlip(device) ? 1 : 0);
|
|
241
|
+
rbg.setValue('srgbOut', srgbOutput ? 1 : 0);
|
|
242
|
+
device.setProgram(PostSSS._recombineProgram);
|
|
243
|
+
device.setBindGroup(0, rbg);
|
|
244
|
+
this.drawFullscreenQuad();
|
|
245
|
+
device.pool.releaseFrameBuffer(diffusedFB);
|
|
246
|
+
device.pool.releaseFrameBuffer(bvarFB);
|
|
247
|
+
}
|
|
248
|
+
static fullscreenVertex(pb) {
|
|
249
|
+
pb.getGlobalScope().flip = pb.int().uniform(0);
|
|
250
|
+
pb.getGlobalScope().$inputs.pos = pb.vec2().attrib('position');
|
|
251
|
+
pb.getGlobalScope().$outputs.uv = pb.vec2();
|
|
252
|
+
pb.main(function() {
|
|
253
|
+
this.$builtins.position = pb.vec4(this.$inputs.pos, DEPTH_FARTHEST, 1);
|
|
254
|
+
this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));
|
|
255
|
+
this.$if(pb.notEqual(this.flip, 0), function() {
|
|
256
|
+
this.$builtins.position.y = pb.neg(this.$builtins.position.y);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
createBurleyProgram(ctx) {
|
|
261
|
+
const program = ctx.device.buildRenderProgram({
|
|
262
|
+
vertex (pb) {
|
|
263
|
+
PostSSS.fullscreenVertex(pb);
|
|
264
|
+
},
|
|
265
|
+
fragment (pb) {
|
|
266
|
+
this.depthTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);
|
|
267
|
+
this.sceneTex = pb.tex2D().uniform(0);
|
|
268
|
+
this.maskTex = pb.tex2D().uniform(0);
|
|
269
|
+
this.profileIdTex = pb.tex2D().uniform(0);
|
|
270
|
+
this.cameraNearFar = pb.vec2().uniform(0);
|
|
271
|
+
this.targetSize = pb.vec4().uniform(0);
|
|
272
|
+
this.projScale = pb.vec2().uniform(0);
|
|
273
|
+
this.perspective = pb.int().uniform(0);
|
|
274
|
+
this.profileParams = pb.vec4().uniform(0);
|
|
275
|
+
this.profileTex = pb.tex2D().uniform(0);
|
|
276
|
+
// Always declared so the cached program has one layout; a 1x1 dummy is
|
|
277
|
+
// bound on frames without a transmission pass. Only the debug view reads
|
|
278
|
+
// it — shading takes its thickness through the material, per light.
|
|
279
|
+
this.thicknessTex = pb.tex2DArray().uniform(0);
|
|
280
|
+
this.sampleCount = pb.int().uniform(0);
|
|
281
|
+
this.debugMode = pb.int().uniform(0);
|
|
282
|
+
this.debugExposure = pb.float().uniform(0);
|
|
283
|
+
this.$outputs.outColor = pb.vec4();
|
|
284
|
+
pb.func('readDepth01', [
|
|
285
|
+
pb.vec2('uv')
|
|
286
|
+
], function() {
|
|
287
|
+
this.$return(ShaderHelper.sampleLinearDepth(this, this.depthTex, this.uv, 0));
|
|
288
|
+
});
|
|
289
|
+
pb.func('readDiffusible', [
|
|
290
|
+
pb.vec2('uv')
|
|
291
|
+
], function() {
|
|
292
|
+
this.$l.scene = pb.textureSampleLevel(this.sceneTex, this.uv, 0);
|
|
293
|
+
this.$l.opacity = pb.clamp(pb.textureSampleLevel(this.maskTex, this.uv, 0).a, 0, 1);
|
|
294
|
+
this.$l.lum = pb.dot(this.scene.rgb, pb.vec3(0.2126, 0.7152, 0.0722));
|
|
295
|
+
this.$l.diffAmt = pb.select(pb.float(1), pb.clamp(pb.div(this.scene.a, pb.max(this.lum, 1e-4)), 0, 1), pb.greaterThan(this.lum, 1e-4));
|
|
296
|
+
this.$return(pb.vec4(pb.mul(this.scene.rgb, this.diffAmt), this.opacity));
|
|
297
|
+
});
|
|
298
|
+
pb.func('readProfileId', [
|
|
299
|
+
pb.vec2('uv')
|
|
300
|
+
], function() {
|
|
301
|
+
this.$return(pb.textureSampleLevel(this.profileIdTex, this.uv, 0).r);
|
|
302
|
+
});
|
|
303
|
+
pb.func('scalingFactor', [
|
|
304
|
+
pb.float('a')
|
|
305
|
+
], function() {
|
|
306
|
+
this.$l.v = pb.sub(this.a, 0.33);
|
|
307
|
+
this.$l.v2 = pb.mul(this.v, this.v);
|
|
308
|
+
this.$return(pb.add(3.5, pb.mul(100, this.v2, this.v2)));
|
|
309
|
+
});
|
|
310
|
+
pb.func('scalingFactor3D', [
|
|
311
|
+
pb.vec3('a')
|
|
312
|
+
], function() {
|
|
313
|
+
this.$l.v = pb.sub(this.a, pb.vec3(0.33));
|
|
314
|
+
this.$l.v2 = pb.mul(this.v, this.v);
|
|
315
|
+
this.$return(pb.add(pb.vec3(3.5), pb.mul(pb.vec3(100), this.v2, this.v2)));
|
|
316
|
+
});
|
|
317
|
+
// RadiusRootFindByApproximation: d ((2 - 2.6) xi - 2) ln(1 - xi).
|
|
318
|
+
pb.func('radiusRootApprox', [
|
|
319
|
+
pb.float('d'),
|
|
320
|
+
pb.float('xi')
|
|
321
|
+
], function() {
|
|
322
|
+
this.$l.x = pb.min(this.xi, 0.9999);
|
|
323
|
+
this.$return(pb.mul(this.d, pb.sub(pb.mul(pb.sub(2, 2.6), this.x), 2), pb.log(pb.max(pb.sub(1, this.x), 1e-6))));
|
|
324
|
+
});
|
|
325
|
+
// GetCDFDeriv1: 0.25/d (e^{-r/d} + e^{-r/3d}), clamped as CLAMP_PDF does.
|
|
326
|
+
pb.func('burleyPdf', [
|
|
327
|
+
pb.float('r'),
|
|
328
|
+
pb.float('l'),
|
|
329
|
+
pb.float('s')
|
|
330
|
+
], function() {
|
|
331
|
+
this.$l.d = pb.max(pb.div(this.l, this.s), 1e-6);
|
|
332
|
+
this.$l.e1 = pb.exp(pb.neg(pb.min(pb.div(this.r, this.d), 40)));
|
|
333
|
+
this.$l.e2 = pb.exp(pb.neg(pb.min(pb.div(this.r, pb.mul(this.d, 3)), 40)));
|
|
334
|
+
this.$return(pb.max(pb.mul(pb.div(0.25, this.d), pb.add(this.e1, this.e2)), 1e-5));
|
|
335
|
+
});
|
|
336
|
+
// GetDiffuseReflectProfileWithDiffuseMeanFreePath: r R(r), per channel.
|
|
337
|
+
// D = 1/s3d, R = radius/L, (e^{-R/D} + e^{-R/3D}) / (D L) / 8pi
|
|
338
|
+
pb.func('diffusionProfile', [
|
|
339
|
+
pb.vec3('l'),
|
|
340
|
+
pb.vec3('s3d'),
|
|
341
|
+
pb.float('radius')
|
|
342
|
+
], function() {
|
|
343
|
+
this.$l.D = pb.div(pb.vec3(1), pb.max(this.s3d, pb.vec3(1e-6)));
|
|
344
|
+
this.$l.L = pb.max(this.l, pb.vec3(1e-6));
|
|
345
|
+
this.$l.R = pb.div(pb.vec3(this.radius), this.L);
|
|
346
|
+
this.$l.negRD = pb.div(pb.neg(this.R), this.D);
|
|
347
|
+
this.$l.e1 = pb.exp(pb.max(this.negRD, pb.vec3(-40)));
|
|
348
|
+
this.$l.e2 = pb.exp(pb.max(pb.div(this.negRD, 3), pb.vec3(-40)));
|
|
349
|
+
this.$return(pb.max(pb.div(pb.add(this.e1, this.e2), pb.mul(this.D, this.L, 8 * Math.PI)), pb.vec3(1e-12)));
|
|
350
|
+
});
|
|
351
|
+
// GetCDF with XI = 0, used to weight the centre sample.
|
|
352
|
+
pb.func('burleyCdf', [
|
|
353
|
+
pb.float('d'),
|
|
354
|
+
pb.float('x')
|
|
355
|
+
], function() {
|
|
356
|
+
this.$l.sd = pb.max(this.d, 1e-6);
|
|
357
|
+
this.$return(pb.clamp(pb.sub(pb.sub(1, pb.mul(0.25, pb.exp(pb.neg(pb.min(pb.div(this.x, this.sd), 40))))), pb.mul(0.75, pb.exp(pb.neg(pb.min(pb.div(this.x, pb.mul(this.sd, 3)), 40))))), 0, 1));
|
|
358
|
+
});
|
|
359
|
+
pb.func('r2Sequence', [
|
|
360
|
+
pb.int('i')
|
|
361
|
+
], function() {
|
|
362
|
+
this.$return(pb.fract(pb.mul(pb.vec2(0.7548776662466927, 0.5698402909980532), pb.float(this.i))));
|
|
363
|
+
});
|
|
364
|
+
pb.func('readProfile', [
|
|
365
|
+
pb.float('id'),
|
|
366
|
+
pb.float('column')
|
|
367
|
+
], function() {
|
|
368
|
+
this.$l.u = pb.mul(pb.add(this.column, 0.5), this.profileParams.y);
|
|
369
|
+
this.$l.v = pb.mul(pb.add(pb.mul(pb.clamp(this.id, 0, 1), 255), 0.5), this.profileParams.z);
|
|
370
|
+
this.$return(pb.textureSampleLevel(this.profileTex, pb.vec2(this.u, this.v), 0));
|
|
371
|
+
});
|
|
372
|
+
pb.func('readNormal', [
|
|
373
|
+
pb.vec2('uv')
|
|
374
|
+
], function() {
|
|
375
|
+
this.$return(pb.normalize(pb.sub(pb.mul(pb.textureSampleLevel(this.maskTex, this.uv, 0).rgb, 2), pb.vec3(1))));
|
|
376
|
+
});
|
|
377
|
+
pb.main(function() {
|
|
378
|
+
this.$l.uv = this.$inputs.uv;
|
|
379
|
+
this.$l.center = this.readDiffusible(this.uv);
|
|
380
|
+
this.$l.centerId = this.readProfileId(this.uv);
|
|
381
|
+
this.$l.centerDepth01 = this.readDepth01(this.uv);
|
|
382
|
+
this.$outputs.outColor = this.center;
|
|
383
|
+
// Two distinct tests: a pixel can carry a profile with zero opacity, or
|
|
384
|
+
// an opacity with no profile where the prepass and the light pass
|
|
385
|
+
// disagree about coverage. Neither scatters.
|
|
386
|
+
this.$if(pb.and(pb.lessThan(this.centerDepth01, 1), pb.and(pb.greaterThan(this.center.a, 1e-4), pb.greaterThan(this.centerId, 0.5 / 255))), function() {
|
|
387
|
+
this.$l.centerDepth = pb.max(pb.mul(this.centerDepth01, this.cameraNearFar.y), 1e-4);
|
|
388
|
+
this.$l.centerNormal = this.readNormal(this.uv);
|
|
389
|
+
this.$l.scaling = this.readProfile(this.centerId, 0);
|
|
390
|
+
this.$l.albedo = this.readProfile(this.centerId, 1);
|
|
391
|
+
this.$l.mfp = this.readProfile(this.centerId, 2);
|
|
392
|
+
this.$l.boundaryBleed = this.readProfile(this.centerId, 3).rgb;
|
|
393
|
+
this.$l.worldUnitScale = pb.max(this.scaling.x, 1e-3);
|
|
394
|
+
this.$l.aForSampling = this.albedo.w;
|
|
395
|
+
this.$l.lForSampling = pb.max(this.mfp.w, 1e-6);
|
|
396
|
+
this.$l.S = this.scalingFactor(this.aForSampling);
|
|
397
|
+
this.$l.S3D = this.scalingFactor3D(this.albedo.rgb);
|
|
398
|
+
this.$l.dForSampling = pb.div(this.lForSampling, pb.max(this.S, 1e-6));
|
|
399
|
+
this.$l.viewScale = pb.max(pb.select(this.centerDepth, pb.float(1), pb.equal(this.perspective, 0)), 1e-4);
|
|
400
|
+
this.$l.burleyScale = pb.div(pb.mul(this.projScale, this.worldUnitScale), this.viewScale);
|
|
401
|
+
this.$l.centerRadiusMM = pb.mul(0.5, pb.add(pb.div(this.targetSize.z, pb.max(this.burleyScale.x, 1e-9)), pb.div(this.targetSize.w, pb.max(this.burleyScale.y, 1e-9))));
|
|
402
|
+
this.$l.centerCdf = this.burleyCdf(this.dForSampling, this.centerRadiusMM);
|
|
403
|
+
this.$l.dPerChannel = pb.div(this.mfp.rgb, pb.max(this.S3D, pb.vec3(1e-6)));
|
|
404
|
+
this.$l.centerWeight = pb.vec3(this.burleyCdf(this.dPerChannel.x, this.centerRadiusMM), this.burleyCdf(this.dPerChannel.y, this.centerRadiusMM), this.burleyCdf(this.dPerChannel.z, this.centerRadiusMM));
|
|
405
|
+
this.$l.seedStart = pb.int(pb.mul(hash21(this, pb.mul(this.uv, this.targetSize.xy)), 65536));
|
|
406
|
+
this.$l.radianceAccum = pb.vec3(0);
|
|
407
|
+
this.$l.weightAccum = pb.vec3(0);
|
|
408
|
+
this.$l.bleedAccum = pb.vec3(0);
|
|
409
|
+
this.$l.acceptedCount = pb.float(0);
|
|
410
|
+
this.$l.radiusSum = pb.float(0);
|
|
411
|
+
this.$for(pb.int('i'), 0, DEFAULT_SAMPLE_COUNT, function() {
|
|
412
|
+
this.$l.rand = this.r2Sequence(pb.add(this.seedStart, this.i));
|
|
413
|
+
this.$l.xi = pb.add(this.centerCdf, pb.mul(this.rand.x, pb.sub(1, this.centerCdf)));
|
|
414
|
+
this.$l.radiusMM = pb.max(this.radiusRootApprox(this.dForSampling, this.xi), 1e-5);
|
|
415
|
+
this.$l.pdf = this.burleyPdf(this.radiusMM, this.lForSampling, this.S);
|
|
416
|
+
this.$l.theta = pb.mul(this.rand.y, 2 * Math.PI);
|
|
417
|
+
this.$l.uvOffset = pb.mul(pb.vec2(pb.cos(this.theta), pb.sin(this.theta)), pb.mul(this.radiusMM, this.burleyScale));
|
|
418
|
+
this.$l.sampleUV = pb.clamp(pb.add(this.uv, this.uvOffset), pb.vec2(0), pb.vec2(1));
|
|
419
|
+
this.$l.tapSample = this.readDiffusible(this.sampleUV);
|
|
420
|
+
this.$l.sampleDepth01 = this.readDepth01(this.sampleUV);
|
|
421
|
+
this.$l.sampleDepth = pb.max(pb.mul(this.sampleDepth01, this.cameraNearFar.y), 1e-4);
|
|
422
|
+
this.$l.tapNormal = this.readNormal(this.sampleUV);
|
|
423
|
+
this.$l.normalWeight = pb.sqrt(pb.clamp(pb.add(pb.mul(pb.dot(this.tapNormal, this.centerNormal), 0.5), 0.5), 0, 1));
|
|
424
|
+
this.$l.deltaDepth = pb.div(pb.sub(this.sampleDepth, this.centerDepth), this.worldUnitScale);
|
|
425
|
+
this.$l.radiusSampledMM = pb.sqrt(pb.add(pb.mul(this.radiusMM, this.radiusMM), pb.mul(this.deltaDepth, this.deltaDepth)));
|
|
426
|
+
this.$l.profile = this.diffusionProfile(this.mfp.rgb, this.S3D, this.radiusSampledMM);
|
|
427
|
+
this.$l.tapId = this.readProfileId(this.sampleUV);
|
|
428
|
+
this.$l.tapOpacity = pb.select(pb.float(0), this.tapSample.a, pb.greaterThan(this.tapId, 0.5 / 255));
|
|
429
|
+
this.$l.tapColor = pb.mix(this.center.rgb, this.tapSample.rgb, this.tapOpacity);
|
|
430
|
+
this.$l.sampleWeight = pb.mul(pb.div(this.profile, this.pdf), this.normalWeight);
|
|
431
|
+
this.$l.sameProfile = pb.float(pb.or(pb.lessThan(pb.abs(pb.sub(this.tapId, this.centerId)), 0.002), pb.lessThan(this.tapOpacity, 1e-4)));
|
|
432
|
+
this.bleedAccum = pb.add(this.bleedAccum, pb.mul(pb.mix(this.boundaryBleed, pb.vec3(1), this.sameProfile), this.tapOpacity));
|
|
433
|
+
this.acceptedCount = pb.add(this.acceptedCount, this.tapOpacity);
|
|
434
|
+
this.radianceAccum = pb.add(this.radianceAccum, pb.mul(this.sampleWeight, this.tapColor));
|
|
435
|
+
this.weightAccum = pb.add(this.weightAccum, this.sampleWeight);
|
|
436
|
+
this.radiusSum = pb.add(this.radiusSum, this.radiusMM);
|
|
437
|
+
});
|
|
438
|
+
this.$l.diffused = pb.mul(pb.div(this.radianceAccum, pb.max(this.weightAccum, pb.vec3(1e-9))), 1 / 0.99995);
|
|
439
|
+
this.$l.bleedTint = pb.vec3(1);
|
|
440
|
+
this.$if(pb.greaterThan(this.acceptedCount, 1e-4), function() {
|
|
441
|
+
this.bleedTint = pb.div(this.bleedAccum, this.acceptedCount);
|
|
442
|
+
});
|
|
443
|
+
this.diffused = pb.mul(this.diffused, this.bleedTint);
|
|
444
|
+
this.diffused = pb.mix(this.diffused, this.center.rgb, this.centerWeight);
|
|
445
|
+
this.$l.weightValid = pb.vec3(pb.float(pb.greaterThan(this.weightAccum.x, 0)), pb.float(pb.greaterThan(this.weightAccum.y, 0)), pb.float(pb.greaterThan(this.weightAccum.z, 0)));
|
|
446
|
+
this.diffused = pb.mix(this.center.rgb, this.diffused, this.weightValid);
|
|
447
|
+
this.diffused = pb.mix(this.center.rgb, this.diffused, this.center.a);
|
|
448
|
+
this.$outputs.outColor = pb.vec4(pb.max(this.diffused, pb.vec3(0)), this.center.a);
|
|
449
|
+
this.$if(pb.notEqual(this.debugMode, 0), function() {
|
|
450
|
+
this.$l.dbg = pb.vec3(0);
|
|
451
|
+
this.$if(pb.equal(this.debugMode, 1), function() {
|
|
452
|
+
this.dbg = this.center.rgb;
|
|
453
|
+
});
|
|
454
|
+
this.$if(pb.equal(this.debugMode, 2), function() {
|
|
455
|
+
this.$l.lum = pb.dot(pb.textureSampleLevel(this.sceneTex, this.uv, 0).rgb, pb.vec3(0.2126, 0.7152, 0.0722));
|
|
456
|
+
this.dbg = pb.vec3(pb.clamp(pb.div(pb.textureSampleLevel(this.sceneTex, this.uv, 0).a, pb.max(this.lum, 1e-4)), 0, 1));
|
|
457
|
+
});
|
|
458
|
+
this.$if(pb.equal(this.debugMode, 3), function() {
|
|
459
|
+
this.dbg = pb.vec3(pb.mul(this.centerId, 255 / 8));
|
|
460
|
+
});
|
|
461
|
+
this.$if(pb.equal(this.debugMode, 4), function() {
|
|
462
|
+
this.dbg = pb.add(pb.mul(this.centerNormal, 0.5), pb.vec3(0.5));
|
|
463
|
+
});
|
|
464
|
+
this.$if(pb.equal(this.debugMode, 5), function() {
|
|
465
|
+
// d in millimetres of world space, so skin reads around 1.
|
|
466
|
+
this.dbg = pb.mul(this.dPerChannel, 1000);
|
|
467
|
+
});
|
|
468
|
+
this.$if(pb.equal(this.debugMode, 6), function() {
|
|
469
|
+
// Mean vertical sample radius in pixels, 32 px mapped to white.
|
|
470
|
+
this.dbg = pb.vec3(pb.div(pb.mul(pb.div(this.radiusSum, DEFAULT_SAMPLE_COUNT), this.burleyScale.y, this.targetSize.y), 32));
|
|
471
|
+
});
|
|
472
|
+
this.$if(pb.equal(this.debugMode, 7), function() {
|
|
473
|
+
this.dbg = this.weightAccum;
|
|
474
|
+
});
|
|
475
|
+
this.$if(pb.equal(this.debugMode, 8), function() {
|
|
476
|
+
this.dbg = pb.vec3(pb.div(this.acceptedCount, DEFAULT_SAMPLE_COUNT));
|
|
477
|
+
});
|
|
478
|
+
this.$if(pb.equal(this.debugMode, 9), function() {
|
|
479
|
+
this.dbg = this.centerWeight;
|
|
480
|
+
});
|
|
481
|
+
this.$if(pb.equal(this.debugMode, 10), function() {
|
|
482
|
+
this.dbg = this.diffused;
|
|
483
|
+
});
|
|
484
|
+
this.$if(pb.equal(this.debugMode, 11), function() {
|
|
485
|
+
this.$l.th = pb.textureArraySampleLevel(this.thicknessTex, this.uv, 0, 0);
|
|
486
|
+
this.$l.enc = pb.min(pb.min(this.th.r, this.th.g), pb.min(this.th.b, this.th.a));
|
|
487
|
+
this.$if(pb.greaterThan(this.enc, 0.999), function() {
|
|
488
|
+
this.dbg = pb.vec3(0, 0, 1);
|
|
489
|
+
}).$else(function() {
|
|
490
|
+
this.dbg = pb.vec3(pb.sub(1, this.enc));
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
this.$outputs.outColor = pb.vec4(pb.mul(this.dbg, this.debugExposure), this.center.a);
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
program.name = '@PostSSSBurley';
|
|
500
|
+
return program;
|
|
501
|
+
}
|
|
502
|
+
createBVarProgram(ctx) {
|
|
503
|
+
const program = ctx.device.buildRenderProgram({
|
|
504
|
+
vertex (pb) {
|
|
505
|
+
PostSSS.fullscreenVertex(pb);
|
|
506
|
+
},
|
|
507
|
+
fragment (pb) {
|
|
508
|
+
this.diffusedTex = pb.tex2D().uniform(0);
|
|
509
|
+
this.depthTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);
|
|
510
|
+
this.targetSize = pb.vec4().uniform(0);
|
|
511
|
+
this.cameraNearFar = pb.vec2().uniform(0);
|
|
512
|
+
this.$outputs.outColor = pb.vec4();
|
|
513
|
+
pb.main(function() {
|
|
514
|
+
this.$l.diffused = pb.textureSampleLevel(this.diffusedTex, this.$inputs.uv, 0);
|
|
515
|
+
this.$outputs.outColor = pb.vec4(this.diffused.rgb, this.diffused.a);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
program.name = '@PostSSSBVar';
|
|
520
|
+
return program;
|
|
521
|
+
}
|
|
522
|
+
createRecombineProgram(ctx) {
|
|
523
|
+
const program = ctx.device.buildRenderProgram({
|
|
524
|
+
vertex (pb) {
|
|
525
|
+
PostSSS.fullscreenVertex(pb);
|
|
526
|
+
},
|
|
527
|
+
fragment (pb) {
|
|
528
|
+
this.colorTex = pb.tex2D().uniform(0);
|
|
529
|
+
this.maskTex = pb.tex2D().uniform(0);
|
|
530
|
+
this.bvarTex = pb.tex2D().uniform(0);
|
|
531
|
+
this.depthTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);
|
|
532
|
+
this.cameraNearFar = pb.vec2().uniform(0);
|
|
533
|
+
this.targetSize = pb.vec4().uniform(0);
|
|
534
|
+
this.debugMode = pb.int().uniform(0);
|
|
535
|
+
this.srgbOut = pb.int().uniform(0);
|
|
536
|
+
this.$outputs.outColor = pb.vec4();
|
|
537
|
+
pb.func('readDepth01', [
|
|
538
|
+
pb.vec2('uv')
|
|
539
|
+
], function() {
|
|
540
|
+
this.$return(ShaderHelper.sampleLinearDepth(this, this.depthTex, this.uv, 0));
|
|
541
|
+
});
|
|
542
|
+
pb.main(function() {
|
|
543
|
+
this.$l.uv = this.$inputs.uv;
|
|
544
|
+
this.$l.baseColor = pb.textureSampleLevel(this.colorTex, this.uv, 0);
|
|
545
|
+
this.$l.result = this.baseColor.rgb;
|
|
546
|
+
this.$l.centerDepth01 = this.readDepth01(this.uv);
|
|
547
|
+
this.$l.centerMask = pb.textureSampleLevel(this.maskTex, this.uv, 0).a;
|
|
548
|
+
this.$if(pb.and(pb.equal(this.debugMode, 0), pb.and(pb.lessThan(this.centerDepth01, 1), pb.greaterThan(this.centerMask, 1e-4))), function() {
|
|
549
|
+
this.$l.lum = pb.dot(this.baseColor.rgb, pb.vec3(0.2126, 0.7152, 0.0722));
|
|
550
|
+
this.$l.diffAmt = pb.select(pb.float(1), pb.clamp(pb.div(this.baseColor.a, pb.max(this.lum, 1e-4)), 0, 1), pb.greaterThan(this.lum, 1e-4));
|
|
551
|
+
this.$l.specKeep = pb.mul(this.baseColor.rgb, pb.sub(1, this.diffAmt));
|
|
552
|
+
this.$l.diffused = pb.textureSampleLevel(this.bvarTex, this.uv, 0).rgb;
|
|
553
|
+
this.result = pb.max(pb.add(this.diffused, this.specKeep), pb.vec3(0));
|
|
554
|
+
});
|
|
555
|
+
this.$if(pb.notEqual(this.debugMode, 0), function() {
|
|
556
|
+
this.result = pb.textureSampleLevel(this.bvarTex, this.uv, 0).rgb;
|
|
557
|
+
});
|
|
558
|
+
this.$if(pb.equal(this.srgbOut, 0), function() {
|
|
559
|
+
this.$outputs.outColor = pb.vec4(this.result, this.baseColor.a);
|
|
560
|
+
}).$else(function() {
|
|
561
|
+
this.$outputs.outColor = pb.vec4(linearToGamma(this, this.result), this.baseColor.a);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
program.name = '@PostSSSRecombine';
|
|
567
|
+
return program;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export { PostSSS };
|
|
572
|
+
//# sourceMappingURL=postsss.js.map
|