reze-engine 0.17.0 → 0.17.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/README.md CHANGED
@@ -1,250 +1,252 @@
1
- # Reze Engine
2
-
3
- **Zero-runtime-dependency** WebGPU engine for real-time MMD/PMX rendering — renderer, animation, IK, and physics, all in TypeScript.
4
-
5
- ![screenshot](./screenshot.png)
6
-
7
- ```bash
8
- npm install reze-engine
9
- ```
10
-
11
- ## Features
12
-
13
- - Anime/MMD **hybrid renderer** — toon-ramp NPR over a Principled GGX BSDF, mixed per material
14
- - **9 per-material presets** assigned by material name (`face` / `hair` / `body` / `eye` / `stockings` / `metal` / `cloth_smooth` / `cloth_rough` / `default`)
15
- - **HDR pipeline** — bloom, Filmic tone mapping, MSAA, Apple-TBDR-friendly targets
16
- - **In-house TS physics** sequential-impulse rigid bodies for PMX rigs, no external dependency
17
- - **VMD animation** with MMD IK, morphs (GPU compute path), and VMD export
18
- - **Interactive editing** — GPU picking, transform gizmo, bone/material selection
19
- - Orbit camera with bone-follow, ground + PCF shadows, multi-model
20
-
21
- See [Physics](#physics) and [Rendering](#rendering) for the internals.
22
-
23
- ## Codebase map
24
-
25
- ```
26
- engine/src/
27
- engine.ts Engine: device/context, render loop, all passes & pipelines,
28
- per-model GPU resources, picking, gizmo (entry point)
29
- model.ts Model: skeleton, 4-bone skinning, morphs (CPU + GPU compute),
30
- animation state, drives IK; per-frame update()
31
- animation.ts AnimationClip, VMD bezier interpolation, playback/priority
32
- ik-solver.ts MMD-style CCD IK (angle limits, solve-axis specialization)
33
- camera.ts Orbit camera (alpha/beta/radius), bone-follow, mouse/touch
34
- math.ts Vec3 / Quat / Mat4 (zero-alloc *Into variants for hot paths)
35
- pmx-loader.ts PMX parser: mesh, bones, morphs, rigid bodies, joints
36
- vmd-loader.ts VMD motion parser · vmd-writer.ts VMD export (Shift-JIS)
37
- asset-reader.ts URL + local-folder asset resolution · folder-upload.ts
38
- index.ts public exports
39
-
40
- physics/ in-house rigid-body solver (~2.5k lines)
41
- physics.ts RezePhysics: bone↔body sync, fixed-step accumulator + interpolation
42
- solver.ts sequential-impulse PGS (joint + contact rows)
43
- contact.ts narrowphase (analytical sphere/box/capsule pairs) + contact pool
44
- constraint.ts 6DOF spring joints · world.ts broadphase + step
45
- body.ts SoA rigid-body store · types.ts
46
-
47
- shaders/
48
- materials/ nodes.ts (Blender-node WGSL library) + common.ts (bindings, skinning VS)
49
- + one file per preset (face, hair, body, eye, stockings, …)
50
- passes/ shadow, morph (GPU vertex-morph compute), bloom, composite (Filmic),
51
- outline, selection, gizmo, pick, ground, mipmap
52
- ```
53
-
54
- ## Quick start
55
-
56
- ```javascript
57
- import { Engine, Vec3 } from "reze-engine"
58
-
59
- const engine = new Engine(canvas, {
60
- world: { color: new Vec3(0.4, 0.49, 0.65), strength: 1.0 }, // environment light
61
- sun: { color: new Vec3(1, 1, 1), strength: 2.0, direction: new Vec3(0, -0.5, 1) },
62
- bloom: { color: new Vec3(0.9, 0.1, 0.8), intensity: 0.05, threshold: 0.5 },
63
- camera: { distance: 31.5, target: new Vec3(0, 11.5, 0) }, // MMD units (1 unit = 8 cm)
64
- })
65
- await engine.init()
66
-
67
- const model = await engine.loadModel("hero", "/models/hero/hero.pmx")
68
-
69
- // Map PMX material names to NPR presets (unlisted names fall back to `default`).
70
- engine.setMaterialPresets("hero", {
71
- face: ["face01"],
72
- body: ["skin"],
73
- hair: ["hair_f"],
74
- eye: ["eye"],
75
- cloth_smooth: ["shirt", "dress", "shoes"],
76
- cloth_rough: ["jacket"],
77
- stockings: ["stockings"],
78
- metal: ["earring"],
79
- })
80
-
81
- await model.loadVmd("idle", "/animations/idle.vmd")
82
- model.show("idle")
83
- model.play()
84
-
85
- engine.setCameraFollow(model, "センター", new Vec3(0, 3.5, 0))
86
- engine.addGround({ width: 160, height: 160 })
87
- engine.runRenderLoop()
88
- ```
89
-
90
- ## API
91
-
92
- One WebGPU **Engine** per page (singleton after `init()`). Models load by URL **or** from a user-selected folder ([below](#local-folder-uploads-browser)).
93
-
94
- ### Engine
95
-
96
- ```javascript
97
- engine.init()
98
- engine.loadModel(name, path) // or ({ files, pmxFile? }) for folder upload
99
- engine.getModel(name) / getModelNames() / removeModel(name)
100
-
101
- engine.setMaterialPresets(name, presetMap) // assign NPR presets by material name
102
- engine.setMaterialVisible(name, material, visible) / toggleMaterialVisible / isMaterialVisible
103
-
104
- engine.setIKEnabled(enabled)
105
- engine.setPhysicsEnabled(enabled)
106
- engine.resetPhysics() // re-pose bodies from animation + zero velocities (call if physics explodes)
107
-
108
- engine.setCameraFollow(model, bone?, offset?) / setCameraFollow(null)
109
- engine.setCameraTarget(vec3) / setCameraDistance(d) / setCameraAlpha(a) / setCameraBeta(b)
110
-
111
- engine.setWorld({ color?, strength? }) / setSun({ color?, strength?, direction? }) // runtime lighting
112
- engine.addGround(options?)
113
- engine.runRenderLoop(callback?) / stopRenderLoop()
114
- engine.getStats() // fps + smoothness metrics (frameTimeMax, fps1PercentLow, jitter)
115
- engine.dispose()
116
- ```
117
-
118
- **Options** — Blender-style scene config: `world` = environment lighting, `sun` = directional lamp (`direction` points from sun into the scene), `camera` = framing (`fov` in radians). Callbacks: `onRaycast`, `onGizmoDrag`. The shadow map is cast from `sun.direction` — the same vector the shader lights with — so shading and cast shadows stay coupled.
119
-
120
- ### Model
121
-
122
- ```javascript
123
- await model.loadVmd(name, url) / model.loadClip(name, clip)
124
- model.show(name)
125
- model.play(name, { priority?, loop? }) // priority: higher wins when clips compete (0 = default)
126
- model.pause() / stop() / seek(time)
127
- model.getAnimationProgress() // { current, duration (s), playing, paused, looping, }
128
- model.exportVmd(name) // ArrayBuffer (Shift-JIS bone/morph names)
129
-
130
- model.rotateBones({ 首: quat }, ms?) / moveBones({ センター: vec3 }, ms?)
131
- model.setMorphWeight(name, weight, ms?)
132
- model.resetAllBones() / resetAllMorphs()
133
- model.getBoneWorldPosition(name)
134
- ```
135
-
136
- `AnimationClip` holds keyframes only (bone/morph tracks keyed by `frame`, plus `frameCount`); time advances at fixed `FPS` (exported, default 30).
137
-
138
- ### Local folder uploads (browser)
139
-
140
- Feed a `<input type="file" webkitdirectory>` `FileList` (or drag/drop) into the engine; textures resolve relative to the chosen PMX inside that tree.
141
-
142
- > **Gotcha:** copy `input.files` into an array **before** `input.value = ""` the `FileList` is live and clearing the input empties it.
143
-
144
- `parsePmxFolderInput(fileList)` returns a tagged result; for `single` you get `{ files, pmxFile }` directly, for `multiple` show a picker over `pmxRelativePaths` and resolve with `pmxFileAtRelativePath(files, path)`. Then:
145
-
146
- ```javascript
147
- const picked = parsePmxFolderInput(e.target.files)
148
- e.target.value = ""
149
- if (picked.status === "single") await engine.loadModel("m", { files: picked.files, pmxFile: picked.pmxFile })
150
- ```
151
-
152
- VMD and other assets still load by URL when the path starts with `/` or `http(s):`; relative paths resolve against the PMX directory.
153
-
154
- ### Interactive pose editing
155
-
156
- Double-click picks a bone or material (per-triangle dominant-joint from the GPU pick, so one handler serves both modes); a local-axis transform gizmo drags it. **The engine only reports — it never writes the skeleton itself**, so the host chooses the write policy.
157
-
158
- ```typescript
159
- engine.setSelectedBone(modelName | null, boneName | null) // shows the gizmo
160
- engine.setSelectedMaterial(modelName | null, materialName | null) // selection outline
161
-
162
- onRaycast: (modelName, material, bone, screenX, screenY) => { ... } // modelName "" = missed
163
-
164
- type GizmoDragEvent = {
165
- boneName: string; boneIndex: number; kind: "rotate" | "translate"
166
- localRotation: Quat; localTranslation: Vec3 // target absolute local transform
167
- phase?: "start" | "end" // undefined during drag moves
168
- }
169
- ```
170
-
171
- The gizmo consumes mouse input inside its bounding sphere so drags never fight camera orbit. Apply the reported transform — runtime override (below) or keyframe edit into a clip you re-`loadClip`:
172
-
173
- ```javascript
174
- onGizmoDrag: (e) => {
175
- const model = engine.getModel(e.modelName)
176
- if (!model) return
177
- if (e.phase === "start") {
178
- model.pause()
179
- model.setClipApplySuspended(true)
180
- return
181
- } // stop re-sampling wiping the edit
182
- if (e.phase === "end") return
183
- if (e.kind === "rotate")
184
- model.rotateBones({ [e.boneName]: e.localRotation }, 0) // 0 = instant write
185
- else model.setBoneLocalTranslation(e.boneIndex, e.localTranslation)
186
- }
187
- // play()/seek() auto-clear the suspend flag (edit is lost — runtime-override semantic).
188
- ```
189
-
190
- Note the asymmetry: rotation goes through `rotateBones(…, 0)`, but translation uses `setBoneLocalTranslation(idx, v)` — `moveBones` converts VMD-relative→local, and the gizmo output is already local.
191
-
192
- ## Physics
193
-
194
- In-house sequential-impulse rigid-body solver for PMX rigs (sphere / box / capsule colliders, 6DOF spring joints), ~2.5k lines of TypeScript, no external dependency, at quality comparable to Bullet's defaults. A fixed-timestep accumulator runs at a constant **60 Hz** (≤6 substeps/frame) so spring impulse, damping, and integration stay deterministic; dynamic bodies are **render-interpolated** between substeps to stay smooth when the display rate ≠ 60 Hz.
195
-
196
- **Per substep:** `predict velocities broad + narrowphase solve constraints (10 iters) split-impulse position correction integrate`.
197
-
198
- - **Solver** projected Gauss-Seidel, joint rows + contact rows in one loop. Joints are 6DOF springs (3 linear + 3 angular) with stop-ERP limit correction and per-axis stiffness×error impulse. Linear rows pivot on each body's own joint-frame origin (Spring2-style, not Bullet 2.7x's shared mid-anchor), so a violated joint pulls itself back together instead of degenerating into torque and "breaking".
199
- - **Angular limits** — hybrid: small violations (< 0.5 rad, the resting-cloth regime) use per-axis Euler stop rows, which converge cleanly and keep resting cloth still; larger violations switch to a single geodesic row toward the Euler-clamped target rotation, because per-axis Euler rows chase phantom errors near the ±90° singularity and pump energy. Ranged stops are unilateral (accumulated impulse clamped to the corrective sign) so a limit pushes back into range but never brakes natural recovery; locked axes stay bilateral equality joints. Spring rows stay per-axis, with stiffness clamped to the `k·dt² ≤ ¼` stability bound.
200
- - **Narrowphase** — analytical sphere-sphere / -capsule / -box and capsule-capsule / -box. Capsule-capsule emits multiple contacts along near-parallel axes so cloth can't pivot around a single closest point.
201
- - **Speculative contacts** (`margin 0.04`) fire at near-touch with a push-only clamp inert until real overlap, but they stop fast bodies tunneling thin surfaces in one substep.
202
- - **Split-impulse correction** resolves penetration by a mass-weighted translation _outside_ the velocity solver, so joint pulls can't fight separation.
203
- - **Kinematic advancement** bone-driven bodies move toward the frame's bone pose incrementally per substep, with velocities derived over the fixed step, so the solver never sees more than one 60 Hz step of anchor motion regardless of render dt.
204
- - **Discontinuity guards** a bone-pose jump beyond continuous motion (timeline scrub, long stall) rigidly carries each dynamic body along with its kinematic root's transform delta and zeroes momentum instead of dragging cloth across the gap; correction velocities are clamped (120 u/s linear, 30 rad/s angular), per-step travel is capped, and any body that still goes non-finite is restored to its previous substep pose.
205
- - Sleeping is off (cloth must always react); resting bodies bleed micro-velocity via per-PMX damping.
206
-
207
- Engine surface is just `setPhysicsEnabled` / `resetPhysics` — all tuning (mass, damping, friction, restitution, joint stiffness/limits, collision groups) lives on the PMX rig.
208
-
209
- ## Rendering
210
-
211
- Each surface mixes an NPR stack with a Principled-style BSDF per material, so characters keep a flat illustrated look while highlights and reflections stay grounded. Shaders live in `engine/src/shaders/materials/`; each fragment shader follows one 7-stage layout (shared stages from `nodes.ts` / `common.ts`):
212
-
213
- ```
214
- (A) setup → (B) texture + alpha → (C) NPR stack → (D) optional bump
215
- → (E) Principled BSDF → (F) NPR↔PBR mix → (G) FSOut
216
- ```
217
-
218
- `default` uses only A/B/E/G; NPR presets add C (and sometimes D), with F choosing how NPR-leaning the result is.
219
-
220
- - **PBR core** (`eval_principled`) GGX + Schlick Fresnel, Walter–Smith G1, Fdez-Agüera 2019 multi-scatter, Karis split-sum DFG LUT, Heitz 2016 LTC direct-spec, optional sheen.
221
- - **NPR toolbox** — toon ramps (constant / fwidth-AA'd), HSV warm-shadow / cool-light remaps, fresnel + layer-weight rims, value-noise bump, Voronoi metallic sparkle, BT.601-gated emission.
222
-
223
- | Preset | Notes |
224
- | -------------- | ----------------------------------------------------------------------- |
225
- | `default` | Plain Principled, metallic 0, rough 0.5 |
226
- | `eye` | Plain + post-eval emission ×1.5 |
227
- | `face` | Toon + warm rim + dual-fresnel rim + bright-tex gate, noise bump |
228
- | `body` | Toon + warm rim + fresnel + facing rim, noise bump |
229
- | `hair` | Toon + fresnel + bevel + bright-tex gate, 20% PBR |
230
- | `cloth_smooth` | Toon + bevel + emission overlay (×18) |
231
- | `cloth_rough` | Same NPR, live noise bump, rough 0.82 |
232
- | `metal` | Toon + emission overlay (×8), Voronoi base, metallic 1 |
233
- | `stockings` | Gradient × facing mask + HSV emission (×5), sheen 0.7, **alpha-hashed** |
234
-
235
- **Post & output.** Directional shadow map (2048², depth32float, PCF) → HDR main pass at 4× MSAA (`rg11b10ufloat` color + `rg8unorm` aux MRT for bloom mask + alpha; fits Apple-Silicon TBDR tile memory so MSAA resolves in-tile, `rgba16float` fallback) → bloom mip pyramid → Filmic tone map (Blender 3.6 "Filmic / Medium High Contrast" LUT) → inverted-hull outline.
236
-
237
- - **Alpha-hashed transparency** (`stockings`) Wyman & McGuire 2017 derivative-aware stochastic discard in object space, so self-overlapping meshes resolve under MSAA with opaque depth writes and the dither doesn't swim.
238
- - **See-through hair over eyes** — stencil-gated extra pass: the eye stamps `EYE_VALUE`, main hair skips it, an extra pass matches it and blends hair at 25% in linear HDR so eyes stay readable.
239
-
240
- ## Used by
241
-
242
- - [Reze Studio](https://reze.studio) (MMD animation editor)
243
- - [MiKaPo](https://mikapo.vercel.app) (motion capture)
244
- - [Popo](https://popo.love) (LLM-generated poses)
245
- - [MPL](https://mmd-mpl.vercel.app) (motion language)
246
- - [Mixamo-MMD](https://mixamo-mmd.vercel.app) (FBX→VMD retarget)
247
-
248
- ## Tutorial
249
-
250
- [How to Render an Anime Character with WebGPU](https://reze.one/tutorial)
1
+ # Reze Engine
2
+
3
+ [![npm](https://img.shields.io/npm/v/reze-engine)](https://www.npmjs.com/package/reze-engine)
4
+
5
+ **Zero-runtime-dependency** WebGPU engine for real-time MMD/PMX rendering — renderer, animation, IK, and physics, all in TypeScript.
6
+
7
+ ![screenshot](./screenshot.png)
8
+
9
+ ```bash
10
+ npm install reze-engine
11
+ ```
12
+
13
+ ## Features
14
+
15
+ - Anime/MMD **hybrid renderer** — toon-ramp NPR over a Principled GGX BSDF, mixed per material
16
+ - **9 per-material presets** assigned by material name (`face` / `hair` / `body` / `eye` / `stockings` / `metal` / `cloth_smooth` / `cloth_rough` / `default`)
17
+ - **HDR pipeline** bloom, Filmic tone mapping, 4× MSAA, Apple-TBDR-friendly targets
18
+ - **In-house TS physics** — sequential-impulse rigid bodies for PMX rigs, no external dependency
19
+ - **VMD animation** with MMD IK, morphs (GPU compute path), and VMD export
20
+ - **Interactive editing** — GPU picking, transform gizmo, bone/material selection
21
+ - Orbit camera with bone-follow, ground + PCF shadows, multi-model
22
+
23
+ See [Physics](#physics) and [Rendering](#rendering) for the internals.
24
+
25
+ ## Codebase map
26
+
27
+ ```
28
+ engine/src/
29
+ engine.ts Engine: device/context, render loop, all passes & pipelines,
30
+ per-model GPU resources, picking, gizmo (entry point)
31
+ model.ts Model: skeleton, 4-bone skinning, morphs (CPU + GPU compute),
32
+ animation state, drives IK; per-frame update()
33
+ animation.ts AnimationClip, VMD bezier interpolation, playback/priority
34
+ ik-solver.ts MMD-style CCD IK (angle limits, solve-axis specialization)
35
+ camera.ts Orbit camera (alpha/beta/radius), bone-follow, mouse/touch
36
+ math.ts Vec3 / Quat / Mat4 (zero-alloc *Into variants for hot paths)
37
+ pmx-loader.ts PMX parser: mesh, bones, morphs, rigid bodies, joints
38
+ vmd-loader.ts VMD motion parser · vmd-writer.ts VMD export (Shift-JIS)
39
+ asset-reader.ts URL + local-folder asset resolution · folder-upload.ts
40
+ index.ts public exports
41
+
42
+ physics/ in-house rigid-body solver (~2.5k lines)
43
+ physics.ts RezePhysics: bone↔body sync, fixed-step accumulator + interpolation
44
+ solver.ts sequential-impulse PGS (joint + contact rows)
45
+ contact.ts narrowphase (analytical sphere/box/capsule pairs) + contact pool
46
+ constraint.ts 6DOF spring joints · world.ts broadphase + step
47
+ body.ts SoA rigid-body store · types.ts
48
+
49
+ shaders/
50
+ materials/ nodes.ts (Blender-node WGSL library) + common.ts (bindings, skinning VS)
51
+ + one file per preset (face, hair, body, eye, stockings, …)
52
+ passes/ shadow, morph (GPU vertex-morph compute), bloom, composite (Filmic),
53
+ outline, selection, gizmo, pick, ground, mipmap
54
+ ```
55
+
56
+ ## Quick start
57
+
58
+ ```javascript
59
+ import { Engine, Vec3 } from "reze-engine"
60
+
61
+ const engine = new Engine(canvas, {
62
+ world: { color: new Vec3(0.4, 0.49, 0.65), strength: 1.0 }, // environment light
63
+ sun: { color: new Vec3(1, 1, 1), strength: 2.0, direction: new Vec3(0, -0.5, 1) },
64
+ bloom: { color: new Vec3(0.9, 0.1, 0.8), intensity: 0.05, threshold: 0.5 },
65
+ camera: { distance: 31.5, target: new Vec3(0, 11.5, 0) }, // MMD units (1 unit = 8 cm)
66
+ })
67
+ await engine.init()
68
+
69
+ const model = await engine.loadModel("hero", "/models/hero/hero.pmx")
70
+
71
+ // Map PMX material names to NPR presets (unlisted names fall back to `default`).
72
+ engine.setMaterialPresets("hero", {
73
+ face: ["face01"],
74
+ body: ["skin"],
75
+ hair: ["hair_f"],
76
+ eye: ["eye"],
77
+ cloth_smooth: ["shirt", "dress", "shoes"],
78
+ cloth_rough: ["jacket"],
79
+ stockings: ["stockings"],
80
+ metal: ["earring"],
81
+ })
82
+
83
+ await model.loadVmd("idle", "/animations/idle.vmd")
84
+ model.show("idle")
85
+ model.play()
86
+
87
+ engine.setCameraFollow(model, "センター", new Vec3(0, 3.5, 0))
88
+ engine.addGround({ width: 160, height: 160 })
89
+ engine.runRenderLoop()
90
+ ```
91
+
92
+ ## API
93
+
94
+ One WebGPU **Engine** per page (singleton after `init()`). Models load by URL **or** from a user-selected folder ([below](#local-folder-uploads-browser)).
95
+
96
+ ### Engine
97
+
98
+ ```javascript
99
+ engine.init()
100
+ engine.loadModel(name, path) // or ({ files, pmxFile? }) for folder upload
101
+ engine.getModel(name) / getModelNames() / removeModel(name)
102
+
103
+ engine.setMaterialPresets(name, presetMap) // assign NPR presets by material name
104
+ engine.setMaterialVisible(name, material, visible) / toggleMaterialVisible / isMaterialVisible
105
+
106
+ engine.setIKEnabled(enabled)
107
+ engine.setPhysicsEnabled(enabled)
108
+ engine.resetPhysics() // re-pose bodies from animation + zero velocities (call if physics explodes)
109
+
110
+ engine.setCameraFollow(model, bone?, offset?) / setCameraFollow(null)
111
+ engine.setCameraTarget(vec3) / setCameraDistance(d) / setCameraAlpha(a) / setCameraBeta(b)
112
+
113
+ engine.setWorld({ color?, strength? }) / setSun({ color?, strength?, direction? }) // runtime lighting
114
+ engine.addGround(options?)
115
+ engine.runRenderLoop(callback?) / stopRenderLoop()
116
+ engine.getStats() // fps + smoothness metrics (frameTimeMax, fps1PercentLow, jitter)
117
+ engine.dispose()
118
+ ```
119
+
120
+ **Options** — Blender-style scene config: `world` = environment lighting, `sun` = directional lamp (`direction` points from sun into the scene), `camera` = framing (`fov` in radians). Callbacks: `onRaycast`, `onGizmoDrag`. The shadow map is cast from `sun.direction` — the same vector the shader lights with — so shading and cast shadows stay coupled.
121
+
122
+ ### Model
123
+
124
+ ```javascript
125
+ await model.loadVmd(name, url) / model.loadClip(name, clip)
126
+ model.show(name)
127
+ model.play(name, { priority?, loop? }) // priority: higher wins when clips compete (0 = default)
128
+ model.pause() / stop() / seek(time)
129
+ model.getAnimationProgress() // { current, duration (s), playing, paused, looping, … }
130
+ model.exportVmd(name) // ArrayBuffer (Shift-JIS bone/morph names)
131
+
132
+ model.rotateBones({ 首: quat }, ms?) / moveBones({ センター: vec3 }, ms?)
133
+ model.setMorphWeight(name, weight, ms?)
134
+ model.resetAllBones() / resetAllMorphs()
135
+ model.getBoneWorldPosition(name)
136
+ ```
137
+
138
+ `AnimationClip` holds keyframes only (bone/morph tracks keyed by `frame`, plus `frameCount`); time advances at fixed `FPS` (exported, default 30).
139
+
140
+ ### Local folder uploads (browser)
141
+
142
+ Feed a `<input type="file" webkitdirectory>` `FileList` (or drag/drop) into the engine; textures resolve relative to the chosen PMX inside that tree.
143
+
144
+ > **Gotcha:** copy `input.files` into an array **before** `input.value = ""` the `FileList` is live and clearing the input empties it.
145
+
146
+ `parsePmxFolderInput(fileList)` returns a tagged result; for `single` you get `{ files, pmxFile }` directly, for `multiple` show a picker over `pmxRelativePaths` and resolve with `pmxFileAtRelativePath(files, path)`. Then:
147
+
148
+ ```javascript
149
+ const picked = parsePmxFolderInput(e.target.files)
150
+ e.target.value = ""
151
+ if (picked.status === "single") await engine.loadModel("m", { files: picked.files, pmxFile: picked.pmxFile })
152
+ ```
153
+
154
+ VMD and other assets still load by URL when the path starts with `/` or `http(s):`; relative paths resolve against the PMX directory.
155
+
156
+ ### Interactive pose editing
157
+
158
+ Double-click picks a bone or material (per-triangle dominant-joint from the GPU pick, so one handler serves both modes); a local-axis transform gizmo drags it. **The engine only reports — it never writes the skeleton itself**, so the host chooses the write policy.
159
+
160
+ ```typescript
161
+ engine.setSelectedBone(modelName | null, boneName | null) // shows the gizmo
162
+ engine.setSelectedMaterial(modelName | null, materialName | null) // selection outline
163
+
164
+ onRaycast: (modelName, material, bone, screenX, screenY) => { ... } // modelName "" = missed
165
+
166
+ type GizmoDragEvent = {
167
+ boneName: string; boneIndex: number; kind: "rotate" | "translate"
168
+ localRotation: Quat; localTranslation: Vec3 // target absolute local transform
169
+ phase?: "start" | "end" // undefined during drag moves
170
+ }
171
+ ```
172
+
173
+ The gizmo consumes mouse input inside its bounding sphere so drags never fight camera orbit. Apply the reported transform — runtime override (below) or keyframe edit into a clip you re-`loadClip`:
174
+
175
+ ```javascript
176
+ onGizmoDrag: (e) => {
177
+ const model = engine.getModel(e.modelName)
178
+ if (!model) return
179
+ if (e.phase === "start") {
180
+ model.pause()
181
+ model.setClipApplySuspended(true)
182
+ return
183
+ } // stop re-sampling wiping the edit
184
+ if (e.phase === "end") return
185
+ if (e.kind === "rotate")
186
+ model.rotateBones({ [e.boneName]: e.localRotation }, 0) // 0 = instant write
187
+ else model.setBoneLocalTranslation(e.boneIndex, e.localTranslation)
188
+ }
189
+ // play()/seek() auto-clear the suspend flag (edit is lost — runtime-override semantic).
190
+ ```
191
+
192
+ Note the asymmetry: rotation goes through `rotateBones(…, 0)`, but translation uses `setBoneLocalTranslation(idx, v)` — `moveBones` converts VMD-relative→local, and the gizmo output is already local.
193
+
194
+ ## Physics
195
+
196
+ In-house sequential-impulse rigid-body solver for PMX rigs (sphere / box / capsule colliders, 6DOF spring joints), ~2.5k lines of TypeScript, no external dependency, at quality comparable to Bullet's defaults. A fixed-timestep accumulator runs at a constant **60 Hz** (≤6 substeps/frame) so spring impulse, damping, and integration stay deterministic; dynamic bodies are **render-interpolated** between substeps to stay smooth when the display rate ≠ 60 Hz.
197
+
198
+ **Per substep:** `predict velocities broad + narrowphase solve constraints (10 iters) split-impulse position correction integrate`.
199
+
200
+ - **Solver** — projected Gauss-Seidel, joint rows + contact rows in one loop. Joints are 6DOF springs (3 linear + 3 angular) with stop-ERP limit correction and per-axis stiffness×error impulse. Linear rows pivot on each body's own joint-frame origin (Spring2-style, not Bullet 2.7x's shared mid-anchor), so a violated joint pulls itself back together instead of degenerating into torque and "breaking".
201
+ - **Angular limits** — hybrid: small violations (< 0.5 rad, the resting-cloth regime) use per-axis Euler stop rows, which converge cleanly and keep resting cloth still; larger violations switch to a single geodesic row toward the Euler-clamped target rotation, because per-axis Euler rows chase phantom errors near the ±90° singularity and pump energy. Ranged stops are unilateral (accumulated impulse clamped to the corrective sign) so a limit pushes back into range but never brakes natural recovery; locked axes stay bilateral equality joints. Spring rows stay per-axis, with stiffness clamped to the `k·dt² ≤ ¼` stability bound.
202
+ - **Narrowphase** — analytical sphere-sphere / -capsule / -box and capsule-capsule / -box. Capsule-capsule emits multiple contacts along near-parallel axes so cloth can't pivot around a single closest point.
203
+ - **Speculative contacts** (`margin 0.04`) fire at near-touch with a push-only clamp inert until real overlap, but they stop fast bodies tunneling thin surfaces in one substep.
204
+ - **Split-impulse correction** resolves penetration by a mass-weighted translation _outside_ the velocity solver, so joint pulls can't fight separation.
205
+ - **Kinematic advancement** bone-driven bodies move toward the frame's bone pose incrementally per substep, with velocities derived over the fixed step, so the solver never sees more than one 60 Hz step of anchor motion regardless of render dt.
206
+ - **Discontinuity guards** — a bone-pose jump beyond continuous motion (timeline scrub, long stall) rigidly carries each dynamic body along with its kinematic root's transform delta and zeroes momentum instead of dragging cloth across the gap; correction velocities are clamped (120 u/s linear, 30 rad/s angular), per-step travel is capped, and any body that still goes non-finite is restored to its previous substep pose.
207
+ - Sleeping is off (cloth must always react); resting bodies bleed micro-velocity via per-PMX damping.
208
+
209
+ Engine surface is just `setPhysicsEnabled` / `resetPhysics` — all tuning (mass, damping, friction, restitution, joint stiffness/limits, collision groups) lives on the PMX rig.
210
+
211
+ ## Rendering
212
+
213
+ Each surface mixes an NPR stack with a Principled-style BSDF per material, so characters keep a flat illustrated look while highlights and reflections stay grounded. Shaders live in `engine/src/shaders/materials/`; each fragment shader follows one 7-stage layout (shared stages from `nodes.ts` / `common.ts`):
214
+
215
+ ```
216
+ (A) setup → (B) texture + alpha → (C) NPR stack → (D) optional bump
217
+ → (E) Principled BSDF → (F) NPR↔PBR mix → (G) FSOut
218
+ ```
219
+
220
+ `default` uses only A/B/E/G; NPR presets add C (and sometimes D), with F choosing how NPR-leaning the result is.
221
+
222
+ - **PBR core** (`eval_principled`) — GGX + Schlick Fresnel, Walter–Smith G1, Fdez-Agüera 2019 multi-scatter, Karis split-sum DFG LUT, Heitz 2016 LTC direct-spec, optional sheen.
223
+ - **NPR toolbox** — toon ramps (constant / fwidth-AA'd), HSV warm-shadow / cool-light remaps, fresnel + layer-weight rims, value-noise bump, Voronoi metallic sparkle, BT.601-gated emission.
224
+
225
+ | Preset | Notes |
226
+ | -------------- | ----------------------------------------------------------------------- |
227
+ | `default` | Plain Principled, metallic 0, rough 0.5 |
228
+ | `eye` | Plain + post-eval emission ×1.5 |
229
+ | `face` | Toon + warm rim + dual-fresnel rim + bright-tex gate, noise bump |
230
+ | `body` | Toon + warm rim + fresnel + facing rim, noise bump |
231
+ | `hair` | Toon + fresnel + bevel + bright-tex gate, 20% PBR |
232
+ | `cloth_smooth` | Toon + bevel + emission overlay (×18) |
233
+ | `cloth_rough` | Same NPR, live noise bump, rough 0.82 |
234
+ | `metal` | Toon + emission overlay (×8), Voronoi base, metallic 1 |
235
+ | `stockings` | Gradient × facing mask + HSV emission (×5), sheen 0.7, **alpha-hashed** |
236
+
237
+ **Post & output.** Directional shadow map (2048², depth32float, PCF) → HDR main pass at 4× MSAA (`rg11b10ufloat` color + `rg8unorm` aux MRT for bloom mask + alpha; fits Apple-Silicon TBDR tile memory so MSAA resolves in-tile, `rgba16float` fallback) bloom mip pyramid Filmic tone map (Blender 3.6 "Filmic / Medium High Contrast" LUT) → inverted-hull outline.
238
+
239
+ - **Alpha-hashed transparency** (`stockings`) — Wyman & McGuire 2017 derivative-aware stochastic discard in object space, so self-overlapping meshes resolve under MSAA with opaque depth writes and the dither doesn't swim.
240
+ - **See-through hair over eyes** — stencil-gated extra pass: the eye stamps `EYE_VALUE`, main hair skips it, an extra pass matches it and blends hair at 25% in linear HDR so eyes stay readable.
241
+
242
+ ## Used by
243
+
244
+ - [Reze Studio](https://reze.studio) (MMD animation editor)
245
+ - [MiKaPo](https://mikapo.vercel.app) (motion capture)
246
+ - [Popo](https://popo.love) (LLM-generated poses)
247
+ - [MPL](https://mmd-mpl.vercel.app) (motion language)
248
+ - [Mixamo-MMD](https://mixamo-mmd.vercel.app) (FBX→VMD retarget)
249
+
250
+ ## Tutorial
251
+
252
+ [How to Render an Anime Character with WebGPU](https://reze.one/tutorial)
package/dist/engine.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Quat, Vec3 } from "./math";
2
2
  import { Model } from "./model";
3
3
  import { type AssetReader } from "./asset-reader";
4
- export type MaterialPreset = "default" | "face" | "hair" | "body" | "eye" | "stockings" | "metal" | "cloth_smooth" | "cloth_rough" | "mmd_classic";
4
+ export type MaterialPreset = "default" | "face" | "hair" | "body" | "eye" | "stockings" | "metal" | "cloth_smooth" | "cloth_rough";
5
+ export type ResolvedMaterialPreset = MaterialPreset | "mmd_classic";
5
6
  export type MaterialPresetMap = Partial<Record<MaterialPreset, string[]>>;
6
7
  export type RaycastCallback = (modelName: string, material: string | null, bone: string | null, screenX: number, screenY: number) => void;
7
8
  /** Select a folder (webkitdirectory) and pass FileList or File[]; pmxFile picks which .pmx when several exist. */
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAA;AAI9C,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAA;AA6BvB,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,WAAW,GACX,OAAO,GACP,cAAc,GACd,aAAa,GACb,aAAa,CAAA;AAEjB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AA+DzE,MAAM,MAAM,eAAe,GAAG,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,KACZ,IAAI,CAAA;AAET,kHAAkH;AAClH,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,CAAA;IACxB,OAAO,CAAC,EAAE,IAAI,CAAA;CACf,CAAA;AAID,MAAM,MAAM,YAAY,GAAG;IACzB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM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AuC1C,OAAO,CAAC,eAAe;IA6CvB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,uBAAuB,CAI9B;IAED,OAAO,CAAC,iBAAiB,CA0BxB;IAED,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,qBAAqB;IAsC7B,OAAO,CAAC,eAAe;IA8DvB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,YAAY;IAqDpB,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,oBAAoB,CAoG3B;IAED,OAAO,CAAC,oBAAoB,CA+C3B;IAED,OAAO,CAAC,kBAAkB,CAsBzB;IAED,OAAO,CAAC,cAAc;YA+CR,iBAAiB;IAkD/B,MAAM;IA4HN,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,iBAAiB;IAazB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAoBrB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAepB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,WAAW;CA0CpB"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Engine, DEFAULT_BLOOM_OPTIONS, DEFAULT_VIEW_TRANSFORM, type EngineStats, type EngineOptions, type BloomOptions, type ViewTransformOptions, type LoadModelFromFilesOptions, type MaterialPreset, type MaterialPresetMap, type GizmoDragEvent, type GizmoDragCallback, type GizmoDragKind, } from "./engine";
1
+ export { Engine, DEFAULT_BLOOM_OPTIONS, DEFAULT_VIEW_TRANSFORM, type EngineStats, type EngineOptions, type BloomOptions, type ViewTransformOptions, type LoadModelFromFilesOptions, type MaterialPreset, type ResolvedMaterialPreset, type MaterialPresetMap, type GizmoDragEvent, type GizmoDragCallback, type GizmoDragKind, } from "./engine";
2
2
  export { parsePmxFolderInput, pmxFileAtRelativePath, type PmxFolderInputResult } from "./folder-upload";
3
3
  export { Model } from "./model";
4
4
  export { Vec3, Quat, Mat4 } from "./math";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "reze-engine",
3
- "version": "0.17.0",
4
- "description": "A lightweight WebGPU engine for real-time 3D MMD/PMX model rendering",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "type": "module",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/AmyangXYZ/reze-engine"
11
- },
12
- "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js"
16
- }
17
- },
18
- "files": [
19
- "dist",
20
- "src"
21
- ],
22
- "scripts": {
23
- "build": "tsc",
24
- "dev": "tsc --watch",
25
- "prepublishOnly": "npm run build"
26
- },
27
- "keywords": [
28
- "webgpu",
29
- "3d",
30
- "engine",
31
- "pmx",
32
- "physics"
33
- ],
34
- "author": "",
35
- "license": "MIT",
36
- "dependencies": {
37
- "@webgpu/types": "^0.1.66"
38
- },
39
- "devDependencies": {
40
- "@types/node": "^20",
41
- "typescript": "^5"
42
- }
1
+ {
2
+ "name": "reze-engine",
3
+ "version": "0.17.1",
4
+ "description": "A lightweight WebGPU engine for real-time 3D MMD/PMX model rendering",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/AmyangXYZ/reze-engine"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "dev": "tsc --watch",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "keywords": [
28
+ "webgpu",
29
+ "3d",
30
+ "engine",
31
+ "pmx",
32
+ "physics"
33
+ ],
34
+ "author": "",
35
+ "license": "MIT",
36
+ "dependencies": {
37
+ "@webgpu/types": "^0.1.66"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^20",
41
+ "typescript": "^5"
42
+ }
43
43
  }
package/src/engine.ts CHANGED
@@ -52,7 +52,13 @@ export type MaterialPreset =
52
52
  | "metal"
53
53
  | "cloth_smooth"
54
54
  | "cloth_rough"
55
- | "mmd_classic"
55
+
56
+ // What a draw call actually resolves to. "mmd_classic" is the automatic
57
+ // authentic-MMD fallback for materials no preset map or name heuristic
58
+ // covers — deliberately NOT part of MaterialPreset, so consumer-side
59
+ // exhaustive Record<MaterialPreset, …> maps and switches don't have to
60
+ // carry an option users never assign.
61
+ export type ResolvedMaterialPreset = MaterialPreset | "mmd_classic"
56
62
 
57
63
  export type MaterialPresetMap = Partial<Record<MaterialPreset, string[]>>
58
64
 
@@ -102,7 +108,7 @@ const PRESET_NAME_HINTS: Array<[MaterialPreset, string[]]> = [
102
108
  ],
103
109
  ]
104
110
 
105
- function resolvePreset(materialName: string, map: MaterialPresetMap | undefined): MaterialPreset {
111
+ function resolvePreset(materialName: string, map: MaterialPresetMap | undefined): ResolvedMaterialPreset {
106
112
  if (map) {
107
113
  for (const [preset, names] of Object.entries(map)) {
108
114
  if (names && names.includes(materialName)) return preset as MaterialPreset
@@ -259,7 +265,7 @@ interface DrawCall {
259
265
  firstIndex: number
260
266
  bindGroup: GPUBindGroup
261
267
  materialName: string
262
- preset: MaterialPreset
268
+ preset: ResolvedMaterialPreset
263
269
  }
264
270
 
265
271
  interface PickDrawCall {
@@ -3180,7 +3186,7 @@ export class Engine {
3180
3186
  "transparent-outline": 3,
3181
3187
  ground: 4,
3182
3188
  }
3183
- const presetRank = (p: MaterialPreset): number => (p === "hair" ? 2 : p === "eye" ? 1 : 0)
3189
+ const presetRank = (p: ResolvedMaterialPreset): number => (p === "hair" ? 2 : p === "eye" ? 1 : 0)
3184
3190
  inst.drawCalls.sort((a, b) => {
3185
3191
  const ta = typeOrder[a.type] - typeOrder[b.type]
3186
3192
  if (ta !== 0) return ta
@@ -4021,7 +4027,7 @@ export class Engine {
4021
4027
  }
4022
4028
  }
4023
4029
 
4024
- private pipelineForPreset(preset: MaterialPreset): GPURenderPipeline {
4030
+ private pipelineForPreset(preset: ResolvedMaterialPreset): GPURenderPipeline {
4025
4031
  if (preset === "face") return this.facePipeline
4026
4032
  if (preset === "hair") return this.hairPipeline
4027
4033
  if (preset === "cloth_smooth") return this.clothSmoothPipeline
package/src/index.ts CHANGED
@@ -1,29 +1,30 @@
1
- export {
2
- Engine,
3
- DEFAULT_BLOOM_OPTIONS,
4
- DEFAULT_VIEW_TRANSFORM,
5
- type EngineStats,
6
- type EngineOptions,
7
- type BloomOptions,
8
- type ViewTransformOptions,
9
- type LoadModelFromFilesOptions,
10
- type MaterialPreset,
11
- type MaterialPresetMap,
12
- type GizmoDragEvent,
13
- type GizmoDragCallback,
14
- type GizmoDragKind,
15
- } from "./engine"
16
- export { parsePmxFolderInput, pmxFileAtRelativePath, type PmxFolderInputResult } from "./folder-upload"
17
- export { Model } from "./model"
18
- export { Vec3, Quat, Mat4 } from "./math"
19
- export type {
20
- AnimationClip,
21
- AnimationPlayOptions,
22
- AnimationProgress,
23
- BoneKeyframe,
24
- MorphKeyframe,
25
- BoneInterpolation,
26
- ControlPoint,
27
- } from "./animation"
28
- export { FPS } from "./animation"
1
+ export {
2
+ Engine,
3
+ DEFAULT_BLOOM_OPTIONS,
4
+ DEFAULT_VIEW_TRANSFORM,
5
+ type EngineStats,
6
+ type EngineOptions,
7
+ type BloomOptions,
8
+ type ViewTransformOptions,
9
+ type LoadModelFromFilesOptions,
10
+ type MaterialPreset,
11
+ type ResolvedMaterialPreset,
12
+ type MaterialPresetMap,
13
+ type GizmoDragEvent,
14
+ type GizmoDragCallback,
15
+ type GizmoDragKind,
16
+ } from "./engine"
17
+ export { parsePmxFolderInput, pmxFileAtRelativePath, type PmxFolderInputResult } from "./folder-upload"
18
+ export { Model } from "./model"
19
+ export { Vec3, Quat, Mat4 } from "./math"
20
+ export type {
21
+ AnimationClip,
22
+ AnimationPlayOptions,
23
+ AnimationProgress,
24
+ BoneKeyframe,
25
+ MorphKeyframe,
26
+ BoneInterpolation,
27
+ ControlPoint,
28
+ } from "./animation"
29
+ export { FPS } from "./animation"
29
30
  export { RezePhysics } from "./physics"