@woosh/meep-engine 3.53.0 → 3.55.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/package.json +1 -1
- package/src/core/math/noise/worley_noise_2d.d.ts +14 -0
- package/src/core/math/noise/worley_noise_2d.d.ts.map +1 -0
- package/src/core/math/noise/worley_noise_2d.js +74 -0
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.d.ts +6 -1
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +363 -325
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.d.ts +93 -14
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +322 -183
- package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.d.ts +9 -0
- package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.js +110 -83
- package/src/engine/graphics/texture/atlas/SpriteAtlas.d.ts +42 -0
- package/src/engine/graphics/texture/atlas/SpriteAtlas.d.ts.map +1 -0
- package/src/engine/{graphics3/decal/DecalAtlas.js → graphics/texture/atlas/SpriteAtlas.js} +202 -194
- package/src/engine/{graphics3/decal/DecalAtlasFill.d.ts → graphics/texture/atlas/SpriteAtlasFill.d.ts} +4 -4
- package/src/engine/graphics/texture/atlas/SpriteAtlasFill.d.ts.map +1 -0
- package/src/engine/graphics/texture/atlas/SpriteAtlasFill.js +30 -0
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts +7 -0
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +11 -1
- package/src/engine/{graphics3/decal/decal_atlas_border.d.ts → graphics/texture/atlas/sprite_atlas_border.d.ts} +12 -12
- package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -0
- package/src/engine/{graphics3/decal/decal_atlas_border.js → graphics/texture/atlas/sprite_atlas_border.js} +69 -69
- package/src/engine/graphics3/DecalSystem.d.ts.map +1 -1
- package/src/engine/graphics3/DecalSystem.js +447 -450
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +9 -22
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +892 -951
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/generation/foliage/FOLIAGE_DESIGN.md +2 -1
- package/src/generation/foliage/config/BarkMaterialConfig.d.ts +4 -3
- package/src/generation/foliage/config/BarkMaterialConfig.d.ts.map +1 -1
- package/src/generation/foliage/config/BarkMaterialConfig.js +6 -6
- package/src/generation/foliage/config/FoliageBarkType.d.ts +11 -0
- package/src/generation/foliage/config/FoliageBarkType.d.ts.map +1 -0
- package/src/generation/foliage/config/FoliageBarkType.js +16 -0
- package/src/generation/foliage/config/FoliageMaterialConfig.d.ts +58 -5
- package/src/generation/foliage/config/FoliageMaterialConfig.d.ts.map +1 -1
- package/src/generation/foliage/config/FoliageMaterialConfig.js +279 -181
- package/src/generation/foliage/index.d.ts +2 -1
- package/src/generation/foliage/index.js +44 -43
- package/src/generation/foliage/material/make_bark_material.d.ts.map +1 -1
- package/src/generation/foliage/material/make_bark_material.js +23 -95
- package/src/generation/foliage/material/make_foliage_material.d.ts +29 -3
- package/src/generation/foliage/material/make_foliage_material.d.ts.map +1 -1
- package/src/generation/foliage/material/make_foliage_material.js +605 -359
- package/src/generation/foliage/mesh/branch_collar_project.d.ts.map +1 -1
- package/src/generation/foliage/mesh/branch_collar_project.js +205 -203
- package/src/generation/foliage/mesh/foliage_collect_attachments.d.ts +15 -0
- package/src/generation/foliage/mesh/foliage_collect_attachments.d.ts.map +1 -1
- package/src/generation/foliage/mesh/foliage_collect_attachments.js +569 -502
- package/src/generation/foliage/mesh/tree_mesh_build_bark.d.ts.map +1 -1
- package/src/generation/foliage/mesh/tree_mesh_build_bark.js +1049 -1047
- package/src/generation/foliage/mesh/tree_mesh_build_foliage.d.ts +2 -1
- package/src/generation/foliage/mesh/tree_mesh_build_foliage.d.ts.map +1 -1
- package/src/generation/foliage/mesh/tree_mesh_build_foliage.js +454 -415
- package/src/generation/foliage/presets/make_tree_species_preset.d.ts.map +1 -1
- package/src/generation/foliage/presets/make_tree_species_preset.js +870 -837
- package/src/generation/foliage/skeleton/crown_envelope_evaluate.js +121 -121
- package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.d.ts +10 -7
- package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.d.ts.map +1 -1
- package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.js +206 -179
- package/src/generation/foliage/skeleton/tree_skeleton_grow.d.ts.map +1 -1
- package/src/generation/foliage/skeleton/tree_skeleton_grow.js +1871 -1104
- package/src/shade/RENDERER_CONTRACT.md +5 -2
- package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -1
- package/src/shade/device/SHADE_DEVICE_FLOOR.js +2 -0
- package/src/shade/playground/foliage_wind/foliage_world.d.ts +6 -0
- package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
- package/src/shade/playground/foliage_wind/foliage_world.js +602 -593
- package/src/shade/playground/foliage_wind/index.html +260 -254
- package/src/shade/playground/foliage_wind/main.js +275 -263
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +1 -1
- package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts +3 -3
- package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts.map +1 -1
- package/src/shade/renderer/hiz/HierarchicalZBuffer.js +350 -294
- package/src/shade/renderer/hiz/generate_downsampler_code.d.ts +0 -2
- package/src/shade/renderer/hiz/generate_downsampler_code.d.ts.map +1 -1
- package/src/shade/renderer/hiz/generate_downsampler_code.js +99 -100
- package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts +15 -0
- package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -0
- package/src/shade/renderer/hiz/hzb_pick_alignment.js +148 -0
- package/src/shade/renderer/hiz/hzb_plan_reduction_steps.d.ts +28 -0
- package/src/shade/renderer/hiz/hzb_plan_reduction_steps.d.ts.map +1 -0
- package/src/shade/renderer/hiz/hzb_plan_reduction_steps.js +58 -0
- package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts +5 -5
- package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts.map +1 -1
- package/src/shade/renderer/hiz/shader_hzb_reduce_any.js +57 -67
- package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts +3 -3
- package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts.map +1 -1
- package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.js +111 -112
- package/src/shade/renderer/hiz/shader_hzb_spd.d.ts +5 -0
- package/src/shade/renderer/hiz/shader_hzb_spd.d.ts.map +1 -0
- package/src/shade/renderer/hiz/shader_hzb_spd.js +160 -0
- package/src/shade/renderer/light/GPULightCollection.d.ts +8 -0
- package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/GPULightCollection.js +67 -0
- package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.d.ts +7 -0
- package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.js +13 -0
- package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.d.ts +10 -0
- package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.d.ts.map +1 -0
- package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.js +72 -0
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +39 -0
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -0
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +90 -0
- package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.d.ts +12 -0
- package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.d.ts.map +1 -0
- package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.js +56 -0
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +31 -0
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -0
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +196 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts +10 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +163 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.d.ts +4 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.d.ts.map +1 -0
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.js +137 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +4 -3
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts +4 -3
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +28 -11
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +9 -13
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +25 -20
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +21 -38
- package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js +154 -147
- package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +2 -1
- package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/GTAO.js +5 -1
- package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts +8 -0
- package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.js +10 -1
- package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +5 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts +22 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.js +33 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts +22 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.js +56 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts +13 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.js +42 -0
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts +2 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +382 -357
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +414 -410
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/prefilter/NOTES.md +0 -7
- package/src/shade/renderer/shader/chunk/depth/chunk_query_depth_from_screen_space_bb.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/depth/chunk_query_depth_from_screen_space_bb.js +62 -62
- package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.js +19 -0
- package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_get_mip_resolution.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_get_mip_resolution.js +16 -10
- package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_hierarchical_raymarch.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_hierarchical_raymarch.js +118 -117
- package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.d.ts +41 -7
- package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.d.ts.map +1 -1
- package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.js +162 -58
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.js +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +10 -12
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +583 -606
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +640 -640
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts +113 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +484 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +50 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +60 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +25 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +47 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.d.ts +74 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.js +173 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts +26 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +83 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts +36 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.js +129 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts +121 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +370 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts +16 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts.map +1 -0
- package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.js +191 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +1 -1
- package/src/engine/graphics3/decal/DecalAtlas.d.ts +0 -43
- package/src/engine/graphics3/decal/DecalAtlas.d.ts.map +0 -1
- package/src/engine/graphics3/decal/DecalAtlasFill.d.ts.map +0 -1
- package/src/engine/graphics3/decal/DecalAtlasFill.js +0 -32
- package/src/engine/graphics3/decal/decal_atlas_border.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts +0 -26
- package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.js +0 -268
- package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts +0 -3
- package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/ssr/copy_shader_f32.js +0 -32
- package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts +0 -17
- package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/ssr/depth_max_shader.js +0 -98
- package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts +0 -23
- package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.js +0 -118
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts +0 -15
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.js +0 -49
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +0 -17
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +0 -50
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts +0 -35
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.js +0 -105
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +0 -35
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +0 -80
- package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts +0 -10
- package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.js +0 -51
- package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts +0 -28
- package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.js +0 -39
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +0 -48
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +0 -121
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +0 -28
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +0 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +0 -237
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { CAMERA_UNIFORM_STRUCT } from "../../camera/CAMERA_UNIFORM_STRUCT.js";
|
|
2
|
+
import { INDIRECT_LIGHT_INTENSITY } from "../../deferred/INDIRECT_LIGHT_INTENSITY.js";
|
|
3
|
+
import { BRICK4_DATA_STRUCT } from "../../global_illumination/brick4/gpu/BRICK4_DATA_STRUCT.js";
|
|
4
|
+
import { LPV_SHADER_RESOURCE_GROUP_WITH_DEFAULTS } from "../../global_illumination/probe/octahedral/LPV_SHADER_RESOURCE_GROUP.js";
|
|
5
|
+
import { chunk_light_cluster_counts } from "../../light/cluster/chunk_light_cluster_counts.js";
|
|
6
|
+
import { LIGHT_CLUSTER_LOOKUP_STRUCT } from "../../light/cluster/shader_cluster_assign_lights.js";
|
|
7
|
+
import { ENVIRONMENT_SH_TYPE } from "../../light/environment/shader_project_environment_sh.js";
|
|
8
|
+
import { chunk_world_light_cluster_lookup } from "../../light/world_cluster/chunk_world_light_cluster_lookup.js";
|
|
9
|
+
import { chunk_mat4_extract_position } from "../../shader/chunk/geometry/mat4/chunk_mat4_extract_position.js";
|
|
10
|
+
import {
|
|
11
|
+
chunk_directional_lights_iteration_mask
|
|
12
|
+
} from "../../shader/chunk/light/io/chunk_directional_lights_iteration_mask.js";
|
|
13
|
+
import {
|
|
14
|
+
chunk_get_directional_light_info_by_index
|
|
15
|
+
} from "../../shader/chunk/light/io/chunk_get_directional_light_info_by_index.js";
|
|
16
|
+
import {
|
|
17
|
+
METRO_L1_IRRADIANCE_STRUCT
|
|
18
|
+
} from "../../shader/chunk/spherical_harmonics/l1i/chunk_convert_to_irradiance_sh.js";
|
|
19
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
20
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
21
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
22
|
+
import { f32, i32, u32, vec3i, vec3u } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
23
|
+
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
24
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
25
|
+
import { chunk_shadowmap_get_light_visibility } from "../../shadow/map/shader/chunk_shadowmap_get_light_visibility.js";
|
|
26
|
+
import { SHADOWMAP_COMPARE_SAMPLER_DESCRIPTOR } from "../../shadow/map/SHADOWMAP_COMPARE_SAMPLER_DESCRIPTOR.js";
|
|
27
|
+
import { chunk_volumetrics_irradiance_sh } from "../chunk_volumetrics_irradiance_sh.js";
|
|
28
|
+
import { chunk_volumetrics_local_light_shadow } from "../chunk_volumetrics_local_light_shadow.js";
|
|
29
|
+
import { chunk_irradiance_clipmap_gi_sample } from "./chunk_irradiance_clipmap_gi_sample.js";
|
|
30
|
+
import { chunk_irradiance_clipmap_local_light } from "./chunk_irradiance_clipmap_local_light.js";
|
|
31
|
+
import {
|
|
32
|
+
IRRADIANCE_CLIPMAP_LIGHT_BUDGET,
|
|
33
|
+
IRRADIANCE_CLIPMAP_TILE_FORMAT,
|
|
34
|
+
} from "./IRRADIANCE_CLIPMAP.js";
|
|
35
|
+
|
|
36
|
+
export const IRRADIANCE_CLIPMAP_BUILD_GROUP_SIZE = Object.freeze([4, 4, 4]);
|
|
37
|
+
|
|
38
|
+
export const IRRADIANCE_CLIPMAP_BUILD_STRUCT = WebGPUStruct.from({
|
|
39
|
+
tile_origin: vec3u,
|
|
40
|
+
cascade_index: u32,
|
|
41
|
+
corner: vec3i,
|
|
42
|
+
cell_size: f32,
|
|
43
|
+
tile_size: vec3u,
|
|
44
|
+
border: i32,
|
|
45
|
+
}, "IrradianceClipmapBuild");
|
|
46
|
+
|
|
47
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
48
|
+
|
|
49
|
+
resources.createGroup()
|
|
50
|
+
.addUniform("build_settings", IRRADIANCE_CLIPMAP_BUILD_STRUCT)
|
|
51
|
+
.addUniform("camera", CAMERA_UNIFORM_STRUCT)
|
|
52
|
+
.addUniform("environment_sh", ENVIRONMENT_SH_TYPE)
|
|
53
|
+
.addStorageBuffer("brick4", BRICK4_DATA_STRUCT, false, true)
|
|
54
|
+
.addStorageBuffer("light_data", WebGPUArray.u32, false)
|
|
55
|
+
.addStorageBuffer("world_cluster_lookup", LIGHT_CLUSTER_LOOKUP_STRUCT, false)
|
|
56
|
+
.addStorageBuffer("world_cluster_data", WebGPUArray.u32, false)
|
|
57
|
+
.addTexture("shadowmapAtlas", "depth")
|
|
58
|
+
.addSampler("sCompareLinear", "comparison", SHADOWMAP_COMPARE_SAMPLER_DESCRIPTOR)
|
|
59
|
+
.addStorageTexture("atlas_y", IRRADIANCE_CLIPMAP_TILE_FORMAT, "3d", "write-only")
|
|
60
|
+
.addStorageTexture("atlas_cocg", IRRADIANCE_CLIPMAP_TILE_FORMAT, "3d", "write-only");
|
|
61
|
+
|
|
62
|
+
resources.addGroup(LPV_SHADER_RESOURCE_GROUP_WITH_DEFAULTS);
|
|
63
|
+
|
|
64
|
+
const body = CodeChunk.from(
|
|
65
|
+
//language=WGSL
|
|
66
|
+
`
|
|
67
|
+
@compute @workgroup_size(${IRRADIANCE_CLIPMAP_BUILD_GROUP_SIZE.join(", ")})
|
|
68
|
+
fn main(@builtin(global_invocation_id) local_texel: vec3<u32>) {
|
|
69
|
+
let tile_size = build_settings.tile_size;
|
|
70
|
+
if (any(local_texel >= tile_size)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let local_cell = vec3<i32>(local_texel) - vec3<i32>(build_settings.border);
|
|
75
|
+
let world_cell = build_settings.corner + local_cell;
|
|
76
|
+
let position_ws = (vec3<f32>(world_cell) + vec3<f32>(0.5)) * build_settings.cell_size;
|
|
77
|
+
|
|
78
|
+
const INDIRECT_INTENSITY: f32 = ${INDIRECT_LIGHT_INTENSITY};
|
|
79
|
+
let gi_radiance = irradiance_clipmap_gi_sample(position_ws);
|
|
80
|
+
let scaled_gi = array<vec3<f32>, 4>(
|
|
81
|
+
gi_radiance[0] * INDIRECT_INTENSITY,
|
|
82
|
+
gi_radiance[1] * INDIRECT_INTENSITY,
|
|
83
|
+
gi_radiance[2] * INDIRECT_INTENSITY,
|
|
84
|
+
gi_radiance[3] * INDIRECT_INTENSITY,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
var irradiance: ${METRO_L1_IRRADIANCE_STRUCT.wgsl_ref};
|
|
88
|
+
irradiance = volumetrics_irradiance_sh_add_radiance(irradiance, scaled_gi);
|
|
89
|
+
|
|
90
|
+
let to_camera = mat4_extract_position(camera.transform) - position_ws;
|
|
91
|
+
let to_camera_len = max(length(to_camera), 1e-5);
|
|
92
|
+
let toward_camera = to_camera / to_camera_len;
|
|
93
|
+
|
|
94
|
+
var directional_bits = directional_lights_iteration_mask(&light_data);
|
|
95
|
+
while (directional_bits != 0u) {
|
|
96
|
+
let directional_index = countTrailingZeros(directional_bits);
|
|
97
|
+
directional_bits &= ~(1u << directional_index);
|
|
98
|
+
|
|
99
|
+
let sun = get_directional_light_info_by_index(&light_data, directional_index);
|
|
100
|
+
|
|
101
|
+
let shadow_term = shadowmap_get_directional_light_visibility(
|
|
102
|
+
&light_data,
|
|
103
|
+
directional_index,
|
|
104
|
+
position_ws,
|
|
105
|
+
toward_camera,
|
|
106
|
+
sun.direction
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
irradiance = volumetrics_irradiance_sh_add(irradiance, shadow_term * sun.color, sun.direction);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let cluster_meta = world_light_cluster_metadata_by_texel(
|
|
113
|
+
build_settings.cascade_index,
|
|
114
|
+
local_texel,
|
|
115
|
+
tile_size
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
let cluster_offset = cluster_meta.offset;
|
|
119
|
+
let point_count = light_cluster_count_point(cluster_meta.counts);
|
|
120
|
+
let spot_count = light_cluster_count_spot(cluster_meta.counts);
|
|
121
|
+
|
|
122
|
+
for (var j = 0u; j < min(point_count, ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u); j++) {
|
|
123
|
+
let light_index = world_cluster_data[cluster_offset + j];
|
|
124
|
+
let direct_light = irradiance_clipmap_get_point_light_info_by_index(
|
|
125
|
+
&light_data,
|
|
126
|
+
light_index,
|
|
127
|
+
position_ws,
|
|
128
|
+
build_settings.cell_size
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
if (all(direct_light.color == vec3<f32>(0.0))) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let shadow_term = volumetrics_point_light_shadow(&light_data, light_index, position_ws);
|
|
136
|
+
irradiance = volumetrics_irradiance_sh_add(irradiance, shadow_term * direct_light.color, direct_light.direction);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (var k = 0u; k < min(spot_count, ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u); k++) {
|
|
140
|
+
let light_index = world_cluster_data[cluster_offset + point_count + k];
|
|
141
|
+
let direct_light = irradiance_clipmap_get_spot_light_info_by_index(
|
|
142
|
+
&light_data,
|
|
143
|
+
light_index,
|
|
144
|
+
position_ws,
|
|
145
|
+
build_settings.cell_size
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
if (all(direct_light.color == vec3<f32>(0.0))) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let shadow_term = volumetrics_spot_light_shadow(&light_data, light_index, position_ws);
|
|
153
|
+
irradiance = volumetrics_irradiance_sh_add(irradiance, shadow_term * direct_light.color, direct_light.direction);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let stored = volumetrics_irradiance_sh_storable(irradiance);
|
|
157
|
+
let atlas_texel = build_settings.tile_origin + local_texel;
|
|
158
|
+
|
|
159
|
+
textureStore(atlas_y, atlas_texel, stored.Y);
|
|
160
|
+
textureStore(atlas_cocg, atlas_texel, vec4<f32>(stored.CoCg, 0.0, 0.0));
|
|
161
|
+
}
|
|
162
|
+
`, [
|
|
163
|
+
METRO_L1_IRRADIANCE_STRUCT.declaration_chunk,
|
|
164
|
+
chunk_mat4_extract_position,
|
|
165
|
+
chunk_irradiance_clipmap_gi_sample,
|
|
166
|
+
chunk_world_light_cluster_lookup,
|
|
167
|
+
chunk_light_cluster_counts,
|
|
168
|
+
chunk_directional_lights_iteration_mask,
|
|
169
|
+
chunk_get_directional_light_info_by_index,
|
|
170
|
+
chunk_irradiance_clipmap_local_light,
|
|
171
|
+
chunk_shadowmap_get_light_visibility,
|
|
172
|
+
chunk_volumetrics_local_light_shadow,
|
|
173
|
+
chunk_volumetrics_irradiance_sh,
|
|
174
|
+
]
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Populates one cascade's tile (including its 1-texel trilinear skirt) in the synchronized `Y` and
|
|
179
|
+
* `CoCg` 3D tile atlases of the world-space irradiance clipmap.
|
|
180
|
+
*
|
|
181
|
+
* Evaluates indirect lighting (`INDIRECT_LIGHTING`), directional lights (`SHADOW_DIRECTIONAL_TECHNIQUE`),
|
|
182
|
+
* and world-space clustered point and spot lights with shadow maps at deterministic world-space
|
|
183
|
+
* voxel centres.
|
|
184
|
+
*
|
|
185
|
+
* @type {ComputeShader}
|
|
186
|
+
*/
|
|
187
|
+
export const shader_irradiance_clipmap_build = ComputeShader.from({
|
|
188
|
+
label: "Volumetrics / irradiance clipmap build",
|
|
189
|
+
resources,
|
|
190
|
+
body,
|
|
191
|
+
});
|
|
@@ -42,7 +42,7 @@ export class GPUSceneWind {
|
|
|
42
42
|
* @param {number} capacity
|
|
43
43
|
* @returns {GPUTileAtlas3D}
|
|
44
44
|
*/
|
|
45
|
-
static "__#
|
|
45
|
+
static "__#161@#make_atlas"(device: GPUDevice, content: ArrayLike<number>, capacity: number): GPUTileAtlas3D;
|
|
46
46
|
/**
|
|
47
47
|
* @param {GPUDevice} device
|
|
48
48
|
*/
|
|
@@ -126,7 +126,7 @@ export class GPUSceneWind {
|
|
|
126
126
|
|
|
127
127
|
return new GPUTileAtlas3D({
|
|
128
128
|
device,
|
|
129
|
-
|
|
129
|
+
formats: [WIND_FIELD_TILE_FORMAT],
|
|
130
130
|
// copied by the atlas; made only when the atlas is
|
|
131
131
|
content_size: [content[0], content[1], content[2]],
|
|
132
132
|
border: WIND_FIELD_TILE_BORDER,
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A texture atlas whose patches can be **mipmapped without bleeding into each other**.
|
|
3
|
-
*
|
|
4
|
-
* The atlas this replaces generates mipmaps and reserves padding, and still bleeds: nothing ever
|
|
5
|
-
* fills the padding, so the gutter is zeros and every level past the first averages a patch against
|
|
6
|
-
* whatever lies beyond it. The workarounds are visible in the shader that reads it — a negative LOD
|
|
7
|
-
* bias, and a switch to turn mipmapping off when a scene has many overlapping decals.
|
|
8
|
-
*
|
|
9
|
-
* Three things fix it, and all three are here: a border sized in proportion to the patch
|
|
10
|
-
* ({@link decal_atlas_border}), a border that is actually **filled**, by a rule that suits what the
|
|
11
|
-
* channel means ({@link DecalAtlasFill}), and a per-patch bound on how deep the mip chain may be
|
|
12
|
-
* sampled ({@link decal_atlas_max_lod}), because no finite border protects every level.
|
|
13
|
-
*
|
|
14
|
-
* Packing, growth, repacking and uv bookkeeping are the base class's and are untouched — it already
|
|
15
|
-
* places content at `packing + padding`, which is the whole geometry of a bordered patch.
|
|
16
|
-
*/
|
|
17
|
-
export class DecalAtlas extends TextureAtlas {
|
|
18
|
-
/**
|
|
19
|
-
* @param {DecalAtlasFill} fill
|
|
20
|
-
* @param {number} [size] initial edge length; the atlas grows on demand
|
|
21
|
-
*/
|
|
22
|
-
constructor(fill: DecalAtlasFill, size?: number);
|
|
23
|
-
/**
|
|
24
|
-
* @returns {DecalAtlasFill}
|
|
25
|
-
*/
|
|
26
|
-
get fill(): number;
|
|
27
|
-
/**
|
|
28
|
-
* The border is the patch's own size, not the caller's choice — every patch in one atlas has to
|
|
29
|
-
* obey the same rule for {@link decal_atlas_max_lod}'s "+1 from the neighbour" to hold.
|
|
30
|
-
*
|
|
31
|
-
* @param {Sampler2D} sampler
|
|
32
|
-
* @returns {AtlasPatch}
|
|
33
|
-
*/
|
|
34
|
-
add(sampler: Sampler2D): AtlasPatch;
|
|
35
|
-
/**
|
|
36
|
-
* @param {AtlasPatch} patch
|
|
37
|
-
*/
|
|
38
|
-
paintPatch(patch: AtlasPatch): void;
|
|
39
|
-
#private;
|
|
40
|
-
}
|
|
41
|
-
import { TextureAtlas } from "../../graphics/texture/atlas/TextureAtlas.js";
|
|
42
|
-
import { DecalAtlasFill } from "./DecalAtlasFill.js";
|
|
43
|
-
//# sourceMappingURL=DecalAtlas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DecalAtlas.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics3/decal/DecalAtlas.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH;IAMI;;;OAGG;IACH,kBAHW,cAAc,SACd,MAAM,EAQhB;IAED;;OAEG;IACH,mBAEC;IAED;;;;;;OAMG;IACH,oCAIC;IAED;;OAEG;IACH,oCAoDC;;CA6EJ;6BA/L4B,8CAA8C;+BAG5C,qBAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DecalAtlasFill.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics3/decal/DecalAtlasFill.js"],"names":[],"mappings":";;;;;;6BAMU,MAAM"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How a decal atlas fills the border around a patch.
|
|
3
|
-
*
|
|
4
|
-
* Two rules rather than one, because the correct fill depends on what the channel means and getting
|
|
5
|
-
* it wrong shows up only once the mip chain is built.
|
|
6
|
-
*
|
|
7
|
-
* @enum {number}
|
|
8
|
-
*/
|
|
9
|
-
export const DecalAtlasFill = {
|
|
10
|
-
/**
|
|
11
|
-
* Colour weighted by coverage, and a gutter of nothing.
|
|
12
|
-
*
|
|
13
|
-
* The patch is stored **premultiplied** and its border is zero. Averaging that pair down a mip
|
|
14
|
-
* chain gives premultiplied colour times coverage at every level, which is what a decal fading
|
|
15
|
-
* out at its edge should look like. The same arrangement in *straight* alpha is where dark
|
|
16
|
-
* halos come from — an edge texel averaged against transparent black keeps its alpha and loses
|
|
17
|
-
* its colour — and straight alpha beside a zeroed gutter is exactly what the atlas this
|
|
18
|
-
* replaces has today.
|
|
19
|
-
*/
|
|
20
|
-
PremultipliedCoverage: 0,
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The nearest content texel, repeated outward.
|
|
24
|
-
*
|
|
25
|
-
* For channels that carry no coverage of their own — a normal, a roughness, a metalness — there
|
|
26
|
-
* is nothing to fade toward, and a zeroed gutter would drag a partially covered mip texel toward
|
|
27
|
-
* a meaningless value (a zero normal, mirror-smooth roughness). Coverage for these comes from
|
|
28
|
-
* the albedo's alpha, so their border repeats the edge and lets the mip chain average content
|
|
29
|
-
* against more of the same.
|
|
30
|
-
*/
|
|
31
|
-
EdgeExtend: 1,
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decal_atlas_border.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics3/decal/decal_atlas_border.js"],"names":[],"mappings":"AA2BA;;;;;;;;;GASG;AACH,0CAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CAHW,MAAM,GACJ,MAAM,CAOlB;AAlED;;;;;;;;;;;GAWG;AACH,uCAFU,MAAM,CAE+B;AAE/C;;;;;;;;GAQG;AACH,yCAFU,MAAM,CAE4B"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {GraphicsContext} graphics
|
|
3
|
-
* @param {GPUCommandEncoder} encoder
|
|
4
|
-
* @param {GPUTextureContext} output_depth
|
|
5
|
-
* @param {GPUTextureView} source_view
|
|
6
|
-
* @param {GPUBuffer} camera
|
|
7
|
-
*/
|
|
8
|
-
export function render_mip0(graphics: GraphicsContext, encoder: GPUCommandEncoder, output_depth: GPUTextureContext, source_view: GPUTextureView, camera: GPUBuffer): any;
|
|
9
|
-
/**
|
|
10
|
-
* NOTE: was written for GTAO, currently not being used
|
|
11
|
-
* @param {Object} options
|
|
12
|
-
* @param {FrameGraph} options.graph
|
|
13
|
-
* @param {number} options.depth
|
|
14
|
-
* @param {number[]} options.resolution
|
|
15
|
-
* @param {number} [options.max_mips]
|
|
16
|
-
* @param {number} options.camera camera buffer
|
|
17
|
-
* @returns {number} mip-mapped linear z-buffer
|
|
18
|
-
*/
|
|
19
|
-
export function graph_build_depth_mipmap({ graph, depth, resolution, max_mips, camera }: {
|
|
20
|
-
graph: FrameGraph;
|
|
21
|
-
depth: number;
|
|
22
|
-
resolution: number[];
|
|
23
|
-
max_mips?: number;
|
|
24
|
-
camera: number;
|
|
25
|
-
}): number;
|
|
26
|
-
//# sourceMappingURL=graph_build_depth_mipmap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph_build_depth_mipmap.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.js"],"names":[],"mappings":"AA0HA;;;;;;GAMG;AACH,yKAoCC;AAED;;;;;;;;;GASG;AACH;IAP+B,KAAK;IACT,KAAK,EAArB,MAAM;IACY,UAAU,EAA5B,MAAM,EAAE;IACS,QAAQ,GAAzB,MAAM;IACU,MAAM,EAAtB,MAAM;IACJ,MAAM,CA4FlB"}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { BufferBindingLayout } from "../../../descriptor/binding/BufferBindingLayout.js";
|
|
2
|
-
import { TextureBindingLayout } from "../../../descriptor/binding/TextureBindingLayout.js";
|
|
3
|
-
import { PipelineLayoutDescriptor } from "../../../descriptor/pipeline/PipelineLayoutDescriptor.js";
|
|
4
|
-
import { TextureViewDescriptor } from "../../../descriptor/texture/TextureViewDescriptor.js";
|
|
5
|
-
import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
|
|
6
|
-
import { BindGroupDescriptor } from "../../binding/BindGroupDescriptor.js";
|
|
7
|
-
import { CAMERA_UNIFORM_STRUCT } from "../../camera/CAMERA_UNIFORM_STRUCT.js";
|
|
8
|
-
import { create_full_quad_pipeline_descriptor } from "../../shader/fullscreen/create_full_quad_pipeline_descriptor.js";
|
|
9
|
-
import { chunk_linearize_depth } from "../../shader/chunk/depth/chunk_linearize_depth.js";
|
|
10
|
-
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
11
|
-
import { GTAO_EFFECT_FALLOFF_RANGE, GTAO_EFFECT_RADIUS } from "./fragment_shader_gtao.js";
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
//language=WGSL
|
|
16
|
-
const shader_reduce = `
|
|
17
|
-
|
|
18
|
-
@group(0) @binding(0) var source : texture_2d<f32>;
|
|
19
|
-
|
|
20
|
-
const EffectRadius = ${GTAO_EFFECT_RADIUS};
|
|
21
|
-
const EffectFalloffRange = ${GTAO_EFFECT_FALLOFF_RANGE};
|
|
22
|
-
|
|
23
|
-
fn DepthMIPFilter( depth0:f32, depth1:f32, depth2:f32, depth3:f32 ) -> f32
|
|
24
|
-
{
|
|
25
|
-
let maxDepth = max( max( depth0, depth1 ), max( depth2, depth3 ) );
|
|
26
|
-
|
|
27
|
-
const depthRangeScaleFactor = 0.75; // found empirically :)
|
|
28
|
-
|
|
29
|
-
const effectRadius = depthRangeScaleFactor * EffectRadius;
|
|
30
|
-
const falloffRange = EffectFalloffRange * effectRadius;
|
|
31
|
-
|
|
32
|
-
const falloffFrom = effectRadius * (1-EffectFalloffRange);
|
|
33
|
-
|
|
34
|
-
// fadeout precompute optimisation
|
|
35
|
-
const falloffMul = -1.0 / ( falloffRange );
|
|
36
|
-
const falloffAdd = falloffFrom / ( falloffRange ) + 1.0;
|
|
37
|
-
|
|
38
|
-
let weight0 = saturate( (maxDepth-depth0) * falloffMul + falloffAdd );
|
|
39
|
-
let weight1 = saturate( (maxDepth-depth1) * falloffMul + falloffAdd );
|
|
40
|
-
let weight2 = saturate( (maxDepth-depth2) * falloffMul + falloffAdd );
|
|
41
|
-
let weight3 = saturate( (maxDepth-depth3) * falloffMul + falloffAdd );
|
|
42
|
-
|
|
43
|
-
let weightSum = weight0 + weight1 + weight2 + weight3;
|
|
44
|
-
|
|
45
|
-
return (weight0 * depth0 + weight1 * depth1 + weight2 * depth2 + weight3 * depth3) / weightSum;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@fragment
|
|
49
|
-
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) f32 {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let source_size = textureDimensions(source, 0);
|
|
53
|
-
let limit = vec2u(source_size - 1u);
|
|
54
|
-
|
|
55
|
-
let p0 = min( vec2u( u32(coord.x) << 1, u32(coord.y) << 1), limit);
|
|
56
|
-
let p1 = min( p0 + vec2u(1,0), limit );
|
|
57
|
-
let p2 = min( p0 + vec2u(0,1), limit );
|
|
58
|
-
let p3 = min( p0 + vec2u(1,1), limit );
|
|
59
|
-
|
|
60
|
-
let depth0 = textureLoad(source, p0, 0).r;
|
|
61
|
-
let depth1 = textureLoad(source, p1, 0).r;
|
|
62
|
-
let depth2 = textureLoad(source, p2, 0).r;
|
|
63
|
-
let depth3 = textureLoad(source, p3, 0).r;
|
|
64
|
-
|
|
65
|
-
let depth = DepthMIPFilter(depth0, depth1, depth2, depth3);
|
|
66
|
-
|
|
67
|
-
return depth;
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const render_pipeline_descriptor_reduce = create_full_quad_pipeline_descriptor({
|
|
72
|
-
fragment_code: shader_reduce,
|
|
73
|
-
layout: PipelineLayoutDescriptor.forStage(GPUShaderStage.FRAGMENT, [
|
|
74
|
-
[
|
|
75
|
-
TextureBindingLayout.unfilterableFloat
|
|
76
|
-
]
|
|
77
|
-
]),
|
|
78
|
-
targets: [
|
|
79
|
-
{
|
|
80
|
-
format: "r32float",
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//language=WGSL
|
|
87
|
-
const shader_mip0 = CodeChunk.from(`
|
|
88
|
-
|
|
89
|
-
@group(0) @binding(0) var source : texture_2d<f32>;
|
|
90
|
-
@group(0) @binding(1) var<uniform> camera: ${CAMERA_UNIFORM_STRUCT.wgsl_ref};
|
|
91
|
-
|
|
92
|
-
@fragment
|
|
93
|
-
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) f32 {
|
|
94
|
-
|
|
95
|
-
let depth_raw = textureLoad(source,vec2u(coord.xy), 0).r;
|
|
96
|
-
|
|
97
|
-
let depth = linearize_depth(camera.projection_matrix, depth_raw);
|
|
98
|
-
|
|
99
|
-
return depth;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
`,[
|
|
103
|
-
CAMERA_UNIFORM_STRUCT.declaration_chunk,
|
|
104
|
-
chunk_linearize_depth,
|
|
105
|
-
]).compile().text;
|
|
106
|
-
|
|
107
|
-
const render_pipeline_descriptor_mip0 = create_full_quad_pipeline_descriptor({
|
|
108
|
-
fragment_code: shader_mip0,
|
|
109
|
-
layout: PipelineLayoutDescriptor.forStage(GPUShaderStage.FRAGMENT, [
|
|
110
|
-
[
|
|
111
|
-
TextureBindingLayout.unfilterableFloat,
|
|
112
|
-
BufferBindingLayout.uniform
|
|
113
|
-
]
|
|
114
|
-
]),
|
|
115
|
-
targets: [
|
|
116
|
-
{
|
|
117
|
-
format: "r32float",
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @param {GraphicsContext} graphics
|
|
125
|
-
* @param {GPUCommandEncoder} encoder
|
|
126
|
-
* @param {GPUTextureContext} output_depth
|
|
127
|
-
* @param {GPUTextureView} source_view
|
|
128
|
-
* @param {GPUBuffer} camera
|
|
129
|
-
*/
|
|
130
|
-
export function render_mip0(
|
|
131
|
-
graphics,
|
|
132
|
-
encoder,
|
|
133
|
-
output_depth,
|
|
134
|
-
source_view,
|
|
135
|
-
camera
|
|
136
|
-
) {
|
|
137
|
-
const pipeline = graphics.render_pipelines.obtain(render_pipeline_descriptor_mip0);
|
|
138
|
-
|
|
139
|
-
const output_view = output_depth.obtainView(TextureViewDescriptor.from({
|
|
140
|
-
baseMipLevel: 0,
|
|
141
|
-
mipLevelCount: 1
|
|
142
|
-
}));
|
|
143
|
-
|
|
144
|
-
const pass = encoder.beginRenderPass({
|
|
145
|
-
colorAttachments: [
|
|
146
|
-
{
|
|
147
|
-
view: output_view,
|
|
148
|
-
loadOp: "clear",
|
|
149
|
-
storeOp: "store"
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const bind_group = graphics.bind_groups.obtain(BindGroupDescriptor.from(render_pipeline_descriptor_mip0.layout.bindGroupLayouts[0], [
|
|
156
|
-
source_view,
|
|
157
|
-
{ buffer: camera }
|
|
158
|
-
]));
|
|
159
|
-
|
|
160
|
-
pass.setPipeline(pipeline);
|
|
161
|
-
pass.setBindGroup(0, bind_group);
|
|
162
|
-
pass.draw(3);
|
|
163
|
-
pass.end();
|
|
164
|
-
|
|
165
|
-
return output_view;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* NOTE: was written for GTAO, currently not being used
|
|
170
|
-
* @param {Object} options
|
|
171
|
-
* @param {FrameGraph} options.graph
|
|
172
|
-
* @param {number} options.depth
|
|
173
|
-
* @param {number[]} options.resolution
|
|
174
|
-
* @param {number} [options.max_mips]
|
|
175
|
-
* @param {number} options.camera camera buffer
|
|
176
|
-
* @returns {number} mip-mapped linear z-buffer
|
|
177
|
-
*/
|
|
178
|
-
export function graph_build_depth_mipmap(
|
|
179
|
-
{
|
|
180
|
-
graph,
|
|
181
|
-
depth,
|
|
182
|
-
resolution,
|
|
183
|
-
max_mips = Number.POSITIVE_INFINITY,
|
|
184
|
-
camera
|
|
185
|
-
}
|
|
186
|
-
) {
|
|
187
|
-
const data = {};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
* @param data
|
|
193
|
-
* @param {FramePassResources} resources
|
|
194
|
-
* @param {GraphicsExecutionContext} context
|
|
195
|
-
*/
|
|
196
|
-
function execute(data, resources, context) {
|
|
197
|
-
/**
|
|
198
|
-
* @type {GPUTextureContext}
|
|
199
|
-
*/
|
|
200
|
-
const input_depth = resources.get(data.input_depth);
|
|
201
|
-
const output_depth = resources.get(data.output_depth);
|
|
202
|
-
const camera = resources.get(data.camera);
|
|
203
|
-
|
|
204
|
-
const graphics = context.graphics;
|
|
205
|
-
|
|
206
|
-
const reduction_pipeline = graphics.render_pipelines.obtain(render_pipeline_descriptor_reduce);
|
|
207
|
-
|
|
208
|
-
const mip_limit = Math.min(max_mips, output_depth.gpu_texture.mipLevelCount);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const encoder = context.encoder;
|
|
212
|
-
|
|
213
|
-
// mip 0
|
|
214
|
-
let source_view = input_depth.obtainView();
|
|
215
|
-
|
|
216
|
-
source_view = render_mip0(graphics, encoder, output_depth, source_view, camera);
|
|
217
|
-
|
|
218
|
-
// inspect_gpu_buffer_typed({
|
|
219
|
-
// buffer: camera,
|
|
220
|
-
// device: graphics.device,
|
|
221
|
-
// type: CAMERA_UNIFORM_STRUCT,
|
|
222
|
-
// count:1
|
|
223
|
-
// }).then(console.warn);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for (let i = 1; i < mip_limit; i++) {
|
|
227
|
-
const destination_view = output_depth.obtainView(TextureViewDescriptor.from({
|
|
228
|
-
baseMipLevel: i,
|
|
229
|
-
mipLevelCount: 1,
|
|
230
|
-
}));
|
|
231
|
-
|
|
232
|
-
const pass = encoder.beginRenderPass({
|
|
233
|
-
colorAttachments: [
|
|
234
|
-
{
|
|
235
|
-
view: destination_view,
|
|
236
|
-
loadOp: "clear",
|
|
237
|
-
storeOp: "store"
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
const bind_group = graphics.bind_groups.obtain(BindGroupDescriptor.from(render_pipeline_descriptor_reduce.layout.bindGroupLayouts[0], [
|
|
243
|
-
source_view
|
|
244
|
-
]));
|
|
245
|
-
|
|
246
|
-
pass.setPipeline(reduction_pipeline);
|
|
247
|
-
pass.setBindGroup(0, bind_group);
|
|
248
|
-
pass.draw(3);
|
|
249
|
-
pass.end();
|
|
250
|
-
|
|
251
|
-
source_view = destination_view;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const builder = graph.add('depth mipmap', data, execute);
|
|
257
|
-
|
|
258
|
-
data.input_depth = builder.read(depth);
|
|
259
|
-
data.camera = builder.read(camera);
|
|
260
|
-
data.output_depth = builder.create("mipmap", TextureResourceDescriptor.from({
|
|
261
|
-
resolution: resolution,
|
|
262
|
-
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_DST,
|
|
263
|
-
format: "r32float",
|
|
264
|
-
enableMips: true
|
|
265
|
-
}));
|
|
266
|
-
|
|
267
|
-
return data.output_depth;
|
|
268
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy_shader_f32.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/ssr/copy_shader_f32.js"],"names":[],"mappings":"AAsBA,0CASE;4BA9B0B,6BAA6B"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
|
-
import { ImageShader } from "../../shader/ImageShader.js";
|
|
3
|
-
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
4
|
-
import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
|
|
5
|
-
|
|
6
|
-
const resources = new ShaderResourceSetDescriptor();
|
|
7
|
-
resources.createGroup()
|
|
8
|
-
.addTexture("tInput");
|
|
9
|
-
|
|
10
|
-
const body = CodeChunk.from(
|
|
11
|
-
//language=WGSL
|
|
12
|
-
`
|
|
13
|
-
@fragment
|
|
14
|
-
fn main(
|
|
15
|
-
@builtin(position) coord : vec4<f32>,
|
|
16
|
-
@location(0) uv: vec2<f32>,
|
|
17
|
-
) -> @location(0) f32 {
|
|
18
|
-
return textureLoad(tInput, vec2<i32>(coord.xy), 0).r;
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export const copy_shader_f32 = new ImageShader({
|
|
24
|
-
descriptor: ShaderDescriptor.from({
|
|
25
|
-
label: "Copy r32",
|
|
26
|
-
resources,
|
|
27
|
-
body
|
|
28
|
-
}),
|
|
29
|
-
targets: [
|
|
30
|
-
{ format: "r32float" }
|
|
31
|
-
]
|
|
32
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inclusive source-texel window one output texel of the reduction reads: `(min.xy, max.xy)`.
|
|
3
|
-
*
|
|
4
|
-
* The windows of one step tile the source exactly — every source texel belongs to one output texel,
|
|
5
|
-
* none twice and none missed — which is what makes the result a max over the whole level rather than a
|
|
6
|
-
* max over an arbitrary stencil. Pinned by `depth_max_source_bounds.spec`.
|
|
7
|
-
*
|
|
8
|
-
* The stride is `ceil(source / output)`, not a hardcoded 2, and the upper bound is
|
|
9
|
-
* `min + stride - 1` because the loops that read it are inclusive. It used to be `target * 2` for the
|
|
10
|
-
* origin and `min + stride` for the bound, which at a halving step is three texels per axis: nine
|
|
11
|
-
* reads for a 2x2 footprint, overlapping its neighbours on both sides.
|
|
12
|
-
*/
|
|
13
|
-
export const chunk_depth_max_source_bounds: CodeChunk;
|
|
14
|
-
export const depth_max_shader: ImageShader;
|
|
15
|
-
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
16
|
-
import { ImageShader } from "../../shader/ImageShader.js";
|
|
17
|
-
//# sourceMappingURL=depth_max_shader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"depth_max_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/ssr/depth_max_shader.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;GAWG;AACH,sDAyBE;AAkCF,2CAWG;0BAhGuB,oCAAoC;4BAClC,6BAA6B"}
|