reze-engine 0.68.20 → 0.68.22
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/dist/camera-animation.d.ts.map +1 -1
- package/dist/camera-animation.js +5 -0
- package/dist/engine.d.ts +8 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +19 -3
- package/dist/graph/slots.js +2 -2
- package/dist/shaders/materials/common.d.ts +3 -0
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +7 -1
- package/dist/shaders/passes/outline.d.ts.map +1 -1
- package/dist/shaders/passes/outline.js +4 -2
- package/dist/shaders/passes/shadow.d.ts +1 -1
- package/dist/shaders/passes/shadow.d.ts.map +1 -1
- package/dist/shaders/passes/shadow.js +2 -2
- package/package.json +1 -1
- package/src/camera-animation.ts +4 -0
- package/src/engine.ts +20 -4
- package/src/graph/slots.ts +2 -2
- package/src/shaders/materials/common.ts +9 -1
- package/src/shaders/passes/outline.ts +4 -2
- package/src/shaders/passes/shadow.ts +2 -2
- package/dist/graph/presets/pool_floor.d.ts +0 -3
- package/dist/graph/presets/pool_floor.d.ts.map +0 -1
- package/dist/graph/presets/pool_floor.js +0 -42
- package/dist/graph/presets/water.d.ts +0 -3
- package/dist/graph/presets/water.d.ts.map +0 -1
- package/dist/graph/presets/water.js +0 -31
- package/dist/physics/autofit.d.ts +0 -147
- package/dist/physics/autofit.d.ts.map +0 -1
- package/dist/physics/autofit.js +0 -501
- package/dist/shaders/agx-lut.d.ts +0 -11
- package/dist/shaders/agx-lut.d.ts.map +0 -1
- package/dist/shaders/agx-lut.js +0 -29
- package/dist/shaders/dfg_lut.d.ts +0 -3
- package/dist/shaders/dfg_lut.d.ts.map +0 -1
- package/dist/shaders/dfg_lut.js +0 -129
- package/dist/shaders/ltc_mag_lut.d.ts +0 -3
- package/dist/shaders/ltc_mag_lut.d.ts.map +0 -1
- package/dist/shaders/ltc_mag_lut.js +0 -1033
- package/dist/shaders/passes/field-blit.d.ts +0 -26
- package/dist/shaders/passes/field-blit.d.ts.map +0 -1
- package/dist/shaders/passes/field-blit.js +0 -65
- package/dist/shaders/passes/ghosts.d.ts +0 -22
- package/dist/shaders/passes/ghosts.d.ts.map +0 -1
- package/dist/shaders/passes/ghosts.js +0 -75
- package/dist/shaders/passes/ground-noise.d.ts +0 -7
- package/dist/shaders/passes/ground-noise.d.ts.map +0 -1
- package/dist/shaders/passes/ground-noise.js +0 -88
- package/dist/shaders/passes/sim.d.ts +0 -34
- package/dist/shaders/passes/sim.d.ts.map +0 -1
- package/dist/shaders/passes/sim.js +0 -169
- package/dist/shaders/score-api.d.ts +0 -10
- package/dist/shaders/score-api.d.ts.map +0 -1
- package/dist/shaders/score-api.js +0 -114
- package/dist/shaders/shadow-api.d.ts +0 -29
- package/dist/shaders/shadow-api.d.ts.map +0 -1
- package/dist/shaders/shadow-api.js +0 -112
package/src/engine.ts
CHANGED
|
@@ -1068,7 +1068,7 @@ interface ModelInstance {
|
|
|
1068
1068
|
shadowDrawCalls: DrawCall[]
|
|
1069
1069
|
shadowBindGroups: GPUBindGroup[]
|
|
1070
1070
|
mainPerInstanceBindGroup: GPUBindGroup
|
|
1071
|
-
/** Its ObjectLight — rendering layers, its own ambient, its fill — and the CPU copy it
|
|
1071
|
+
/** Its ObjectLight — rendering layers, its own ambient, its fill, its bloom — and the CPU copy it
|
|
1072
1072
|
* is written from. Every model has one: its layers decide its lights. */
|
|
1073
1073
|
lightBuffer: GPUBuffer
|
|
1074
1074
|
objectLight: Float32Array<ArrayBuffer>
|
|
@@ -12666,6 +12666,20 @@ export class Engine {
|
|
|
12666
12666
|
return true
|
|
12667
12667
|
}
|
|
12668
12668
|
|
|
12669
|
+
/**
|
|
12670
|
+
* Whether one model feeds the bloom. Off, its surfaces and outlines write 0
|
|
12671
|
+
* to the bloom mask, as the ground does: its own bright pixels stop glowing,
|
|
12672
|
+
* while a glow from behind it still spreads across it. A model drawn by the
|
|
12673
|
+
* game's own shaders (src/unity) writes its own mask and takes none of this.
|
|
12674
|
+
*/
|
|
12675
|
+
setModelBloom(name: string, on: boolean): boolean {
|
|
12676
|
+
const inst = this.modelInstances.get(name)
|
|
12677
|
+
if (!inst || !this.device) return false
|
|
12678
|
+
inst.objectLight[96] = on ? 1 : 0
|
|
12679
|
+
this.device.queue.writeBuffer(inst.lightBuffer, 96 * 4, inst.objectLight, 96, 4)
|
|
12680
|
+
return true
|
|
12681
|
+
}
|
|
12682
|
+
|
|
12669
12683
|
/** The per-model group: its skinning matrices and its ObjectLight. */
|
|
12670
12684
|
private perInstanceBindGroup(name: string, skinMatrixBuffer: GPUBuffer, light: GPUBuffer): GPUBindGroup {
|
|
12671
12685
|
return this.device.createBindGroup({
|
|
@@ -15431,8 +15445,9 @@ export class Engine {
|
|
|
15431
15445
|
// the cast on the character layer as well as the default one. Words:
|
|
15432
15446
|
// layers [0..3] (y: a stage, which takes the cast's shadow —
|
|
15433
15447
|
// rzRoofedCastShadow), ambient flag [4..7], SH [8..43], fill [44..47],
|
|
15434
|
-
// jelly eyes [48..
|
|
15435
|
-
const objectLight = new Float32Array(
|
|
15448
|
+
// jelly eyes [48..95], bloom [96..99] — see materials/common.ts.
|
|
15449
|
+
const objectLight = new Float32Array(100)
|
|
15450
|
+
objectLight[96] = 1
|
|
15436
15451
|
const objectLayers = new Uint32Array(objectLight.buffer)
|
|
15437
15452
|
objectLayers[0] =
|
|
15438
15453
|
isStage || isPlane || isProp ? RENDERING_LAYER_DEFAULT : (RENDERING_LAYER_DEFAULT | RENDERING_LAYER_CHARACTER) >>> 0
|
|
@@ -19347,7 +19362,8 @@ export class Engine {
|
|
|
19347
19362
|
// shoe's sole's hull cut the upper behind it, and the floor showed through
|
|
19348
19363
|
// as pale lines along the seam. After every surface of this phase it only
|
|
19349
19364
|
// ever blends over finished ones. Same index ranges; own pipeline and
|
|
19350
|
-
// groups 0/2 — group 1 (skinMats) is layout-identical and
|
|
19365
|
+
// groups 0/2 — group 1 (skinMats, ObjectLight) is layout-identical and
|
|
19366
|
+
// stays bound.
|
|
19351
19367
|
if (outlined.length) {
|
|
19352
19368
|
const mirrored = view.args === "mirror"
|
|
19353
19369
|
pass.setPipeline(mirrored ? this.outlineMirrorPipeline : this.outlinePipeline)
|
package/src/graph/slots.ts
CHANGED
|
@@ -250,13 +250,13 @@ ${ID_WRITE} return out;
|
|
|
250
250
|
|
|
251
251
|
var out: FSOut;
|
|
252
252
|
out.color = vec4f(final_color${LIT}${BURN}, outAlpha);
|
|
253
|
-
${CAST}${FOG} out.mask = vec4f(
|
|
253
|
+
${CAST}${FOG} out.mask = vec4f(objectLight.bloom.x, 1.0, _rzSubsurface, out.color.a);
|
|
254
254
|
${ID_WRITE} return out;
|
|
255
255
|
`
|
|
256
256
|
}
|
|
257
257
|
return `${ALBEDO} var out: FSOut;
|
|
258
258
|
out.color = vec4f(final_color${LIT}${BURN}, ${alphaBase});
|
|
259
|
-
${CAST}${FOG} out.mask = vec4f(
|
|
259
|
+
${CAST}${FOG} out.mask = vec4f(objectLight.bloom.x, 1.0, _rzSubsurface, out.color.a);
|
|
260
260
|
${ID_WRITE} return out;
|
|
261
261
|
`
|
|
262
262
|
}
|
|
@@ -93,6 +93,11 @@ fn rzJellyVertex(p: vec3f, joints: vec4<u32>, nw: vec4f) -> vec3f {
|
|
|
93
93
|
}
|
|
94
94
|
`
|
|
95
95
|
|
|
96
|
+
/** A model's ObjectLight as WGSL declares it (see the layout below). One copy
|
|
97
|
+
* for every pass that binds it, so their layouts cannot drift. */
|
|
98
|
+
export const OBJECT_LIGHT_STRUCT_WGSL =
|
|
99
|
+
"struct ObjectLight { layers: vec4u, ambient: vec4f, sh: array<vec4f, 9>, fill: vec4f, jelly: array<vec4f, 12>, bloom: vec4f }"
|
|
100
|
+
|
|
96
101
|
export const COMMON_BINDINGS_WGSL = /* wgsl */ `
|
|
97
102
|
|
|
98
103
|
struct CameraUniforms {
|
|
@@ -299,7 +304,10 @@ fn _rzCastShadow(wp: vec3f) -> f32 {
|
|
|
299
304
|
// [9] the right's
|
|
300
305
|
// [10] left highlight scale x, y, forward push (bind units), 0
|
|
301
306
|
// [11] the right's
|
|
302
|
-
|
|
307
|
+
// bloom.x 1 while it feeds the bloom, 0 when it is left out
|
|
308
|
+
// (Engine.setModelBloom): the bloom mask its surfaces and
|
|
309
|
+
// outlines write.
|
|
310
|
+
${OBJECT_LIGHT_STRUCT_WGSL}
|
|
303
311
|
@group(1) @binding(1) var<uniform> objectLight: ObjectLight;
|
|
304
312
|
|
|
305
313
|
${JELLY_VERTEX_WGSL}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// a string baked at import cannot know what the device said.
|
|
18
18
|
|
|
19
19
|
import { sceneFsOutWgsl, sceneIdPadWgsl } from "./scene-contract"
|
|
20
|
-
import { DISSOLVE_WGSL } from "../materials/common"
|
|
20
|
+
import { DISSOLVE_WGSL, OBJECT_LIGHT_STRUCT_WGSL } from "../materials/common"
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Where `dissolve` sits in the outline's own uniform, in bytes.
|
|
@@ -89,6 +89,8 @@ struct OutlineLights { ambientColor: vec4f, lights: array<OutlineLight, 4>, };
|
|
|
89
89
|
@group(0) @binding(1) var edgeSampler: sampler;
|
|
90
90
|
@group(0) @binding(2) var<uniform> light: OutlineLights;
|
|
91
91
|
@group(1) @binding(0) var<storage, read> skinMats: array<mat4x4f>;
|
|
92
|
+
${OBJECT_LIGHT_STRUCT_WGSL}
|
|
93
|
+
@group(1) @binding(1) var<uniform> objectLight: ObjectLight;
|
|
92
94
|
@group(2) @binding(0) var<uniform> material: MaterialUniforms;
|
|
93
95
|
@group(2) @binding(1) var diffuseTexture: texture_2d<f32>;
|
|
94
96
|
/** A look's outline tint (ShaderGraph.outline.tint): one of its images, white
|
|
@@ -288,7 +290,7 @@ ${sceneFsOutWgsl({ name: "FSOut", aux: "mask" })}
|
|
|
288
290
|
rgb = tex.rgb * tint * mix(material.shadowColor.rgb, rgb, lit);
|
|
289
291
|
}
|
|
290
292
|
out.color = vec4f(rgb, material.edgeColor.a * texA * input.coverage);
|
|
291
|
-
out.mask = vec4f(
|
|
293
|
+
out.mask = vec4f(objectLight.bloom.x, 1.0, 0.0, out.color.a);
|
|
292
294
|
${sceneIdPadWgsl("out")} return out;
|
|
293
295
|
}
|
|
294
296
|
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DISSOLVE_WGSL, JELLY_VERTEX_WGSL } from "../materials/common"
|
|
1
|
+
import { DISSOLVE_WGSL, JELLY_VERTEX_WGSL, OBJECT_LIGHT_STRUCT_WGSL } from "../materials/common"
|
|
2
2
|
|
|
3
3
|
// Shadow map depth pass. Skinned VS + alpha-test FS (depth-only attachment, no
|
|
4
4
|
// color targets): texels where diffuse-texture alpha × material alpha fall below
|
|
@@ -29,7 +29,7 @@ struct MaterialDiffuse {
|
|
|
29
29
|
@group(1) @binding(1) var<uniform> material: MaterialDiffuse;
|
|
30
30
|
// The model's ObjectLight, for its jelly eyes: the map must hold the iris where
|
|
31
31
|
// the colour pass draws it.
|
|
32
|
-
|
|
32
|
+
${OBJECT_LIGHT_STRUCT_WGSL}
|
|
33
33
|
@group(0) @binding(3) var<uniform> objectLight: ObjectLight;
|
|
34
34
|
${JELLY_VERTEX_WGSL}
|
|
35
35
|
|
|
@@ -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 +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"}
|