reze-engine 0.17.1 → 0.18.1
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 +34 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +258 -15
- package/dist/gpu-profile.d.ts +19 -0
- package/dist/gpu-profile.d.ts.map +1 -0
- package/dist/gpu-profile.js +120 -0
- package/dist/graph/compile.d.ts +34 -0
- package/dist/graph/compile.d.ts.map +1 -0
- package/dist/graph/compile.js +299 -0
- package/dist/graph/presets/body.d.ts +3 -0
- package/dist/graph/presets/body.d.ts.map +1 -0
- package/dist/graph/presets/body.js +100 -0
- package/dist/graph/presets/cloth_rough.d.ts +3 -0
- package/dist/graph/presets/cloth_rough.d.ts.map +1 -0
- package/dist/graph/presets/cloth_rough.js +61 -0
- package/dist/graph/presets/cloth_smooth.d.ts +3 -0
- package/dist/graph/presets/cloth_smooth.d.ts.map +1 -0
- package/dist/graph/presets/cloth_smooth.js +53 -0
- package/dist/graph/presets/default.d.ts +3 -0
- package/dist/graph/presets/default.d.ts.map +1 -0
- package/dist/graph/presets/default.js +20 -0
- package/dist/graph/presets/eye.d.ts +3 -0
- package/dist/graph/presets/eye.d.ts.map +1 -0
- package/dist/graph/presets/eye.js +30 -0
- package/dist/graph/presets/face.d.ts +3 -0
- package/dist/graph/presets/face.d.ts.map +1 -0
- package/dist/graph/presets/face.js +125 -0
- package/dist/graph/presets/hair.d.ts +3 -0
- package/dist/graph/presets/hair.d.ts.map +1 -0
- package/dist/graph/presets/hair.js +79 -0
- package/dist/graph/presets/metal.d.ts +3 -0
- package/dist/graph/presets/metal.d.ts.map +1 -0
- package/dist/graph/presets/metal.js +58 -0
- package/dist/graph/presets/stockings.d.ts +3 -0
- package/dist/graph/presets/stockings.d.ts.map +1 -0
- package/dist/graph/presets/stockings.js +54 -0
- package/dist/graph/registry.d.ts +28 -0
- package/dist/graph/registry.d.ts.map +1 -0
- package/dist/graph/registry.js +322 -0
- package/dist/graph/schema.d.ts +66 -0
- package/dist/graph/schema.d.ts.map +1 -0
- package/dist/graph/schema.js +6 -0
- package/dist/graph/slots.d.ts +14 -0
- package/dist/graph/slots.d.ts.map +1 -0
- package/dist/graph/slots.js +155 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/physics/profile.d.ts +18 -0
- package/dist/physics/profile.d.ts.map +1 -0
- package/dist/physics/profile.js +44 -0
- package/package.json +2 -1
- package/src/engine.ts +290 -15
- package/src/graph/compile.ts +342 -0
- package/src/graph/presets/body.ts +103 -0
- package/src/graph/presets/cloth_rough.ts +64 -0
- package/src/graph/presets/cloth_smooth.ts +56 -0
- package/src/graph/presets/default.ts +23 -0
- package/src/graph/presets/eye.ts +33 -0
- package/src/graph/presets/face.ts +136 -0
- package/src/graph/presets/hair.ts +82 -0
- package/src/graph/presets/metal.ts +61 -0
- package/src/graph/presets/stockings.ts +57 -0
- package/src/graph/registry.ts +351 -0
- package/src/graph/schema.ts +60 -0
- package/src/graph/slots.ts +178 -0
- package/src/index.ts +27 -0
- package/dist/physics-debug.d.ts +0 -30
- package/dist/physics-debug.d.ts.map +0 -1
- package/dist/physics-debug.js +0 -526
- package/dist/shaders/passes/physics-debug.d.ts +0 -2
- package/dist/shaders/passes/physics-debug.d.ts.map +0 -1
- package/dist/shaders/passes/physics-debug.js +0 -69
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Eye as a StyleGraph — port of shaders/materials/eye.ts. The published preset
|
|
2
|
+
// author's instruction: "keep eyes in the default nodegraph, add emission 1.5".
|
|
3
|
+
// So it's the default Principled BSDF plus an Emission of the diffuse texture at
|
|
4
|
+
// 1.5× (Blender's Principled Emission socket, decomposed as a separate Emission +
|
|
5
|
+
// Add Shader — the emission feeds bloom pre-tonemap).
|
|
6
|
+
//
|
|
7
|
+
// The rear-view gate and the see-through stencil stamp are slot-owned (built-in eye
|
|
8
|
+
// behavior, see EYE_TEMPLATE in slots.ts + createSlotPipeline) — not in this graph.
|
|
9
|
+
export const EYE_GRAPH = {
|
|
10
|
+
version: 1,
|
|
11
|
+
name: "Eye",
|
|
12
|
+
slot: "eye",
|
|
13
|
+
nodes: [
|
|
14
|
+
{ id: "tex", type: "texture" },
|
|
15
|
+
{
|
|
16
|
+
id: "principled",
|
|
17
|
+
type: "principled",
|
|
18
|
+
inputs: { metallic: 0.0, specular: 0.5, roughness: 0.5, spec_clamp: 1e30, sheen: 0.0, sheen_tint: 0.0 },
|
|
19
|
+
},
|
|
20
|
+
{ id: "emission", type: "emission", inputs: { strength: 1.5 } },
|
|
21
|
+
{ id: "add", type: "add_shader" },
|
|
22
|
+
],
|
|
23
|
+
links: [
|
|
24
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "principled", socket: "base" } },
|
|
25
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "emission", socket: "color" } },
|
|
26
|
+
{ from: { node: "principled", socket: "color" }, to: { node: "add", socket: "a" } },
|
|
27
|
+
{ from: { node: "emission", socket: "color" }, to: { node: "add", socket: "b" } },
|
|
28
|
+
],
|
|
29
|
+
output: { node: "add", socket: "color" },
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/face.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,eAAO,MAAM,UAAU,EAAE,UA6HxB,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// M_Face as a StyleGraph — port of shaders/materials/face.ts (仿深空之眼 "M_Face").
|
|
2
|
+
// Toon + warm rim + dual fresnel rim + BT.601 bright-tex gate, mixed 50/50 against a
|
|
3
|
+
// Principled BSDF with noise bump. Structurally close to body, but: the toon uses the
|
|
4
|
+
// edge-AA ramp, hue tints are 0.46 (full hue_sat, not the 0.5 _id specialization),
|
|
5
|
+
// rim2 is the hair-style fresnel×layer_weight_fresnel rim, and there's an extra
|
|
6
|
+
// near-white texture gate that emits (freckle/highlight paint). Plain material — no
|
|
7
|
+
// built-in slot effect, so it uses the default prelude/epilogue.
|
|
8
|
+
export const FACE_GRAPH = {
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "Face",
|
|
11
|
+
slot: "face",
|
|
12
|
+
nodes: [
|
|
13
|
+
{ id: "tex", type: "texture" },
|
|
14
|
+
{ id: "geo", type: "geometry" },
|
|
15
|
+
// ── toon shading ──
|
|
16
|
+
{ id: "str", type: "shader_to_rgb_diffuse" },
|
|
17
|
+
{ id: "toon", type: "ramp_constant_aa", inputs: { edge: 0.2966 } },
|
|
18
|
+
{ id: "shadow_tint", type: "hue_sat", inputs: { hue: 0.46000000834465027, saturation: 2.0, value: 0.3499999940395355, fac: 1.0 } },
|
|
19
|
+
{ id: "lit_tint", type: "hue_sat", inputs: { hue: 0.46000000834465027, saturation: 1.600000023841858, value: 1.5, fac: 1.0 } },
|
|
20
|
+
{ id: "toon_color", type: "mix/blend" },
|
|
21
|
+
{ id: "bc", type: "bright_contrast", inputs: { bright: 0.1, contrast: 0.2 } },
|
|
22
|
+
{ id: "emission3", type: "emission", inputs: { strength: 2.5 } },
|
|
23
|
+
// ── warm rim (toon*0.5+0.5 → cardinal ramp) ──
|
|
24
|
+
{ id: "warm_mul", type: "math/multiply", inputs: { b: 0.5 } },
|
|
25
|
+
{ id: "warm_add", type: "math/add", inputs: { b: 0.5 } },
|
|
26
|
+
{ id: "warm_clamp", type: "math/clamp01" },
|
|
27
|
+
{
|
|
28
|
+
id: "warm_ramp",
|
|
29
|
+
type: "ramp_cardinal",
|
|
30
|
+
inputs: {
|
|
31
|
+
pos0: 0.2409,
|
|
32
|
+
color0: [0.2426, 0.068, 0.0588, 1.0],
|
|
33
|
+
pos1: 0.4663,
|
|
34
|
+
color1: [0.6677, 0.5024, 0.5126, 1.0],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{ id: "warm_emit", type: "emission", inputs: { strength: 0.30000001192092896 } },
|
|
38
|
+
// ── rim1: fresnel × facing ──
|
|
39
|
+
{ id: "rim1_fres", type: "fresnel", inputs: { ior: 2.0 } },
|
|
40
|
+
{ id: "rim1_lw", type: "layer_weight/facing", inputs: { blend: 0.24 } },
|
|
41
|
+
{ id: "rim1_str", type: "math/multiply" },
|
|
42
|
+
{ id: "rim1", type: "emission", inputs: { color: [0.984157919883728, 0.6110184788703918, 0.5736401677131653] } },
|
|
43
|
+
// ── rim2: fresnel × fresnel-layer-weight, powered (hair-style) ──
|
|
44
|
+
{ id: "rim2_fres", type: "fresnel", inputs: { ior: 1.45 } },
|
|
45
|
+
{ id: "rim2_lw", type: "layer_weight/fresnel", inputs: { blend: 0.61 } },
|
|
46
|
+
{ id: "rim2_raw", type: "math/multiply" },
|
|
47
|
+
{ id: "rim2_pow", type: "math/power", inputs: { b: 0.6300000548362732 } },
|
|
48
|
+
{ id: "rim2_mix", type: "mix_shader", inputs: { b: [1.0, 0.4684903025627136, 0.3698573112487793] } },
|
|
49
|
+
// ── near-white texture gate emission ──
|
|
50
|
+
{ id: "gate", type: "math/greater_than", inputs: { b: 0.9300000071525574 } },
|
|
51
|
+
{ id: "gate_scale", type: "math/multiply", inputs: { b: 3.0 } },
|
|
52
|
+
// ── npr stack (rim1 + rim2 + bright_emit + warm) ──
|
|
53
|
+
{ id: "npr_add1", type: "add_shader" },
|
|
54
|
+
{ id: "npr_add2", type: "add_shader" },
|
|
55
|
+
{ id: "npr_stack", type: "add_shader" },
|
|
56
|
+
// ── principled with noise bump ──
|
|
57
|
+
{ id: "map", type: "mapping", inputs: { scl: [1.0, 1.0, 1.5] } },
|
|
58
|
+
{ id: "noise", type: "tex_noise", inputs: { scale: 1.0 } },
|
|
59
|
+
{ id: "noise_ramp", type: "ramp_linear", inputs: { pos0: 0.0, pos1: 1.0 } },
|
|
60
|
+
{ id: "bump", type: "bump", inputs: { strength: 0.324644535779953 } },
|
|
61
|
+
{ id: "principled_base", type: "mix/blend", inputs: { b: [0.6832, 0.1947, 0.1373] } },
|
|
62
|
+
{ id: "p_emit", type: "emission", inputs: { strength: 0.2 } },
|
|
63
|
+
{
|
|
64
|
+
id: "principled",
|
|
65
|
+
type: "principled",
|
|
66
|
+
inputs: { metallic: 0.0, specular: 0.5, roughness: 0.3, spec_clamp: 10.0, sheen: 0.0, sheen_tint: 0.0 },
|
|
67
|
+
},
|
|
68
|
+
{ id: "p_sum", type: "add_shader" },
|
|
69
|
+
{ id: "mix_shader_001", type: "mix_shader", inputs: { fac: 0.5 } },
|
|
70
|
+
],
|
|
71
|
+
links: [
|
|
72
|
+
// toon
|
|
73
|
+
{ from: { node: "str", socket: "value" }, to: { node: "toon", socket: "fac" } },
|
|
74
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "shadow_tint", socket: "color" } },
|
|
75
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "lit_tint", socket: "color" } },
|
|
76
|
+
{ from: { node: "toon", socket: "fac_out" }, to: { node: "toon_color", socket: "fac" } },
|
|
77
|
+
{ from: { node: "shadow_tint", socket: "color" }, to: { node: "toon_color", socket: "a" } },
|
|
78
|
+
{ from: { node: "lit_tint", socket: "color" }, to: { node: "toon_color", socket: "b" } },
|
|
79
|
+
{ from: { node: "toon_color", socket: "color" }, to: { node: "bc", socket: "color" } },
|
|
80
|
+
{ from: { node: "bc", socket: "color" }, to: { node: "emission3", socket: "color" } },
|
|
81
|
+
// warm rim
|
|
82
|
+
{ from: { node: "toon", socket: "fac_out" }, to: { node: "warm_mul", socket: "a" } },
|
|
83
|
+
{ from: { node: "warm_mul", socket: "value" }, to: { node: "warm_add", socket: "a" } },
|
|
84
|
+
{ from: { node: "warm_add", socket: "value" }, to: { node: "warm_clamp", socket: "a" } },
|
|
85
|
+
{ from: { node: "warm_clamp", socket: "value" }, to: { node: "warm_ramp", socket: "fac" } },
|
|
86
|
+
{ from: { node: "warm_ramp", socket: "color" }, to: { node: "warm_emit", socket: "color" } },
|
|
87
|
+
// rim1
|
|
88
|
+
{ from: { node: "rim1_fres", socket: "value" }, to: { node: "rim1_str", socket: "a" } },
|
|
89
|
+
{ from: { node: "rim1_lw", socket: "value" }, to: { node: "rim1_str", socket: "b" } },
|
|
90
|
+
{ from: { node: "rim1_str", socket: "value" }, to: { node: "rim1", socket: "strength" } },
|
|
91
|
+
// rim2
|
|
92
|
+
{ from: { node: "rim2_fres", socket: "value" }, to: { node: "rim2_raw", socket: "a" } },
|
|
93
|
+
{ from: { node: "rim2_lw", socket: "value" }, to: { node: "rim2_raw", socket: "b" } },
|
|
94
|
+
{ from: { node: "rim2_raw", socket: "value" }, to: { node: "rim2_pow", socket: "a" } },
|
|
95
|
+
{ from: { node: "emission3", socket: "color" }, to: { node: "rim2_mix", socket: "a" } },
|
|
96
|
+
{ from: { node: "rim2_pow", socket: "value" }, to: { node: "rim2_mix", socket: "fac" } },
|
|
97
|
+
// gate
|
|
98
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "gate", socket: "a" } },
|
|
99
|
+
{ from: { node: "gate", socket: "value" }, to: { node: "gate_scale", socket: "a" } },
|
|
100
|
+
// npr stack
|
|
101
|
+
{ from: { node: "rim1", socket: "color" }, to: { node: "npr_add1", socket: "a" } },
|
|
102
|
+
{ from: { node: "rim2_mix", socket: "color" }, to: { node: "npr_add1", socket: "b" } },
|
|
103
|
+
{ from: { node: "npr_add1", socket: "color" }, to: { node: "npr_add2", socket: "a" } },
|
|
104
|
+
{ from: { node: "gate_scale", socket: "value" }, to: { node: "npr_add2", socket: "b" } },
|
|
105
|
+
{ from: { node: "npr_add2", socket: "color" }, to: { node: "npr_stack", socket: "a" } },
|
|
106
|
+
{ from: { node: "warm_emit", socket: "color" }, to: { node: "npr_stack", socket: "b" } },
|
|
107
|
+
// principled + noise bump
|
|
108
|
+
{ from: { node: "geo", socket: "rest_pos" }, to: { node: "map", socket: "vector" } },
|
|
109
|
+
{ from: { node: "map", socket: "vector" }, to: { node: "noise", socket: "vector" } },
|
|
110
|
+
{ from: { node: "noise", socket: "value" }, to: { node: "noise_ramp", socket: "fac" } },
|
|
111
|
+
{ from: { node: "noise_ramp", socket: "fac_out" }, to: { node: "bump", socket: "height" } },
|
|
112
|
+
{ from: { node: "geo", socket: "normal" }, to: { node: "bump", socket: "normal" } },
|
|
113
|
+
{ from: { node: "noise_ramp", socket: "fac_out" }, to: { node: "principled_base", socket: "fac" } },
|
|
114
|
+
{ from: { node: "bc", socket: "color" }, to: { node: "principled_base", socket: "a" } },
|
|
115
|
+
{ from: { node: "bc", socket: "color" }, to: { node: "p_emit", socket: "color" } },
|
|
116
|
+
{ from: { node: "principled_base", socket: "color" }, to: { node: "principled", socket: "base" } },
|
|
117
|
+
{ from: { node: "bump", socket: "vector" }, to: { node: "principled", socket: "normal" } },
|
|
118
|
+
{ from: { node: "principled", socket: "color" }, to: { node: "p_sum", socket: "a" } },
|
|
119
|
+
{ from: { node: "p_emit", socket: "color" }, to: { node: "p_sum", socket: "b" } },
|
|
120
|
+
// final mix
|
|
121
|
+
{ from: { node: "npr_stack", socket: "color" }, to: { node: "mix_shader_001", socket: "a" } },
|
|
122
|
+
{ from: { node: "p_sum", socket: "color" }, to: { node: "mix_shader_001", socket: "b" } },
|
|
123
|
+
],
|
|
124
|
+
output: { node: "mix_shader_001", socket: "color" },
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hair.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/hair.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,eAAO,MAAM,UAAU,EAAE,UAmExB,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// M_Hair — 仿深空之眼渲染预设v1.0_by_小绿毛猫, as a StyleGraph. Node ids mirror the
|
|
2
|
+
// Blender node names referenced in shaders/materials/hair.ts comments; compiled with
|
|
3
|
+
// { inlineParams: true } this graph must reproduce HAIR_SHADER_WGSL's fragment body
|
|
4
|
+
// (golden test #1 — see tests/graph.test.mjs).
|
|
5
|
+
//
|
|
6
|
+
// Inherited authoring decisions from the hand port: the noise→bump subtree on
|
|
7
|
+
// Principled.Normal is omitted (imperceptible at 0.2 mix weight), and Blender's bevel
|
|
8
|
+
// node is approximated by saturate(normal.y) — Blender Z-up ⇒ engine Y-up.
|
|
9
|
+
//
|
|
10
|
+
// The object is pure JSON (no functions/undefined) — JSON.stringify round-trips it,
|
|
11
|
+
// which is how reze.design will ship additional presets.
|
|
12
|
+
export const HAIR_GRAPH = {
|
|
13
|
+
version: 1,
|
|
14
|
+
name: "Hair",
|
|
15
|
+
slot: "hair",
|
|
16
|
+
nodes: [
|
|
17
|
+
{ id: "tex", type: "texture" },
|
|
18
|
+
{ id: "geo", type: "geometry" },
|
|
19
|
+
{ id: "hs_shadow", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.2, value: 0.5, fac: 1.0 } },
|
|
20
|
+
{ id: "hs_002", type: "hue_sat", inputs: { hue: 0.48, saturation: 1.2, value: 0.7, fac: 1.0 } },
|
|
21
|
+
{ id: "hs_001", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.5, value: 1.0, fac: 1.0 } },
|
|
22
|
+
{ id: "str", type: "shader_to_rgb_diffuse" },
|
|
23
|
+
{ id: "ramp_008", type: "ramp_constant", inputs: { pos0: 0.0, color0: [0, 0, 0, 1], pos1: 0.2966, color1: [1, 1, 1, 1] } },
|
|
24
|
+
{ id: "mix_004", type: "mix/blend" },
|
|
25
|
+
{ id: "bc", type: "bright_contrast", inputs: { bright: 0.1, contrast: 0.2 } },
|
|
26
|
+
{ id: "sep_n", type: "separate_xyz" },
|
|
27
|
+
{ id: "bevel_clamp", type: "math/clamp01" },
|
|
28
|
+
{ id: "mix_003", type: "mix/blend" },
|
|
29
|
+
{ id: "fres", type: "fresnel", inputs: { ior: 1.45 } },
|
|
30
|
+
{ id: "lw", type: "layer_weight/fresnel", inputs: { blend: 0.61 } },
|
|
31
|
+
{ id: "rim_mul", type: "math/multiply" },
|
|
32
|
+
{ id: "rim_pow", type: "math/power", inputs: { b: 0.6300000548362732 } },
|
|
33
|
+
{
|
|
34
|
+
id: "mix_shader_002",
|
|
35
|
+
type: "mix_shader",
|
|
36
|
+
inputs: { b: [0.1673291176557541, 0.1673291176557541, 0.1673291176557541] },
|
|
37
|
+
},
|
|
38
|
+
{ id: "gate", type: "math/greater_than", inputs: { b: 0.15000000596046448 } },
|
|
39
|
+
{ id: "gate_scale", type: "math/multiply", inputs: { b: 0.1 } },
|
|
40
|
+
{ id: "npr_add", type: "mix/add_emit" },
|
|
41
|
+
{
|
|
42
|
+
id: "principled",
|
|
43
|
+
type: "principled",
|
|
44
|
+
inputs: { metallic: 0.0, specular: 1.0, roughness: 0.3, spec_clamp: 10.0, sheen: 0.0, sheen_tint: 0.0 },
|
|
45
|
+
},
|
|
46
|
+
{ id: "mix_shader_001", type: "mix_shader", inputs: { fac: 0.2 } },
|
|
47
|
+
],
|
|
48
|
+
links: [
|
|
49
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "hs_shadow", socket: "color" } },
|
|
50
|
+
{ from: { node: "hs_shadow", socket: "color" }, to: { node: "hs_002", socket: "color" } },
|
|
51
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "hs_001", socket: "color" } },
|
|
52
|
+
{ from: { node: "str", socket: "value" }, to: { node: "ramp_008", socket: "fac" } },
|
|
53
|
+
{ from: { node: "ramp_008", socket: "fac_out" }, to: { node: "mix_004", socket: "fac" } },
|
|
54
|
+
{ from: { node: "hs_002", socket: "color" }, to: { node: "mix_004", socket: "a" } },
|
|
55
|
+
{ from: { node: "hs_001", socket: "color" }, to: { node: "mix_004", socket: "b" } },
|
|
56
|
+
{ from: { node: "mix_004", socket: "color" }, to: { node: "bc", socket: "color" } },
|
|
57
|
+
{ from: { node: "geo", socket: "normal" }, to: { node: "sep_n", socket: "vector" } },
|
|
58
|
+
{ from: { node: "sep_n", socket: "y" }, to: { node: "bevel_clamp", socket: "a" } },
|
|
59
|
+
{ from: { node: "bevel_clamp", socket: "value" }, to: { node: "mix_003", socket: "fac" } },
|
|
60
|
+
{ from: { node: "bc", socket: "color" }, to: { node: "mix_003", socket: "a" } },
|
|
61
|
+
{ from: { node: "hs_002", socket: "color" }, to: { node: "mix_003", socket: "b" } },
|
|
62
|
+
{ from: { node: "fres", socket: "value" }, to: { node: "rim_mul", socket: "a" } },
|
|
63
|
+
{ from: { node: "lw", socket: "value" }, to: { node: "rim_mul", socket: "b" } },
|
|
64
|
+
{ from: { node: "rim_mul", socket: "value" }, to: { node: "rim_pow", socket: "a" } },
|
|
65
|
+
{ from: { node: "mix_003", socket: "color" }, to: { node: "mix_shader_002", socket: "a" } },
|
|
66
|
+
{ from: { node: "rim_pow", socket: "value" }, to: { node: "mix_shader_002", socket: "fac" } },
|
|
67
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "gate", socket: "a" } },
|
|
68
|
+
{ from: { node: "gate", socket: "value" }, to: { node: "gate_scale", socket: "a" } },
|
|
69
|
+
{ from: { node: "mix_shader_002", socket: "color" }, to: { node: "npr_add", socket: "a" } },
|
|
70
|
+
{ from: { node: "gate_scale", socket: "value" }, to: { node: "npr_add", socket: "b" } },
|
|
71
|
+
{ from: { node: "bc", socket: "color" }, to: { node: "principled", socket: "base" } },
|
|
72
|
+
{ from: { node: "npr_add", socket: "color" }, to: { node: "mix_shader_001", socket: "a" } },
|
|
73
|
+
{ from: { node: "principled", socket: "color" }, to: { node: "mix_shader_001", socket: "b" } },
|
|
74
|
+
],
|
|
75
|
+
output: { node: "mix_shader_001", socket: "color" },
|
|
76
|
+
// Adjust-tier params deliberately absent: which sockets deserve sliders (and what
|
|
77
|
+
// they're called) is preset-author curation done in reze.design, not engine data.
|
|
78
|
+
// The exposed-param mechanism itself is covered by tests/graph.test.mjs.
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metal.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/metal.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,eAAO,MAAM,WAAW,EAAE,UAoDzB,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// M_Metal as a StyleGraph — port of shaders/materials/metal.ts.
|
|
2
|
+
// Metallic Principled (Metallic=1, Specular=1, Roughness=0.3) with a
|
|
3
|
+
// reflection-coord voronoi driving base color (metallic sparkle), plus an NPR
|
|
4
|
+
// toon/overlay emission stack mixed at Fac=0.6967. The voronoi Color→ramp Fac
|
|
5
|
+
// link goes through Blender's implicit BT.601 conversion (color_to_value).
|
|
6
|
+
export const METAL_GRAPH = {
|
|
7
|
+
version: 1,
|
|
8
|
+
name: "Metal",
|
|
9
|
+
slot: "metal",
|
|
10
|
+
nodes: [
|
|
11
|
+
{ id: "tex", type: "texture" },
|
|
12
|
+
{ id: "geo", type: "geometry" },
|
|
13
|
+
{ id: "tex_tint", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.0, value: 0.800000011920929, fac: 1.0 } },
|
|
14
|
+
{ id: "str", type: "shader_to_rgb_diffuse" },
|
|
15
|
+
{ id: "ramp_008", type: "ramp_constant_aa", inputs: { edge: 0.2966 } },
|
|
16
|
+
{ id: "mix04_fac", type: "math/multiply", inputs: { b: 0.5 } },
|
|
17
|
+
{ id: "dark_tex", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.0, value: 0.19999998807907104, fac: 1.0 } },
|
|
18
|
+
{ id: "mix_004", type: "mix/blend" },
|
|
19
|
+
{ id: "hue_004", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.0, value: 2.0, fac: 1.0 } },
|
|
20
|
+
{ id: "npr_overlay", type: "mix/overlay", inputs: { fac: 1.0 } },
|
|
21
|
+
{ id: "npr_emit", type: "emission", inputs: { strength: 8.100000381469727 } },
|
|
22
|
+
{ id: "voro_cross", type: "vect_cross", inputs: { b: [0, 1, 0] } },
|
|
23
|
+
{ id: "voro", type: "tex_voronoi/color", inputs: { scale: 4.3 } },
|
|
24
|
+
{ id: "voro_ramp", type: "ramp_linear", inputs: { pos0: 0.0, pos1: 1.0 } },
|
|
25
|
+
{ id: "hue_006", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.5, value: 1.2999999523162842, fac: 1.0 } },
|
|
26
|
+
{ id: "albedo", type: "mix/blend" },
|
|
27
|
+
{
|
|
28
|
+
id: "principled",
|
|
29
|
+
type: "principled",
|
|
30
|
+
inputs: { metallic: 1.0, specular: 1.0, roughness: 0.3, spec_clamp: 1e30, sheen: 0.0, sheen_tint: 0.0 },
|
|
31
|
+
},
|
|
32
|
+
{ id: "mix_shader_001", type: "mix_shader", inputs: { fac: 0.6967 } },
|
|
33
|
+
],
|
|
34
|
+
links: [
|
|
35
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "tex_tint", socket: "color" } },
|
|
36
|
+
{ from: { node: "str", socket: "value" }, to: { node: "ramp_008", socket: "fac" } },
|
|
37
|
+
{ from: { node: "ramp_008", socket: "fac_out" }, to: { node: "mix04_fac", socket: "a" } },
|
|
38
|
+
{ from: { node: "tex_tint", socket: "color" }, to: { node: "dark_tex", socket: "color" } },
|
|
39
|
+
{ from: { node: "mix04_fac", socket: "value" }, to: { node: "mix_004", socket: "fac" } },
|
|
40
|
+
{ from: { node: "dark_tex", socket: "color" }, to: { node: "mix_004", socket: "a" } },
|
|
41
|
+
{ from: { node: "tex_tint", socket: "color" }, to: { node: "mix_004", socket: "b" } },
|
|
42
|
+
{ from: { node: "mix_004", socket: "color" }, to: { node: "hue_004", socket: "color" } },
|
|
43
|
+
{ from: { node: "mix_004", socket: "color" }, to: { node: "npr_overlay", socket: "a" } },
|
|
44
|
+
{ from: { node: "hue_004", socket: "color" }, to: { node: "npr_overlay", socket: "b" } },
|
|
45
|
+
{ from: { node: "npr_overlay", socket: "color" }, to: { node: "npr_emit", socket: "color" } },
|
|
46
|
+
{ from: { node: "geo", socket: "reflection" }, to: { node: "voro_cross", socket: "a" } },
|
|
47
|
+
{ from: { node: "voro_cross", socket: "vector" }, to: { node: "voro", socket: "vector" } },
|
|
48
|
+
{ from: { node: "voro", socket: "color" }, to: { node: "voro_ramp", socket: "fac" } },
|
|
49
|
+
{ from: { node: "tex_tint", socket: "color" }, to: { node: "hue_006", socket: "color" } },
|
|
50
|
+
{ from: { node: "voro_ramp", socket: "fac_out" }, to: { node: "albedo", socket: "fac" } },
|
|
51
|
+
{ from: { node: "voro_ramp", socket: "fac_out" }, to: { node: "albedo", socket: "a" } },
|
|
52
|
+
{ from: { node: "hue_006", socket: "color" }, to: { node: "albedo", socket: "b" } },
|
|
53
|
+
{ from: { node: "albedo", socket: "color" }, to: { node: "principled", socket: "base" } },
|
|
54
|
+
{ from: { node: "npr_emit", socket: "color" }, to: { node: "mix_shader_001", socket: "a" } },
|
|
55
|
+
{ from: { node: "principled", socket: "color" }, to: { node: "mix_shader_001", socket: "b" } },
|
|
56
|
+
],
|
|
57
|
+
output: { node: "mix_shader_001", socket: "color" },
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stockings.d.ts","sourceRoot":"","sources":["../../../src/graph/presets/stockings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,eAAO,MAAM,eAAe,EAAE,UA8C7B,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// M_Stockings as a StyleGraph — port of shaders/materials/stockings.ts.
|
|
2
|
+
// A bbox-gradient × facing-rim mask drives a Mix Shader between an HSV-boosted
|
|
3
|
+
// emission (val 5×) and a sheen Principled. The hashed-alpha discard and the
|
|
4
|
+
// alpha=1 output are slot-owned (see STOCKINGS_TEMPLATE in slots.ts) — the graph
|
|
5
|
+
// computes only the radiance. Blender's Generated coord is approximated with UV,
|
|
6
|
+
// as in the hand port. The grayscale mask feeds Mix Shader Fac through Blender's
|
|
7
|
+
// implicit BT.601 color→float conversion (equal-component vector → same scalar).
|
|
8
|
+
export const STOCKINGS_GRAPH = {
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "Stockings",
|
|
11
|
+
slot: "stockings",
|
|
12
|
+
nodes: [
|
|
13
|
+
{ id: "tex", type: "texture" },
|
|
14
|
+
{ id: "geo", type: "geometry" },
|
|
15
|
+
{ id: "map", type: "mapping", inputs: { loc: [1.0, 1.0, 1.0], rot: [0.0, 1.5708, 1.5708] } },
|
|
16
|
+
{ id: "grad", type: "tex_gradient" },
|
|
17
|
+
{ id: "ramp_001", type: "ramp_tri" },
|
|
18
|
+
{ id: "ramp_002", type: "ramp_cardinal", inputs: { pos0: 0.0, pos1: 0.9565 } },
|
|
19
|
+
{ id: "facing", type: "layer_weight/facing", inputs: { blend: 0.4 } },
|
|
20
|
+
{ id: "ramp_face", type: "ramp_cardinal", inputs: { pos0: 0.0, pos1: 0.5435 } },
|
|
21
|
+
{ id: "mix_001", type: "mix/blend", inputs: { fac: 0.5, a: [1.0, 1.0, 1.0] } },
|
|
22
|
+
{ id: "mask", type: "mix/lighten", inputs: { fac: 0.5 } },
|
|
23
|
+
{ id: "emission_hs", type: "hue_sat", inputs: { hue: 0.5, saturation: 1.0, value: 5.0, fac: 1.0 } },
|
|
24
|
+
{
|
|
25
|
+
id: "principled",
|
|
26
|
+
type: "principled",
|
|
27
|
+
inputs: {
|
|
28
|
+
metallic: 0.1,
|
|
29
|
+
specular: 1.0,
|
|
30
|
+
roughness: 0.5,
|
|
31
|
+
spec_clamp: 1e30,
|
|
32
|
+
sheen: 0.7017999887466431,
|
|
33
|
+
sheen_tint: 0.5,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{ id: "mix_shader_001", type: "mix_shader" },
|
|
37
|
+
],
|
|
38
|
+
links: [
|
|
39
|
+
{ from: { node: "geo", socket: "uv" }, to: { node: "map", socket: "vector" } },
|
|
40
|
+
{ from: { node: "map", socket: "vector" }, to: { node: "grad", socket: "vector" } },
|
|
41
|
+
{ from: { node: "grad", socket: "value" }, to: { node: "ramp_001", socket: "fac" } },
|
|
42
|
+
{ from: { node: "ramp_001", socket: "value" }, to: { node: "ramp_002", socket: "fac" } },
|
|
43
|
+
{ from: { node: "facing", socket: "value" }, to: { node: "ramp_face", socket: "fac" } },
|
|
44
|
+
{ from: { node: "ramp_face", socket: "fac_out" }, to: { node: "mix_001", socket: "b" } },
|
|
45
|
+
{ from: { node: "mix_001", socket: "color" }, to: { node: "mask", socket: "a" } },
|
|
46
|
+
{ from: { node: "ramp_002", socket: "fac_out" }, to: { node: "mask", socket: "b" } },
|
|
47
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "emission_hs", socket: "color" } },
|
|
48
|
+
{ from: { node: "tex", socket: "color" }, to: { node: "principled", socket: "base" } },
|
|
49
|
+
{ from: { node: "emission_hs", socket: "color" }, to: { node: "mix_shader_001", socket: "a" } },
|
|
50
|
+
{ from: { node: "principled", socket: "color" }, to: { node: "mix_shader_001", socket: "b" } },
|
|
51
|
+
{ from: { node: "mask", socket: "color" }, to: { node: "mix_shader_001", socket: "fac" } },
|
|
52
|
+
],
|
|
53
|
+
output: { node: "mix_shader_001", socket: "color" },
|
|
54
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SocketValue } from "./schema";
|
|
2
|
+
export type SockT = "float" | "color" | "vector" | "vec4";
|
|
3
|
+
export type InputSpec = {
|
|
4
|
+
type: SockT;
|
|
5
|
+
default?: SocketValue;
|
|
6
|
+
/** Socket is meaningless as a literal (e.g. the color being processed) — must be linked. */
|
|
7
|
+
requiresLink?: boolean;
|
|
8
|
+
/** Unlinked fallback is a template local, not a literal (e.g. principled.normal → n). */
|
|
9
|
+
contextDefault?: string;
|
|
10
|
+
};
|
|
11
|
+
export type NodeSpec = {
|
|
12
|
+
inputs: Record<string, InputSpec>;
|
|
13
|
+
outputs: Record<string, SockT>;
|
|
14
|
+
/** RHS expression for this node's `let`, from resolved arg expressions keyed by socket. */
|
|
15
|
+
emit?: (args: Record<string, string>) => string;
|
|
16
|
+
/** Context nodes tap template locals directly — no `let` emitted. */
|
|
17
|
+
contextOutputs?: Record<string, string>;
|
|
18
|
+
/** Swizzle applied to the node's variable per output socket (default: none). */
|
|
19
|
+
outputSelect?: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
export declare function fmtFloat(x: number): string;
|
|
22
|
+
export declare function fmtValue(value: SocketValue, type: SockT): string;
|
|
23
|
+
/** Does a literal's shape fit a socket type? (Scalar splats onto color/vector/vec4.) */
|
|
24
|
+
export declare function literalFits(value: SocketValue, type: SockT): boolean;
|
|
25
|
+
export declare function canConvert(from: SockT, to: SockT): boolean;
|
|
26
|
+
export declare function convert(from: SockT, to: SockT, expr: string): string;
|
|
27
|
+
export declare const NODE_REGISTRY: Record<string, NodeSpec>;
|
|
28
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/graph/registry.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEzD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,KAAK,CAAA;IACX,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC9B,2FAA2F;IAC3F,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAA;IAC/C,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACtC,CAAA;AAMD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAgBhE;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAIpE;AAMD,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAM1D;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpE;AA6BD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CA+OlD,CAAA"}
|