@eskais/character 0.0.0-stage → 0.1.0
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/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/LICENSE-APACHE-2.0.txt +202 -0
- package/LICENSES.md +17 -0
- package/README.md +136 -2
- package/assets/anny/anny.bin +0 -0
- package/assets/hair/hair.bin +0 -0
- package/dist/engine.d.ts +302 -0
- package/dist/errors.js +49 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +525 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.d.ts +1 -0
- package/dist/motion.js +5 -0
- package/dist/motion.js.map +1 -0
- package/dist/react.d.ts +62 -0
- package/dist/react.js +168 -0
- package/dist/react.js.map +1 -0
- package/dist/style.d.ts +32 -0
- package/dist/style.js +152 -0
- package/dist/style.js.map +1 -0
- package/dist/three.d.ts +14 -0
- package/dist/three.js +100 -0
- package/dist/three.js.map +1 -0
- package/dist/worker.d.ts +3 -0
- package/dist/worker.js +42 -0
- package/dist/worker.js.map +1 -0
- package/package.json +147 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-29)
|
|
4
|
+
|
|
5
|
+
First release: a local, in-browser engine that turns a face photo (and optionally a full-body photo) into a
|
|
6
|
+
stylised, rigged character with a face. Nothing leaves the browser.
|
|
7
|
+
|
|
8
|
+
Published on npm as `@eskais/character`, under the `eskais` scope; the unscoped `eskais-character` name was never
|
|
9
|
+
published.
|
|
10
|
+
|
|
11
|
+
- `createScanEngine()` / `scanCharacter()`: an async event stream (`stage`, `download`, `landmarks`, `mask`, `model`, `progress`, `done`,
|
|
12
|
+
`error`) from a module worker. MediaPipe Face and Pose Landmarker, a fit of NAVER Anny's body phenotypes and face
|
|
13
|
+
modifiers with learned priors, colour sampling (skin, eyes, hair, brows, beard), and a hair pick.
|
|
14
|
+
- The character as a GLB: skinned to Anny's 104-bone rig, with morph targets for the body, face modifiers and the 52
|
|
15
|
+
ARKit-named expressions; eyes and hair as separate meshes.
|
|
16
|
+
- Looks: four styles (`soft-toon`, `cel-outline`, `low-poly`, `clay`), a `stylize` amount, an outfit (tee or hoodie,
|
|
17
|
+
joggers, sneakers) and ten hair choices from CC0 MakeHuman assets. `engine.restyle()` changes any of them without the
|
|
18
|
+
photo.
|
|
19
|
+
- Nothing runs or downloads until the first scan (or `load()`): safe to import and create while prerendering. Download
|
|
20
|
+
progress, error codes for offline and unsupported browsers, aborts that stop the download, and a `dispose()` that
|
|
21
|
+
frees the memory and leaves the engine usable.
|
|
22
|
+
- `mask` events: the person's segmentation mask for each photo (MediaPipe's pose model, at most 256 px, 0–255),
|
|
23
|
+
for transitions that send the photo's person onto the character. `useCharacterScan` exposes them as `masks`.
|
|
24
|
+
- Clips: `idle` and a friendly `wave` (arm out to the side, forearm up, palm forward, three swings from the elbow and
|
|
25
|
+
wrist), both from one relaxed stance with the arms down, as far as
|
|
26
|
+
each body has room for. Scanned and restyled characters carry them.
|
|
27
|
+
- `@eskais/character/three`: reference three.js materials for the styles (toon ramp, rim light, inverted-hull
|
|
28
|
+
outline). `@eskais/character/react`: `useCharacterScan(engine)`.
|
|
29
|
+
- Privacy: photos stay in memory in the worker; the only network requests fetch pinned, SHA-256-checked model files.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pablo Otero
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/LICENSES.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
@eskais/character is licensed under MIT (see `LICENSE`). It ships or downloads the following third-party
|
|
4
|
+
works. Details, sources and the dates they were checked are in [`docs/licences.md`](docs/licences.md).
|
|
5
|
+
|
|
6
|
+
- **NAVER Anny** — Copyright (c) 2025 NAVER Corp., Apache License 2.0. <https://github.com/naver/anny>.
|
|
7
|
+
`assets/anny/anny.bin` is baked from Anny 0.6.2 (default `anny` topology and rig).
|
|
8
|
+
- **MakeHuman / MPFB2 assets** (via Anny `data/mpfb2`) — CC0 1.0 Universal. <https://static.makehumancommunity.org/>
|
|
9
|
+
- **Face Units asset pack** by Mika Suominen (via Anny `data/faceunits01`) — CC0 1.0 Universal.
|
|
10
|
+
- **MediaPipe Tasks for Web** (`@mediapipe/tasks-vision` 1.2.3: its JavaScript is bundled, minified, in
|
|
11
|
+
`dist/worker.js`; its WASM and loader are downloaded at runtime from a pinned URL) — Copyright Google LLC,
|
|
12
|
+
Apache License 2.0. <https://github.com/google-ai-edge/mediapipe>
|
|
13
|
+
- **MediaPipe Face Landmarker and Pose Landmarker models** (`.task` files, downloaded at runtime from pinned URLs) —
|
|
14
|
+
Copyright Google LLC, Apache License 2.0 per their model cards.
|
|
15
|
+
|
|
16
|
+
The Apache License 2.0 text is in `LICENSE-APACHE-2.0.txt`. No upstream NOTICE files are required by these components at the
|
|
17
|
+
versions used; if one is added upstream, it must be reproduced here.
|
package/README.md
CHANGED
|
@@ -1,3 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @eskais/character
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A local, in-browser engine that turns photos into a **stylised, rigged character with a face**, and later animates
|
|
4
|
+
it. Nothing is processed in the cloud.
|
|
5
|
+
|
|
6
|
+
The engine produces data only: a scan event stream, morph-target weights, colours, a hair choice and a GLB. Screens
|
|
7
|
+
live in the Eskais UI component library (`ModelViewer`, `ModelScan`), which consumes that data.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @eskais/character
|
|
13
|
+
# optional peers: react (for @eskais/character/react), three (for @eskais/character/three)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
ESM only, for browsers and Electron renderers (WebGL2 required).
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { createScanEngine } from "@eskais/character"
|
|
22
|
+
|
|
23
|
+
const engine = createScanEngine() // nothing runs or downloads until the first scan
|
|
24
|
+
const controller = new AbortController()
|
|
25
|
+
|
|
26
|
+
for await (const event of engine.scan({ face: faceFile, body: bodyFile }, { signal: controller.signal })) {
|
|
27
|
+
if (event.type === "download") showDownload(event.loaded / event.total) // before the first scan only
|
|
28
|
+
if (event.type === "landmarks") drawPoints(event.points) // x, y pairs normalised to the photo
|
|
29
|
+
if (event.type === "mask") setMask(event) // { source, width, height, data }: person confidence 0-255, ≤ 256 px
|
|
30
|
+
if (event.type === "model") viewer.load(event.glb) // once: the base character with every morph target
|
|
31
|
+
if (event.type === "progress") viewer.setWeights(event.weights) // live morphing while the fit converges
|
|
32
|
+
if (event.type === "done") viewer.load(event.character.glb)
|
|
33
|
+
if (event.type === "error") showError(event.error.code) // e.g. "no-face"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Another look, without the photo:
|
|
37
|
+
const clay = await engine.restyle(character, { style: "clay", stylize: 0.8, hair: "ponytail" })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **Start.** Importing the package and creating an engine do nothing, so both are safe while prerendering. The first
|
|
41
|
+
`scan()` starts the worker and downloads the models, with `download` events; `engine.load({ signal, onProgress })`
|
|
42
|
+
does it earlier. Nothing is fetched on a browser that can't scan, or during later scans.
|
|
43
|
+
- **Errors** are a final event: `unsupported` (no workers, WebAssembly or OffscreenCanvas, or an insecure page),
|
|
44
|
+
`webgl2-unavailable`, `offline`, `asset-load`, `asset-integrity`, `no-face`, `unreadable-image`, `worker`, `internal`.
|
|
45
|
+
The same engine can scan again after any of them.
|
|
46
|
+
- **Cancel** with the `AbortSignal`: the iterator throws its `AbortError`, and a download nobody else waits for stops.
|
|
47
|
+
- **Memory.** `engine.dispose()` stops the worker and frees everything; the engine stays usable and loads again from the
|
|
48
|
+
HTTP cache. Photos are scaled to at most 2048 px before processing.
|
|
49
|
+
- **Phones.** Pass `poseModel: "lite"` for a 3.6 MB smaller download.
|
|
50
|
+
|
|
51
|
+
The character's GLB carries two clips, `idle` and `wave`, posed for its own body: the arms hang as far as that body has
|
|
52
|
+
room for, and both clips start and end on the same stance. With no clip playing the skeleton is in its A-pose, so play
|
|
53
|
+
`idle` or hold its first frame. The `model` event's GLB (for live morphing) has none.
|
|
54
|
+
|
|
55
|
+
With three.js, `styleCharacter(gltf.scene)` from `@eskais/character/three` builds the style the GLB was exported with
|
|
56
|
+
(toon ramp, rim light, outline). With React, `useCharacterScan(engine)` from `@eskais/character/react` maps the events
|
|
57
|
+
to state.
|
|
58
|
+
|
|
59
|
+
### Bundlers and where the files come from
|
|
60
|
+
|
|
61
|
+
| File | Size | Where it comes from |
|
|
62
|
+
| ---------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| Scan worker (`dist/worker.js`, MediaPipe Tasks bundled in) | 0.46 MB (0.15 MB gzip) | Your bundler, from the package |
|
|
64
|
+
| Body model (`assets/anny/anny.bin`) | 5.2 MB (1.1 MB brotli) | Your bundler, from the package; fallback `cdn.jsdelivr.net/npm/@eskais/character@<version>/assets/…` |
|
|
65
|
+
| Hair styles (`assets/hair/hair.bin`) | 0.37 MB (0.19 MB brotli) | Same as the body model |
|
|
66
|
+
| MediaPipe WASM and loader | 15 MB (2.9 MB brotli) | `cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@1.2.3/wasm/` |
|
|
67
|
+
| Face and pose models | 3.8 + 9.4 MB (5.8 MB with `poseModel: "lite"`) | `storage.googleapis.com/mediapipe-models/…/float16/1/` |
|
|
68
|
+
|
|
69
|
+
Every file is checked against a pinned size and SHA-256 before use, wherever it comes from. To serve everything
|
|
70
|
+
yourself, copy the files and pass `assetUrls` (same bytes, same hashes).
|
|
71
|
+
|
|
72
|
+
- **Vite** (dev and build), **webpack** and **Next.js** (Turbopack): nothing to configure. The worker and the model
|
|
73
|
+
files are found through `new URL(…, import.meta.url)`, and the bundler emits them.
|
|
74
|
+
- **bun build** doesn't emit those files: copy `node_modules/@eskais/character/dist/worker.js` to your static files
|
|
75
|
+
and pass `createScanEngine({ workerUrl: "/worker.js" })`. The model files then come from the pinned CDN copy, or pass
|
|
76
|
+
`assetUrls` for your own copies.
|
|
77
|
+
- A Content-Security-Policy needs `worker-src 'self' blob:`, `script-src 'self' 'wasm-unsafe-eval' blob:` and
|
|
78
|
+
`connect-src` for the hosts above (see `demo/index.html`).
|
|
79
|
+
|
|
80
|
+
## Scope
|
|
81
|
+
|
|
82
|
+
- **Stylised, not realistic.** The face shape and body proportions are fitted to the person; skin, eye, hair, brow
|
|
83
|
+
and beard colours are sampled from the photo; hair is picked from a CC0 catalogue and the user can change it;
|
|
84
|
+
materials are toon-friendly.
|
|
85
|
+
- **It has a face**: fitted face modifiers plus the 52 ARKit-named expression morph targets, so it can be animated.
|
|
86
|
+
- **Runs entirely in a browser or Electron** on an ordinary PC, and on phones where possible: WASM, WebGL or WebGPU,
|
|
87
|
+
Web Workers. No Python at runtime (Python is used only at build time to bake the Anny assets).
|
|
88
|
+
- **Commercial-safe licences only.** See [`LICENSES.md`](LICENSES.md) and [`docs/licences.md`](https://github.com/p-otero/eskais-character/blob/main/docs/licences.md).
|
|
89
|
+
SMPL, SMPL-X and anything trained on SMPL or Max Planck data are forbidden.
|
|
90
|
+
|
|
91
|
+
| Module | What it is |
|
|
92
|
+
| -------------------------- | -------------------------------------------------------------- |
|
|
93
|
+
| `@eskais/character` | `createScanEngine()`, `scanCharacter()`: photos → event stream |
|
|
94
|
+
| `@eskais/character/three` | `styleCharacter(scene)`: the toon materials for a character |
|
|
95
|
+
| `@eskais/character/motion` | later: rig, glTF clips, retargeting |
|
|
96
|
+
| `@eskais/character/react` | `useCharacterScan(engine)`: maps scan events to props |
|
|
97
|
+
|
|
98
|
+
## Privacy rules (hard constraints)
|
|
99
|
+
|
|
100
|
+
1. Photos are processed in memory, in a worker, and discarded; bitmaps are closed as soon as a stage is done.
|
|
101
|
+
2. The output is only the character: parameters, colours, hair choice and GLB. No pixels, crops or landmarks of
|
|
102
|
+
the photo are kept in the result. During a scan the host page receives normalised landmarks and a person mask of
|
|
103
|
+
at most 256 px (confidence only, no colour) for its transitions.
|
|
104
|
+
3. No logging of image data.
|
|
105
|
+
4. No network calls except fetching model and asset files from pinned URLs, checked by SHA-256.
|
|
106
|
+
5. **No real people's photos anywhere** in this repository: tests, demos, fixtures and screenshots use synthetic
|
|
107
|
+
people rendered by `tooling/synth` from Anny with known parameters. CI fails on any image the generator did not
|
|
108
|
+
produce.
|
|
109
|
+
|
|
110
|
+
## Try it on your own photo (in a checkout of the repository)
|
|
111
|
+
|
|
112
|
+
A local-only check with a real photo. Nothing is uploaded, saved or committed.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
bun install
|
|
116
|
+
bun run fetch:models # once: the pinned MediaPipe models into .cache/models (SHA-256 checked)
|
|
117
|
+
bun run scan:photo -- --face path/to/face.jpg --body path/to/body.jpg --height 175
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- `--face` is required; `--body` (front, A-pose, fitted clothes), `--height` (cm) and `--stylize` (0–1) are optional.
|
|
121
|
+
- The engine runs in headless Chrome on this machine with every network request outside the local files aborted;
|
|
122
|
+
the photo is read into memory and never copied or written.
|
|
123
|
+
- Output goes to `.local/scans/<time>/`, which git ignores: a GLB and a front and side render per style, and
|
|
124
|
+
`character.json` (fitted parameters, colours, hair). Delete the folder when you're done.
|
|
125
|
+
- The demo page (`bun run demo`) does the same in a browser tab with file inputs.
|
|
126
|
+
|
|
127
|
+
Never add a real photo, or anything rendered from one, to the repository or to CI: the image guard rejects any image
|
|
128
|
+
the synthetic generator did not produce.
|
|
129
|
+
|
|
130
|
+
## Status
|
|
131
|
+
|
|
132
|
+
0.1: early. The API can change between minor versions. How it was built and measured:
|
|
133
|
+
[`docs/spike-report.md`](https://github.com/p-otero/eskais-character/blob/main/docs/spike-report.md).
|
|
134
|
+
|
|
135
|
+
## Licence
|
|
136
|
+
|
|
137
|
+
MIT. Third-party notices (Anny, MediaPipe and the bundled assets keep their own Apache-2.0 and CC0 licences) are in [`LICENSES.md`](LICENSES.md).
|
|
Binary file
|
|
Binary file
|