reze-engine 0.68.29 → 0.68.31
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/engine.d.ts.map +1 -1
- package/dist/engine.js +2 -1
- package/dist/graph/slots.d.ts.map +1 -1
- package/dist/graph/slots.js +6 -1
- package/dist/jelly-eyes.d.ts +4 -0
- package/dist/jelly-eyes.d.ts.map +1 -1
- package/dist/jelly-eyes.js +3 -1
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +0 -13
- package/dist/shaders/passes/depth-prepass.d.ts.map +1 -1
- package/dist/shaders/passes/depth-prepass.js +1 -5
- package/dist/shaders/passes/outline.d.ts.map +1 -1
- package/dist/shaders/passes/outline.js +1 -5
- 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 +3 -6
- package/package.json +1 -1
- package/src/engine.ts +2 -1
- package/src/graph/slots.ts +6 -1
- package/src/jelly-eyes.ts +7 -1
- package/src/shaders/materials/common.ts +0 -13
- package/src/shaders/passes/depth-prepass.ts +1 -5
- package/src/shaders/passes/outline.ts +1 -5
- package/src/shaders/passes/shadow.ts +3 -6
- package/dist/_dbg-loader.mjs +0 -1100
package/src/jelly-eyes.ts
CHANGED
|
@@ -31,6 +31,9 @@ export interface JellyEyeOptions {
|
|
|
31
31
|
/** The idle taps: a ripple every 4–8 s while nothing else moves them.
|
|
32
32
|
* Default true; false leaves only what her blinks and motion set off. */
|
|
33
33
|
idle?: boolean
|
|
34
|
+
/** Whether her head's motion knocks them: a turn, a bob, a step. Default
|
|
35
|
+
* true; false leaves only her blinks and the idle taps. */
|
|
36
|
+
motion?: boolean
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
// The closing morphs, by the names MMD, VRoid and the usual converters give
|
|
@@ -254,6 +257,7 @@ const newState = (): EyeState => ({
|
|
|
254
257
|
export class JellyEyes {
|
|
255
258
|
strength: number
|
|
256
259
|
idle: boolean
|
|
260
|
+
motion: boolean
|
|
257
261
|
// Scene time stepped so far, and the idle taps: how many, and when the next.
|
|
258
262
|
private clock = 0
|
|
259
263
|
private taps = 0
|
|
@@ -282,6 +286,7 @@ export class JellyEyes {
|
|
|
282
286
|
constructor(model: Model, options: JellyEyeOptions) {
|
|
283
287
|
this.strength = clampStrength(options.strength)
|
|
284
288
|
this.idle = options.idle ?? true
|
|
289
|
+
this.motion = options.motion ?? true
|
|
285
290
|
const bones = model.getSkeleton().bones
|
|
286
291
|
const index = (name: string) => bones.findIndex((b) => b.name === name)
|
|
287
292
|
const both = index("両目")
|
|
@@ -354,7 +359,8 @@ export class JellyEyes {
|
|
|
354
359
|
// Only her motion — the head turning and moving (the inertia) — and her
|
|
355
360
|
// blinks do.
|
|
356
361
|
look(head, null, s.look)
|
|
357
|
-
const
|
|
362
|
+
const moved = this.motion ? Math.tanh(Math.hypot(...this.offset(s, e)) / PULSE_REF) : 0
|
|
363
|
+
const knock = seek ? 0 : Math.max(this.tapKnock, moved)
|
|
358
364
|
const squashTarget = MOTION_SQUASH * knock
|
|
359
365
|
if (seek) {
|
|
360
366
|
// Landing on a pose is no blink: the spring rests where it lands.
|
|
@@ -191,18 +191,6 @@ struct VertexOutput {
|
|
|
191
191
|
// At rest skinMats are identity so restPos == worldPos, which is why existing noise-
|
|
192
192
|
// scale constants stay valid without retuning.
|
|
193
193
|
@location(3) restPos: vec3f,
|
|
194
|
-
/**
|
|
195
|
-
* This TRIANGLE's dissolve threshold.
|
|
196
|
-
*
|
|
197
|
-
* FLAT, so every fragment of a face shares the provoking vertex's value and
|
|
198
|
-
* the face goes as a unit — the mesh comes apart in triangles that light and
|
|
199
|
-
* leave in turn, rather than in a scatter that crosses them. Computed in the
|
|
200
|
-
* vertex stage from the bind-pose attribute, which is what lets the depth
|
|
201
|
-
* prepass, the shadow map and the outline hull reach the same number for the
|
|
202
|
-
* same face: one function, one input, one provoking vertex, one answer. They
|
|
203
|
-
* must agree — a pass that disagrees punches holes through her.
|
|
204
|
-
*/
|
|
205
|
-
@location(4) @interpolate(flat) faceT: f32,
|
|
206
194
|
/** The scene fog's two amounts, computed PER VERTEX as the game does — see
|
|
207
195
|
* Engine.setSceneFog — and interpolated across the face. */
|
|
208
196
|
@location(5) fog: vec2f,
|
|
@@ -484,7 +472,6 @@ const COMMON_VS_WGSL = /* wgsl */ `
|
|
|
484
472
|
output.uv = uv;
|
|
485
473
|
output.worldPos = skinnedPos.xyz;
|
|
486
474
|
output.restPos = position;
|
|
487
|
-
output.faceT = rz_dissolve_threshold(position);
|
|
488
475
|
let viewZ = (camera.view * vec4f(skinnedPos.xyz, 1.0)).z;
|
|
489
476
|
output.fog = vec2f(
|
|
490
477
|
_rzFogAmount(viewZ, skinnedPos.y, light.fog[0], light.fog[1]),
|
|
@@ -69,9 +69,6 @@ struct VSOut {
|
|
|
69
69
|
// The bind-pose position, carried for one reason: the dissolve test below has
|
|
70
70
|
// to be the SAME test the colour pass runs, and that one is in object space.
|
|
71
71
|
@location(1) restPos: vec3f,
|
|
72
|
-
/** The triangle's own threshold, flat — see the material VertexOutput. This
|
|
73
|
-
* pass must throw away exactly the faces the colour pass does. */
|
|
74
|
-
@location(2) @interpolate(flat) faceT: f32,
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
@vertex fn vs(
|
|
@@ -94,7 +91,6 @@ struct VSOut {
|
|
|
94
91
|
o.position = camera.projection * camera.view * vec4f(skinned.xyz, 1.0);
|
|
95
92
|
o.uv = uv;
|
|
96
93
|
o.restPos = position;
|
|
97
|
-
o.faceT = rz_dissolve_threshold(position);
|
|
98
94
|
return o;
|
|
99
95
|
}
|
|
100
96
|
|
|
@@ -121,7 +117,7 @@ override CUTOFF: f32 = 0.5;
|
|
|
121
117
|
// the colour pass throws away would punch holes that occlude the floor behind
|
|
122
118
|
// her: you would see sky through her, which is the failure this line exists
|
|
123
119
|
// to prevent.
|
|
124
|
-
if (material.dissolve < 0.9995 && in.
|
|
120
|
+
if (material.dissolve < 0.9995 && rz_dissolve_threshold(in.restPos) > material.dissolve) { discard; }
|
|
125
121
|
var out: PrepassOut;
|
|
126
122
|
out.color = vec4f(0.0);
|
|
127
123
|
out.mask = vec4f(0.0);
|
|
@@ -104,9 +104,6 @@ struct VertexOutput {
|
|
|
104
104
|
* the depth prepass measure against, so all three agree about which flakes
|
|
105
105
|
* are gone. */
|
|
106
106
|
@location(1) restPos: vec3f,
|
|
107
|
-
/** The triangle's own threshold, flat — see the material VertexOutput. The
|
|
108
|
-
* hull traces the body's faces, so it has to lose the same ones. */
|
|
109
|
-
@location(2) @interpolate(flat) faceT: f32,
|
|
110
107
|
/** How much of a pixel-wide line this one really is (1 = all of it): a line
|
|
111
108
|
* held at the minimum width fades by what it was short. */
|
|
112
109
|
@location(3) coverage: f32,
|
|
@@ -246,7 +243,6 @@ fn safe_normal2(v: vec2f) -> vec2f {
|
|
|
246
243
|
output.position = vec4f(clipPos.xy + ndc * w, clipPos.z, clipPos.w);
|
|
247
244
|
output.uv = uv;
|
|
248
245
|
output.restPos = position;
|
|
249
|
-
output.faceT = rz_dissolve_threshold(position);
|
|
250
246
|
return output;
|
|
251
247
|
}
|
|
252
248
|
|
|
@@ -272,7 +268,7 @@ ${sceneFsOutWgsl({ name: "FSOut", aux: "mask" })}
|
|
|
272
268
|
// The same test the colour pass and the depth prepass run, against the same
|
|
273
269
|
// bind-pose position — three passes, one rule, or they disagree about which
|
|
274
270
|
// pieces are still there.
|
|
275
|
-
if (material.dissolve < 0.9995 && input.
|
|
271
|
+
if (material.dissolve < 0.9995 && rz_dissolve_threshold(input.restPos) > material.dissolve) { discard; }
|
|
276
272
|
let tex = textureSample(diffuseTexture, edgeSampler, input.uv);
|
|
277
273
|
let texA = tex.a;
|
|
278
274
|
if (texA < 0.05) {
|
|
@@ -36,11 +36,9 @@ ${JELLY_VERTEX_WGSL}
|
|
|
36
36
|
struct VSOut {
|
|
37
37
|
@builtin(position) position: vec4f,
|
|
38
38
|
@location(0) uv: vec2f,
|
|
39
|
-
/** Bind-pose position, for the dissolve test — object space, as everywhere.
|
|
39
|
+
/** Bind-pose position, for the dissolve test — object space, as everywhere.
|
|
40
|
+
* A flake that is gone must stop casting. */
|
|
40
41
|
@location(1) restPos: vec3f,
|
|
41
|
-
/** The triangle's own threshold, flat — see the material VertexOutput. A
|
|
42
|
-
* face that is gone must stop casting, and stop as a whole face. */
|
|
43
|
-
@location(2) @interpolate(flat) faceT: f32,
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
@vertex fn vs(@location(0) position: vec3f, @location(1) normal: vec3f, @location(2) uv: vec2f,
|
|
@@ -56,7 +54,6 @@ struct VSOut {
|
|
|
56
54
|
out.position = lp.viewProj * vec4f(sp.xyz, 1.0);
|
|
57
55
|
out.uv = uv;
|
|
58
56
|
out.restPos = position;
|
|
59
|
-
out.faceT = rz_dissolve_threshold(position);
|
|
60
57
|
return out;
|
|
61
58
|
}
|
|
62
59
|
|
|
@@ -66,6 +63,6 @@ struct VSOut {
|
|
|
66
63
|
// The dissolve, run as the colour pass runs it. A flake that is gone stops
|
|
67
64
|
// casting: without this she leaves a whole shadow standing on the floor while
|
|
68
65
|
// her body is in the air.
|
|
69
|
-
if (material.dissolve < 0.9995 && in.
|
|
66
|
+
if (material.dissolve < 0.9995 && rz_dissolve_threshold(in.restPos) > material.dissolve) { discard; }
|
|
70
67
|
}
|
|
71
68
|
`
|