reze-engine 0.68.1 → 0.68.2

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.
Files changed (50) hide show
  1. package/dist/_dbg-loader.mjs +1100 -0
  2. package/dist/engine.d.ts +100 -0
  3. package/dist/engine.d.ts.map +1 -1
  4. package/dist/engine.js +194 -2
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -0
  8. package/dist/shaders/passes/aov.d.ts +37 -0
  9. package/dist/shaders/passes/aov.d.ts.map +1 -0
  10. package/dist/shaders/passes/aov.js +180 -0
  11. package/package.json +1 -1
  12. package/src/engine.ts +229 -2
  13. package/src/index.ts +4 -0
  14. package/src/shaders/passes/aov.ts +187 -0
  15. package/dist/graph/presets/pool_floor.d.ts +0 -3
  16. package/dist/graph/presets/pool_floor.d.ts.map +0 -1
  17. package/dist/graph/presets/pool_floor.js +0 -42
  18. package/dist/graph/presets/water.d.ts +0 -3
  19. package/dist/graph/presets/water.d.ts.map +0 -1
  20. package/dist/graph/presets/water.js +0 -31
  21. package/dist/physics/autofit.d.ts +0 -147
  22. package/dist/physics/autofit.d.ts.map +0 -1
  23. package/dist/physics/autofit.js +0 -501
  24. package/dist/shaders/agx-lut.d.ts +0 -11
  25. package/dist/shaders/agx-lut.d.ts.map +0 -1
  26. package/dist/shaders/agx-lut.js +0 -29
  27. package/dist/shaders/dfg_lut.d.ts +0 -3
  28. package/dist/shaders/dfg_lut.d.ts.map +0 -1
  29. package/dist/shaders/dfg_lut.js +0 -129
  30. package/dist/shaders/ltc_mag_lut.d.ts +0 -3
  31. package/dist/shaders/ltc_mag_lut.d.ts.map +0 -1
  32. package/dist/shaders/ltc_mag_lut.js +0 -1033
  33. package/dist/shaders/passes/field-blit.d.ts +0 -26
  34. package/dist/shaders/passes/field-blit.d.ts.map +0 -1
  35. package/dist/shaders/passes/field-blit.js +0 -65
  36. package/dist/shaders/passes/ghosts.d.ts +0 -22
  37. package/dist/shaders/passes/ghosts.d.ts.map +0 -1
  38. package/dist/shaders/passes/ghosts.js +0 -75
  39. package/dist/shaders/passes/ground-noise.d.ts +0 -7
  40. package/dist/shaders/passes/ground-noise.d.ts.map +0 -1
  41. package/dist/shaders/passes/ground-noise.js +0 -88
  42. package/dist/shaders/passes/sim.d.ts +0 -34
  43. package/dist/shaders/passes/sim.d.ts.map +0 -1
  44. package/dist/shaders/passes/sim.js +0 -169
  45. package/dist/shaders/score-api.d.ts +0 -10
  46. package/dist/shaders/score-api.d.ts.map +0 -1
  47. package/dist/shaders/score-api.js +0 -114
  48. package/dist/shaders/shadow-api.d.ts +0 -29
  49. package/dist/shaders/shadow-api.d.ts.map +0 -1
  50. package/dist/shaders/shadow-api.js +0 -112
@@ -0,0 +1,187 @@
1
+ import { sceneLightApi } from "../scene-light-api"
2
+ import { lightsApi, MAX_LIGHTS } from "../lights"
3
+
4
+ /**
5
+ * The frame, read back as numbers — what an agent (or a test) measures instead
6
+ * of squinting at a picture.
7
+ *
8
+ * A screenshot answers "what does it look like". It cannot answer the questions
9
+ * a lighting artist actually asks of a render: is her face in the sun's shadow,
10
+ * which lamp is carrying the key, how many stops over is that highlight, which
11
+ * pixels are skin. Every one of those is a number the frame already computed
12
+ * and threw away; these passes keep them.
13
+ *
14
+ * TWO ENTRY POINTS over one prelude:
15
+ *
16
+ * pixels — one invocation per texel of the frame just rendered. Reads the id
17
+ * attachment, the depth and the linear HDR resolve, rebuilds the
18
+ * world point from the depth and a normal from its neighbours, and
19
+ * asks the same shadow atlas and lamp records the materials asked.
20
+ * probe — the same light questions at points the caller names (a bone, a
21
+ * face), with each lamp's share kept apart.
22
+ *
23
+ * The normal is RECONSTRUCTED from depth, not the one the material shaded
24
+ * with: the frame never stores normals, and storing them for every frame to
25
+ * serve an occasional readback would be the cost the id attachment's
26
+ * store-only-when-read rule exists to avoid. On a silhouette edge it is the
27
+ * flatter of the two neighbours, which is right for every texel that is not
28
+ * the edge itself.
29
+ */
30
+
31
+ /** Floats per texel in the pixels output — see PIXEL_FIELDS. */
32
+ export const AOV_PIXEL_STRIDE = 12
33
+
34
+ /** What each of a texel's floats is, in order. */
35
+ export const AOV_PIXEL_FIELDS = [
36
+ "r", "g", "b", // linear HDR, before exposure and the view transform
37
+ "depth", // distance from the eye, world units; 0 where nothing drew
38
+ "sunShadow", // 1 lit, 0 in a caster's shadow; -1 where nothing drew
39
+ "sunFacing", // N·L toward the sun, -1..1 (the toon ramp's input)
40
+ "lampR", "lampG", "lampB", // every positional lamp's light arriving here
41
+ "ambR", "ambG", "ambB", // the world's light arriving here
42
+ ] as const
43
+
44
+ /** Floats per probe point before its per-lamp block. */
45
+ export const AOV_PROBE_HEAD = 12
46
+ /** Floats per probe point: the head, then rgb+pad for every lamp slot. */
47
+ export const AOV_PROBE_STRIDE = AOV_PROBE_HEAD + MAX_LIGHTS * 4
48
+
49
+ // Bindings 0..3 are the scene light API, 4..6 the lamps and their cookies.
50
+ const PRELUDE = /* wgsl */ `
51
+ ${sceneLightApi(true, 0, 0)}
52
+ ${lightsApi(0, 4, "0xffffffffu", { binding: 5, sampler: "_aovSampler" })}
53
+ @group(0) @binding(6) var _aovSampler: sampler;
54
+
55
+ /** The sun's cast shadow at p, nudged along n off the surface — the
56
+ * materials' rzSunOcclusion, without the facing test (sunFacing carries it). */
57
+ fn aovSunShadow(p: vec3f, n: vec3f) -> f32 {
58
+ let castAmt = _rzLight.lights[0].direction.w;
59
+ if (castAmt <= 0.0) { return 1.0; }
60
+ let a = _rzSunLocate(p + n * 0.08);
61
+ if (a.w < 0.0) { return 1.0; }
62
+ return mix(1.0, _rzSunTaps(a), castAmt);
63
+ }
64
+
65
+ fn aovToSun() -> vec3f { return normalize(-_rzLight.lights[0].direction.xyz); }
66
+ `
67
+
68
+ export const AOV_PIXELS_WGSL = /* wgsl */ `
69
+ ${PRELUDE}
70
+ @group(0) @binding(7) var idTex: texture_multisampled_2d<u32>;
71
+ @group(0) @binding(8) var depthTex: texture_depth_multisampled_2d;
72
+ @group(0) @binding(9) var hdrTex: texture_2d<f32>;
73
+ struct AovU { invViewProj: mat4x4f, eye: vec4f, size: vec4u, }
74
+ @group(0) @binding(10) var<uniform> u: AovU;
75
+ @group(0) @binding(11) var<storage, read_write> outF: array<f32>;
76
+ @group(0) @binding(12) var<storage, read_write> outId: array<u32>;
77
+
78
+ fn worldAt(c: vec2i, z: f32) -> vec3f {
79
+ let uv = (vec2f(c) + 0.5) / vec2f(u.size.xy);
80
+ let h = u.invViewProj * vec4f(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, z, 1.0);
81
+ return h.xyz / h.w;
82
+ }
83
+
84
+ fn drawn(c: vec2i) -> bool {
85
+ if (any(c < vec2i(0)) || any(c >= vec2i(u.size.xy))) { return false; }
86
+ let id = textureLoad(idTex, c, 0).xy;
87
+ return id.x != 0u || id.y != 0u;
88
+ }
89
+
90
+ /** The step from p to the neighbour at c + d (or c - d, negated), whichever is
91
+ * nearer in depth: across a silhouette the far neighbour belongs to something
92
+ * else, and a normal built from it tilts toward the background. */
93
+ fn tangent(c: vec2i, d: vec2i, p: vec3f) -> vec3f {
94
+ let a = c + d;
95
+ let b = c - d;
96
+ let okA = drawn(a);
97
+ let okB = drawn(b);
98
+ var ta = vec3f(0.0);
99
+ var tb = vec3f(0.0);
100
+ if (okA) { ta = worldAt(a, textureLoad(depthTex, a, 0)) - p; }
101
+ if (okB) { tb = p - worldAt(b, textureLoad(depthTex, b, 0)); }
102
+ if (okA && okB) { return select(tb, ta, dot(ta, ta) <= dot(tb, tb)); }
103
+ if (okA) { return ta; }
104
+ return tb;
105
+ }
106
+
107
+ @compute @workgroup_size(8, 8)
108
+ fn pixels(@builtin(global_invocation_id) gid: vec3u) {
109
+ if (gid.x >= u.size.x || gid.y >= u.size.y) { return; }
110
+ let c = vec2i(gid.xy);
111
+ let i = gid.y * u.size.x + gid.x;
112
+ let o = i * ${AOV_PIXEL_STRIDE}u;
113
+ let id = textureLoad(idTex, c, 0).xy;
114
+ let rgb = textureLoad(hdrTex, c, 0).rgb;
115
+ // Material in the low half, object in the high — the attachment's own order
116
+ // (scene-contract: vec2u(material, object)).
117
+ outId[i] = (id.y << 16u) | (id.x & 0xffffu);
118
+ outF[o] = rgb.r;
119
+ outF[o + 1u] = rgb.g;
120
+ outF[o + 2u] = rgb.b;
121
+ for (var k = 3u; k < ${AOV_PIXEL_STRIDE}u; k++) { outF[o + k] = 0.0; }
122
+ if (id.x == 0u && id.y == 0u) {
123
+ outF[o + 4u] = -1.0;
124
+ return;
125
+ }
126
+ let p = worldAt(c, textureLoad(depthTex, c, 0));
127
+ var n = cross(tangent(c, vec2i(0, 1), p), tangent(c, vec2i(1, 0), p));
128
+ let toEye = u.eye.xyz - p;
129
+ if (dot(n, n) < 1e-12) { n = toEye; }
130
+ n = normalize(n);
131
+ // Toward the eye: the side of the surface this texel shows.
132
+ if (dot(n, toEye) < 0.0) { n = -n; }
133
+ let lamps = rzLightsDiffuse(p, n);
134
+ let amb = rzWorldAmbient(n);
135
+ outF[o + 3u] = length(toEye);
136
+ outF[o + 4u] = aovSunShadow(p, n);
137
+ outF[o + 5u] = dot(n, aovToSun());
138
+ outF[o + 6u] = lamps.r;
139
+ outF[o + 7u] = lamps.g;
140
+ outF[o + 8u] = lamps.b;
141
+ outF[o + 9u] = amb.r;
142
+ outF[o + 10u] = amb.g;
143
+ outF[o + 11u] = amb.b;
144
+ }
145
+ `
146
+
147
+ export const AOV_PROBE_WGSL = /* wgsl */ `
148
+ ${PRELUDE}
149
+ struct ProbePoint { p: vec4f, n: vec4f, }
150
+ @group(0) @binding(7) var<storage, read> points: array<ProbePoint>;
151
+ @group(0) @binding(8) var<storage, read_write> outF: array<f32>;
152
+
153
+ @compute @workgroup_size(1)
154
+ fn probe(@builtin(global_invocation_id) gid: vec3u) {
155
+ let i = gid.x;
156
+ if (i >= arrayLength(&points)) { return; }
157
+ let p = points[i].p.xyz;
158
+ let n = normalize(points[i].n.xyz);
159
+ let o = i * ${AOV_PROBE_STRIDE}u;
160
+ // Colour and strength travel apart in the light uniform (writeSun); the
161
+ // light arriving is their product.
162
+ let sun = _rzLight.lights[0].color.rgb * _rzLight.lights[0].color.w;
163
+ let amb = rzWorldAmbient(n);
164
+ outF[o] = aovSunShadow(p, n);
165
+ outF[o + 1u] = dot(n, aovToSun());
166
+ outF[o + 2u] = sun.r;
167
+ outF[o + 3u] = sun.g;
168
+ outF[o + 4u] = sun.b;
169
+ outF[o + 5u] = amb.r;
170
+ outF[o + 6u] = amb.g;
171
+ outF[o + 7u] = amb.b;
172
+ let count = rzLightCount();
173
+ outF[o + 8u] = f32(count);
174
+ // The document's lamps come first (setLights order); the rest are effects'.
175
+ outF[o + 9u] = f32(_rzLightDocCount());
176
+ for (var k = 10u; k < ${AOV_PROBE_HEAD}u; k++) { outF[o + k] = 0.0; }
177
+ for (var l = 0u; l < ${MAX_LIGHTS}u; l++) {
178
+ var c = vec3f(0.0);
179
+ if (l < count) { c = _rzLightOne(l, p, n); }
180
+ let b = o + ${AOV_PROBE_HEAD}u + l * 4u;
181
+ outF[b] = c.r;
182
+ outF[b + 1u] = c.g;
183
+ outF[b + 2u] = c.b;
184
+ outF[b + 3u] = 0.0;
185
+ }
186
+ }
187
+ `
@@ -1,3 +0,0 @@
1
- import type { ShaderGraph } from "../schema";
2
- export declare const POOL_FLOOR_GRAPH: ShaderGraph;
3
- //# sourceMappingURL=pool_floor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pool_floor.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/pool_floor.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,eAAO,MAAM,gBAAgB,EAAE,WA6B9B,CAAA"}
@@ -1,42 +0,0 @@
1
- // Pool floor — the tiled bottom seen through water, with caustics on it.
2
- //
3
- // The other half of a pool, and the half that does most of the work. A water
4
- // surface can be tuned for a long time without the shot reading as a pool;
5
- // putting the focused-light web on the FLOOR is what settles it, because that
6
- // is the cue a photograph actually carries. It is a floor material, so it is
7
- // applied to the tile under the water rather than to the water itself.
8
- //
9
- // Caustics land between the albedo and the shading deliberately: they are
10
- // light, so they should still be dimmed by the floor's own shadow rather than
11
- // glowing through it. That is the difference between water-focused sun and a
12
- // decal.
13
- export const POOL_FLOOR_GRAPH = {
14
- version: 1,
15
- name: "Pool floor",
16
- tags: ["stage", "water", "pool"],
17
- nodes: [
18
- { id: "tex", type: "texture" },
19
- { id: "mat", type: "material_diffuse" },
20
- { id: "base", type: "mix/multiply", inputs: { fac: 1.0 } },
21
- { id: "caust", type: "caustics" },
22
- {
23
- id: "principled",
24
- type: "principled",
25
- inputs: { metallic: 0.0, specular_ior_level: 0.4, roughness: 0.45, spec_clamp: 10.0, sheen_weight: 0.0, sheen_tint: 0.0 },
26
- },
27
- ],
28
- links: [
29
- { from: { node: "tex", socket: "color" }, to: { node: "base", socket: "a" } },
30
- { from: { node: "mat", socket: "color" }, to: { node: "base", socket: "b" } },
31
- { from: { node: "base", socket: "color" }, to: { node: "caust", socket: "color" } },
32
- { from: { node: "caust", socket: "color" }, to: { node: "principled", socket: "base_color" } },
33
- ],
34
- output: { node: "principled", socket: "color" },
35
- params: [
36
- { id: "tint", label: "Light tint", target: { node: "caust", socket: "tint" }, kind: "color", default: [1.0, 1.0, 1.0] },
37
- { id: "scale", label: "Caustic scale", target: { node: "caust", socket: "scale" }, kind: "float", min: 0.01, max: 1, default: 0.12 },
38
- { id: "speed", label: "Caustic speed", target: { node: "caust", socket: "speed" }, kind: "float", min: 0, max: 1, default: 0.15 },
39
- { id: "strength", label: "Caustic strength", target: { node: "caust", socket: "strength" }, kind: "float", min: 0, max: 3, default: 0.6 },
40
- { id: "fade", label: "Depth fade", target: { node: "caust", socket: "fade" }, kind: "float", min: 1, max: 200, default: 30 },
41
- ],
42
- };
@@ -1,3 +0,0 @@
1
- import type { ShaderGraph } from "../schema";
2
- export declare const WATER_GRAPH: ShaderGraph;
3
- //# sourceMappingURL=water.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"water.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/water.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,eAAO,MAAM,WAAW,EAAE,WAgBzB,CAAA"}
@@ -1,31 +0,0 @@
1
- // Water — a planar reflection, rippled, seen through Fresnel.
2
- //
3
- // Put a stage's water materials in a style group carrying this graph and the
4
- // pool starts reflecting. The reflection itself is the engine's mirror pass,
5
- // which this is the only graph to read; everything else here is the shaping
6
- // that keeps it from reading as a mirror laid flat in the floor.
7
- //
8
- // The exposed params are the ones worth a slider while judging a shot. Scale
9
- // and speed are the ripple; a real pool's surface is slow and broad, so both
10
- // defaults sit low. Tint is the water's own colour — a game rip carries that
11
- // in its material, and the converter hands it straight over.
12
- //
13
- // How see-through the water is belongs to the MATERIAL's alpha, not to this
14
- // graph, which is where every other group's coverage comes from too.
15
- export const WATER_GRAPH = {
16
- version: 1,
17
- name: "Water",
18
- tags: ["water", "stage"],
19
- nodes: [{ id: "water", type: "water" }],
20
- links: [],
21
- output: { node: "water", socket: "color" },
22
- params: [
23
- { id: "tint", label: "Tint", target: { node: "water", socket: "tint" }, kind: "color", default: [0.04, 0.62, 0.66] },
24
- { id: "scale", label: "Ripple scale", target: { node: "water", socket: "scale" }, kind: "float", min: 0.01, max: 1, default: 0.18 },
25
- { id: "speed", label: "Ripple speed", target: { node: "water", socket: "speed" }, kind: "float", min: 0, max: 1, default: 0.12 },
26
- { id: "strength", label: "Ripple depth", target: { node: "water", socket: "strength" }, kind: "float", min: 0, max: 2, default: 0.7 },
27
- { id: "blur", label: "Reflection blur", target: { node: "water", socket: "blur" }, kind: "float", min: 0, max: 1, default: 0.25 },
28
- { id: "mirroring", label: "Mirroring", target: { node: "water", socket: "mirroring" }, kind: "float", min: 0, max: 1, default: 0.20 },
29
- { id: "sparkle", label: "Sparkle", target: { node: "water", socket: "sparkle" }, kind: "float", min: 0, max: 4, default: 1.0 },
30
- ],
31
- };
@@ -1,147 +0,0 @@
1
- import { type Rigidbody } from "./types";
2
- import type { Skinning } from "../model";
3
- /**
4
- * Supplementary colliders fitted to the mesh a PMX rigid body fails to cover.
5
- *
6
- * PMX body proxies are bodies of revolution — 下半身 is a capsule lying
7
- * transversely across the hips, so its cross-section is a circle. A pelvis seen
8
- * from the side is not a circle, and across every rig measured the butt sits
9
- * 0.18–0.71 units OUTSIDE that capsule while the front is flush or inside. That
10
- * gap is where a skirt goes through a character: the cloth is resting correctly
11
- * on the collider it was given, and the collider stops half a unit short of the
12
- * skin.
13
- *
14
- * A rest offset cannot close it (see RigidBodyStore.restOffset) — it is one
15
- * scalar on a radially symmetric shape, and the error is asymmetric. Measured
16
- * on 托特's run cycle, the offset that clears the butt is 0.5, which is simply
17
- * the size of the missing geometry, and at that value the skirt stands off the
18
- * front and hips by the same 0.5.
19
- *
20
- * So fit the missing piece instead: take each bone-following body's own skinned
21
- * vertices, find the ones that escape its shape in a concentrated lobe, and fit
22
- * a capsule to that lobe. That is the fix riggers apply by hand, derived from
23
- * the mesh rather than guessed.
24
- *
25
- * Measured on 托特's run cycle, counting butt vertices swallowed by a cloth
26
- * body: 32.4 per frame with nothing, 30.9 with a 0.02 rest offset, 12.4 with
27
- * this pass, 10.4 with both.
28
- */
29
- export interface AutoFitOptions {
30
- /** A vertex counts as protruding past this much (model units). Below it the
31
- * mesh is within authoring tolerance of the proxy and needs no help. */
32
- minProtrusion?: number;
33
- /**
34
- * Ignore vertices further out than this multiple of the source shape's
35
- * RADIUS (its smallest characteristic dimension).
36
- *
37
- * A coarse first cut at keeping hair and loose clothing out — anything
38
- * standing further off the proxy than the proxy is wide is not skin. The
39
- * discriminator that actually does the work is minConcentration.
40
- */
41
- maxProtrusionRatio?: number;
42
- /** Fewer protruding vertices than this and it is a spike, not a region. */
43
- minVertices?: number;
44
- /**
45
- * Per-axis quantile the fitted lobe's extent is clipped to, each end. A
46
- * handful of stray vertices (a weight-painting slip, a seam) would otherwise
47
- * stretch the capsule far past the surface everyone can see.
48
- */
49
- quantile?: number;
50
- /** Skip the fit unless the capsule actually reaches this far past what is
51
- * already covered — otherwise it adds solver rows for nothing. */
52
- minGain?: number;
53
- /** How tightly the kept lobe's outward directions must agree, 0–1. A loose
54
- * sanity check; the real discriminator is minConcentration. */
55
- minDirectionality?: number;
56
- /** Vertices outside the dominant lobe, by this cosine, are not part of the
57
- * feature being fitted. */
58
- lobeCos?: number;
59
- /**
60
- * How much deeper the fitted lobe must be than protrusion typically is on
61
- * this body, averaged over the vertices that protrude at all.
62
- *
63
- * This is the guard that separates "the proxy is missing a lobe" from "the
64
- * proxy is not a proxy for this mesh at all". A pelvis escapes its capsule by
65
- * 0.53 at the back and 0.14 at the front, so the back lobe stands well clear
66
- * of the average. Hair escapes the skull by a similar depth in every
67
- * direction, so its deepest lobe is no deeper than typical and the ratio sits
68
- * near 1. See the note at the meanProtrusion computation for what this
69
- * deliberately refuses to fit.
70
- *
71
- * Without it the pass fits the hairstyle — measured on 托特, 頭 reports
72
- * 3653 of 4669 vertices outside its capsule, and the fitted shape was a crate
73
- * around the whole head. No threshold on depth or vertex count tells those
74
- * two cases apart; concentration does.
75
- */
76
- minConcentration?: number;
77
- /**
78
- * How many capsules may be fitted to one body, each against what the previous
79
- * ones already cover.
80
- *
81
- * One capsule inscribed in a lobe does not fill it — on 托特's butt a single
82
- * fit removed 58% of the clipping and left the rest at the edges the capsule
83
- * could not reach. Each further pass re-measures protrusion against the
84
- * original shape UNION everything fitted so far, so it lands on whatever is
85
- * still exposed instead of re-fitting the same bulge.
86
- */
87
- maxShapesPerBody?: number;
88
- /**
89
- * Quantile of the lobe's perpendicular spread used as the capsule radius.
90
- *
91
- * The clip-versus-float dial, and the one to reach for if a result looks
92
- * wrong. Lower hugs the body: less standoff in idle, more clipping left. 1.0
93
- * encloses the lobe entirely, which is what produced a visibly hovering
94
- * skirt on 托特.
95
- */
96
- radiusQuantile?: number;
97
- /**
98
- * Fit only the deepest part of each lobe: points at least this fraction of
99
- * the lobe's own maximum protrusion.
100
- *
101
- * A lobe tapers to nothing at its edges, and a capsule sized to span the
102
- * whole thing has to be fat enough to reach the edges too. Fitting the deep
103
- * core keeps each capsule small and lets a later pass handle the shallows
104
- * with its own, which is both tighter and closer to what the surface is
105
- * actually doing.
106
- */
107
- lobeDepthFraction?: number;
108
- }
109
- /** What the pass decided for one source body — surfaced so a rig can be
110
- * inspected rather than silently rebuilt underneath its author. */
111
- export interface AutoFitResult {
112
- /** Index of the body in the input array that this supplements. */
113
- sourceIndex: number;
114
- sourceName: string;
115
- /** Vertices dominated by that body's bone, and how many were outside it. */
116
- vertexCount: number;
117
- protrudingCount: number;
118
- /** Furthest any kept vertex sat outside the source shape. */
119
- maxProtrusion: number;
120
- /** How far the fitted capsule reaches past what was already covered. */
121
- gain: number;
122
- /** Length of the kept lobe's mean outward direction, 0–1. */
123
- directionality: number;
124
- /** Lobe depth over the body's average protrusion. See minConcentration. */
125
- concentration: number;
126
- /**
127
- * Furthest the capsule's newly exposed surface sits from the skin it was
128
- * fitted to — the amount cloth resting on it will stand off the body at the
129
- * worst point, and the number to watch if a result looks puffy. Only the part
130
- * reaching outside the source shape is measured; the rest is buried.
131
- */
132
- overshoot: number;
133
- body: Rigidbody;
134
- }
135
- /**
136
- * Fit supplementary colliders for every bone-following body whose own mesh
137
- * escapes it.
138
- *
139
- * `vertices` is the model's interleaved vertex buffer (stride 8, position
140
- * first) and `skinning` its joints/weights — both in PMX bind pose, the same
141
- * space as `shapePosition` / `shapeRotation`, so nothing has to be skinned.
142
- *
143
- * Returns one entry per body it chose to supplement; the caller appends
144
- * `.body` to the rigid body list before constructing RezePhysics.
145
- */
146
- export declare function fitSupplementaryColliders(rigidbodies: Rigidbody[], vertices: Float32Array, skinning: Skinning, options?: AutoFitOptions): AutoFitResult[];
147
- //# sourceMappingURL=autofit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autofit.d.ts","sourceRoot":"","sources":["../../src/physics/autofit.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,SAAS,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,cAAc;IAC7B;6EACyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;uEACmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;oEACgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;gCAC4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AA2BD;oEACoE;AACpE,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAA;IACtB,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,SAAS,CAAA;CAChB;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,SAAS,EAAE,EACxB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,cAAmB,GAC3B,aAAa,EAAE,CA4CjB"}