@woosh/meep-engine 3.64.0 → 3.65.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/CHANGELOG.md +85 -0
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts +5 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +39 -5
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
- package/src/engine/graphics/texture/sampler/exr_to_sampler2d.d.ts +27 -0
- package/src/engine/graphics/texture/sampler/exr_to_sampler2d.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/exr_to_sampler2d.js +91 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts +23 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.js +64 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GroundCoverSystem.js +58 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +372 -110
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
- package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +65 -9
- package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
- package/src/engine/network/state/PredictionHistory.js +6 -1
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
- package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
- package/src/engine/network/time/RenderPlayout.d.ts +23 -3
- package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
- package/src/engine/network/time/RenderPlayout.js +40 -4
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
- package/src/format/image/exr/ExrCompression.d.ts +22 -0
- package/src/format/image/exr/ExrCompression.d.ts.map +1 -0
- package/src/format/image/exr/ExrCompression.js +27 -0
- package/src/format/image/exr/ExrImage.d.ts +32 -0
- package/src/format/image/exr/ExrImage.d.ts.map +1 -0
- package/src/format/image/exr/ExrImage.js +32 -0
- package/src/format/image/exr/ExrPixelType.d.ts +13 -0
- package/src/format/image/exr/ExrPixelType.d.ts.map +1 -0
- package/src/format/image/exr/ExrPixelType.js +18 -0
- package/src/format/image/exr/exr_compare_names.d.ts +16 -0
- package/src/format/image/exr/exr_compare_names.d.ts.map +1 -0
- package/src/format/image/exr/exr_compare_names.js +25 -0
- package/src/format/image/exr/exr_constants.d.ts +49 -0
- package/src/format/image/exr/exr_constants.d.ts.map +1 -0
- package/src/format/image/exr/exr_constants.js +56 -0
- package/src/format/image/exr/exr_read.d.ts +32 -0
- package/src/format/image/exr/exr_read.d.ts.map +1 -0
- package/src/format/image/exr/exr_read.js +531 -0
- package/src/format/image/exr/exr_sample_bits.d.ts +16 -0
- package/src/format/image/exr/exr_sample_bits.d.ts.map +1 -0
- package/src/format/image/exr/exr_sample_bits.js +21 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.d.ts +17 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.d.ts.map +1 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.js +31 -0
- package/src/format/image/exr/exr_write.d.ts +27 -0
- package/src/format/image/exr/exr_write.d.ts.map +1 -0
- package/src/format/image/exr/exr_write.js +378 -0
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
- package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
- package/src/shade/playground/grass_surfaces/index.html +75 -0
- package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
- package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/main.js +593 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
- package/src/shade/playground/probe_clipmap/index.html +5 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +34 -1
- package/src/shade/playground/probe_clipmap_box/README.md +5 -1
- package/src/shade/playground/probe_clipmap_box/index.html +12 -0
- package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/main.js +15 -0
- package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
- package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +47 -43
- package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
- package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
- package/src/shade/renderer/extension/ViewTextures.js +19 -5
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +12 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +35 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +128 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +27 -15
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +3 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +18 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +10 -21
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +7 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +28 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +18 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +18 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +44 -48
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +15 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +29 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +8 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +21 -3
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
- package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +18 -13
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
- package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GRASS_POOL_BAKED,
|
|
3
|
+
GRASS_POOL_FREE_COUNT,
|
|
4
|
+
GRASS_POOL_HEADER_WORDS,
|
|
5
|
+
GRASS_POOL_REMOVED,
|
|
6
|
+
GRASS_POOL_STARVED,
|
|
7
|
+
GRASS_SLOT_LAYER_COUNT,
|
|
8
|
+
GRASS_SLOT_LEVEL_LAYER,
|
|
9
|
+
GRASS_SLOT_STATE,
|
|
10
|
+
GRASS_SLOT_STATE_FREE,
|
|
11
|
+
GRASS_SLOT_SURFACE,
|
|
12
|
+
GRASS_SLOT_SURFEL_COUNT,
|
|
13
|
+
GRASS_SLOT_TILE_X,
|
|
14
|
+
GRASS_SLOT_TILE_Z,
|
|
15
|
+
GRASS_SLOT_WANTED_FRAME,
|
|
16
|
+
GRASS_SLOT_WORDS,
|
|
17
|
+
GRASS_TILE_COLUMNS
|
|
18
|
+
} from "../../renderer/grass/surface/GRASS_SURFACE.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {object} GrassSlotReading
|
|
22
|
+
* @property {number} slot
|
|
23
|
+
* @property {number} surface the surface's `transforms` row
|
|
24
|
+
* @property {number} level
|
|
25
|
+
* @property {number} layer
|
|
26
|
+
* @property {number[]} tile `[x, z]`, in tiles of the level
|
|
27
|
+
* @property {number} state `GRASS_SLOT_STATE_*`
|
|
28
|
+
* @property {number} wanted_frame
|
|
29
|
+
* @property {number} layer_count
|
|
30
|
+
* @property {number} surfel_count
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} GrassSurfelReading
|
|
35
|
+
* @property {number} x column along the tile's x, `[0, GRASS_TILE_COLUMNS)`
|
|
36
|
+
* @property {number} z column along the tile's z
|
|
37
|
+
* @property {number} height along the frame's up axis
|
|
38
|
+
* @property {number} member the member's `meshes` row
|
|
39
|
+
* @property {number} clear_height
|
|
40
|
+
* @property {number} density
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Copy a range of a buffer off the device.
|
|
45
|
+
*
|
|
46
|
+
* @param {GPUDevice} device
|
|
47
|
+
* @param {GPUBuffer} buffer needs `COPY_SRC`
|
|
48
|
+
* @param {number} size bytes, a multiple of 4
|
|
49
|
+
* @returns {Promise<ArrayBuffer>}
|
|
50
|
+
*/
|
|
51
|
+
async function read_buffer(device, buffer, size) {
|
|
52
|
+
const staging = device.createBuffer({ size, usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST });
|
|
53
|
+
|
|
54
|
+
const encoder = device.createCommandEncoder();
|
|
55
|
+
|
|
56
|
+
encoder.copyBufferToBuffer(buffer, 0, staging, 0, size);
|
|
57
|
+
|
|
58
|
+
device.queue.submit([encoder.finish()]);
|
|
59
|
+
|
|
60
|
+
await staging.mapAsync(GPUMapMode.READ);
|
|
61
|
+
|
|
62
|
+
const copy = staging.getMappedRange().slice(0);
|
|
63
|
+
|
|
64
|
+
staging.unmap();
|
|
65
|
+
staging.destroy();
|
|
66
|
+
|
|
67
|
+
return copy;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Read the grass surfaces' pool off the device: its counters, every slot that is not free, and on request
|
|
72
|
+
* the surfels the slots hold. A playground's inspection tool; nothing in a frame calls it.
|
|
73
|
+
*
|
|
74
|
+
* @param {GPUDevice} device
|
|
75
|
+
* @param {import("../../renderer/grass/surface/GPUGrassSurfaces.js").GPUGrassSurfaces} surfaces
|
|
76
|
+
* @param {boolean} [with_surfels] also read the atlas, and give every slot its `surfels`
|
|
77
|
+
* @returns {Promise<{capacity: number, free_count: number, starved: number, baked: number, removed: number, listed: number, slots: (GrassSlotReading & {surfels?: GrassSurfelReading[]})[]}>}
|
|
78
|
+
* `removed` is the records taken out of the directory since the pool was made, `listed` the records it holds
|
|
79
|
+
*/
|
|
80
|
+
export async function read_grass_surfaces(device, surfaces, with_surfels = false) {
|
|
81
|
+
const capacity = surfaces.slot_capacity;
|
|
82
|
+
|
|
83
|
+
if (capacity === 0) {
|
|
84
|
+
return { capacity: 0, free_count: 0, starved: 0, baked: 0, removed: 0, listed: 0, slots: [] };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const words = new Uint32Array(await read_buffer(device, surfaces.pool_buffer, (GRASS_POOL_HEADER_WORDS + capacity * GRASS_SLOT_WORDS) * 4));
|
|
88
|
+
|
|
89
|
+
/** @type {GrassSlotReading[]} */
|
|
90
|
+
const slots = [];
|
|
91
|
+
|
|
92
|
+
for (let slot = 0; slot < capacity; slot++) {
|
|
93
|
+
const record = GRASS_POOL_HEADER_WORDS + slot * GRASS_SLOT_WORDS;
|
|
94
|
+
|
|
95
|
+
if (words[record + GRASS_SLOT_STATE] === GRASS_SLOT_STATE_FREE) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const level_layer = words[record + GRASS_SLOT_LEVEL_LAYER];
|
|
100
|
+
|
|
101
|
+
slots.push({
|
|
102
|
+
slot,
|
|
103
|
+
surface: words[record + GRASS_SLOT_SURFACE],
|
|
104
|
+
level: level_layer & 0xff,
|
|
105
|
+
layer: (level_layer >> 8) & 0xff,
|
|
106
|
+
tile: [words[record + GRASS_SLOT_TILE_X] | 0, words[record + GRASS_SLOT_TILE_Z] | 0],
|
|
107
|
+
state: words[record + GRASS_SLOT_STATE],
|
|
108
|
+
wanted_frame: words[record + GRASS_SLOT_WANTED_FRAME],
|
|
109
|
+
layer_count: words[record + GRASS_SLOT_LAYER_COUNT],
|
|
110
|
+
surfel_count: words[record + GRASS_SLOT_SURFEL_COUNT],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const result = {
|
|
115
|
+
capacity,
|
|
116
|
+
free_count: words[GRASS_POOL_FREE_COUNT],
|
|
117
|
+
starved: words[GRASS_POOL_STARVED],
|
|
118
|
+
baked: words[GRASS_POOL_BAKED],
|
|
119
|
+
removed: words[GRASS_POOL_REMOVED],
|
|
120
|
+
listed: new Uint32Array(await read_buffer(device, surfaces.directory_buffer, 8))[0],
|
|
121
|
+
slots,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (!with_surfels) {
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const atlas = surfaces.atlas;
|
|
129
|
+
const width = atlas.width;
|
|
130
|
+
const height = atlas.height;
|
|
131
|
+
|
|
132
|
+
// four words a texel
|
|
133
|
+
const staging = device.createBuffer({ size: width * height * 16, usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST });
|
|
134
|
+
|
|
135
|
+
const encoder = device.createCommandEncoder();
|
|
136
|
+
|
|
137
|
+
encoder.copyTextureToBuffer({ texture: atlas }, { buffer: staging, bytesPerRow: width * 16, rowsPerImage: height }, [width, height]);
|
|
138
|
+
|
|
139
|
+
device.queue.submit([encoder.finish()]);
|
|
140
|
+
|
|
141
|
+
await staging.mapAsync(GPUMapMode.READ);
|
|
142
|
+
|
|
143
|
+
const texels = new Uint32Array(staging.getMappedRange().slice(0));
|
|
144
|
+
const texel_floats = new Float32Array(texels.buffer);
|
|
145
|
+
|
|
146
|
+
staging.unmap();
|
|
147
|
+
staging.destroy();
|
|
148
|
+
|
|
149
|
+
const half = new Float16Array(1);
|
|
150
|
+
const half_bits = new Uint16Array(half.buffer);
|
|
151
|
+
|
|
152
|
+
for (const reading of slots) {
|
|
153
|
+
// a GPUTileAtlas2D: tiles in rows as wide as the texture
|
|
154
|
+
const row_slots = width / GRASS_TILE_COLUMNS;
|
|
155
|
+
|
|
156
|
+
const corner_x = (reading.slot % row_slots) * GRASS_TILE_COLUMNS;
|
|
157
|
+
const corner_z = Math.floor(reading.slot / row_slots) * GRASS_TILE_COLUMNS;
|
|
158
|
+
|
|
159
|
+
/** @type {GrassSurfelReading[]} */
|
|
160
|
+
const surfels = [];
|
|
161
|
+
|
|
162
|
+
for (let z = 0; z < GRASS_TILE_COLUMNS; z++) {
|
|
163
|
+
for (let x = 0; x < GRASS_TILE_COLUMNS; x++) {
|
|
164
|
+
const at = ((corner_z + z) * width + corner_x + x) * 4;
|
|
165
|
+
const member = texels[at + 2];
|
|
166
|
+
|
|
167
|
+
if (member === 0) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
half_bits[0] = texels[at + 3] & 0xffff;
|
|
172
|
+
|
|
173
|
+
surfels.push({
|
|
174
|
+
x,
|
|
175
|
+
z,
|
|
176
|
+
height: texel_floats[at],
|
|
177
|
+
member,
|
|
178
|
+
clear_height: half[0],
|
|
179
|
+
density: (texels[at + 3] >>> 16) / 65535,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
reading.surfels = surfels;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
@@ -124,6 +124,11 @@
|
|
|
124
124
|
|
|
125
125
|
<hr>
|
|
126
126
|
|
|
127
|
+
<label>
|
|
128
|
+
<input type="checkbox" id="sun" checked>
|
|
129
|
+
<span>Sun <span class="hint">— the directional light; L flips it</span></span>
|
|
130
|
+
</label>
|
|
131
|
+
|
|
127
132
|
<label>
|
|
128
133
|
<span>Sun height</span>
|
|
129
134
|
<input type="range" id="sun_elevation" min="2" max="88" value="62">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap/main.js"],"names":[],"mappings":"AAyFA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap/main.js"],"names":[],"mappings":"AAyFA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CAuUzB"}
|
|
@@ -178,7 +178,11 @@ export async function start() {
|
|
|
178
178
|
// a sun the sliders turn, whatever lights the file brought
|
|
179
179
|
const sun = make_sunlight({ intensity: 7.2 });
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
/**
|
|
182
|
+
* The sun's entity while it is in the scene, -1 while the toggle has it out.
|
|
183
|
+
* @type {number}
|
|
184
|
+
*/
|
|
185
|
+
let sun_entity = place_light(scene, sun);
|
|
182
186
|
|
|
183
187
|
const rotation = new Quaternion();
|
|
184
188
|
const sun_direction = new Vector3();
|
|
@@ -229,6 +233,33 @@ export async function start() {
|
|
|
229
233
|
element('sun_elevation').addEventListener('input', on_sun_input);
|
|
230
234
|
element('sun_azimuth').addEventListener('input', on_sun_input);
|
|
231
235
|
|
|
236
|
+
const sun_toggle = element('sun');
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Take the sun out of the scene, or put it back; out, it is gone from the lights, its shadows and the
|
|
240
|
+
* probes' hits alike, rather than dimmed to nothing.
|
|
241
|
+
* @param {boolean} enabled
|
|
242
|
+
*/
|
|
243
|
+
function set_sun(enabled) {
|
|
244
|
+
sun_toggle.checked = enabled;
|
|
245
|
+
|
|
246
|
+
if (enabled === (sun_entity !== -1)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (enabled) {
|
|
251
|
+
sun_entity = place_light(scene, sun);
|
|
252
|
+
} else {
|
|
253
|
+
scene.lights.remove(sun);
|
|
254
|
+
scene.dataset.removeEntity(sun_entity);
|
|
255
|
+
sun_entity = -1;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
lights_changed();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
sun_toggle.addEventListener('change', event => set_sun(event.target.checked));
|
|
262
|
+
|
|
232
263
|
load_default_environment(scene);
|
|
233
264
|
|
|
234
265
|
// ---- controls -------------------------------------------------------------------------
|
|
@@ -311,6 +342,8 @@ export async function start() {
|
|
|
311
342
|
} else if (event.code === 'KeyT') {
|
|
312
343
|
ray_resampling_toggle.checked = !ray_resampling_toggle.checked;
|
|
313
344
|
renderer.probe_clipmap.ray_resampling = ray_resampling_toggle.checked;
|
|
345
|
+
} else if (event.code === 'KeyL') {
|
|
346
|
+
set_sun(sun_entity === -1);
|
|
314
347
|
}
|
|
315
348
|
});
|
|
316
349
|
|
|
@@ -34,7 +34,8 @@ then open <http://localhost:5173/src/shade/playground/probe_clipmap_box/index.ht
|
|
|
34
34
|
| Sun (1, 2, 3) | through the hole onto the red wall or the green wall, from 45°, or straight down onto the floor |
|
|
35
35
|
| Hole open (H) | closed, a lid of the hole's size sits flush in the ceiling; it is placed into the scene and taken out again, so the bricks the rays march are rebuilt as a level's would be |
|
|
36
36
|
| Indirect light | the probe clipmap, or IBL to compare against |
|
|
37
|
-
| Debug view | the brick clipmap as the rays see it; the geometry caches' mesh SDF; the hits' albedo from the meshes' surface caches |
|
|
37
|
+
| Debug view | the brick clipmap as the rays see it; the geometry caches' mesh SDF; the hits' albedo from the meshes' surface caches; the probes' indirect diffuse and indirect specular, each before the surface's material |
|
|
38
|
+
| Roughness | every slab's, 1 as the box starts. The indirect specular view samples the probes at the surface's roughness: at 1 it is their SH alone, and toward 0.05 it is one tap of their radiance tiles along the reflection, the walls as the probes hold them. A slab keeps its geometry, so the bricks the rays march do not change |
|
|
38
39
|
| Restart GI (K) | gives the clipmaps back and builds them again from nothing, the geometry caches kept: a cold start without a reload |
|
|
39
40
|
| Path tracer (P) | the accumulating path tracer, three bounces, for context; TAA is off while it is on |
|
|
40
41
|
| TAA | the resolve the probe pick's noise is meant for |
|
|
@@ -47,6 +48,9 @@ The stats line counts the frames since the sun or the hole last changed.
|
|
|
47
48
|
- **Hole closed**: the inside should go black. Whatever light stays is what the probes still hold.
|
|
48
49
|
- **Sun moved between the walls**: the colour bleeding onto the back wall and the floor should swap from red
|
|
49
50
|
to green.
|
|
51
|
+
- **Indirect specular, roughness low**: the reflections are the probes' 16 × 16 radiance tiles, tapped along the
|
|
52
|
+
reflection with no parallax (the proposal's §9.3, "Parallax correction"): the walls show blurred, and placed as
|
|
53
|
+
if they were far.
|
|
50
54
|
- **Restart**: until the brick clipmap has built (about 48 frames at the default build budget), the rays see
|
|
51
55
|
no walls and every probe sees the sky; the light then has to drain out of the probes.
|
|
52
56
|
|
|
@@ -128,9 +128,21 @@
|
|
|
128
128
|
<option value="BrickClipmap">Brick clipmap — what the rays see</option>
|
|
129
129
|
<option value="MeshSDF">Mesh SDF — the geometry caches</option>
|
|
130
130
|
<option value="MeshSurfaces">Mesh surfaces — each mesh's surface cache</option>
|
|
131
|
+
<option value="IndirectDiffuse">Indirect diffuse — the probes' irradiance / π, before the material</option>
|
|
132
|
+
<option value="IndirectSpecular">Indirect specular — the probes' radiance, before the material</option>
|
|
131
133
|
</select>
|
|
132
134
|
</label>
|
|
133
135
|
|
|
136
|
+
<label>
|
|
137
|
+
<span>Roughness</span>
|
|
138
|
+
<input type="range" id="roughness" min="0.05" max="1" step="0.05" value="1">
|
|
139
|
+
<output id="roughness_value"></output>
|
|
140
|
+
</label>
|
|
141
|
+
<p class="note">
|
|
142
|
+
Every slab's. At 1 the indirect specular view shows the probes' SH alone; lower it to see the reflections
|
|
143
|
+
their radiance tiles hold.
|
|
144
|
+
</p>
|
|
145
|
+
|
|
134
146
|
<label>
|
|
135
147
|
<span>Restart GI</span>
|
|
136
148
|
<button id="restart">Restart</button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/main.js"],"names":[],"mappings":"AAsEA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/main.js"],"names":[],"mappings":"AAsEA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CAuQzB"}
|
|
@@ -123,6 +123,7 @@ export async function start() {
|
|
|
123
123
|
const box = await build_hole_box(scene, scene_context, {
|
|
124
124
|
aim: BoxSunAim[element('sun_aim').value],
|
|
125
125
|
open: element('hole_open').checked,
|
|
126
|
+
roughness: Number(element('roughness').value),
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
// inside, against the front wall, looking at the back one: both coloured walls and the floor in view
|
|
@@ -210,6 +211,20 @@ export async function start() {
|
|
|
210
211
|
|
|
211
212
|
element('restart').addEventListener('click', restart_gi);
|
|
212
213
|
|
|
214
|
+
const roughness_slider = element('roughness');
|
|
215
|
+
|
|
216
|
+
function show_roughness() {
|
|
217
|
+
element('roughness_value').textContent = Number(roughness_slider.value).toFixed(2);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
show_roughness();
|
|
221
|
+
roughness_slider.addEventListener('input', show_roughness);
|
|
222
|
+
// on release: every stop on the way would be ten materials of its own
|
|
223
|
+
roughness_slider.addEventListener('change', () => {
|
|
224
|
+
box.roughness = Number(roughness_slider.value);
|
|
225
|
+
box_changed();
|
|
226
|
+
});
|
|
227
|
+
|
|
213
228
|
const exposure_slider = element('exposure');
|
|
214
229
|
|
|
215
230
|
function show_exposure() {
|
|
@@ -46,16 +46,23 @@ export function box_lid(): {
|
|
|
46
46
|
* @param {number[]} [options.sky] linear radiance of the flat sky
|
|
47
47
|
* @param {BoxSunAim} [options.aim]
|
|
48
48
|
* @param {boolean} [options.open]
|
|
49
|
+
* @param {number} [options.roughness] every slab's, 1 the Cornell box's own
|
|
49
50
|
*/
|
|
50
|
-
export function build_hole_box(scene: import("../../renderer/scene/Scene.js").Scene, scene_context: import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext, { sun_intensity, sky, aim, open, }?: {
|
|
51
|
+
export function build_hole_box(scene: import("../../renderer/scene/Scene.js").Scene, scene_context: import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext, { sun_intensity, sky, aim, open, roughness, }?: {
|
|
51
52
|
sun_intensity?: number;
|
|
52
53
|
sky?: number[];
|
|
53
54
|
aim?: BoxSunAim;
|
|
54
55
|
open?: boolean;
|
|
56
|
+
roughness?: number;
|
|
55
57
|
}): Promise<{
|
|
56
58
|
sun: import("../../renderer/light/model/DirectionalLight.js").DirectionalLight;
|
|
57
59
|
aim: number;
|
|
58
60
|
open: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Every slab's roughness.
|
|
63
|
+
* @returns {number}
|
|
64
|
+
*/
|
|
65
|
+
roughness: number;
|
|
59
66
|
}>;
|
|
60
67
|
/**
|
|
61
68
|
* The inside of the box, a side, metres: x and z in [−½, ½] of it, y in [0, 1] of it. Five probe spacings of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/scene.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/scene.js"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,uCAJW,OAAO,OACP,SAAS,GACP,OAAO,CAgBnB;AAED;;;;;;;GAOG;AACH,6BAFa;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAwBhF;AAED;;;;GAIG;AACH,2BAFa;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAI9E;AAiBD;;;;;;;;;;;;;;;;GAgBG;AACH,sCATW,OAAO,+BAA+B,EAAE,KAAK,iBAC7C,OAAO,yCAAyC,EAAE,eAAe;IAEhD,aAAa,GAA9B,MAAM;IACa,GAAG,GAAtB,MAAM,EAAE;IACY,GAAG,GAAvB,SAAS;IACS,IAAI,GAAtB,OAAO;IACU,SAAS,GAA1B,MAAM;;;;;IA+HT;;;OAGG;;GAsCV;AAtTD;;;;GAIG;AACH,yBAFU,MAAM,CAEY;AAE5B;;;;GAIG;AACH,uBAFU,MAAM,CAEa;AAE7B;;;GAGG;AACH,uBAFU,MAAM,CAEa;AAE7B;;;;GAIG;AACH,qCAFU,MAAM,CAEyB;;;;wBAY/B,MAAM;;;;;;oBAhDI,+BAA+B"}
|
|
@@ -7,6 +7,7 @@ import { MeshoptClusterizer } from "../../renderer/geometry/meshlet/build/meshop
|
|
|
7
7
|
import { make_sunlight } from "../../renderer/light/make_sunlight.js";
|
|
8
8
|
import { place_light } from "../../renderer/light/place_light.js";
|
|
9
9
|
import { StandardShadeMaterial } from "../../renderer/material/StandardShadeMaterial.js";
|
|
10
|
+
import { ShadedGeometry } from "../../../engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
10
11
|
import { place_primitive, remove_primitive } from "../../renderer/scene/rows/place_primitive.js";
|
|
11
12
|
import { make_flat_environment } from "../skinned_blas_refit/flat_environment.js";
|
|
12
13
|
|
|
@@ -124,13 +125,14 @@ export function box_lid() {
|
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* @param {number[]} rgb linear
|
|
128
|
+
* @param {number} roughness
|
|
127
129
|
* @returns {StandardShadeMaterial}
|
|
128
130
|
*/
|
|
129
|
-
function
|
|
131
|
+
function dielectric(rgb, roughness) {
|
|
130
132
|
const material = new StandardShadeMaterial();
|
|
131
133
|
|
|
132
134
|
material.diffuse_color.copy(new Color(rgb[0], rgb[1], rgb[2]));
|
|
133
|
-
material.roughness_factor =
|
|
135
|
+
material.roughness_factor = roughness;
|
|
134
136
|
material.metallic_factor = 0;
|
|
135
137
|
|
|
136
138
|
return material;
|
|
@@ -151,12 +153,14 @@ function diffuse(rgb) {
|
|
|
151
153
|
* @param {number[]} [options.sky] linear radiance of the flat sky
|
|
152
154
|
* @param {BoxSunAim} [options.aim]
|
|
153
155
|
* @param {boolean} [options.open]
|
|
156
|
+
* @param {number} [options.roughness] every slab's, 1 the Cornell box's own
|
|
154
157
|
*/
|
|
155
158
|
export async function build_hole_box(scene, scene_context, {
|
|
156
159
|
sun_intensity = 7.2,
|
|
157
160
|
sky = [0.2, 0.25, 0.35],
|
|
158
161
|
aim = BoxSunAim.RedWall,
|
|
159
162
|
open = true,
|
|
163
|
+
roughness = 1,
|
|
160
164
|
} = {}) {
|
|
161
165
|
// meshlet geometry is built as it is made
|
|
162
166
|
await MeshoptClusterizer.ready;
|
|
@@ -176,13 +180,42 @@ export async function build_hole_box(scene, scene_context, {
|
|
|
176
180
|
return place_primitive(scene_context, geometry, material, transform, { name: slab.name });
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
/**
|
|
184
|
+
* A slab's material at a roughness, made once. A material's GPU side does not change after its upload, so a
|
|
185
|
+
* slab at another roughness draws with another material.
|
|
186
|
+
* @type {Map<string, StandardShadeMaterial>}
|
|
187
|
+
*/
|
|
188
|
+
const materials = new Map();
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @param {{name: string, colour: number[]}} slab
|
|
192
|
+
* @param {number} value
|
|
193
|
+
* @returns {StandardShadeMaterial}
|
|
194
|
+
*/
|
|
195
|
+
function material_of(slab, value) {
|
|
196
|
+
const key = `${slab.name}/${value}`;
|
|
197
|
+
|
|
198
|
+
let material = materials.get(key);
|
|
199
|
+
|
|
200
|
+
if (material === undefined) {
|
|
201
|
+
material = dielectric(slab.colour, value);
|
|
202
|
+
|
|
203
|
+
materials.set(key, material);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return material;
|
|
181
207
|
}
|
|
182
208
|
|
|
209
|
+
let current_roughness = roughness;
|
|
210
|
+
|
|
211
|
+
const slabs = box_slabs().map(slab => {
|
|
212
|
+
const geometry = new BoxGeometry(slab.size[0], slab.size[1], slab.size[2]);
|
|
213
|
+
|
|
214
|
+
return { slab, geometry, entity: place(slab, geometry, material_of(slab, current_roughness)) };
|
|
215
|
+
});
|
|
216
|
+
|
|
183
217
|
const lid = box_lid();
|
|
184
218
|
const lid_geometry = new BoxGeometry(lid.size[0], lid.size[1], lid.size[2]);
|
|
185
|
-
const lid_material = diffuse(lid.colour);
|
|
186
219
|
|
|
187
220
|
/**
|
|
188
221
|
* The lid's entity while it closes the hole, -1 while the hole is open.
|
|
@@ -243,7 +276,42 @@ export async function build_hole_box(scene, scene_context, {
|
|
|
243
276
|
remove_primitive(scene_context, lid_entity);
|
|
244
277
|
lid_entity = -1;
|
|
245
278
|
} else {
|
|
246
|
-
lid_entity = place(lid, lid_geometry,
|
|
279
|
+
lid_entity = place(lid, lid_geometry, material_of(lid, current_roughness));
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Every slab's roughness.
|
|
285
|
+
* @returns {number}
|
|
286
|
+
*/
|
|
287
|
+
get roughness() {
|
|
288
|
+
return current_roughness;
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Each slab keeps its entity and its geometry and draws with a material of the new roughness, so the
|
|
293
|
+
* distance field the rays march does not change.
|
|
294
|
+
*
|
|
295
|
+
* @param {number} v in [0, 1]
|
|
296
|
+
*/
|
|
297
|
+
set roughness(v) {
|
|
298
|
+
if (v === current_roughness) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
current_roughness = v;
|
|
303
|
+
|
|
304
|
+
const placed = slabs.map(s => [s.entity, s.slab, s.geometry]);
|
|
305
|
+
|
|
306
|
+
if (lid_entity !== -1) {
|
|
307
|
+
placed.push([lid_entity, lid, lid_geometry]);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
for (const [entity, slab, geometry] of placed) {
|
|
311
|
+
const material = material_of(slab, v);
|
|
312
|
+
|
|
313
|
+
scene.dataset.getComponent(entity, ShadedGeometry).material = material;
|
|
314
|
+
scene_context.rows.attach_mesh(entity, geometry, material);
|
|
247
315
|
}
|
|
248
316
|
},
|
|
249
317
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA6IA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;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OAMG;IACH,cAFU,iBAAiB,CAEU;IAErC;;;;;;OAMG;IACH,eAgBC;IAkED;;;;;;;;OAQG;IACH;QAJsC,OAAO;QACd,MAAM;QACT,UAAU,GAA3B,MAAM;sBAyNhB;IAED;;;;;;;;;;;;;;OAcG;IACH,0BAFW,eAAe,QAkEzB;IAiCD;;;;;;;;;;;;;;;;;OAiBG;IACH,WAFa,IAAI,CA0ChB;IAkCD,4BAoBC;IAkID;;;;;OAKG;IACH,UAHW,MAAM,KACN,MAAM,QAgBhB;IAoFD,0CAMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,eAZW,iBAAiB,SACjB,KAAK,uBACL,MAAM,GAIJ,OAAO,CAuCnB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,yBARW,iBAAiB,SACjB,KAAK,sBACL,MAAM,UACN,iBAAiB,GACf,OAAO,CAiBnB;;
|
|
1
|
+
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA6IA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;;OAEG;IACH,kBAAO;IAYP;;;OAGG;IACH,2BAEC;IAaD,wCAGC;IAED,uCAEC;IAED;;;;OAIG;IACH,wBAFU,yBAAyB,CAEoB;IAEvD;;;;;;;OAOG;IACH,mBAFU,gBAAgB,CAEgB;IAE1C;;;;OAIG;IACH,eAFU,oBAAoB,CAEa;IAY3C;;;;;;;OAOG;IACH,mBAFU,qBAAqB,CAEkB;IAEjD;;;;OAIG;IACH,aAFU,UAAU,CAER;IAEZ;;;OAGG;IACH,QAFU,cAAc,CAEM;IAE9B;;;;;;;;;OASG;IACH,2BAFU,OAAO,CAEiB;IAElC,6BAA4B;IAC5B,8BAA4B;IAC5B;;;;OAIG;IACH,mCAAkC;IAClC;;;;;;;OAOG;IACH,mCAFU,OAAO,CAEyB;IAW1C,oCAIC;IAED,mCAEC;IAYD,oCAI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AAiB,GACf,OAAO,CAiBnB;;CA+lCJ;+BA/3GY,OAAO,8CAA8C,EAAE,gBAAgB;gCACvE,OAAO,+CAA+C,EAAE,iBAAiB;gCACzE,OAAO,+BAA+B,EAAE,iBAAiB;8BACzD,OAAO,gCAAgC,EAAE,eAAe;gCACxD,OAAO,gDAAgD,EAAE,iBAAiB;8BAC1E,OAAO,4BAA4B,EAAE,eAAe;oBACpD,OAAO,kBAAkB,EAAE,KAAK;6BAnChB,yBAAyB;0CACZ,gCAAgC;iCACzC,yCAAyC;qCA9CrC,6DAA6D;sCA+C5D,4BAA4B;2BAvEvC,kCAAkC;+BAwE9B,6CAA6C;gCAC5C,sCAAsC;2BAhC3C,yCAAyC;6BAFvC,4CAA4C;8BAD3C,2CAA2C;4BAuD7C,uBAAuB;mCAChB,qCAAqC;gCAnExC,sBAAsB;oBAhDlC,4BAA4B;kCA+Gd,gCAAgC;2BAxFvC,2BAA2B;iCAsFrB,0CAA0C;4CAnE/B,+DAA+D;yBA6ClF,yBAAyB;kCAChB,kCAAkC;kCAUlC,wBAAwB;oBAnCtC,0BAA0B;gCAlDd,uCAAuC;uCAwChC,sDAAsD"}
|
|
@@ -2824,49 +2824,8 @@ export class Renderer {
|
|
|
2824
2824
|
|
|
2825
2825
|
const gr_shadowmap_atlas = graph_import_texture(graph, sm.texture);
|
|
2826
2826
|
|
|
2827
|
-
//
|
|
2828
|
-
//
|
|
2829
|
-
frame.phase = FramePhase.AfterGBuffer;
|
|
2830
|
-
|
|
2831
|
-
const record_gbuffer = frame.create(GBufferTextures);
|
|
2832
|
-
const record_view_textures = frame.create(ViewTextures);
|
|
2833
|
-
|
|
2834
|
-
record_gbuffer.albedo = gr_texture_material_albedo_ao;
|
|
2835
|
-
record_gbuffer.normal = gr_texture_normal;
|
|
2836
|
-
record_gbuffer.pbr = gr_texture_pbr;
|
|
2837
|
-
record_gbuffer.emissive = gr_texture_material_emissive;
|
|
2838
|
-
|
|
2839
|
-
record_view_textures.depth = gr_texture_depth_current;
|
|
2840
|
-
record_view_textures.depth_previous = gr_texture_depth_previous;
|
|
2841
|
-
record_view_textures.visibility = gr_visibility;
|
|
2842
|
-
record_view_textures.visible_meshlets = gr_visible_meshlets;
|
|
2843
|
-
|
|
2844
|
-
this.#extensions.run(frame);
|
|
2845
|
-
|
|
2846
|
-
/*
|
|
2847
|
-
`GBufferTextures` is in/out at this phase, and frozen after it. An extension that wants to
|
|
2848
|
-
*change* surface properties — decals are the reason this exists — cannot blend into these
|
|
2849
|
-
targets: two of the four are integer formats, and one texture cannot be a render attachment
|
|
2850
|
-
and a sampled source in the same pass. So it reads a copy — of the targets, or of the part
|
|
2851
|
-
it changes — and writes, and publishes the handles it wrote. Everything downstream carries
|
|
2852
|
-
what it left.
|
|
2853
|
-
|
|
2854
|
-
Publishing is what makes it a contract. A written handle is a *renamed* clone of the same
|
|
2855
|
-
physical resource, so a change written in place and not published would land in the
|
|
2856
|
-
texture the shading pass reads only because the graph happens to execute in insertion
|
|
2857
|
-
order, with no dependency edge saying so. Threading the handles makes the edge real,
|
|
2858
|
-
whether they name replacements or the originals written through `write`.
|
|
2859
|
-
*/
|
|
2860
|
-
gr_texture_pbr = record_gbuffer.pbr;
|
|
2861
|
-
gr_texture_normal = record_gbuffer.normal;
|
|
2862
|
-
gr_texture_material_albedo_ao = record_gbuffer.albedo;
|
|
2863
|
-
gr_texture_material_emissive = record_gbuffer.emissive;
|
|
2864
|
-
|
|
2865
|
-
gr_texture_depth_current = record_view_textures.depth;
|
|
2866
|
-
gr_texture_depth_previous = record_view_textures.depth_previous;
|
|
2867
|
-
gr_visibility = record_view_textures.visibility;
|
|
2868
|
-
gr_visible_meshlets = record_view_textures.visible_meshlets;
|
|
2869
|
-
|
|
2827
|
+
// Ahead of the phase below, from the scene's own depth and visibility: an extension that draws
|
|
2828
|
+
// surfaces the visibility buffer cannot describe writes their motion over this.
|
|
2870
2829
|
// Velocity pass with three branches: rotation-reprojection
|
|
2871
2830
|
// background, rigid per-object foreground (mesh.global delta),
|
|
2872
2831
|
// and skinned per-vertex foreground (barycentric interpolation
|
|
@@ -2924,6 +2883,51 @@ export class Renderer {
|
|
|
2924
2883
|
view: view_ctx,
|
|
2925
2884
|
});
|
|
2926
2885
|
|
|
2886
|
+
// The frame's surface handles exist now, so this is where the records that carry them are
|
|
2887
|
+
// published. There is no colour yet, which is what makes this the phase for G-buffer work.
|
|
2888
|
+
frame.phase = FramePhase.AfterGBuffer;
|
|
2889
|
+
|
|
2890
|
+
const record_gbuffer = frame.create(GBufferTextures);
|
|
2891
|
+
const record_view_textures = frame.create(ViewTextures);
|
|
2892
|
+
|
|
2893
|
+
record_gbuffer.albedo = gr_texture_material_albedo_ao;
|
|
2894
|
+
record_gbuffer.normal = gr_texture_normal;
|
|
2895
|
+
record_gbuffer.pbr = gr_texture_pbr;
|
|
2896
|
+
record_gbuffer.emissive = gr_texture_material_emissive;
|
|
2897
|
+
|
|
2898
|
+
record_view_textures.depth = gr_texture_depth_current;
|
|
2899
|
+
record_view_textures.depth_previous = gr_texture_depth_previous;
|
|
2900
|
+
record_view_textures.visibility = gr_visibility;
|
|
2901
|
+
record_view_textures.visible_meshlets = gr_visible_meshlets;
|
|
2902
|
+
record_view_textures.velocity = gr_velocity;
|
|
2903
|
+
|
|
2904
|
+
this.#extensions.run(frame);
|
|
2905
|
+
|
|
2906
|
+
/*
|
|
2907
|
+
`GBufferTextures` is in/out at this phase, and frozen after it. An extension that wants to
|
|
2908
|
+
*change* surface properties — decals are the reason this exists — cannot blend into these
|
|
2909
|
+
targets: two of the four are integer formats, and one texture cannot be a render attachment
|
|
2910
|
+
and a sampled source in the same pass. So it reads a copy — of the targets, or of the part
|
|
2911
|
+
it changes — and writes, and publishes the handles it wrote. Everything downstream carries
|
|
2912
|
+
what it left.
|
|
2913
|
+
|
|
2914
|
+
Publishing is what makes it a contract. A written handle is a *renamed* clone of the same
|
|
2915
|
+
physical resource, so a change written in place and not published would land in the
|
|
2916
|
+
texture the shading pass reads only because the graph happens to execute in insertion
|
|
2917
|
+
order, with no dependency edge saying so. Threading the handles makes the edge real,
|
|
2918
|
+
whether they name replacements or the originals written through `write`.
|
|
2919
|
+
*/
|
|
2920
|
+
gr_texture_pbr = record_gbuffer.pbr;
|
|
2921
|
+
gr_texture_normal = record_gbuffer.normal;
|
|
2922
|
+
gr_texture_material_albedo_ao = record_gbuffer.albedo;
|
|
2923
|
+
gr_texture_material_emissive = record_gbuffer.emissive;
|
|
2924
|
+
|
|
2925
|
+
gr_texture_depth_current = record_view_textures.depth;
|
|
2926
|
+
gr_texture_depth_previous = record_view_textures.depth_previous;
|
|
2927
|
+
gr_visibility = record_view_textures.visibility;
|
|
2928
|
+
gr_visible_meshlets = record_view_textures.visible_meshlets;
|
|
2929
|
+
gr_velocity = record_view_textures.velocity;
|
|
2930
|
+
|
|
2927
2931
|
// rg8unorm: r is the history confidence, g records which texel won the nearest-depth search,
|
|
2928
2932
|
// so the TAA resolve can reproject with exactly the velocity this pass validated.
|
|
2929
2933
|
let [gr_occlusion_clip] = graph_image_pass({
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What the frame knows about where each pixel came from: this frame's depth, last frame's depth,
|
|
3
|
-
* the visibility buffer,
|
|
3
|
+
* the visibility buffer, the visible-meshlet table that resolves it, and how far each pixel moved.
|
|
4
4
|
*
|
|
5
5
|
* Carried from {@link FramePhase.AfterGBuffer} through {@link FramePhase.BeforePresent}, and
|
|
6
6
|
* writable wherever it is carried — an extension that rasterizes geometry which should own depth
|
|
7
7
|
* publishes a replacement here, the same way any other record is published into.
|
|
8
|
-
*
|
|
9
|
-
* `velocity` is deliberately absent: it is one of the frame's optional products, and products are
|
|
10
|
-
* their own delivery step. A field nothing may legally read yet would be a promise with no
|
|
11
|
-
* mechanism behind it.
|
|
12
8
|
*/
|
|
13
9
|
export class ViewTextures extends FrameRecord {
|
|
14
10
|
static is_present_at(phase: any): boolean;
|
|
@@ -43,6 +39,17 @@ export class ViewTextures extends FrameRecord {
|
|
|
43
39
|
* @returns {number}
|
|
44
40
|
*/
|
|
45
41
|
get visible_meshlets(): number;
|
|
42
|
+
set velocity(handle: number);
|
|
43
|
+
/**
|
|
44
|
+
* How far each pixel's surface moved on screen since the last frame: `rg16float`, in pixels, this
|
|
45
|
+
* frame's place less last frame's, free of the sub-pixel jitter. The renderer fills it from depth and
|
|
46
|
+
* {@link visibility} before {@link FramePhase.AfterGBuffer}; an extension that draws surfaces the
|
|
47
|
+
* visibility buffer cannot describe writes their pixels' motion over it at that phase and publishes
|
|
48
|
+
* the handle it wrote. What is published later than that phase reaches nothing the renderer runs.
|
|
49
|
+
*
|
|
50
|
+
* @returns {number}
|
|
51
|
+
*/
|
|
52
|
+
get velocity(): number;
|
|
46
53
|
#private;
|
|
47
54
|
}
|
|
48
55
|
import { FrameRecord } from "./FrameRecord.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTextures.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/ViewTextures.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"ViewTextures.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/ViewTextures.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH;IAOI,0CAKC;IASD,0BAEC;IATD;;OAEG;IACH,oBAEC;IAgBD,mCAEC;IAZD;;;;;OAKG;IACH,6BAEC;IAiBD,+BAEC;IAbD;;;;;;OAMG;IACH,yBAEC;IAiBD,qCAEC;IAbD;;;;;;OAMG;IACH,+BAEC;IAmBD,6BAEC;IAfD;;;;;;;;OAQG;IACH,uBAEC;;CAKJ;4BA/F2B,kBAAkB"}
|