@woosh/meep-engine 3.68.0 → 3.69.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 +45 -0
- package/editor/ecs/component/editors/ecs/Trail3DEditor.d.ts +2 -17
- package/editor/ecs/component/editors/ecs/Trail3DEditor.d.ts.map +1 -1
- package/editor/ecs/component/editors/ecs/Trail3DEditor.js +3 -18
- package/package.json +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +33 -65
- package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/Trail3D.js +37 -245
- package/src/engine/graphics/ecs/trail3d/Trail3DFlags.d.ts +0 -4
- package/src/engine/graphics/ecs/trail3d/Trail3DFlags.js +4 -10
- package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.d.ts +13 -10
- package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail3d/seed_trail_stroke.js +28 -37
- package/src/engine/graphics/ecs/trail3d/trail_knot_count.d.ts +10 -0
- package/src/engine/graphics/ecs/trail3d/trail_knot_count.d.ts.map +1 -0
- package/src/engine/graphics/ecs/trail3d/trail_knot_count.js +27 -0
- package/src/engine/graphics/trail/TrailKnots.d.ts +62 -0
- package/src/engine/graphics/trail/TrailKnots.d.ts.map +1 -0
- package/src/engine/graphics/trail/TrailKnots.js +137 -0
- package/src/engine/graphics/trail/tube/TubeXMaterialSpec.d.ts +1 -1
- package/src/engine/graphics/trail/tube/TubeXMaterialSpec.js +1 -1
- package/src/engine/graphics3/EntityRowHold.d.ts +48 -0
- package/src/engine/graphics3/EntityRowHold.d.ts.map +1 -0
- package/src/engine/graphics3/EntityRowHold.js +128 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -2
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +11 -44
- package/src/engine/graphics3/Trail3DSystem.d.ts +69 -35
- package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -1
- package/src/engine/graphics3/Trail3DSystem.js +380 -81
- package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts +17 -0
- package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacle.js +22 -2
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +6 -5
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.js +14 -3
- package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.d.ts +9 -1
- package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/FLUID_OBSTACLE_RECORD_STRUCT.js +11 -1
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.d.ts +5 -0
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_record_create.js +2 -0
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.d.ts +4 -3
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/fluid_obstacle_write_gpu_record.js +11 -3
- package/src/shade/playground/trails/index.html +50 -0
- package/src/shade/playground/trails/main.d.ts +2 -0
- package/src/shade/playground/trails/main.d.ts.map +1 -0
- package/src/shade/playground/trails/main.js +258 -0
- package/src/shade/renderer/animation/animation_curve_write_keys.d.ts +18 -0
- package/src/shade/renderer/animation/animation_curve_write_keys.d.ts.map +1 -0
- package/src/shade/renderer/animation/animation_curve_write_keys.js +34 -0
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +13 -36
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +2 -2
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts +2 -13
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js +6 -21
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts +17 -6
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.js +38 -178
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts +7 -9
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.js +17 -106
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts +7 -17
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js +18 -118
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING.d.ts +14 -0
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING.js +18 -0
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.d.ts +3 -1
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.js +4 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +9 -0
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +20 -4
- package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.d.ts +11 -2
- package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.js +59 -2
- package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.d.ts +4 -1
- package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/shader_fluid_forcing_apply.js +367 -341
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts +6 -2
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.js +339 -282
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +3 -2
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -1
- package/src/shade/renderer/grass/press/shader_grass_press_mark.js +5 -3
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts +49 -0
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.js +144 -0
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.d.ts +71 -0
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_splat.js +152 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.d.ts +21 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_unlit_varyings.js +30 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.d.ts +101 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_avboit_unlit.js +306 -0
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts +9 -0
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +11 -4
- package/src/shade/renderer/trails/GPUTrailAVBOITChannel.d.ts +69 -0
- package/src/shade/renderer/trails/GPUTrailAVBOITChannel.d.ts.map +1 -0
- package/src/shade/renderer/trails/GPUTrailAVBOITChannel.js +129 -0
- package/src/shade/renderer/trails/GPUTrailSystem.d.ts +164 -0
- package/src/shade/renderer/trails/GPUTrailSystem.d.ts.map +1 -0
- package/src/shade/renderer/trails/GPUTrailSystem.js +725 -0
- package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.d.ts +14 -0
- package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.d.ts.map +1 -0
- package/src/shade/renderer/trails/data/TRAIL_DATABASE_SPEC.js +38 -0
- package/src/shade/renderer/trails/data/TRAIL_KNOT.d.ts +66 -0
- package/src/shade/renderer/trails/data/TRAIL_KNOT.d.ts.map +1 -0
- package/src/shade/renderer/trails/data/TRAIL_KNOT.js +154 -0
- package/src/shade/renderer/trails/data/TRAIL_RECORD.d.ts +19 -0
- package/src/shade/renderer/trails/data/TRAIL_RECORD.d.ts.map +1 -0
- package/src/shade/renderer/trails/data/TRAIL_RECORD.js +68 -0
- package/src/shade/renderer/trails/data/TRAIL_STATE.d.ts +18 -0
- package/src/shade/renderer/trails/data/TRAIL_STATE.d.ts.map +1 -0
- package/src/shade/renderer/trails/data/TRAIL_STATE.js +43 -0
- package/src/shade/renderer/trails/graph_trails.d.ts +58 -0
- package/src/shade/renderer/trails/graph_trails.d.ts.map +1 -0
- package/src/shade/renderer/trails/graph_trails.js +155 -0
- package/src/shade/renderer/trails/graph_trails_avboit.d.ts +126 -0
- package/src/shade/renderer/trails/graph_trails_avboit.d.ts.map +1 -0
- package/src/shade/renderer/trails/graph_trails_avboit.js +300 -0
- package/src/shade/renderer/trails/runtime/TrailFadeCurves.d.ts +56 -0
- package/src/shade/renderer/trails/runtime/TrailFadeCurves.d.ts.map +1 -0
- package/src/shade/renderer/trails/runtime/TrailFadeCurves.js +220 -0
- package/src/shade/renderer/trails/runtime/TrailKnotPool.d.ts +49 -0
- package/src/shade/renderer/trails/runtime/TrailKnotPool.d.ts.map +1 -0
- package/src/shade/renderer/trails/runtime/TrailKnotPool.js +162 -0
- package/src/shade/renderer/trails/runtime/TrailParameters.d.ts +52 -0
- package/src/shade/renderer/trails/runtime/TrailParameters.d.ts.map +1 -0
- package/src/shade/renderer/trails/runtime/TrailParameters.js +126 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.d.ts +23 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_frame_transport.js +57 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.d.ts +14 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_knot_alpha.js +40 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_seed.d.ts +18 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_seed.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_seed.js +64 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_segment.d.ts +14 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_segment.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_segment.js +51 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_update.d.ts +48 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_update.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_update.js +197 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_vertex.d.ts +34 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_vertex.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/chunk_trail_vertex.js +111 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit.d.ts +24 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit.js +78 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.d.ts +23 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/shader_trail_avboit_segments.js +130 -0
- package/src/shade/renderer/trails/shaders/shader_trail_draw_args.d.ts +29 -0
- package/src/shade/renderer/trails/shaders/shader_trail_draw_args.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/shader_trail_draw_args.js +78 -0
- package/src/shade/renderer/trails/shaders/shader_trail_seed.d.ts +18 -0
- package/src/shade/renderer/trails/shaders/shader_trail_seed.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/shader_trail_seed.js +79 -0
- package/src/shade/renderer/trails/shaders/shader_trail_update.d.ts +20 -0
- package/src/shade/renderer/trails/shaders/shader_trail_update.d.ts.map +1 -0
- package/src/shade/renderer/trails/shaders/shader_trail_update.js +101 -0
- package/src/engine/graphics/ecs/trail3d/advance_trail.d.ts +0 -18
- package/src/engine/graphics/ecs/trail3d/advance_trail.d.ts.map +0 -1
- package/src/engine/graphics/ecs/trail3d/advance_trail.js +0 -42
- package/src/engine/graphics/ecs/trail3d/seed_trail_tube.d.ts +0 -14
- package/src/engine/graphics/ecs/trail3d/seed_trail_tube.d.ts.map +0 -1
- package/src/engine/graphics/ecs/trail3d/seed_trail_tube.js +0 -75
- package/src/engine/graphics/ecs/trail3d/trail_head_position.d.ts +0 -17
- package/src/engine/graphics/ecs/trail3d/trail_head_position.d.ts.map +0 -1
- package/src/engine/graphics/ecs/trail3d/trail_head_position.js +0 -19
- package/src/engine/graphics/trail/tube/TubeX.d.ts +0 -186
- package/src/engine/graphics/trail/tube/TubeX.d.ts.map +0 -1
- package/src/engine/graphics/trail/tube/TubeX.js +0 -575
- package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.d.ts +0 -16
- package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.d.ts.map +0 -1
- package/src/engine/graphics/trail/tube/simulator/TubeXFixedPhysicsSimulator.js +0 -34
- package/src/engine/graphics/trail/tube/tube_attributes_spec.d.ts +0 -27
- package/src/engine/graphics/trail/tube/tube_attributes_spec.d.ts.map +0 -1
- package/src/engine/graphics/trail/tube/tube_attributes_spec.js +0 -70
- package/src/engine/graphics3/trail/trail_tube_write_geometry.d.ts +0 -38
- package/src/engine/graphics3/trail/trail_tube_write_geometry.d.ts.map +0 -1
- package/src/engine/graphics3/trail/trail_tube_write_geometry.js +0 -119
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
3
|
-
import { chunk_sample_volumetrics } from "../deferred/chunk_sample_volumetrics.js";
|
|
4
|
-
import { AVBOIT_EXTINCT_TRANSMITTANCE } from "../rasterize/native/avboit/AVBOIT_CONSTANTS.js";
|
|
5
|
-
import { AVBOIT_WARP_STRUCT } from "../rasterize/native/avboit/AVBOIT_WARP_STRUCT.js";
|
|
6
|
-
import { AVBOIT_DRAW_TARGETS } from "../rasterize/native/avboit/avboit_draw_fragment_body.js";
|
|
7
|
-
import {
|
|
8
|
-
chunk_avboit_premultiplied_contribution
|
|
9
|
-
} from "../rasterize/native/avboit/chunk_avboit_premultiplied_contribution.js";
|
|
10
|
-
import { chunk_avboit_view_depth_to_virtual } from "../rasterize/native/avboit/chunk_avboit_view_depth_to_virtual.js";
|
|
11
|
-
import { chunk_avboit_footprint_bias } from "../rasterize/native/avboit/chunk_avboit_footprint_bias.js";
|
|
12
|
-
import { chunk_avboit_sample_transmittance } from "../rasterize/native/avboit/chunk_avboit_sample_transmittance.js";
|
|
1
|
+
import { avboit_unlit_draw_pipeline, AVBOIT_UNLIT_DRAW_PASS_GROUP, chunk_avboit_unlit_draw_fragment } from "../rasterize/native/avboit/avboit_unlit_draw.js";
|
|
13
2
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
14
3
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
15
4
|
import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
|
|
16
|
-
import { SAMPLER_LINEAR_UPSCALE } from "../texture/SAMPLER_LINEAR_UPSCALE.js";
|
|
17
|
-
import { VIEW_UNIFORM_STRUCT } from "../view/VIEW_UNIFORM_STRUCT.js";
|
|
18
|
-
import { VOLUMETRICS_METADATA_STRUCT } from "../volumetrics/VOLUMETRICS_METADATA_STRUCT.js";
|
|
19
5
|
import { chunk_dynamic_mesh_avboit_vertex } from "./chunk_dynamic_mesh_avboit_vertex.js";
|
|
20
6
|
import {
|
|
21
7
|
DYNAMIC_MESH_BIND_GROUP_DRAWS,
|
|
@@ -24,126 +10,51 @@ import {
|
|
|
24
10
|
} from "./shader_dynamic_mesh.js";
|
|
25
11
|
|
|
26
12
|
/**
|
|
27
|
-
* Bind group of everything the draw reads once per pass — the view,
|
|
28
|
-
* fog. Groups 0 and 1 are the dynamic-mesh groups: the draw constants
|
|
29
|
-
* mesh.
|
|
13
|
+
* Bind group of everything the draw reads once per pass (`AVBOIT_UNLIT_DRAW_PASS_GROUP`) — the view,
|
|
14
|
+
* the warp, the integral and the fog. Groups 0 and 1 are the dynamic-mesh groups: the draw constants
|
|
15
|
+
* per chunk, the geometry per mesh.
|
|
30
16
|
* @type {number}
|
|
31
17
|
*/
|
|
32
18
|
export const DYNAMIC_MESH_AVBOIT_DRAW_BIND_GROUP_PASS = 2;
|
|
33
19
|
|
|
34
20
|
/**
|
|
35
|
-
* The dynamic meshes' AVBOIT draw: every mesh's triangles at internal resolution
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* Per fragment: nothing at all if it has faded out (the splat recorded nothing for it either), then
|
|
40
|
-
* the transmittance of everything in front from the integral texture — a fragment the volume
|
|
41
|
-
* already calls extinct is discarded unshaded — the volumetric fog at its depth, and the
|
|
42
|
-
* accumulators through `avboit_premultiplied_contribution`, the routing every side channel shares.
|
|
43
|
-
*
|
|
44
|
-
* A dynamic mesh is straight alpha and unlit, as the pass over the scene draws it: its colour is
|
|
45
|
-
* premultiplied here and never emits — a fragment that can get past the first test covers
|
|
46
|
-
* something — so the pipeline does not write the emission target at all rather than blend zeros
|
|
47
|
-
* into it over every covered pixel.
|
|
21
|
+
* The dynamic meshes' AVBOIT draw: every mesh's triangles at internal resolution by the dynamic-mesh
|
|
22
|
+
* vertex stage, into the unlit draw's fragment stage (`chunk_avboit_unlit_draw_fragment`, which says
|
|
23
|
+
* what a fragment contributes). A dynamic mesh is straight alpha and unlit, as the pass over the scene
|
|
24
|
+
* draws it.
|
|
48
25
|
*/
|
|
49
26
|
|
|
50
27
|
const resources = new ShaderResourceSetDescriptor();
|
|
51
28
|
|
|
52
29
|
resources.addGroup(DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_DRAWS]);
|
|
53
30
|
resources.addGroup(DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_GEOMETRY]);
|
|
54
|
-
|
|
55
|
-
resources.createGroup()
|
|
56
|
-
.addUniform("view", VIEW_UNIFORM_STRUCT)
|
|
57
|
-
.addStorageBuffer("warp", AVBOIT_WARP_STRUCT)
|
|
58
|
-
// sampled through sLinear: linear, clamped on every axis, which is what the integral needs
|
|
59
|
-
.addTexture("tIntegral", "float", "3d")
|
|
60
|
-
.addSampler("sLinear", "filtering", SAMPLER_LINEAR_UPSCALE)
|
|
61
|
-
// volumetrics (composited inline)
|
|
62
|
-
.addUniform("volumetrics_metadata", VOLUMETRICS_METADATA_STRUCT)
|
|
63
|
-
.addTexture("tVolumetrics", "float", "3d")
|
|
64
|
-
.addTexture("tSTBN_vec3", "float", "3d");
|
|
31
|
+
resources.addGroup(AVBOIT_UNLIT_DRAW_PASS_GROUP);
|
|
65
32
|
|
|
66
33
|
const body = CodeChunk.from(
|
|
67
34
|
//language=WGSL
|
|
68
35
|
`
|
|
69
|
-
struct DynamicMeshAVBOITDrawOutput {
|
|
70
|
-
@location(0) color : vec4<f32>,
|
|
71
|
-
@location(1) norm : vec4<f32>,
|
|
72
|
-
@location(2) extinction : vec4<f32>,
|
|
73
|
-
@location(3) emission : vec4<f32>,
|
|
74
|
-
}
|
|
75
|
-
|
|
76
36
|
@vertex
|
|
77
|
-
fn vs_main(@builtin(vertex_index) vi : u32, @builtin(instance_index) draw_index : u32) ->
|
|
37
|
+
fn vs_main(@builtin(vertex_index) vi : u32, @builtin(instance_index) draw_index : u32) -> AVBOITUnlitVaryings {
|
|
78
38
|
return dynamic_mesh_avboit_vertex(vi, draw_index);
|
|
79
39
|
}
|
|
80
|
-
|
|
81
|
-
@fragment
|
|
82
|
-
fn fs_main(in : DynamicMeshAVBOITVertexOut) -> DynamicMeshAVBOITDrawOutput {
|
|
83
|
-
// a ribbon seen at an angle runs through depth across a voxel; see avboit_footprint_bias. Taken
|
|
84
|
-
// first, in uniform control flow
|
|
85
|
-
let footprint = avboit_footprint_bias(&warp, fwidth(avboit_view_depth_to_virtual(&warp, in.view_depth)));
|
|
86
|
-
|
|
87
|
-
if (in.color.a <= 0.0) {
|
|
88
|
-
// faded out: covers nothing, and straight alpha carries no light without coverage
|
|
89
|
-
discard;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let screen_uv = in.clip.xy / vec2<f32>(f32(view.width), f32(view.height));
|
|
93
|
-
|
|
94
|
-
let transmittance = avboit_sample_transmittance(&warp, tIntegral, sLinear, screen_uv, in.view_depth, footprint);
|
|
95
|
-
|
|
96
|
-
if (all(transmittance <= vec3<f32>(${AVBOIT_EXTINCT_TRANSMITTANCE}))) {
|
|
97
|
-
// nothing this fragment contributes survives what is in front of it; skip the shading
|
|
98
|
-
discard;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
let volumetrics = sample_volumetrics(in.view_depth, screen_uv, in.clip.xy);
|
|
102
|
-
|
|
103
|
-
let premultiplied = vec4<f32>(in.color.rgb * in.color.a, in.color.a);
|
|
104
|
-
|
|
105
|
-
let contribution = avboit_premultiplied_contribution(premultiplied, transmittance, volumetrics);
|
|
106
|
-
|
|
107
|
-
var out : DynamicMeshAVBOITDrawOutput;
|
|
108
|
-
|
|
109
|
-
out.color = contribution.color;
|
|
110
|
-
out.norm = contribution.norm;
|
|
111
|
-
out.extinction = contribution.extinction;
|
|
112
|
-
out.emission = contribution.emission;
|
|
113
|
-
|
|
114
|
-
return out;
|
|
115
|
-
}
|
|
116
40
|
`, [
|
|
117
41
|
chunk_dynamic_mesh_avboit_vertex,
|
|
118
|
-
|
|
119
|
-
chunk_avboit_footprint_bias,
|
|
120
|
-
chunk_avboit_sample_transmittance,
|
|
121
|
-
chunk_sample_volumetrics,
|
|
122
|
-
chunk_avboit_premultiplied_contribution,
|
|
42
|
+
chunk_avboit_unlit_draw_fragment,
|
|
123
43
|
]);
|
|
124
44
|
|
|
125
45
|
const descriptor = ShaderDescriptor.from({ label: "Dynamic Mesh AVBOIT Draw", body, resources });
|
|
126
46
|
|
|
127
47
|
/**
|
|
128
|
-
* The draw pipeline
|
|
129
|
-
*
|
|
130
|
-
* @type {RenderPipelineDescriptor}
|
|
48
|
+
* The draw pipeline, as every unlit draw is built (`avboit_unlit_draw_pipeline`).
|
|
49
|
+
* @type {import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor}
|
|
131
50
|
*/
|
|
132
|
-
export const DYNAMIC_MESH_AVBOIT_DRAW_PIPELINE =
|
|
51
|
+
export const DYNAMIC_MESH_AVBOIT_DRAW_PIPELINE = avboit_unlit_draw_pipeline({
|
|
133
52
|
label: "Dynamic Mesh AVBOIT Draw",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
fragment: {
|
|
137
|
-
module: { code: descriptor.source },
|
|
138
|
-
entryPoint: "fs_main",
|
|
139
|
-
// color, norm, extinction — and not emission
|
|
140
|
-
targets: AVBOIT_DRAW_TARGETS.map((target, i) => ({ ...target, writeMask: [0xF, 0xF, 0xF, 0][i] })),
|
|
141
|
-
},
|
|
142
|
-
depthStencil: DepthStencilState.from({ format: "depth32float", depthWriteEnabled: false, depthCompare: "greater" }),
|
|
143
|
-
primitive: { topology: "triangle-list", cullMode: "none" },
|
|
53
|
+
resources,
|
|
54
|
+
source: descriptor.source,
|
|
144
55
|
});
|
|
145
56
|
|
|
146
|
-
/** The draw shader's resource set
|
|
57
|
+
/** The draw shader's resource set. */
|
|
147
58
|
export const DYNAMIC_MESH_AVBOIT_DRAW_RESOURCES = resources;
|
|
148
59
|
|
|
149
60
|
/** The assembled shader, for the validity tier. */
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bind group of the warp, set once per pass. Groups 0 and 1 are the
|
|
3
|
-
* constants per chunk, the geometry per mesh.
|
|
2
|
+
* Bind group of the warp (`AVBOIT_UNLIT_SPLAT_PASS_GROUP`), set once per pass. Groups 0 and 1 are the
|
|
3
|
+
* dynamic-mesh groups: the draw constants per chunk, the geometry per mesh.
|
|
4
4
|
* @type {number}
|
|
5
5
|
*/
|
|
6
6
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_PASS: number;
|
|
7
7
|
/**
|
|
8
|
-
* Bind group of the volume atomics, set once per pass.
|
|
8
|
+
* Bind group of the volume atomics (`AVBOIT_SPLAT_VOLUME_GROUP`), set once per pass.
|
|
9
9
|
* @type {number}
|
|
10
10
|
*/
|
|
11
11
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_VOLUME: number;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @type {number}
|
|
16
|
-
*/
|
|
17
|
-
export const DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES: number;
|
|
18
|
-
/**
|
|
19
|
-
* The splat pipeline: no depth, one never-written attachment to size the raster, multisampled so a
|
|
20
|
-
* fragment knows how much of its voxel it covers, both faces — a trail is seen from inside and out.
|
|
21
|
-
* The attachment is the splat's own ({@link DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES} samples), not the
|
|
22
|
-
* volume's single-sampled one the meshlet and particle splats share.
|
|
23
|
-
* @type {RenderPipelineDescriptor}
|
|
13
|
+
* The splat pipeline, as every unlit splat is built (`avboit_unlit_splat_pipeline`).
|
|
14
|
+
* @type {import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor}
|
|
24
15
|
*/
|
|
25
|
-
export const DYNAMIC_MESH_AVBOIT_SPLAT_PIPELINE: RenderPipelineDescriptor;
|
|
26
|
-
/** The splat shader's resource set
|
|
16
|
+
export const DYNAMIC_MESH_AVBOIT_SPLAT_PIPELINE: import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor;
|
|
17
|
+
/** The splat shader's resource set. */
|
|
27
18
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_RESOURCES: ShaderResourceSetDescriptor;
|
|
28
19
|
/** The assembled shader, for the validity tier. */
|
|
29
20
|
export const shader_dynamic_mesh_avboit_splat: ShaderDescriptor;
|
|
30
|
-
import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
31
21
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
32
22
|
import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
|
|
33
23
|
//# sourceMappingURL=shader_dynamic_mesh_avboit_splat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_dynamic_mesh_avboit_splat.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_dynamic_mesh_avboit_splat.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wDAFU,MAAM,CAE2C;AAE3D;;;GAGG;AACH,0DAFU,MAAM,CAE6C;AAiC7D;;;GAGG;AACH,iDAFU,OAAO,8DAA8D,EAAE,wBAAwB,CAMtG;AAEH,uCAAuC;AACvC,8EAA6D;AAE7D,mDAAmD;AACnD,gEAA2D;4CAnEf,mDAAmD;iCAC9D,+BAA+B"}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AVBOIT_WARP_STRUCT } from "../rasterize/native/avboit/AVBOIT_WARP_STRUCT.js";
|
|
4
|
-
import { chunk_avboit_coverage } from "../rasterize/native/avboit/chunk_avboit_coverage.js";
|
|
5
|
-
import { chunk_avboit_splat_slice } from "../rasterize/native/avboit/chunk_avboit_splat_slice.js";
|
|
6
|
-
import {
|
|
7
|
-
chunk_avboit_transmittance_to_extinction
|
|
8
|
-
} from "../rasterize/native/avboit/chunk_avboit_transmittance_to_extinction.js";
|
|
9
|
-
import { chunk_avboit_view_depth_to_physical } from "../rasterize/native/avboit/chunk_avboit_view_depth_to_physical.js";
|
|
10
|
-
import { AVBOIT_SPLAT_DUMMY_FORMAT } from "../rasterize/native/avboit/shader_avboit_splat.js";
|
|
1
|
+
import { avboit_unlit_splat_pipeline, AVBOIT_UNLIT_SPLAT_PASS_GROUP, chunk_avboit_unlit_splat_fragment } from "../rasterize/native/avboit/avboit_unlit_splat.js";
|
|
2
|
+
import { AVBOIT_SPLAT_VOLUME_GROUP } from "../rasterize/native/avboit/shader_avboit_splat.js";
|
|
11
3
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
12
4
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
13
5
|
import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
|
|
14
|
-
import { atomic_u32 } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
15
|
-
import { WebGPUArray } from "../shader/type/WebGPUArray.js";
|
|
16
6
|
import { chunk_dynamic_mesh_avboit_vertex } from "./chunk_dynamic_mesh_avboit_vertex.js";
|
|
17
7
|
import {
|
|
18
8
|
DYNAMIC_MESH_BIND_GROUP_DRAWS,
|
|
@@ -21,53 +11,22 @@ import {
|
|
|
21
11
|
} from "./shader_dynamic_mesh.js";
|
|
22
12
|
|
|
23
13
|
/**
|
|
24
|
-
* Bind group of the warp, set once per pass. Groups 0 and 1 are the
|
|
25
|
-
* constants per chunk, the geometry per mesh.
|
|
14
|
+
* Bind group of the warp (`AVBOIT_UNLIT_SPLAT_PASS_GROUP`), set once per pass. Groups 0 and 1 are the
|
|
15
|
+
* dynamic-mesh groups: the draw constants per chunk, the geometry per mesh.
|
|
26
16
|
* @type {number}
|
|
27
17
|
*/
|
|
28
18
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_PASS = 2;
|
|
29
19
|
|
|
30
20
|
/**
|
|
31
|
-
* Bind group of the volume atomics, set once per pass.
|
|
21
|
+
* Bind group of the volume atomics (`AVBOIT_SPLAT_VOLUME_GROUP`), set once per pass.
|
|
32
22
|
* @type {number}
|
|
33
23
|
*/
|
|
34
24
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_VOLUME = 3;
|
|
35
25
|
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
export const DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES = 4;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The dynamic meshes' AVBOIT splat: every mesh's triangles rasterized at the volume's resolution,
|
|
45
|
-
* each fragment's extinction added into the voxel volume through `avboit_splat_slice` — the same
|
|
46
|
-
* write path as the meshlet and particle splats, so a trail, a particle and a surface at one depth
|
|
47
|
-
* pile up in one field.
|
|
48
|
-
*
|
|
49
|
-
* Coverage is the vertex colour's alpha times the mesh's, through `avboit_coverage` — the function
|
|
50
|
-
* the draw weights the same fragment by — and `T_self = 1 - coverage`, untinted. A fragment that
|
|
51
|
-
* has faded to nothing covers nothing and writes nothing, which on a trail is its whole aged-out
|
|
52
|
-
* tail.
|
|
53
|
-
*
|
|
54
|
-
* **Weighted by the share of the voxel the triangle covers.** A voxel is eight pixels across, and a
|
|
55
|
-
* trail is often narrower than that. Sampled at the voxel's centre alone, a thin trail either
|
|
56
|
-
* crosses the centre and writes its full extinction there or misses it and writes nothing, so its
|
|
57
|
-
* occlusion of what lies behind it came and went as it moved by a fraction of a voxel — beaded along
|
|
58
|
-
* a curve, flickering in motion. Here the raster has {@link DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES}
|
|
59
|
-
* samples per pixel, the fragment runs wherever any of them is covered, and its extinction is scaled
|
|
60
|
-
* by the covered fraction: the voxel gets the triangle's extinction averaged over its footprint, as
|
|
61
|
-
* a volume that coarse can hold it. The triangles of one mesh cover disjoint samples, so the
|
|
62
|
-
* fractions of the triangles sharing a voxel add up to at most one layer; a fully covered voxel is
|
|
63
|
-
* written exactly as before. What remains is the average's own bias — a trail a fraction of a voxel
|
|
64
|
-
* wide occludes what is behind it by that fraction of its extinction — which holds still as the
|
|
65
|
-
* trail moves.
|
|
66
|
-
*
|
|
67
|
-
* Depth is the fragment's own view depth from the shared vertex stage, through curve → warp →
|
|
68
|
-
* physical and the two-slice linear split the other splats make. No depth attachment, for the
|
|
69
|
-
* reason the meshlet splat has none: a splat behind an opaque surface lies deeper than anything the
|
|
70
|
-
* draw will look it up for.
|
|
27
|
+
* The dynamic meshes' AVBOIT splat: every mesh's triangles rasterized at the volume's resolution by the
|
|
28
|
+
* dynamic-mesh vertex stage, into the unlit splat's fragment stage (`chunk_avboit_unlit_splat_fragment`,
|
|
29
|
+
* which says what a fragment writes). Coverage is the vertex colour's alpha times the mesh's.
|
|
71
30
|
*
|
|
72
31
|
* Groups 0 and 1 are `DYNAMIC_MESH_RESOURCES`' own groups, the same objects, so their layouts are
|
|
73
32
|
* the ones every dynamic-mesh pipeline declares and a geometry's one group serves them all. The AVBOIT
|
|
@@ -78,93 +37,34 @@ const resources = new ShaderResourceSetDescriptor();
|
|
|
78
37
|
|
|
79
38
|
resources.addGroup(DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_DRAWS]);
|
|
80
39
|
resources.addGroup(DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_GEOMETRY]);
|
|
81
|
-
|
|
82
|
-
resources.
|
|
83
|
-
.addStorageBuffer("warp", AVBOIT_WARP_STRUCT);
|
|
84
|
-
|
|
85
|
-
resources.createGroup()
|
|
86
|
-
.addStorageBuffer("extinction_volume", WebGPUArray.from(atomic_u32), true)
|
|
87
|
-
.addStorageBuffer("overflow_slice", WebGPUArray.from(atomic_u32), true);
|
|
40
|
+
resources.addGroup(AVBOIT_UNLIT_SPLAT_PASS_GROUP);
|
|
41
|
+
resources.addGroup(AVBOIT_SPLAT_VOLUME_GROUP);
|
|
88
42
|
|
|
89
43
|
const body = CodeChunk.from(
|
|
90
44
|
//language=WGSL
|
|
91
45
|
`
|
|
92
46
|
@vertex
|
|
93
|
-
fn vs_main(@builtin(vertex_index) vi : u32, @builtin(instance_index) draw_index : u32) ->
|
|
47
|
+
fn vs_main(@builtin(vertex_index) vi : u32, @builtin(instance_index) draw_index : u32) -> AVBOITUnlitVaryings {
|
|
94
48
|
return dynamic_mesh_avboit_vertex(vi, draw_index);
|
|
95
49
|
}
|
|
96
|
-
|
|
97
|
-
@fragment
|
|
98
|
-
fn fs_main(in : DynamicMeshAVBOITVertexOut, @builtin(sample_mask) sample_mask : u32) {
|
|
99
|
-
// the coverage the draw weights this fragment by, through the same function
|
|
100
|
-
let coverage = avboit_coverage(in.color.a);
|
|
101
|
-
|
|
102
|
-
if (coverage <= 0.0) {
|
|
103
|
-
// faded out: occludes nothing
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// the share of the voxel's samples this triangle covers
|
|
108
|
-
let footprint = f32(countOneBits(sample_mask)) / ${DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES}.0;
|
|
109
|
-
|
|
110
|
-
let extinction = avboit_transmittance_to_extinction(vec3<f32>(1.0 - coverage)) * footprint;
|
|
111
|
-
|
|
112
|
-
let p = avboit_view_depth_to_physical(&warp, in.view_depth);
|
|
113
|
-
|
|
114
|
-
// in.clip is @builtin(position): .xy the low-resolution pixel
|
|
115
|
-
let texel = vec2<u32>(in.clip.xy);
|
|
116
|
-
let column = texel.y * warp.voxel_width + texel.x;
|
|
117
|
-
|
|
118
|
-
// linear splat between the two slices around the fragment
|
|
119
|
-
let c = p - 0.5;
|
|
120
|
-
let slice = i32(floor(c));
|
|
121
|
-
let fraction = c - floor(c);
|
|
122
|
-
|
|
123
|
-
avboit_splat_slice(column, slice, extinction * (1.0 - fraction), texel);
|
|
124
|
-
avboit_splat_slice(column, slice + 1, extinction * fraction, texel);
|
|
125
|
-
}
|
|
126
50
|
`, [
|
|
127
51
|
chunk_dynamic_mesh_avboit_vertex,
|
|
128
|
-
|
|
129
|
-
chunk_avboit_transmittance_to_extinction,
|
|
130
|
-
chunk_avboit_view_depth_to_physical,
|
|
131
|
-
chunk_avboit_splat_slice,
|
|
52
|
+
chunk_avboit_unlit_splat_fragment,
|
|
132
53
|
]);
|
|
133
54
|
|
|
134
55
|
const descriptor = ShaderDescriptor.from({ label: "Dynamic Mesh AVBOIT Splat", body, resources });
|
|
135
56
|
|
|
136
|
-
// Built group by group: the atomics are fragment-only, and WebGPU refuses a read-write storage
|
|
137
|
-
// buffer that is visible to the vertex stage. The dynamic-mesh groups keep the visibility they have
|
|
138
|
-
// in the pass over the scene, so the layouts agree and one geometry group serves every pipeline.
|
|
139
|
-
const groups = resources.groups;
|
|
140
|
-
const layout = PipelineLayoutDescriptor.from([
|
|
141
|
-
groups[DYNAMIC_MESH_BIND_GROUP_DRAWS].generateBindGroupLayoutDescriptor(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
|
|
142
|
-
groups[DYNAMIC_MESH_BIND_GROUP_GEOMETRY].generateBindGroupLayoutDescriptor(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
|
|
143
|
-
groups[DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_PASS].generateBindGroupLayoutDescriptor(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
|
|
144
|
-
groups[DYNAMIC_MESH_AVBOIT_SPLAT_BIND_GROUP_VOLUME].generateBindGroupLayoutDescriptor(GPUShaderStage.FRAGMENT),
|
|
145
|
-
], resources.immediateSize);
|
|
146
|
-
|
|
147
57
|
/**
|
|
148
|
-
* The splat pipeline
|
|
149
|
-
*
|
|
150
|
-
* The attachment is the splat's own ({@link DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES} samples), not the
|
|
151
|
-
* volume's single-sampled one the meshlet and particle splats share.
|
|
152
|
-
* @type {RenderPipelineDescriptor}
|
|
58
|
+
* The splat pipeline, as every unlit splat is built (`avboit_unlit_splat_pipeline`).
|
|
59
|
+
* @type {import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor}
|
|
153
60
|
*/
|
|
154
|
-
export const DYNAMIC_MESH_AVBOIT_SPLAT_PIPELINE =
|
|
61
|
+
export const DYNAMIC_MESH_AVBOIT_SPLAT_PIPELINE = avboit_unlit_splat_pipeline({
|
|
155
62
|
label: "Dynamic Mesh AVBOIT Splat",
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
fragment: {
|
|
159
|
-
module: { code: descriptor.source },
|
|
160
|
-
entryPoint: "fs_main",
|
|
161
|
-
targets: [{ format: AVBOIT_SPLAT_DUMMY_FORMAT, writeMask: 0 }],
|
|
162
|
-
},
|
|
163
|
-
primitive: { topology: "triangle-list", cullMode: "none" },
|
|
164
|
-
multisample: { count: DYNAMIC_MESH_AVBOIT_SPLAT_SAMPLES },
|
|
63
|
+
resources,
|
|
64
|
+
source: descriptor.source,
|
|
165
65
|
});
|
|
166
66
|
|
|
167
|
-
/** The splat shader's resource set
|
|
67
|
+
/** The splat shader's resource set. */
|
|
168
68
|
export const DYNAMIC_MESH_AVBOIT_SPLAT_RESOURCES = resources;
|
|
169
69
|
|
|
170
70
|
/** The assembled shader, for the validity tier. */
|
|
@@ -57,6 +57,20 @@ export const FLUID_SOLID_FLAG: number;
|
|
|
57
57
|
* @type {number}
|
|
58
58
|
*/
|
|
59
59
|
export const FLUID_FORCED_FLAG: number;
|
|
60
|
+
/**
|
|
61
|
+
* Bit 2 of a cell's solid flags: the forcing wrote the cell's drag this tick, from the porous obstacles
|
|
62
|
+
* in it (the cell's words of the forcing buffer's porous block). A reader of the drag reads a cell only
|
|
63
|
+
* under it. Never set on a solid cell.
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
export const FLUID_POROUS_FLAG: number;
|
|
67
|
+
/**
|
|
68
|
+
* Words a cell takes in the forcing buffer's porous block: its drag over the step, `k·dt`, 1/(m/s),
|
|
69
|
+
* and the velocity of what drags on it, world m/s (`chunk_fluid_forcing_cell`'s
|
|
70
|
+
* `fluid_forcing_porous`).
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
export const FLUID_FORCING_POROUS_WORDS: number;
|
|
60
74
|
/**
|
|
61
75
|
* The flags as WGSL constants.
|
|
62
76
|
* @type {CodeChunk}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FLUID_FORCING.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/FLUID_FORCING.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,kCAFU,MAAM,CAEqB;AAErC;;;GAGG;AACH,wCAFU,MAAM,CAEkD;AAElE;;;;;GAKG;AACH,2CAFU,MAAM,CAE+B;AAE/C;;;;;GAKG;AACH,2CAFU,MAAM,CAE+B;AAE/C;;;;;GAKG;AACH,4CAFU,MAAM,CAE6F;AAE7G;;;;;;GAMG;AACH,+CAFU,MAAM,CAEkE;AAElF;;;;GAIG;AACH,wCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;;;GAKG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,wCAFU,SAAS,
|
|
1
|
+
{"version":3,"file":"FLUID_FORCING.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/FLUID_FORCING.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,kCAFU,MAAM,CAEqB;AAErC;;;GAGG;AACH,wCAFU,MAAM,CAEkD;AAElE;;;;;GAKG;AACH,2CAFU,MAAM,CAE+B;AAE/C;;;;;GAKG;AACH,2CAFU,MAAM,CAE+B;AAE/C;;;;;GAKG;AACH,4CAFU,MAAM,CAE6F;AAE7G;;;;;;GAMG;AACH,+CAFU,MAAM,CAEkE;AAElF;;;;GAIG;AACH,wCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;;;GAKG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;;GAKG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;;GAKG;AACH,yCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,wCAFU,SAAS,CAUjB;AAEF;;;GAGG;AACH,4CAFU,SAAS,CAcjB;0BApHwB,oCAAoC"}
|
|
@@ -69,6 +69,22 @@ export const FLUID_SOLID_FLAG = 1;
|
|
|
69
69
|
*/
|
|
70
70
|
export const FLUID_FORCED_FLAG = 2;
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Bit 2 of a cell's solid flags: the forcing wrote the cell's drag this tick, from the porous obstacles
|
|
74
|
+
* in it (the cell's words of the forcing buffer's porous block). A reader of the drag reads a cell only
|
|
75
|
+
* under it. Never set on a solid cell.
|
|
76
|
+
* @type {number}
|
|
77
|
+
*/
|
|
78
|
+
export const FLUID_POROUS_FLAG = 4;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Words a cell takes in the forcing buffer's porous block: its drag over the step, `k·dt`, 1/(m/s),
|
|
82
|
+
* and the velocity of what drags on it, world m/s (`chunk_fluid_forcing_cell`'s
|
|
83
|
+
* `fluid_forcing_porous`).
|
|
84
|
+
* @type {number}
|
|
85
|
+
*/
|
|
86
|
+
export const FLUID_FORCING_POROUS_WORDS = 4;
|
|
87
|
+
|
|
72
88
|
/**
|
|
73
89
|
* The flags as WGSL constants.
|
|
74
90
|
* @type {CodeChunk}
|
|
@@ -78,6 +94,8 @@ export const chunk_fluid_forcing_flags = CodeChunk.from(
|
|
|
78
94
|
`
|
|
79
95
|
const FLUID_SOLID_FLAG: u32 = ${FLUID_SOLID_FLAG}u;
|
|
80
96
|
const FLUID_FORCED_FLAG: u32 = ${FLUID_FORCED_FLAG}u;
|
|
97
|
+
const FLUID_POROUS_FLAG: u32 = ${FLUID_POROUS_FLAG}u;
|
|
98
|
+
const FLUID_FORCING_POROUS_WORDS: u32 = ${FLUID_FORCING_POROUS_WORDS}u;
|
|
81
99
|
`
|
|
82
100
|
);
|
|
83
101
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* - `inverse_frame_dt`: `1 / (frame_dt · fixedStepTimeScale)`, 0 when no game time passed, which a
|
|
13
13
|
* wake's node velocity is taken with;
|
|
14
14
|
* - `forcing_v`, `forcing_w`: where the v and w faces start in the forcing buffer, which holds the u
|
|
15
|
-
* faces from 0, each component's faces laid out over its own face lattice, x fastest
|
|
15
|
+
* faces from 0, each component's faces laid out over its own face lattice, x fastest;
|
|
16
|
+
* - `forcing_porous`: where the cells' porous block starts in it, after the w faces,
|
|
17
|
+
* `FLUID_FORCING_POROUS_WORDS` a cell, x fastest.
|
|
16
18
|
*
|
|
17
19
|
* @type {WebGPUStruct}
|
|
18
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FLUID_FORCING_APPLY_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"FLUID_FORCING_APPLY_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/FLUID_FORCING_APPLY_STRUCT.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yCAFU,YAAY,CAeE;6BAnCK,mCAAmC"}
|
|
@@ -16,7 +16,9 @@ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
|
16
16
|
* - `inverse_frame_dt`: `1 / (frame_dt · fixedStepTimeScale)`, 0 when no game time passed, which a
|
|
17
17
|
* wake's node velocity is taken with;
|
|
18
18
|
* - `forcing_v`, `forcing_w`: where the v and w faces start in the forcing buffer, which holds the u
|
|
19
|
-
* faces from 0, each component's faces laid out over its own face lattice, x fastest
|
|
19
|
+
* faces from 0, each component's faces laid out over its own face lattice, x fastest;
|
|
20
|
+
* - `forcing_porous`: where the cells' porous block starts in it, after the w faces,
|
|
21
|
+
* `FLUID_FORCING_POROUS_WORDS` a cell, x fastest.
|
|
20
22
|
*
|
|
21
23
|
* @type {WebGPUStruct}
|
|
22
24
|
*/
|
|
@@ -32,4 +34,5 @@ export const FLUID_FORCING_APPLY_STRUCT = WebGPUStruct.from({
|
|
|
32
34
|
inverse_frame_dt: f32,
|
|
33
35
|
forcing_v: u32,
|
|
34
36
|
forcing_w: u32,
|
|
37
|
+
forcing_porous: u32,
|
|
35
38
|
}, "FluidForcingApply");
|
|
@@ -78,6 +78,15 @@ export class GPUFluidForcing {
|
|
|
78
78
|
* @param {PipelineEnquiry} enquiry
|
|
79
79
|
*/
|
|
80
80
|
static enquirePipelines(enquiry: PipelineEnquiry): void;
|
|
81
|
+
/**
|
|
82
|
+
* How wide a record is for the resolution cull. A solid narrower than half a cascade's cell slips
|
|
83
|
+
* between its cell centres and is left out of that cascade; a porous one drags on every cell it
|
|
84
|
+
* fills part of, by as much as it fills it, so every cascade keeps it.
|
|
85
|
+
*
|
|
86
|
+
* @param {FluidObstacleRecord} record
|
|
87
|
+
* @returns {number} metres
|
|
88
|
+
*/
|
|
89
|
+
static "__#295@#resolved_extent"(record: FluidObstacleRecord): number;
|
|
81
90
|
/**
|
|
82
91
|
* The descriptor of a transient of `role`, `size` bytes, from `kept` (by role): the one kept for
|
|
83
92
|
* the role while its size holds, a new one when it moves. A role's usage and clear range never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUFluidForcing.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/GPUFluidForcing.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUFluidForcing.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/GPUFluidForcing.js"],"names":[],"mappings":"AAwIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH;IAEI;;;;OAIG;IACH,iCAFW,eAAe,QAUzB;IAqBD;;;;;;;OAOG;IACH,yCAHW,mBAAmB,GACjB,MAAM,CAIlB;IAyHD;;;;;;;;;;;OAWG;IACH,kCAPW,wBAAwB,EAAE,QAC1B,MAAM,QACN,MAAM,SACN,MAAM,cACN,MAAM,GACJ,wBAAwB,CAcpC;IAmmBD;;;;OAIG;IACH,yCAJW,MAAM,0CAEN;QAAC,OAAO,yBAAwB;KAAC,QAc3C;IA+MD,iFAcC;IAWD,gFAiCC;IAWD,kFAsBC;IAiHD,gFA0CC;IA7nCD;;;OAGG;IACH;QAF8B,MAAM;OAwCnC;IA4BD;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;;OAKG;IACH,2BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;;;;OAOG;IACH,mBAHW,MAAM,GACJ,MAAM,CAiBlB;IAED;;;;;OAKG;IACH,4BAEC;IAED;;;;;OAKG;IACH,2BAEC;IAED;;;;;OAKG;IACH,qBAHW,mBAAmB,GACjB,MAAM,CAQlB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,UACN,mBAAmB,QAQ7B;IAED;;OAEG;IACH,qBAFW,MAAM,QAUhB;IAED;;;;;OAKG;IACH,uBAHW,mBAAmB,EAAE,GACnB,MAAM,CAsBlB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,UACN,mBAAmB,QAgB7B;IAED;;;OAGG;IACH,wBAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,MAAM,CAuBlB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,SACN,MAAM,QAmBhB;IAED;;;OAGG;IACH,qBAHW,MAAM,SACN,MAAM,QAUhB;IAyID;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAf+B,KAAK,EAAzB,UAAU;QACW,cAAc,EAAnC,WAAW;QAEgB,MAAM,EAAjC,UAAU,MAAM,CAAC;QAID,UAAU,EAA1B,MAAM;QAEU,gBAAgB,EAAhC,MAAM;QAEU,SAAS,EAAzB,MAAM;aA4ChB;IAyND;;;;;;;;;;;;OAYG;IACH;QAJ+B,KAAK,EAAzB,UAAU;QACe,KAAK,EAA9B,eAAe;QACe,MAAM,EAApC,eAAe,GAAC,IAAI;aA8H9B;IAmHD;;;;;;;;;;;OAWG;IACH;QAN+B,KAAK,EAAzB,UAAU;QACe,OAAO,EAAhC,eAAe;QACC,EAAE,EAAlB,MAAM;QACJ,MAAM,GAAC,IAAI,CAyFvB;IAyDD;;;OAGG;IACH,gBAwBC;;CACJ;yBAn8CY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,6CAA6C,EAAE,eAAe;8BACrE,OAAO,uBAAuB,EAAE,eAAe;kCAC/C,OAAO,kFAAkF,EAAE,mBAAmB;kCAC9G,OAAO,2EAA2E,EAAE,mBAAmB;4BAvCxF,mCAAmC;yCADtB,mDAAmD"}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "./FLUID_DATABASE_SPEC.js";
|
|
19
19
|
import {
|
|
20
20
|
FLUID_FORCING_BRICK,
|
|
21
|
+
FLUID_FORCING_POROUS_WORDS,
|
|
21
22
|
FLUID_FORCING_REBUILD_AGE,
|
|
22
23
|
FLUID_FORCING_SURVIVOR_STRIDE
|
|
23
24
|
} from "./FLUID_FORCING.js";
|
|
@@ -236,11 +237,24 @@ export class GPUFluidForcing {
|
|
|
236
237
|
#plane_record = { plane: new Float32Array(4) };
|
|
237
238
|
|
|
238
239
|
/**
|
|
239
|
-
* Each obstacle row's extent (`fluid_obstacle_record_extent`), metres, indexed by row
|
|
240
|
+
* Each obstacle row's extent (`fluid_obstacle_record_extent`), metres, indexed by row; `Infinity` for
|
|
241
|
+
* a porous one, which every cascade resolves (`GPUFluidForcing.#resolved_extent`).
|
|
240
242
|
* @type {Float64Array}
|
|
241
243
|
*/
|
|
242
244
|
#obstacle_extent = new Float64Array(0);
|
|
243
245
|
|
|
246
|
+
/**
|
|
247
|
+
* How wide a record is for the resolution cull. A solid narrower than half a cascade's cell slips
|
|
248
|
+
* between its cell centres and is left out of that cascade; a porous one drags on every cell it
|
|
249
|
+
* fills part of, by as much as it fills it, so every cascade keeps it.
|
|
250
|
+
*
|
|
251
|
+
* @param {FluidObstacleRecord} record
|
|
252
|
+
* @returns {number} metres
|
|
253
|
+
*/
|
|
254
|
+
static #resolved_extent(record) {
|
|
255
|
+
return record.drag > 0 ? Infinity : fluid_obstacle_record_extent(record);
|
|
256
|
+
}
|
|
257
|
+
|
|
244
258
|
/** Bumped by every add and remove of an effector or obstacle row, and by an obstacle's extent changing. */
|
|
245
259
|
#sets_version = 0;
|
|
246
260
|
|
|
@@ -536,7 +550,7 @@ export class GPUFluidForcing {
|
|
|
536
550
|
}
|
|
537
551
|
|
|
538
552
|
for (let i = 0; i < records.length; i++) {
|
|
539
|
-
this.#obstacle_extent[first + i] =
|
|
553
|
+
this.#obstacle_extent[first + i] = GPUFluidForcing.#resolved_extent(records[i]);
|
|
540
554
|
}
|
|
541
555
|
|
|
542
556
|
return first;
|
|
@@ -555,7 +569,7 @@ export class GPUFluidForcing {
|
|
|
555
569
|
|
|
556
570
|
table.set_record(row, record, OBSTACLE_WRITER);
|
|
557
571
|
|
|
558
|
-
const extent =
|
|
572
|
+
const extent = GPUFluidForcing.#resolved_extent(record);
|
|
559
573
|
|
|
560
574
|
if (extent !== this.#obstacle_extent[row]) {
|
|
561
575
|
// which cascades resolve it may have moved
|
|
@@ -1365,6 +1379,7 @@ export class GPUFluidForcing {
|
|
|
1365
1379
|
inverse_frame_dt: 0,
|
|
1366
1380
|
forcing_v: 0,
|
|
1367
1381
|
forcing_w: 0,
|
|
1382
|
+
forcing_porous: 0,
|
|
1368
1383
|
},
|
|
1369
1384
|
};
|
|
1370
1385
|
|
|
@@ -1390,6 +1405,7 @@ export class GPUFluidForcing {
|
|
|
1390
1405
|
|
|
1391
1406
|
settings.forcing_v = faces_u;
|
|
1392
1407
|
settings.forcing_w = faces_u + faces_v;
|
|
1408
|
+
settings.forcing_porous = faces_u + faces_v + faces_w;
|
|
1393
1409
|
|
|
1394
1410
|
apply.cascade = cascade;
|
|
1395
1411
|
apply.tree = tick.trees[slot];
|
|
@@ -1400,7 +1416,7 @@ export class GPUFluidForcing {
|
|
|
1400
1416
|
apply.list = pass.read(tick.lists[slot]);
|
|
1401
1417
|
apply.survivors = pass.read(tick.survivors);
|
|
1402
1418
|
apply.commands = pass.read(tick.commands);
|
|
1403
|
-
apply.output = pass.create('Fluid / forcing / forcing', GPUFluidForcing.#descriptor(this.#descriptors, ROLE_FORCING, 4 * (faces_u + faces_v + faces_w), GPUBufferUsage.STORAGE, 0));
|
|
1419
|
+
apply.output = pass.create('Fluid / forcing / forcing', GPUFluidForcing.#descriptor(this.#descriptors, ROLE_FORCING, 4 * (faces_u + faces_v + faces_w + nx * ny * nz * FLUID_FORCING_POROUS_WORDS), GPUBufferUsage.STORAGE, 0));
|
|
1404
1420
|
|
|
1405
1421
|
// it writes the cascade's flags and persistent faces
|
|
1406
1422
|
pass.make_side_effect();
|
|
@@ -6,9 +6,18 @@
|
|
|
6
6
|
* centred at `c`, u face `i` at `i − ½` along x) in world metres, the window's world cell `corner` at
|
|
7
7
|
* window-local 0: `(corner + p + ½)·h`.
|
|
8
8
|
* - `fluid_forcing_solid(x, count) -> u32`: the solid test at a cell centre, the first of the brick's
|
|
9
|
-
* `count` obstacles (its lowest row) whose field at `x` is within its inflation,
|
|
9
|
+
* `count` solid obstacles (its lowest row) whose field at `x` is within its inflation,
|
|
10
10
|
* `fluid_obstacle_record_signed_distance(record, global, x) ≤ inflation`; `FLUID_FORCING_NONE` for
|
|
11
|
-
* fluid.
|
|
11
|
+
* fluid. A porous obstacle (`drag` above 0) is never solid. At most `FLUID_FORCING_OBSTACLE_LIMIT`
|
|
12
|
+
* fields, each at most 16 hull planes.
|
|
13
|
+
* - `fluid_forcing_porous(x, cell_size, count) -> vec4<f32>`: the drag of the brick's porous obstacles
|
|
14
|
+
* on the cell of side `cell_size` centred at `x`: in `x`, the sum of each one's `drag` times the
|
|
15
|
+
* share of the cell it fills, 1/m; in `yzw`, the velocity it drags toward, each obstacle's wall
|
|
16
|
+
* velocity at `x` weighed by its part of the drag, world m/s, zero where there is no drag. The
|
|
17
|
+
* share is the part of the cell's height inside the obstacle along four vertical lines through it,
|
|
18
|
+
* at a quarter of the cell in from each side (`fluid_obstacle_record_line_span`), so a layer
|
|
19
|
+
* thinner than the cell drags on it by as much as it fills it, and a layer whose sides are vertical
|
|
20
|
+
* fills it exactly.
|
|
12
21
|
* - `fluid_forcing_wall_velocity(slot, x) -> vec3<f32>`: the wall's velocity at `x` of the brick's
|
|
13
22
|
* obstacle `slot`, `rigid_velocity_at_point(v, ω, t, x)` (`fluid_obstacle_record_wall_velocity`).
|
|
14
23
|
* - `fluid_forcing_deposit(x, dt, cell_size, count) -> vec3<f32>`: what the brick's `count` effectors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_fluid_forcing_cell.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"chunk_fluid_forcing_cell.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/fluid/forcing/chunk_fluid_forcing_cell.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,uCAFU,SAAS,CAqGjB;0BA5IwB,oCAAoC"}
|