reze-engine 0.68.17 → 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/_dbg-loader.mjs +1100 -0
- package/dist/engine.d.ts +10 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +103 -53
- 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 +110 -49
- 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/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/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
|
package/package.json
CHANGED
package/src/engine.ts
CHANGED
|
@@ -294,6 +294,17 @@ const PRESET_NAME_HINTS: Array<[MaterialPreset, (string | RegExp)[]]> = [
|
|
|
294
294
|
],
|
|
295
295
|
]
|
|
296
296
|
|
|
297
|
+
// The eye parts the game MULTIPLIES over the iris rather than lays over it: an
|
|
298
|
+
// eye shadow, a soft light-grey band at partial alpha whose job is to darken the
|
|
299
|
+
// top of the eye. They stay eye parts — the stencil, the order and the graph are
|
|
300
|
+
// the eye's — and take blend "multiply" per material (blendByMaterial).
|
|
301
|
+
const EYE_SHADOW_HINTS = ["目影", "眼影", "eyeshadow", "eye_shadow", "eye shadow"]
|
|
302
|
+
|
|
303
|
+
function isEyeShadow(materialName: string): boolean {
|
|
304
|
+
const lower = materialName.toLowerCase()
|
|
305
|
+
return EYE_SHADOW_HINTS.some((hint) => lower.includes(hint))
|
|
306
|
+
}
|
|
307
|
+
|
|
297
308
|
// Whole names that are body parts — skin by another name. Whole, never
|
|
298
309
|
// substrings: 手 alone is a hand, inside 手套 (gloves) or 手镯 (a bracelet) it is
|
|
299
310
|
// what the hand wears; 足 is a leg, 足袋 a sock.
|
|
@@ -355,6 +366,9 @@ type GroupInstall = {
|
|
|
355
366
|
pipelineNoDepthWrite: GPURenderPipeline
|
|
356
367
|
/** hair render-class only: the stencil-matched IS_OVER_EYES=true variant. */
|
|
357
368
|
overEyesPipeline?: GPURenderPipeline
|
|
369
|
+
/** The same three for each blend a member keys apart from the group's
|
|
370
|
+
* (StyleGroup.blendByMaterial) — an eye shadow multiplying in the eye group. */
|
|
371
|
+
byBlend: Partial<Record<StyleBlend, Pick<GroupInstall, "pipeline" | "pipelineNoDepthWrite" | "overEyesPipeline">>>
|
|
358
372
|
uniformBuffer: GPUBuffer
|
|
359
373
|
/** The group's own image maps, uploaded once per apply and owned here — the
|
|
360
374
|
* install destroys them when it is replaced, so a re-apply cannot leak. */
|
|
@@ -2083,6 +2097,9 @@ export class Engine {
|
|
|
2083
2097
|
/** A group blending "premultiplied" — see scene-contract's
|
|
2084
2098
|
* material-premultiplied. */
|
|
2085
2099
|
private sceneTargetsPremultiplied!: GPUColorTargetState[]
|
|
2100
|
+
/** A group or member blending "multiply" — see scene-contract's
|
|
2101
|
+
* material-multiply. */
|
|
2102
|
+
private sceneTargetsMultiply!: GPUColorTargetState[]
|
|
2086
2103
|
/** The scene pass's attachment formats, settled at init once the device has
|
|
2087
2104
|
* said which HDR format it will blend. Every scene-pass pipeline asks
|
|
2088
2105
|
* scene-contract for its targets against these. */
|
|
@@ -8431,6 +8448,7 @@ export class Engine {
|
|
|
8431
8448
|
// blend: "additive". See scene-contract's material-additive.
|
|
8432
8449
|
this.sceneTargetsAdditive = sceneTargetsFor("material-additive", this.sceneFormats)
|
|
8433
8450
|
this.sceneTargetsPremultiplied = sceneTargetsFor("material-premultiplied", this.sceneFormats)
|
|
8451
|
+
this.sceneTargetsMultiply = sceneTargetsFor("material-multiply", this.sceneFormats)
|
|
8434
8452
|
this.fullVertexBufferLayouts = fullVertexBuffers
|
|
8435
8453
|
// Slot 3 stays empty: the outline hull binds its own stream there between
|
|
8436
8454
|
// two material draws, and a material reading slot 3 would pick it up.
|
|
@@ -18149,6 +18167,7 @@ export class Engine {
|
|
|
18149
18167
|
for (const [preset, materials] of buckets) {
|
|
18150
18168
|
const info = PRESET_GROUP_INFO[preset]
|
|
18151
18169
|
if (!info) continue
|
|
18170
|
+
const shadows = preset === "eye" ? materials.filter(isEyeShadow) : []
|
|
18152
18171
|
groups.push({
|
|
18153
18172
|
id: preset,
|
|
18154
18173
|
label: info.graph.name,
|
|
@@ -18156,6 +18175,7 @@ export class Engine {
|
|
|
18156
18175
|
graph: info.graph,
|
|
18157
18176
|
renderClass: info.renderClass,
|
|
18158
18177
|
alphaMode: info.alphaMode,
|
|
18178
|
+
...(shadows.length ? { blendByMaterial: Object.fromEntries(shadows.map((m) => [m, "multiply" as const])) } : {}),
|
|
18159
18179
|
})
|
|
18160
18180
|
}
|
|
18161
18181
|
return this.applyStyleGroups(modelName, groups)
|
|
@@ -18239,20 +18259,26 @@ export class Engine {
|
|
|
18239
18259
|
groups.map(async (g) => {
|
|
18240
18260
|
const renderClass = g.renderClass ?? "auto"
|
|
18241
18261
|
const alphaMode = g.alphaMode ?? "opaque"
|
|
18242
|
-
const
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18262
|
+
const groupBlend = g.blend ?? "over"
|
|
18263
|
+
// Every blend its members draw with, as the install compiles them.
|
|
18264
|
+
const blends = new Set([groupBlend, ...g.materials.map((m) => g.blendByMaterial?.[m] ?? groupBlend)])
|
|
18265
|
+
await Promise.all(
|
|
18266
|
+
[...blends].map(async (blend) => {
|
|
18267
|
+
let result: ReturnType<typeof compileGraph>
|
|
18268
|
+
try {
|
|
18269
|
+
result = compileGraph(g.graph, { renderClass, alphaMode, blend })
|
|
18270
|
+
} catch {
|
|
18271
|
+
return
|
|
18272
|
+
}
|
|
18273
|
+
if (!result.ok) return
|
|
18274
|
+
const module = this.cachedShaderModule(result.wgsl, `style group: ${g.id} (${renderClass}${blend === groupBlend ? "" : `, ${blend}`})`)
|
|
18275
|
+
await Promise.all([
|
|
18276
|
+
this.createRenderClassPipeline(renderClass, module, false, true, blend),
|
|
18277
|
+
this.createRenderClassPipeline(renderClass, module, false, false, blend),
|
|
18278
|
+
renderClass === "hair" ? this.createRenderClassPipeline(renderClass, module, true, true, blend) : null,
|
|
18279
|
+
]).catch(() => {})
|
|
18280
|
+
}),
|
|
18281
|
+
)
|
|
18256
18282
|
}),
|
|
18257
18283
|
)
|
|
18258
18284
|
}
|
|
@@ -18592,14 +18618,23 @@ export class Engine {
|
|
|
18592
18618
|
// arrive twice — once as the model lands and again once its sidecar has
|
|
18593
18619
|
// decoded — and without this the second apply refreshed the definition and
|
|
18594
18620
|
// silently kept the empty slots from the first.
|
|
18621
|
+
// The blends its members draw with: the group's own first, then any a
|
|
18622
|
+
// member keys for itself (blendByMaterial) — one compile each, the graph and
|
|
18623
|
+
// its slots the same in all of them.
|
|
18624
|
+
const groupBlend = group.blend ?? "over"
|
|
18625
|
+
const blends = [
|
|
18626
|
+
groupBlend,
|
|
18627
|
+
...new Set(group.materials.map((m) => group.blendByMaterial?.[m] ?? groupBlend).filter((b) => b !== groupBlend)),
|
|
18628
|
+
]
|
|
18595
18629
|
const signature = JSON.stringify({
|
|
18596
18630
|
g: group.graph,
|
|
18597
18631
|
rc: renderClass,
|
|
18598
18632
|
am: alphaMode,
|
|
18599
|
-
bl:
|
|
18633
|
+
bl: groupBlend,
|
|
18600
18634
|
o: opts?.previewNode ?? null,
|
|
18601
18635
|
im: group.images?.length ?? 0,
|
|
18602
18636
|
ibm: Object.keys(group.imagesByMaterial ?? {}).sort(),
|
|
18637
|
+
bls: blends,
|
|
18603
18638
|
})
|
|
18604
18639
|
const existing = inst.styleGroups.get(group.id)
|
|
18605
18640
|
if (existing && existing.signature === signature) {
|
|
@@ -18607,56 +18642,71 @@ export class Engine {
|
|
|
18607
18642
|
return { ok: true, diagnostics: [], slotMap: existing.slotMap }
|
|
18608
18643
|
}
|
|
18609
18644
|
|
|
18610
|
-
const
|
|
18611
|
-
|
|
18645
|
+
const compiled = blends.map((b) => compileGraph(group.graph, { ...opts, renderClass, alphaMode, blend: b }))
|
|
18646
|
+
const result = compiled[0]
|
|
18647
|
+
const failed = compiled.find((r) => !r.ok)
|
|
18648
|
+
if (failed) return { ok: false, diagnostics: failed.diagnostics, slotMap: failed.slotMap }
|
|
18612
18649
|
|
|
18613
18650
|
const generation = (inst.styleGroupGen.get(group.id) ?? 0) + 1
|
|
18614
18651
|
inst.styleGroupGen.set(group.id, generation)
|
|
18615
18652
|
|
|
18616
|
-
this.device.pushErrorScope("validation")
|
|
18617
|
-
const module = this.cachedShaderModule(result.wgsl, `style group: ${group.id} (${renderClass})`)
|
|
18618
|
-
const scopePromise = this.device.popErrorScope()
|
|
18619
|
-
// EVERY VARIANT AT ONCE, and the module's diagnostics read beside them
|
|
18620
|
-
// rather than first: the compiles run in parallel in the GPU process, and
|
|
18621
|
-
// awaiting each in turn (and the diagnostics before any) made a group cost
|
|
18622
|
-
// the sum of its pipelines instead of the longest.
|
|
18623
|
-
const blend = group.blend ?? "over"
|
|
18624
18653
|
// The single-sided twins a draw of this group will ask for (sidedPipeline),
|
|
18625
18654
|
// built with their pipelines rather than synchronously at the first draw.
|
|
18626
18655
|
const singleSided = inst.drawCalls.some((dc) => !dc.doubleSided && group.materials.includes(dc.materialName))
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
const
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18656
|
+
// EVERY VARIANT AT ONCE, and the module's diagnostics read beside them
|
|
18657
|
+
// rather than first: the compiles run in parallel in the GPU process, and
|
|
18658
|
+
// awaiting each in turn (and the diagnostics before any) made a group cost
|
|
18659
|
+
// the sum of its pipelines instead of the longest. One module per blend,
|
|
18660
|
+
// each with its variants.
|
|
18661
|
+
const builds = compiled.map((r, i) => {
|
|
18662
|
+
const blend = blends[i]
|
|
18663
|
+
this.device.pushErrorScope("validation")
|
|
18664
|
+
const module = this.cachedShaderModule(r.wgsl, `style group: ${group.id} (${renderClass}${blend === blends[0] ? "" : `, ${blend}`})`)
|
|
18665
|
+
const scopePromise = this.device.popErrorScope()
|
|
18666
|
+
const variant = (overEyes: boolean, depthWrite: boolean) =>
|
|
18667
|
+
this.createRenderClassPipeline(renderClass, module, overEyes, depthWrite, blend).then(async (p) => {
|
|
18668
|
+
if (singleSided) await this.buildSidedTwin(p, false)
|
|
18669
|
+
return p
|
|
18670
|
+
})
|
|
18671
|
+
const variants = Promise.all([
|
|
18672
|
+
variant(false, true),
|
|
18673
|
+
// The depth-write-off twin: stage transparency draws with it (see
|
|
18674
|
+
// pipelineForDrawCall), and a future OIT path would too.
|
|
18675
|
+
variant(false, false),
|
|
18676
|
+
renderClass === "hair" ? variant(true, true) : undefined,
|
|
18677
|
+
])
|
|
18678
|
+
// Handled below either way; this keeps a rejection off the console while
|
|
18679
|
+
// the diagnostics are read.
|
|
18680
|
+
variants.catch(() => {})
|
|
18681
|
+
return { wgsl: r.wgsl, module, scopePromise, variants }
|
|
18682
|
+
})
|
|
18643
18683
|
const diagnostics = [...result.diagnostics]
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18684
|
+
let scopeError: GPUError | null = null
|
|
18685
|
+
for (const build of builds) {
|
|
18686
|
+
const [info, error] = await Promise.all([build.module.getCompilationInfo(), build.scopePromise])
|
|
18687
|
+
scopeError ??= error
|
|
18688
|
+
for (const msg of info.messages) {
|
|
18689
|
+
if (msg.type !== "error") continue
|
|
18690
|
+
diagnostics.push({ severity: "error", nodeId: nodeIdForWgslLine(build.wgsl, msg.lineNum), message: `WGSL: ${msg.message}` })
|
|
18691
|
+
}
|
|
18647
18692
|
}
|
|
18648
18693
|
if (diagnostics.some((d) => d.severity === "error") || scopeError) {
|
|
18649
18694
|
if (scopeError && !diagnostics.some((d) => d.severity === "error"))
|
|
18650
18695
|
diagnostics.push({ severity: "error", message: `WGSL: ${scopeError.message}` })
|
|
18651
|
-
this.forgetShaderModule(
|
|
18696
|
+
for (const build of builds) this.forgetShaderModule(build.wgsl)
|
|
18652
18697
|
return { ok: false, diagnostics, slotMap: result.slotMap }
|
|
18653
18698
|
}
|
|
18654
18699
|
|
|
18655
18700
|
let pipeline: GPURenderPipeline
|
|
18656
18701
|
let pipelineNoDepthWrite: GPURenderPipeline
|
|
18657
18702
|
let overEyesPipeline: GPURenderPipeline | undefined
|
|
18703
|
+
const byBlend: GroupInstall["byBlend"] = {}
|
|
18658
18704
|
try {
|
|
18659
|
-
|
|
18705
|
+
const sets = await Promise.all(builds.map((build) => build.variants))
|
|
18706
|
+
;[pipeline, pipelineNoDepthWrite, overEyesPipeline] = sets[0]
|
|
18707
|
+
sets.slice(1).forEach(([p, noDepth, overEyes], i) => {
|
|
18708
|
+
byBlend[blends[i + 1]] = { pipeline: p, pipelineNoDepthWrite: noDepth, overEyesPipeline: overEyes }
|
|
18709
|
+
})
|
|
18660
18710
|
} catch (e) {
|
|
18661
18711
|
diagnostics.push({ severity: "error", message: `pipeline creation failed: ${(e as Error).message}` })
|
|
18662
18712
|
return { ok: false, diagnostics, slotMap: result.slotMap }
|
|
@@ -18686,6 +18736,7 @@ export class Engine {
|
|
|
18686
18736
|
pipeline,
|
|
18687
18737
|
pipelineNoDepthWrite,
|
|
18688
18738
|
overEyesPipeline,
|
|
18739
|
+
byBlend,
|
|
18689
18740
|
uniformBuffer,
|
|
18690
18741
|
images: this.uploadGroupImages(group),
|
|
18691
18742
|
imagesByMaterial: group.imagesByMaterial
|
|
@@ -18938,7 +18989,9 @@ export class Engine {
|
|
|
18938
18989
|
? this.sceneTargetsAdditive
|
|
18939
18990
|
: blend === "premultiplied"
|
|
18940
18991
|
? this.sceneTargetsPremultiplied
|
|
18941
|
-
:
|
|
18992
|
+
: blend === "multiply"
|
|
18993
|
+
? this.sceneTargetsMultiply
|
|
18994
|
+
: this.sceneTargets,
|
|
18942
18995
|
},
|
|
18943
18996
|
depthStencil,
|
|
18944
18997
|
}
|
|
@@ -19173,7 +19226,8 @@ export class Engine {
|
|
|
19173
19226
|
if (dc.groupId) {
|
|
19174
19227
|
const install = inst.styleGroups.get(dc.groupId)
|
|
19175
19228
|
if (install) {
|
|
19176
|
-
|
|
19229
|
+
const own = this.memberPipelines(install, dc)
|
|
19230
|
+
return stageGlass ? own.pipelineNoDepthWrite : own.pipeline
|
|
19177
19231
|
}
|
|
19178
19232
|
}
|
|
19179
19233
|
return stageGlass ? this.neutralPipelineNoDepthWrite : this.neutralPipeline
|
|
@@ -19600,7 +19654,14 @@ export class Engine {
|
|
|
19600
19654
|
private overEyesPipelineFor(inst: ModelInstance, dc: DrawCall): GPURenderPipeline | null {
|
|
19601
19655
|
if (!dc.groupId) return null
|
|
19602
19656
|
const install = inst.styleGroups.get(dc.groupId)
|
|
19603
|
-
return install?.renderClass === "hair" ? (install.overEyesPipeline ?? null) : null
|
|
19657
|
+
return install?.renderClass === "hair" ? (this.memberPipelines(install, dc).overEyesPipeline ?? null) : null
|
|
19658
|
+
}
|
|
19659
|
+
|
|
19660
|
+
/** A member's pipelines: those of the blend it keys for itself, else the
|
|
19661
|
+
* group's (StyleGroup.blendByMaterial). */
|
|
19662
|
+
private memberPipelines(install: GroupInstall, dc: DrawCall): Pick<GroupInstall, "pipeline" | "pipelineNoDepthWrite" | "overEyesPipeline"> {
|
|
19663
|
+
const blend = install.group.blendByMaterial?.[dc.materialName]
|
|
19664
|
+
return (blend && install.byBlend[blend]) || install
|
|
19604
19665
|
}
|
|
19605
19666
|
|
|
19606
19667
|
private updateCameraUniforms() {
|
|
@@ -14,9 +14,11 @@ export type AlphaMode = "opaque" | "hashed"
|
|
|
14
14
|
/** How a group's colour meets the frame. "over" is the ordinary alpha blend;
|
|
15
15
|
* "additive" adds its light and never reads alpha; "premultiplied" takes a
|
|
16
16
|
* colour already weighted by its own coverage (One, OneMinusSrcAlpha) — a
|
|
17
|
-
* game's glass, whose reflection must not fade with its transparency
|
|
18
|
-
*
|
|
19
|
-
|
|
17
|
+
* game's glass, whose reflection must not fade with its transparency;
|
|
18
|
+
* "multiply" filters what is already there by the surface's colour
|
|
19
|
+
* (DstColor Zero) — a game's eye shadow, a tint over the iris that can only
|
|
20
|
+
* darken it. See StyleGroup.blend. */
|
|
21
|
+
export type StyleBlend = "over" | "additive" | "premultiplied" | "multiply"
|
|
20
22
|
|
|
21
23
|
/** Descriptive manifest for hosts (reze-design) so the render-class picker is data-driven
|
|
22
24
|
* instead of hardcoding strings. The effect implementations stay engine-side; this only
|
package/src/graph/slots.ts
CHANGED
|
@@ -221,6 +221,23 @@ function epilogue(renderClass: RenderClass, alphaMode: AlphaMode, hasOpacity: bo
|
|
|
221
221
|
const FOG = takesLight
|
|
222
222
|
? ` 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`
|
|
223
223
|
: ""
|
|
224
|
+
// MULTIPLY WRITES A FILTER, NOT A COLOUR. What it darkens was lit already —
|
|
225
|
+
// the iris under an eye shadow took the sun and its own glow — so the shade
|
|
226
|
+
// takes no light of its own: lit, a light-grey shadow came out brighter than
|
|
227
|
+
// the eye and multiplied it WHITER. The multiplier is the surface's own
|
|
228
|
+
// colour, its texture times the PMX diffuse as every look's base is, or what
|
|
229
|
+
// an emission-only graph paints, which is already a colour no light reaches.
|
|
230
|
+
// Faded by coverage here (the blend reads no alpha), capped at 1 so it can
|
|
231
|
+
// only darken, and with no lamps, burn or fog — all three are light. The aux
|
|
232
|
+
// is kept by the blend, so the mask written is never stored.
|
|
233
|
+
if (blend === "multiply") {
|
|
234
|
+
const filter = takesLight ? "tex_color * material.diffuseColor" : "final_color"
|
|
235
|
+
return ` var out: FSOut;
|
|
236
|
+
out.color = vec4f(mix(vec3f(1.0), saturate(${filter}), ${alphaBase}), ${alphaBase});
|
|
237
|
+
out.mask = vec4f(0.0);
|
|
238
|
+
${ID_WRITE} return out;
|
|
239
|
+
`
|
|
240
|
+
}
|
|
224
241
|
if (renderClass === "hair") {
|
|
225
242
|
return `${ALBEDO} var outAlpha = ${alphaBase};
|
|
226
243
|
if (IS_OVER_EYES) { outAlpha = ${alphaBase} * 0.25; }
|
package/src/graph/style-group.ts
CHANGED
|
@@ -30,8 +30,26 @@ export type StyleGroup = {
|
|
|
30
30
|
* nebula and a starfield on cylinders round the scene, their alpha 0 across
|
|
31
31
|
* the whole image because additive blending does not look at it. Laid over,
|
|
32
32
|
* they are invisible.
|
|
33
|
+
*
|
|
34
|
+
* "multiply" is a FILTER: the frame behind is scaled by the surface's own
|
|
35
|
+
* colour, faded by its alpha, and nothing is added — see `blendByMaterial`
|
|
36
|
+
* for the eye shadow it exists for.
|
|
33
37
|
*/
|
|
34
38
|
blend?: StyleBlend
|
|
39
|
+
/**
|
|
40
|
+
* `blend`, but PER MATERIAL — for a member that meets the frame unlike the
|
|
41
|
+
* rest of its group.
|
|
42
|
+
*
|
|
43
|
+
* An eye shadow (目影) is an EYE part: it sits on the iris, stamps the same
|
|
44
|
+
* stencil the see-through hair reads, and draws in the eye's order. What sets
|
|
45
|
+
* it apart is only how it lands — the game multiplies it, a soft grey band
|
|
46
|
+
* that darkens the top of the iris, where laid over it veils the eye white.
|
|
47
|
+
* Keyed here it stays in the eye's group, shading on the eye's graph, and
|
|
48
|
+
* draws through a pipeline of its own blend.
|
|
49
|
+
*
|
|
50
|
+
* A material with no entry takes `blend`.
|
|
51
|
+
*/
|
|
52
|
+
blendByMaterial?: Record<string, StyleBlend>
|
|
35
53
|
/**
|
|
36
54
|
* Extra image maps for this group's shading, up to four.
|
|
37
55
|
*
|
|
@@ -104,6 +104,14 @@ type SceneRenderClass =
|
|
|
104
104
|
* express. Out of WRITES_ID for the mirror's reason: a window is not what a
|
|
105
105
|
* click on the figure behind it means. */
|
|
106
106
|
| "material-premultiplied"
|
|
107
|
+
/** A material that FILTERS what is behind it — a game's eye shadow (Blend
|
|
108
|
+
* DstColor Zero): a soft band over the top of the iris whose colour is a
|
|
109
|
+
* multiplier, so the eye under it darkens and never lightens. Laid over, its
|
|
110
|
+
* light grey at partial alpha veils the iris white instead. The aux and the
|
|
111
|
+
* coverage are left as they were — a shade is not a surface, and the eye
|
|
112
|
+
* under it keeps its bloom — and out of WRITES_ID for the mirror's reason:
|
|
113
|
+
* a click there means the eye. */
|
|
114
|
+
| "material-multiply"
|
|
107
115
|
/** Particles and ribbons in their default, non-additive mode. */
|
|
108
116
|
| "particle"
|
|
109
117
|
/** Particles declaring `#blend additive` — LIGHT rather than matter, so
|
|
@@ -163,6 +171,20 @@ const PREMULTIPLIED_OVER: GPUBlendState = {
|
|
|
163
171
|
alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" },
|
|
164
172
|
}
|
|
165
173
|
|
|
174
|
+
/** The destination scaled by the source colour; alpha is not touched. The
|
|
175
|
+
* fragment writes its multiplier already faded by its own coverage
|
|
176
|
+
* (mix(1, colour, alpha)), so the blend reads no alpha. */
|
|
177
|
+
const MULTIPLY_KEEP_ALPHA: GPUBlendState = {
|
|
178
|
+
color: { srcFactor: "dst", dstFactor: "zero", operation: "add" },
|
|
179
|
+
alpha: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Leaves the attachment exactly as it was. */
|
|
183
|
+
const KEEP: GPUBlendState = {
|
|
184
|
+
color: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
185
|
+
alpha: { srcFactor: "zero", dstFactor: "one", operation: "add" },
|
|
186
|
+
}
|
|
187
|
+
|
|
166
188
|
/** Additive, premultiplied by the fragment's alpha as it writes. */
|
|
167
189
|
const ADD_PREMULTIPLIED: GPUBlendState = {
|
|
168
190
|
color: { srcFactor: "src-alpha", dstFactor: "one", operation: "add" },
|
|
@@ -199,6 +221,8 @@ const BLENDS: Record<Exclude<SceneRenderClass, "depth-prepass">, [GPUBlendState,
|
|
|
199
221
|
// The colour premultiplied by the graph (game_pbr's glass); the aux is
|
|
200
222
|
// written straight, as every material's is.
|
|
201
223
|
"material-premultiplied": [PREMULTIPLIED_OVER, ALPHA_OVER],
|
|
224
|
+
// A shade over what is drawn: the colour filtered, the aux untouched.
|
|
225
|
+
"material-multiply": [MULTIPLY_KEEP_ALPHA, KEEP],
|
|
202
226
|
// PREMULTIPLIED, like the ground and for the same reason: what a mirror
|
|
203
227
|
// writes is a sample of the HDR target, and that target already holds colour
|
|
204
228
|
// premultiplied by its own alpha. Handed to the src-alpha blend it would be
|
|
@@ -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
|
-
};
|