reze-engine 0.68.16 → 0.68.18
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 +15 -5
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +118 -71
- package/dist/graph/render-class.d.ts +5 -3
- package/dist/graph/render-class.d.ts.map +1 -1
- package/dist/graph/slots.d.ts.map +1 -1
- package/dist/graph/slots.js +17 -0
- package/dist/graph/style-group.d.ts +18 -0
- package/dist/graph/style-group.d.ts.map +1 -1
- package/dist/shaders/passes/scene-contract.d.ts +8 -0
- package/dist/shaders/passes/scene-contract.d.ts.map +1 -1
- package/dist/shaders/passes/scene-contract.js +14 -0
- package/package.json +1 -1
- package/src/engine.ts +124 -67
- package/src/graph/render-class.ts +5 -3
- package/src/graph/slots.ts +17 -0
- package/src/graph/style-group.ts +18 -0
- package/src/shaders/passes/scene-contract.ts +24 -0
package/dist/engine.js
CHANGED
|
@@ -149,6 +149,15 @@ const PRESET_NAME_HINTS = [
|
|
|
149
149
|
],
|
|
150
150
|
],
|
|
151
151
|
];
|
|
152
|
+
// The eye parts the game MULTIPLIES over the iris rather than lays over it: an
|
|
153
|
+
// eye shadow, a soft light-grey band at partial alpha whose job is to darken the
|
|
154
|
+
// top of the eye. They stay eye parts — the stencil, the order and the graph are
|
|
155
|
+
// the eye's — and take blend "multiply" per material (blendByMaterial).
|
|
156
|
+
const EYE_SHADOW_HINTS = ["目影", "眼影", "eyeshadow", "eye_shadow", "eye shadow"];
|
|
157
|
+
function isEyeShadow(materialName) {
|
|
158
|
+
const lower = materialName.toLowerCase();
|
|
159
|
+
return EYE_SHADOW_HINTS.some((hint) => lower.includes(hint));
|
|
160
|
+
}
|
|
152
161
|
// Whole names that are body parts — skin by another name. Whole, never
|
|
153
162
|
// substrings: 手 alone is a hand, inside 手套 (gloves) or 手镯 (a bracelet) it is
|
|
154
163
|
// what the hand wears; 足 is a leg, 足袋 a sock.
|
|
@@ -6744,6 +6753,7 @@ export class Engine {
|
|
|
6744
6753
|
// blend: "additive". See scene-contract's material-additive.
|
|
6745
6754
|
this.sceneTargetsAdditive = sceneTargetsFor("material-additive", this.sceneFormats);
|
|
6746
6755
|
this.sceneTargetsPremultiplied = sceneTargetsFor("material-premultiplied", this.sceneFormats);
|
|
6756
|
+
this.sceneTargetsMultiply = sceneTargetsFor("material-multiply", this.sceneFormats);
|
|
6747
6757
|
this.fullVertexBufferLayouts = fullVertexBuffers;
|
|
6748
6758
|
// Slot 3 stays empty: the outline hull binds its own stream there between
|
|
6749
6759
|
// two material draws, and a material reading slot 3 would pick it up.
|
|
@@ -15549,6 +15559,7 @@ export class Engine {
|
|
|
15549
15559
|
const info = PRESET_GROUP_INFO[preset];
|
|
15550
15560
|
if (!info)
|
|
15551
15561
|
continue;
|
|
15562
|
+
const shadows = preset === "eye" ? materials.filter(isEyeShadow) : [];
|
|
15552
15563
|
groups.push({
|
|
15553
15564
|
id: preset,
|
|
15554
15565
|
label: info.graph.name,
|
|
@@ -15556,6 +15567,7 @@ export class Engine {
|
|
|
15556
15567
|
graph: info.graph,
|
|
15557
15568
|
renderClass: info.renderClass,
|
|
15558
15569
|
alphaMode: info.alphaMode,
|
|
15570
|
+
...(shadows.length ? { blendByMaterial: Object.fromEntries(shadows.map((m) => [m, "multiply"])) } : {}),
|
|
15559
15571
|
});
|
|
15560
15572
|
}
|
|
15561
15573
|
return this.applyStyleGroups(modelName, groups);
|
|
@@ -15634,22 +15646,26 @@ export class Engine {
|
|
|
15634
15646
|
await Promise.all(groups.map(async (g) => {
|
|
15635
15647
|
const renderClass = g.renderClass ?? "auto";
|
|
15636
15648
|
const alphaMode = g.alphaMode ?? "opaque";
|
|
15637
|
-
const
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
this.
|
|
15651
|
-
|
|
15652
|
-
|
|
15649
|
+
const groupBlend = g.blend ?? "over";
|
|
15650
|
+
// Every blend its members draw with, as the install compiles them.
|
|
15651
|
+
const blends = new Set([groupBlend, ...g.materials.map((m) => g.blendByMaterial?.[m] ?? groupBlend)]);
|
|
15652
|
+
await Promise.all([...blends].map(async (blend) => {
|
|
15653
|
+
let result;
|
|
15654
|
+
try {
|
|
15655
|
+
result = compileGraph(g.graph, { renderClass, alphaMode, blend });
|
|
15656
|
+
}
|
|
15657
|
+
catch {
|
|
15658
|
+
return;
|
|
15659
|
+
}
|
|
15660
|
+
if (!result.ok)
|
|
15661
|
+
return;
|
|
15662
|
+
const module = this.cachedShaderModule(result.wgsl, `style group: ${g.id} (${renderClass}${blend === groupBlend ? "" : `, ${blend}`})`);
|
|
15663
|
+
await Promise.all([
|
|
15664
|
+
this.createRenderClassPipeline(renderClass, module, false, true, blend),
|
|
15665
|
+
this.createRenderClassPipeline(renderClass, module, false, false, blend),
|
|
15666
|
+
renderClass === "hair" ? this.createRenderClassPipeline(renderClass, module, true, true, blend) : null,
|
|
15667
|
+
]).catch(() => { });
|
|
15668
|
+
}));
|
|
15653
15669
|
}));
|
|
15654
15670
|
}
|
|
15655
15671
|
/** Add or replace a single style group by id. `opts` may carry a `previewNode` for the
|
|
@@ -15862,25 +15878,20 @@ export class Engine {
|
|
|
15862
15878
|
this.dissolveCycles.set(modelName, cycle);
|
|
15863
15879
|
return true;
|
|
15864
15880
|
}
|
|
15865
|
-
/** The
|
|
15866
|
-
|
|
15881
|
+
/** The models an effect's rzSubject(i) reads, in its own index order: the
|
|
15882
|
+
* ones it is aimed at, or the whole cast when it is aimed at nobody. */
|
|
15883
|
+
castSubjectNames(subjects = null) {
|
|
15884
|
+
const names = [];
|
|
15867
15885
|
let n = 0;
|
|
15868
|
-
let local = 0;
|
|
15869
|
-
let found = null;
|
|
15870
15886
|
this.forEachInstance((inst) => {
|
|
15871
|
-
if (
|
|
15887
|
+
if (n >= MAX_EFFECT_SUBJECTS || inst.isStage || inst.isPlane || inst.isProp || !inst.model.visible)
|
|
15872
15888
|
return;
|
|
15873
15889
|
n++;
|
|
15874
|
-
// The effect's OWN index, which is what its shaders count in: an effect
|
|
15875
|
-
// aimed at the third dancer finds her at 0, so a #dissolve on it takes HER
|
|
15876
|
-
// apart rather than whoever stands at the head of the cast.
|
|
15877
15890
|
if (subjects && !subjects.includes(inst.name))
|
|
15878
15891
|
return;
|
|
15879
|
-
|
|
15880
|
-
found = inst.name;
|
|
15881
|
-
local++;
|
|
15892
|
+
names.push(inst.name);
|
|
15882
15893
|
});
|
|
15883
|
-
return
|
|
15894
|
+
return names;
|
|
15884
15895
|
}
|
|
15885
15896
|
/** One effect's four durations: its dials where it declares them, the
|
|
15886
15897
|
* constants it wrote where it does not. */
|
|
@@ -15900,8 +15911,8 @@ export class Engine {
|
|
|
15900
15911
|
*
|
|
15901
15912
|
* Two things ask for one. A cycle set on a model (setModelDissolveCycle) runs
|
|
15902
15913
|
* on the scene clock and repeats, as it always has. An effect declaring
|
|
15903
|
-
* `#dissolve` takes
|
|
15904
|
-
* it is aimed at, the
|
|
15914
|
+
* `#dissolve` takes every one of ITS subjects apart on its own terms — the
|
|
15915
|
+
* models it is aimed at, the whole cast when it is aimed at nobody in
|
|
15905
15916
|
* particular: scheduled, the cycle on each clip's clock with her whole between
|
|
15906
15917
|
* clips; unscheduled, the same repeating cycle as before. Where both ask, the more dissolved wins — two
|
|
15907
15918
|
* answers about one body, and half a body is not one of them.
|
|
@@ -15916,16 +15927,18 @@ export class Engine {
|
|
|
15916
15927
|
if (!fx.dissolve)
|
|
15917
15928
|
continue;
|
|
15918
15929
|
const cycle = dissolveCycleOf(this.dissolveTimingsOf(fx, fx.dissolve));
|
|
15919
|
-
|
|
15920
|
-
if (!cycle || !subject)
|
|
15930
|
+
if (!cycle)
|
|
15921
15931
|
continue;
|
|
15932
|
+
let v;
|
|
15922
15933
|
if (fx.window && fx.window.length > 0) {
|
|
15923
15934
|
transport ?? (transport = this.transportTime());
|
|
15924
|
-
|
|
15935
|
+
v = scheduledDissolve(fx.window, cycle, transport);
|
|
15925
15936
|
}
|
|
15926
15937
|
else {
|
|
15927
|
-
|
|
15938
|
+
v = sampleDissolveCycle(cycle, this.sceneClock);
|
|
15928
15939
|
}
|
|
15940
|
+
for (const subject of this.castSubjectNames(fx.subjects))
|
|
15941
|
+
put(subject, v);
|
|
15929
15942
|
}
|
|
15930
15943
|
for (const name of this.dissolveTouched)
|
|
15931
15944
|
if (!want.has(name))
|
|
@@ -15983,70 +15996,94 @@ export class Engine {
|
|
|
15983
15996
|
// arrive twice — once as the model lands and again once its sidecar has
|
|
15984
15997
|
// decoded — and without this the second apply refreshed the definition and
|
|
15985
15998
|
// silently kept the empty slots from the first.
|
|
15999
|
+
// The blends its members draw with: the group's own first, then any a
|
|
16000
|
+
// member keys for itself (blendByMaterial) — one compile each, the graph and
|
|
16001
|
+
// its slots the same in all of them.
|
|
16002
|
+
const groupBlend = group.blend ?? "over";
|
|
16003
|
+
const blends = [
|
|
16004
|
+
groupBlend,
|
|
16005
|
+
...new Set(group.materials.map((m) => group.blendByMaterial?.[m] ?? groupBlend).filter((b) => b !== groupBlend)),
|
|
16006
|
+
];
|
|
15986
16007
|
const signature = JSON.stringify({
|
|
15987
16008
|
g: group.graph,
|
|
15988
16009
|
rc: renderClass,
|
|
15989
16010
|
am: alphaMode,
|
|
15990
|
-
bl:
|
|
16011
|
+
bl: groupBlend,
|
|
15991
16012
|
o: opts?.previewNode ?? null,
|
|
15992
16013
|
im: group.images?.length ?? 0,
|
|
15993
16014
|
ibm: Object.keys(group.imagesByMaterial ?? {}).sort(),
|
|
16015
|
+
bls: blends,
|
|
15994
16016
|
});
|
|
15995
16017
|
const existing = inst.styleGroups.get(group.id);
|
|
15996
16018
|
if (existing && existing.signature === signature) {
|
|
15997
16019
|
existing.group = group; // refresh def (label/materials) without recompiling
|
|
15998
16020
|
return { ok: true, diagnostics: [], slotMap: existing.slotMap };
|
|
15999
16021
|
}
|
|
16000
|
-
const
|
|
16001
|
-
|
|
16002
|
-
|
|
16022
|
+
const compiled = blends.map((b) => compileGraph(group.graph, { ...opts, renderClass, alphaMode, blend: b }));
|
|
16023
|
+
const result = compiled[0];
|
|
16024
|
+
const failed = compiled.find((r) => !r.ok);
|
|
16025
|
+
if (failed)
|
|
16026
|
+
return { ok: false, diagnostics: failed.diagnostics, slotMap: failed.slotMap };
|
|
16003
16027
|
const generation = (inst.styleGroupGen.get(group.id) ?? 0) + 1;
|
|
16004
16028
|
inst.styleGroupGen.set(group.id, generation);
|
|
16005
|
-
this.device.pushErrorScope("validation");
|
|
16006
|
-
const module = this.cachedShaderModule(result.wgsl, `style group: ${group.id} (${renderClass})`);
|
|
16007
|
-
const scopePromise = this.device.popErrorScope();
|
|
16008
|
-
// EVERY VARIANT AT ONCE, and the module's diagnostics read beside them
|
|
16009
|
-
// rather than first: the compiles run in parallel in the GPU process, and
|
|
16010
|
-
// awaiting each in turn (and the diagnostics before any) made a group cost
|
|
16011
|
-
// the sum of its pipelines instead of the longest.
|
|
16012
|
-
const blend = group.blend ?? "over";
|
|
16013
16029
|
// The single-sided twins a draw of this group will ask for (sidedPipeline),
|
|
16014
16030
|
// built with their pipelines rather than synchronously at the first draw.
|
|
16015
16031
|
const singleSided = inst.drawCalls.some((dc) => !dc.doubleSided && group.materials.includes(dc.materialName));
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16032
|
+
// EVERY VARIANT AT ONCE, and the module's diagnostics read beside them
|
|
16033
|
+
// rather than first: the compiles run in parallel in the GPU process, and
|
|
16034
|
+
// awaiting each in turn (and the diagnostics before any) made a group cost
|
|
16035
|
+
// the sum of its pipelines instead of the longest. One module per blend,
|
|
16036
|
+
// each with its variants.
|
|
16037
|
+
const builds = compiled.map((r, i) => {
|
|
16038
|
+
const blend = blends[i];
|
|
16039
|
+
this.device.pushErrorScope("validation");
|
|
16040
|
+
const module = this.cachedShaderModule(r.wgsl, `style group: ${group.id} (${renderClass}${blend === blends[0] ? "" : `, ${blend}`})`);
|
|
16041
|
+
const scopePromise = this.device.popErrorScope();
|
|
16042
|
+
const variant = (overEyes, depthWrite) => this.createRenderClassPipeline(renderClass, module, overEyes, depthWrite, blend).then(async (p) => {
|
|
16043
|
+
if (singleSided)
|
|
16044
|
+
await this.buildSidedTwin(p, false);
|
|
16045
|
+
return p;
|
|
16046
|
+
});
|
|
16047
|
+
const variants = Promise.all([
|
|
16048
|
+
variant(false, true),
|
|
16049
|
+
// The depth-write-off twin: stage transparency draws with it (see
|
|
16050
|
+
// pipelineForDrawCall), and a future OIT path would too.
|
|
16051
|
+
variant(false, false),
|
|
16052
|
+
renderClass === "hair" ? variant(true, true) : undefined,
|
|
16053
|
+
]);
|
|
16054
|
+
// Handled below either way; this keeps a rejection off the console while
|
|
16055
|
+
// the diagnostics are read.
|
|
16056
|
+
variants.catch(() => { });
|
|
16057
|
+
return { wgsl: r.wgsl, module, scopePromise, variants };
|
|
16020
16058
|
});
|
|
16021
|
-
const variants = Promise.all([
|
|
16022
|
-
variant(false, true),
|
|
16023
|
-
// The depth-write-off twin: stage transparency draws with it (see
|
|
16024
|
-
// pipelineForDrawCall), and a future OIT path would too.
|
|
16025
|
-
variant(false, false),
|
|
16026
|
-
renderClass === "hair" ? variant(true, true) : undefined,
|
|
16027
|
-
]);
|
|
16028
|
-
// Handled below either way; this keeps a rejection off the console while
|
|
16029
|
-
// the diagnostics are read.
|
|
16030
|
-
variants.catch(() => { });
|
|
16031
|
-
const [info, scopeError] = await Promise.all([module.getCompilationInfo(), scopePromise]);
|
|
16032
16059
|
const diagnostics = [...result.diagnostics];
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16060
|
+
let scopeError = null;
|
|
16061
|
+
for (const build of builds) {
|
|
16062
|
+
const [info, error] = await Promise.all([build.module.getCompilationInfo(), build.scopePromise]);
|
|
16063
|
+
scopeError ?? (scopeError = error);
|
|
16064
|
+
for (const msg of info.messages) {
|
|
16065
|
+
if (msg.type !== "error")
|
|
16066
|
+
continue;
|
|
16067
|
+
diagnostics.push({ severity: "error", nodeId: nodeIdForWgslLine(build.wgsl, msg.lineNum), message: `WGSL: ${msg.message}` });
|
|
16068
|
+
}
|
|
16037
16069
|
}
|
|
16038
16070
|
if (diagnostics.some((d) => d.severity === "error") || scopeError) {
|
|
16039
16071
|
if (scopeError && !diagnostics.some((d) => d.severity === "error"))
|
|
16040
16072
|
diagnostics.push({ severity: "error", message: `WGSL: ${scopeError.message}` });
|
|
16041
|
-
|
|
16073
|
+
for (const build of builds)
|
|
16074
|
+
this.forgetShaderModule(build.wgsl);
|
|
16042
16075
|
return { ok: false, diagnostics, slotMap: result.slotMap };
|
|
16043
16076
|
}
|
|
16044
16077
|
let pipeline;
|
|
16045
16078
|
let pipelineNoDepthWrite;
|
|
16046
16079
|
let overEyesPipeline;
|
|
16080
|
+
const byBlend = {};
|
|
16047
16081
|
try {
|
|
16048
|
-
;
|
|
16049
|
-
[pipeline, pipelineNoDepthWrite, overEyesPipeline] =
|
|
16082
|
+
const sets = await Promise.all(builds.map((build) => build.variants));
|
|
16083
|
+
[pipeline, pipelineNoDepthWrite, overEyesPipeline] = sets[0];
|
|
16084
|
+
sets.slice(1).forEach(([p, noDepth, overEyes], i) => {
|
|
16085
|
+
byBlend[blends[i + 1]] = { pipeline: p, pipelineNoDepthWrite: noDepth, overEyesPipeline: overEyes };
|
|
16086
|
+
});
|
|
16050
16087
|
}
|
|
16051
16088
|
catch (e) {
|
|
16052
16089
|
diagnostics.push({ severity: "error", message: `pipeline creation failed: ${e.message}` });
|
|
@@ -16073,6 +16110,7 @@ export class Engine {
|
|
|
16073
16110
|
pipeline,
|
|
16074
16111
|
pipelineNoDepthWrite,
|
|
16075
16112
|
overEyesPipeline,
|
|
16113
|
+
byBlend,
|
|
16076
16114
|
uniformBuffer,
|
|
16077
16115
|
images: this.uploadGroupImages(group),
|
|
16078
16116
|
imagesByMaterial: group.imagesByMaterial
|
|
@@ -16310,7 +16348,9 @@ export class Engine {
|
|
|
16310
16348
|
? this.sceneTargetsAdditive
|
|
16311
16349
|
: blend === "premultiplied"
|
|
16312
16350
|
? this.sceneTargetsPremultiplied
|
|
16313
|
-
:
|
|
16351
|
+
: blend === "multiply"
|
|
16352
|
+
? this.sceneTargetsMultiply
|
|
16353
|
+
: this.sceneTargets,
|
|
16314
16354
|
},
|
|
16315
16355
|
depthStencil,
|
|
16316
16356
|
};
|
|
@@ -16516,7 +16556,8 @@ export class Engine {
|
|
|
16516
16556
|
if (dc.groupId) {
|
|
16517
16557
|
const install = inst.styleGroups.get(dc.groupId);
|
|
16518
16558
|
if (install) {
|
|
16519
|
-
|
|
16559
|
+
const own = this.memberPipelines(install, dc);
|
|
16560
|
+
return stageGlass ? own.pipelineNoDepthWrite : own.pipeline;
|
|
16520
16561
|
}
|
|
16521
16562
|
}
|
|
16522
16563
|
return stageGlass ? this.neutralPipelineNoDepthWrite : this.neutralPipeline;
|
|
@@ -16907,7 +16948,13 @@ export class Engine {
|
|
|
16907
16948
|
if (!dc.groupId)
|
|
16908
16949
|
return null;
|
|
16909
16950
|
const install = inst.styleGroups.get(dc.groupId);
|
|
16910
|
-
return install?.renderClass === "hair" ? (install.overEyesPipeline ?? null) : null;
|
|
16951
|
+
return install?.renderClass === "hair" ? (this.memberPipelines(install, dc).overEyesPipeline ?? null) : null;
|
|
16952
|
+
}
|
|
16953
|
+
/** A member's pipelines: those of the blend it keys for itself, else the
|
|
16954
|
+
* group's (StyleGroup.blendByMaterial). */
|
|
16955
|
+
memberPipelines(install, dc) {
|
|
16956
|
+
const blend = install.group.blendByMaterial?.[dc.materialName];
|
|
16957
|
+
return (blend && install.byBlend[blend]) || install;
|
|
16911
16958
|
}
|
|
16912
16959
|
updateCameraUniforms() {
|
|
16913
16960
|
const viewMatrix = this.camera.getViewMatrix();
|
|
@@ -6,9 +6,11 @@ export type AlphaMode = "opaque" | "hashed";
|
|
|
6
6
|
/** How a group's colour meets the frame. "over" is the ordinary alpha blend;
|
|
7
7
|
* "additive" adds its light and never reads alpha; "premultiplied" takes a
|
|
8
8
|
* colour already weighted by its own coverage (One, OneMinusSrcAlpha) — a
|
|
9
|
-
* game's glass, whose reflection must not fade with its transparency
|
|
10
|
-
*
|
|
11
|
-
|
|
9
|
+
* game's glass, whose reflection must not fade with its transparency;
|
|
10
|
+
* "multiply" filters what is already there by the surface's colour
|
|
11
|
+
* (DstColor Zero) — a game's eye shadow, a tint over the iris that can only
|
|
12
|
+
* darken it. See StyleGroup.blend. */
|
|
13
|
+
export type StyleBlend = "over" | "additive" | "premultiplied" | "multiply";
|
|
12
14
|
/** Descriptive manifest for hosts (reze-design) so the render-class picker is data-driven
|
|
13
15
|
* instead of hardcoding strings. The effect implementations stay engine-side; this only
|
|
14
16
|
* describes them. `pairsWith` = the effect needs a counterpart class present to show. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-class.d.ts","sourceRoot":"","sources":["../../src/graph/render-class.ts"],"names":[],"mappings":"AAMA,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAEjD;0FAC0F;AAC1F,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE3C
|
|
1
|
+
{"version":3,"file":"render-class.d.ts","sourceRoot":"","sources":["../../src/graph/render-class.ts"],"names":[],"mappings":"AAMA,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAEjD;0FAC0F;AAC1F,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE3C;;;;;;uCAMuC;AACvC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,eAAe,GAAG,UAAU,CAAA;AAE3E;;0FAE0F;AAC1F,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,WAAW,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,SAAS,eAAe,EASpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/graph/slots.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/graph/slots.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAqPxE;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,OAAO,EAC7B,UAAU,UAAQ,EAClB,KAAK,GAAE,UAAmB,EAC1B,UAAU,UAAO,GAChB,MAAM,CAgBR"}
|
package/dist/graph/slots.js
CHANGED
|
@@ -205,6 +205,23 @@ function epilogue(renderClass, alphaMode, hasOpacity, blend, takesLight) {
|
|
|
205
205
|
const FOG = takesLight
|
|
206
206
|
? ` out.color = vec4f(mix(mix(out.color.rgb, light.fog[0].rgb${fogOver}, input.fog.x), light.fog[2].rgb${fogOver}, input.fog.y), out.color.a);\n`
|
|
207
207
|
: "";
|
|
208
|
+
// MULTIPLY WRITES A FILTER, NOT A COLOUR. What it darkens was lit already —
|
|
209
|
+
// the iris under an eye shadow took the sun and its own glow — so the shade
|
|
210
|
+
// takes no light of its own: lit, a light-grey shadow came out brighter than
|
|
211
|
+
// the eye and multiplied it WHITER. The multiplier is the surface's own
|
|
212
|
+
// colour, its texture times the PMX diffuse as every look's base is, or what
|
|
213
|
+
// an emission-only graph paints, which is already a colour no light reaches.
|
|
214
|
+
// Faded by coverage here (the blend reads no alpha), capped at 1 so it can
|
|
215
|
+
// only darken, and with no lamps, burn or fog — all three are light. The aux
|
|
216
|
+
// is kept by the blend, so the mask written is never stored.
|
|
217
|
+
if (blend === "multiply") {
|
|
218
|
+
const filter = takesLight ? "tex_color * material.diffuseColor" : "final_color";
|
|
219
|
+
return ` var out: FSOut;
|
|
220
|
+
out.color = vec4f(mix(vec3f(1.0), saturate(${filter}), ${alphaBase}), ${alphaBase});
|
|
221
|
+
out.mask = vec4f(0.0);
|
|
222
|
+
${ID_WRITE} return out;
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
208
225
|
if (renderClass === "hair") {
|
|
209
226
|
return `${ALBEDO} var outAlpha = ${alphaBase};
|
|
210
227
|
if (IS_OVER_EYES) { outAlpha = ${alphaBase} * 0.25; }
|
|
@@ -23,8 +23,26 @@ export type StyleGroup = {
|
|
|
23
23
|
* nebula and a starfield on cylinders round the scene, their alpha 0 across
|
|
24
24
|
* the whole image because additive blending does not look at it. Laid over,
|
|
25
25
|
* they are invisible.
|
|
26
|
+
*
|
|
27
|
+
* "multiply" is a FILTER: the frame behind is scaled by the surface's own
|
|
28
|
+
* colour, faded by its alpha, and nothing is added — see `blendByMaterial`
|
|
29
|
+
* for the eye shadow it exists for.
|
|
26
30
|
*/
|
|
27
31
|
blend?: StyleBlend;
|
|
32
|
+
/**
|
|
33
|
+
* `blend`, but PER MATERIAL — for a member that meets the frame unlike the
|
|
34
|
+
* rest of its group.
|
|
35
|
+
*
|
|
36
|
+
* An eye shadow (目影) is an EYE part: it sits on the iris, stamps the same
|
|
37
|
+
* stencil the see-through hair reads, and draws in the eye's order. What sets
|
|
38
|
+
* it apart is only how it lands — the game multiplies it, a soft grey band
|
|
39
|
+
* that darkens the top of the iris, where laid over it veils the eye white.
|
|
40
|
+
* Keyed here it stays in the eye's group, shading on the eye's graph, and
|
|
41
|
+
* draws through a pipeline of its own blend.
|
|
42
|
+
*
|
|
43
|
+
* A material with no entry takes `blend`.
|
|
44
|
+
*/
|
|
45
|
+
blendByMaterial?: Record<string, StyleBlend>;
|
|
28
46
|
/**
|
|
29
47
|
* Extra image maps for this group's shading, up to four.
|
|
30
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-group.d.ts","sourceRoot":"","sources":["../../src/graph/style-group.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,MAAM,UAAU,GAAG;IACvB,wFAAwF;IACxF,EAAE,EAAE,MAAM,CAAA;IACV;2CACuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,sFAAsF;IACtF,KAAK,EAAE,WAAW,CAAA;IAClB,uEAAuE;IACvE,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB
|
|
1
|
+
{"version":3,"file":"style-group.d.ts","sourceRoot":"","sources":["../../src/graph/style-group.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,MAAM,UAAU,GAAG;IACvB,wFAAwF;IACxF,EAAE,EAAE,MAAM,CAAA;IACV;2CACuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,sFAAsF;IACtF,KAAK,EAAE,WAAW,CAAA;IAClB,uEAAuE;IACvE,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC5C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,CAAC,UAAU,GAAG,gBAAgB,GAAG,IAAI,CAAC,EAAE,CAAA;IACjD;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,UAAU,GAAG,gBAAgB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;CAC5E,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,CAAA;AAEjF;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,CAAA;AAEzF,MAAM,MAAM,sBAAsB,GAAG;IACnC,sCAAsC;IACtC,EAAE,EAAE,OAAO,CAAA;IACX,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kFAAkF;IAClF,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA"}
|
|
@@ -79,6 +79,14 @@ type SceneRenderClass =
|
|
|
79
79
|
* express. Out of WRITES_ID for the mirror's reason: a window is not what a
|
|
80
80
|
* click on the figure behind it means. */
|
|
81
81
|
| "material-premultiplied"
|
|
82
|
+
/** A material that FILTERS what is behind it — a game's eye shadow (Blend
|
|
83
|
+
* DstColor Zero): a soft band over the top of the iris whose colour is a
|
|
84
|
+
* multiplier, so the eye under it darkens and never lightens. Laid over, its
|
|
85
|
+
* light grey at partial alpha veils the iris white instead. The aux and the
|
|
86
|
+
* coverage are left as they were — a shade is not a surface, and the eye
|
|
87
|
+
* under it keeps its bloom — and out of WRITES_ID for the mirror's reason:
|
|
88
|
+
* a click there means the eye. */
|
|
89
|
+
| "material-multiply"
|
|
82
90
|
/** Particles and ribbons in their default, non-additive mode. */
|
|
83
91
|
| "particle"
|
|
84
92
|
/** Particles declaring `#blend additive` — LIGHT rather than matter, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-contract.d.ts","sourceRoot":"","sources":["../../../src/shaders/passes/scene-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;uDAEuD;AACvD,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,GAAG,EAAE,gBAAgB,CAAA;IACrB,iEAAiE;IACjE,GAAG,EAAE,gBAAgB,CAAA;CACtB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,gBAA6B,CAAA;AAkB3D,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE3C;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;GAMG;AACH,KAAK,gBAAgB;AACnB,2DAA2D;AACzD,UAAU;AACZ;;+CAE+C;GAC7C,QAAQ;AACV,uEAAuE;GACrE,SAAS;AACX;;;;6EAI6E;GAC3E,QAAQ;AACV;;;;;;yEAMyE;GACvE,mBAAmB;AACrB;;;;2CAI2C;GACzC,wBAAwB;AAC1B,iEAAiE;GAC/D,UAAU;AACZ;;;mDAGmD;GACjD,mBAAmB;AACrB;;;oCAGoC;GAClC,OAAO;AACT;;;;;iDAKiD;GAC/C,YAAY;AACd;;;kDAGkD;GAChD,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"scene-contract.d.ts","sourceRoot":"","sources":["../../../src/shaders/passes/scene-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;uDAEuD;AACvD,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,GAAG,EAAE,gBAAgB,CAAA;IACrB,iEAAiE;IACjE,GAAG,EAAE,gBAAgB,CAAA;CACtB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,gBAA6B,CAAA;AAkB3D,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE3C;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;GAMG;AACH,KAAK,gBAAgB;AACnB,2DAA2D;AACzD,UAAU;AACZ;;+CAE+C;GAC7C,QAAQ;AACV,uEAAuE;GACrE,SAAS;AACX;;;;6EAI6E;GAC3E,QAAQ;AACV;;;;;;yEAMyE;GACvE,mBAAmB;AACrB;;;;2CAI2C;GACzC,wBAAwB;AAC1B;;;;;;mCAMmC;GACjC,mBAAmB;AACrB,iEAAiE;GAC/D,UAAU;AACZ;;;mDAGmD;GACjD,mBAAmB;AACrB;;;oCAGoC;GAClC,OAAO;AACT;;;;;iDAKiD;GAC/C,YAAY;AACd;;;kDAGkD;GAChD,eAAe,CAAA;AA6GnB;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,GAAG,mBAAmB,EAAE,CAoBhG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAE3E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAmB7E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -83,6 +83,18 @@ const PREMULTIPLIED_OVER = {
|
|
|
83
83
|
color: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" },
|
|
84
84
|
alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" },
|
|
85
85
|
};
|
|
86
|
+
/** The destination scaled by the source colour; alpha is not touched. The
|
|
87
|
+
* fragment writes its multiplier already faded by its own coverage
|
|
88
|
+
* (mix(1, colour, alpha)), so the blend reads no alpha. */
|
|
89
|
+
const MULTIPLY_KEEP_ALPHA = {
|
|
90
|
+
color: { srcFactor: "dst", dstFactor: "zero", operation: "add" },
|
|
91
|
+
alpha: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
92
|
+
};
|
|
93
|
+
/** Leaves the attachment exactly as it was. */
|
|
94
|
+
const KEEP = {
|
|
95
|
+
color: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
96
|
+
alpha: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
97
|
+
};
|
|
86
98
|
/** Additive, premultiplied by the fragment's alpha as it writes. */
|
|
87
99
|
const ADD_PREMULTIPLIED = {
|
|
88
100
|
color: { srcFactor: "src-alpha", dstFactor: "one", operation: "add" },
|
|
@@ -117,6 +129,8 @@ const BLENDS = {
|
|
|
117
129
|
// The colour premultiplied by the graph (game_pbr's glass); the aux is
|
|
118
130
|
// written straight, as every material's is.
|
|
119
131
|
"material-premultiplied": [PREMULTIPLIED_OVER, ALPHA_OVER],
|
|
132
|
+
// A shade over what is drawn: the colour filtered, the aux untouched.
|
|
133
|
+
"material-multiply": [MULTIPLY_KEEP_ALPHA, KEEP],
|
|
120
134
|
// PREMULTIPLIED, like the ground and for the same reason: what a mirror
|
|
121
135
|
// writes is a sample of the HDR target, and that target already holds colour
|
|
122
136
|
// premultiplied by its own alpha. Handed to the src-alpha blend it would be
|