Remove the MakeHuman figure and shortlist commercial models

The owner rejected the MakeHuman-based figures and asked for them to be
deleted, with free models usable in a commercial app researched instead.
MakeHuman-based bodies (MakeHuman, MPFB, Anny, MB-Lab, CharMorph) are not
to be used again.

- Delete the figure bake script and every MakeHuman file: the base mesh,
  rig weights, targets, licence records, the three.js studies' baked
  human and its converter.
- The figure preview shows the practice's empty stage with a "model
  pending" note, and Breeze's current flat figure on it when asked; the
  figure painter, character switch and profiler are gone. Pin practices
  57c4f4c5, which keeps only the model-independent figure parts.
- The three.js astral studies play with invisible stand-in skeletons; their
  verifier passes.
- plans/2026-11-18-figure-model-candidates.md lists the candidates with
  their licences, quoted from the licence pages, and the motion sources.
This commit is contained in:
waozi committed 2026-11-18 11:58:31 -03:00
1 parent 4dc8f300e7
commit 8375209829
42 files changed
+386 -2575

No files matched your search

+11 -17
View File
@@ -23,19 +23,14 @@ compares the snapshot against the current upstream files before rendering.
Caption text remains present through the silence until the next cue.
Each exercise owns a separate scene, sampled directly from session seconds.
Both figures share the CC0 MakeHuman hm08 anatomical surface: a continuous
13,380-vertex human with a shaped face, shoulders, torso, hips, limbs, hands,
individual fingers and feet. A 37-bone skin rig supports shoulder/elbow reaches,
wrist movement and real finger curls for alternating rope grips. The limbs
are reposed into a supported resting shape; pigment regions provide blue
sleep clothes. The foundation marker follows the actual thumb joint.
No Tai Chi rig, teacher artwork or promo character geometry is used.
Model source, licence, generation prompt and texture details are documented in
[`assets/README.md`](assets/README.md). The reproducible converter rejects
stretched edges and invalid weights before producing the compact mesh.
The figure model is pending: the MakeHuman-based body was removed on
2026-11-18, and the owner will choose a new, commercially licensed model.
Until then both figures are invisible stand-in skeletons with the joints the
scenes drive (shoulders, elbows, wrists and finger chains for the rope
grips), so the rooms, energy effects, cords and cameras still play.
The dim bedroom contains a bed, pillow, window, curtains and a warm bedside
lamp. Room geometry and energy effects are procedural; the human mesh and
painted material maps are loaded from local assets.
lamp. Room geometry and energy effects are procedural; the painted material
maps are loaded from local assets.
Directed cameras frame the hand, pathways and exit motion. **Steady** removes
camera drift. Full canonical captions appear below the shorter action labels.
Foundation shows thumb stirring and leg strokes; Current shows limb bounces and
@@ -64,9 +59,8 @@ to preserve the painted character silhouette.
The earlier shared promo-film shaders still shade painted Lumi and both Tai Chi
teachers; this upgrade leaves their source artwork and materials intact.
The preview caps render width at 1280px (720px in **Phone** quality), pixel
ratio at 1. The anatomical surface is shared between six scenes; each figure owns
its skin skeleton. The browser fetches an 803 KB mesh plus compact rig metadata.
No shadow maps are used. Textures are local files. Real phone GPU performance
ratio at 1. Each figure owns its stand-in skeleton until the new model is
chosen. No shadow maps are used. Textures are local files. Real phone GPU performance
still needs device review.
Local test (owns a private Xvfb and headless Chromium; never the desktop):
@@ -79,8 +73,8 @@ Frames and the report go to `build/astral-threejs/`. The test compares every cue
boundary, tests controls and captures several cue times in all six exercises,
plus exit/return poses, changing animation pixels, highlights pause/scrub,
computed styles, portrait framing, reduced-motion autoplay and promo character
shader compilation, anatomical mesh/rig presence, real finger deformation and
thumb-marker alignment. No audio plays.
shader compilation, the stand-in skeleton, finger curls and thumb-marker
alignment. No audio plays.
For matching before/after review, preserve the previous six `showcase-*.png`
frames and `portrait-rope-1500.png` in `build/astral-compare/before/`, then run:
@@ -1,41 +0,0 @@
# Creative Commons CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
### Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. __Copyright and Related Rights.__ A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. __Waiver.__ To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
3. __Public License Fallback.__ Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
4. __Limitations and Disclaimers.__
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
@@ -1,37 +1,11 @@
# Anatomical model and watercolor textures
`human.bin` is a compact derivative of MakeHuman's **hm08 base mesh**:
13,380 surface vertices, 26,756 triangles and a 37-bone arm/hand rig. Both the
sleeper and luminous double use the same surface and bind pose. The complete
face, hands, fingers and feet come from the anatomical mesh, not primitives.
The neutral eyes are closed, the arms/legs reposed for lying down, and limbs
weighted to the shoulders, elbows, wrists and individual finger segments.
The blue sleep clothes are pigment regions on the same continuous surface.
Source: [MakeHuman base.obj](https://github.com/makehumancommunity/makehuman/blob/a8bc2d54ff0ac92e78ff71431b1023eda42bf482/makehuman/data/3dobjs/base.obj).
Its own header explicitly releases the mesh under CC0 in September 2020.
See `MAKEHUMAN-CC0.txt`, `makehuman-source.json` and the
[project licence](https://github.com/makehumancommunity/makehuman/blob/a8bc2d54ff0ac92e78ff71431b1023eda42bf482/LICENSE.md).
The unmodified mesh in `makehuman-base.obj.gz` is retained for reproducibility. The browser
fetches only `human.json` and the 803 KB `human.bin`, not the OBJ source.
Regenerate and validate the posed/weighted derivative with NumPy:
```sh
build-queue -- python3 design/astral-projection/three/tools/prepare-human.py
```
The converter rejects nonfinite positions, unnormalized skin weights, hands
outside the resting silhouette and stretched anatomical edges. The runtime
uses Three.js skinning for alternating reaches and actual finger curls.
Whole-body roll, rise and return transform that same figure as one shape.
# Watercolor textures
The six 256×256 WebP textures total 80,982 bytes:
`paper.webp`, `pigment.webp`, `linen.webp`, `plaster.webp`, `wood.webp`, and
`luminous-wash.webp`. Generated with the built-in imagegen tool as one material
atlas, then its six cells were cropped and downsampled for phone-friendly use.
No watermarks, signatures or text were visible in the inspected atlas. Paper
and pigment are sampled by the body and full-scene watercolor shader; linen,
and pigment are sampled by the full-scene watercolor shader; linen,
plaster and wood by the room materials; the luminous wash shades the double.
The full generated source atlas is retained locally in the ignored
`backup/astral-threejs/watercolor-source-atlas.png` for provenance; the browser loads only the small WebP derivatives.
Binary file not shown.
@@ -1,431 +0,0 @@
{
"vertices": 13380,
"bones": [
{
"name": "body",
"parent": -1,
"position": [
0,
0,
0
]
},
{
"name": "l-shoulder",
"parent": 0,
"position": [
0.2683400000000001,
0.9393279999999999,
0.023368
]
},
{
"name": "l-elbow",
"parent": 1,
"position": [
0.044999999999999984,
-0.3613925004811249,
0.0
]
},
{
"name": "l-hand",
"parent": 2,
"position": [
0.018000000000000016,
-0.3615185100102069,
0.010000000000000002
]
},
{
"name": "l-finger-1-0",
"parent": 3,
"position": [
-0.0402880502296164,
-0.04565434740636959,
0.029012770629404334
]
},
{
"name": "l-finger-1-1",
"parent": 4,
"position": [
-0.025572408015921755,
-0.023397464651016497,
0.024121396563458797
]
},
{
"name": "l-finger-1-2",
"parent": 5,
"position": [
-0.03718252743263051,
-0.03826938959543452,
0.021372039624578287
]
},
{
"name": "l-finger-2-0",
"parent": 3,
"position": [
-0.03989626196079493,
-0.14943352041104802,
0.040736823871241036
]
},
{
"name": "l-finger-2-1",
"parent": 7,
"position": [
-0.01330688809369307,
-0.03759230077458389,
0.005952242580334888
]
},
{
"name": "l-finger-2-2",
"parent": 8,
"position": [
-0.017639098677462495,
-0.031601153121456255,
0.0014198969121077265
]
},
{
"name": "l-finger-3-0",
"parent": 3,
"position": [
-0.030970100443604764,
-0.1511192822896113,
0.0023519784832782276
]
},
{
"name": "l-finger-3-1",
"parent": 10,
"position": [
-0.010678523103319293,
-0.04952951733955918,
-0.005353228226237558
]
},
{
"name": "l-finger-3-2",
"parent": 11,
"position": [
-0.016017893195093724,
-0.036363365867304015,
-0.004227120579207599
]
},
{
"name": "l-finger-4-0",
"parent": 3,
"position": [
-0.018441134847322405,
-0.14367019377374207,
-0.026238804670911837
]
},
{
"name": "l-finger-4-1",
"parent": 13,
"position": [
-0.006691303692796746,
-0.0430418230092674,
-0.01155470479630142
]
},
{
"name": "l-finger-4-2",
"parent": 14,
"position": [
-0.01366390929992578,
-0.03411143700394789,
-0.009297869657566196
]
},
{
"name": "l-finger-5-0",
"parent": 3,
"position": [
-0.010584276938476744,
-0.13134537370447313,
-0.054978650148234005
]
},
{
"name": "l-finger-5-1",
"parent": 16,
"position": [
-0.009866177862033254,
-0.030595575655873286,
-0.012330145849926637
]
},
{
"name": "l-finger-5-2",
"parent": 17,
"position": [
-0.009292796921655189,
-0.01886983490533964,
-0.008603686652714937
]
},
{
"name": "r-shoulder",
"parent": 0,
"position": [
-0.2683400000000001,
0.9393279999999999,
0.023368
]
},
{
"name": "r-elbow",
"parent": 19,
"position": [
-0.044999999999999984,
-0.3613925004811249,
0.0
]
},
{
"name": "r-hand",
"parent": 20,
"position": [
-0.018000000000000016,
-0.3615185100102069,
0.010000000000000002
]
},
{
"name": "r-finger-1-0",
"parent": 21,
"position": [
0.0402880502296164,
-0.04565434740636959,
0.029012770629404334
]
},
{
"name": "r-finger-1-1",
"parent": 22,
"position": [
0.025572408015921755,
-0.023397464651016497,
0.024121396563458797
]
},
{
"name": "r-finger-1-2",
"parent": 23,
"position": [
0.03718252743263051,
-0.03826938959543452,
0.021372039624578287
]
},
{
"name": "r-finger-2-0",
"parent": 21,
"position": [
0.03989626196079493,
-0.14943352041104802,
0.040736823871241036
]
},
{
"name": "r-finger-2-1",
"parent": 25,
"position": [
0.01330688809369307,
-0.03759230077458389,
0.005952242580334888
]
},
{
"name": "r-finger-2-2",
"parent": 26,
"position": [
0.017639098677462495,
-0.031601153121456255,
0.0014198969121077265
]
},
{
"name": "r-finger-3-0",
"parent": 21,
"position": [
0.030970100443604764,
-0.1511192822896113,
0.0023519784832782276
]
},
{
"name": "r-finger-3-1",
"parent": 28,
"position": [
0.010678523103319293,
-0.04952951733955918,
-0.005353228226237558
]
},
{
"name": "r-finger-3-2",
"parent": 29,
"position": [
0.016017893195093724,
-0.036363365867304015,
-0.004227120579207599
]
},
{
"name": "r-finger-4-0",
"parent": 21,
"position": [
0.018441134847322405,
-0.14367019377374207,
-0.026238804670911837
]
},
{
"name": "r-finger-4-1",
"parent": 31,
"position": [
0.006691303692796746,
-0.0430418230092674,
-0.01155470479630142
]
},
{
"name": "r-finger-4-2",
"parent": 32,
"position": [
0.01366390929992578,
-0.03411143700394789,
-0.009297869657566196
]
},
{
"name": "r-finger-5-0",
"parent": 21,
"position": [
0.010584276938476744,
-0.13134537370447313,
-0.054978650148234005
]
},
{
"name": "r-finger-5-1",
"parent": 34,
"position": [
0.009866177862033254,
-0.030595575655873286,
-0.012330145849926637
]
},
{
"name": "r-finger-5-2",
"parent": 35,
"position": [
0.009292796921655189,
-0.01886983490533964,
-0.008603686652714937
]
}
],
"arms": [
{
"shoulder": 1,
"elbow": 2,
"wrist": 3,
"fingers": [
[
4,
5,
6
],
[
7,
8,
9
],
[
10,
11,
12
],
[
13,
14,
15
],
[
16,
17,
18
]
]
},
{
"shoulder": 19,
"elbow": 20,
"wrist": 21,
"fingers": [
[
22,
23,
24
],
[
25,
26,
27
],
[
28,
29,
30
],
[
31,
32,
33
],
[
34,
35,
36
]
]
}
],
"attributes": {
"position": {
"offset": 0,
"length": 40140,
"type": "float32"
},
"bodyCoordinate": {
"offset": 160560,
"length": 40140,
"type": "float32"
},
"skinWeight": {
"offset": 321120,
"length": 53520,
"type": "float32"
},
"skinIndex": {
"offset": 535200,
"length": 53520,
"type": "uint16"
},
"index": {
"offset": 642240,
"length": 80268,
"type": "uint16"
}
}
}
@@ -1,34 +0,0 @@
{
"repository": "https://github.com/makehumancommunity/makehuman",
"revision": "a8bc2d54ff0ac92e78ff71431b1023eda42bf482",
"mesh": "makehuman/data/3dobjs/base.obj",
"licence": "CC0-1.0",
"licence_evidence": "https://github.com/makehumancommunity/makehuman/blob/a8bc2d54ff0ac92e78ff71431b1023eda42bf482/LICENSE.md",
"weights": "makehuman/data/rigs/default_weights.mhw",
"weights_sha256": "0f3641d651ae3d00ad6b4ccee43142edb109d3bd909d27d9e4139ef1beed8625",
"weights_licence": "CC0-1.0 (declared in the file header)",
"shape": "two characters, each MakeHuman's own young-adult macro shape, mixed as MakeHuman mixes its macro targets: makehuman/data/targets/macrodetails/{asian,caucasian}-GENDER-young.target (0.9 and 0.1), macrodetails/universal-GENDER-young-*muscle-*weight and macrodetails/proportions/GENDER-young-*-idealproportions (ideal proportions) at each character's weight and muscle, and macrodetails/height/GENDER-young-*-maxheight (the four are one file). The petite woman: weight 0.10, muscle 0.45, height 0.60; then smaller hands and feet, narrower shoulders, a slightly longer neck, larger eyes, a smaller mouth, a shorter chin and a smaller jaw. The young man: weight 0.40, muscle 0.65, height 0.60, eyes a little larger. Both in Breeze scripts/prepare-practice-human.py.",
"shape_files": {
"makehuman-asian-female-young.target.gz": "47067a1afcaea462d751f1b8ad30e465b54dd22b3f28c8d8e7fc7344ddd7e02a",
"makehuman-asian-male-young.target.gz": "decf95b11819927fad59931e080046f84c36f6742f4fd6e74ab4a5665a1df4fd",
"makehuman-caucasian-female-young.target.gz": "09559da0d7e7936b94f4898063620650e1e7489fa8459f859e67a70646482c62",
"makehuman-caucasian-male-young.target.gz": "b494e2c28d7c97cc997a4d64ac91b854e0037eb475cce042aaa5e5ec54ef8274",
"makehuman-height-female-young-maxheight.target.gz": "db4021e632faa65c4a9b735fafe8bd2c84476047234557490985f6550e528071",
"makehuman-height-male-young-maxheight.target.gz": "db4021e632faa65c4a9b735fafe8bd2c84476047234557490985f6550e528071",
"makehuman-proportions-female-young-averagemuscle-averageweight-idealproportions.target.gz": "862192427280d8695e7a212ce5b73ced42d8d469ff822781c07066149467d952",
"makehuman-proportions-female-young-averagemuscle-minweight-idealproportions.target.gz": "0d80f8a42a0ecefe9bea6fe63808973dcb71db0b0717d50e9ad6247d1e60cac3",
"makehuman-proportions-female-young-minmuscle-averageweight-idealproportions.target.gz": "6cfa5b6c82ad68a0255f8e567162b15edc225d41cfbac3a632cf5308c02cb3dd",
"makehuman-proportions-female-young-minmuscle-minweight-idealproportions.target.gz": "304bb6ffb59e167d9a38d230336bea0996b12b27c3c76778f72257437f2eda08",
"makehuman-proportions-male-young-averagemuscle-averageweight-idealproportions.target.gz": "162b35ad3d297c532688e48976fe94d0826987c8353364791e8b20753e785217",
"makehuman-proportions-male-young-averagemuscle-minweight-idealproportions.target.gz": "36f2812c196c0677f86c39e5b8bc09bbbab2c85e94a8f73593410f7f5b4c039f",
"makehuman-proportions-male-young-maxmuscle-averageweight-idealproportions.target.gz": "2e1969967db03c78cfbb435a9c18c263290c3ebb37c7aadb4d0ff96f735c69be",
"makehuman-proportions-male-young-maxmuscle-minweight-idealproportions.target.gz": "2e1969967db03c78cfbb435a9c18c263290c3ebb37c7aadb4d0ff96f735c69be",
"makehuman-universal-female-young-averagemuscle-minweight.target.gz": "1c16fee7ff8a5f3e7fd746fc3a400fb6139ec8bba8ecb8d28397f469bdccc629",
"makehuman-universal-female-young-minmuscle-averageweight.target.gz": "1da31baecbf8b98430d8e6dca8000afe56d1063d112057d559c97f57a1b7eb7a",
"makehuman-universal-female-young-minmuscle-minweight.target.gz": "1a29b433bae8304b9254242226526799561eb2d25c691441cea599ebe6a04def",
"makehuman-universal-male-young-averagemuscle-minweight.target.gz": "591f4105390abc3b4d7691d33fcdd9737875922374f8d227652b8f94d600acea",
"makehuman-universal-male-young-maxmuscle-averageweight.target.gz": "06cbc0fb72830b88609f3cf05dc1c90006c13758b157002bec0a1921545c3da3",
"makehuman-universal-male-young-maxmuscle-minweight.target.gz": "5ba2c95a24e8cbc52ace6516e5368e1abf58bcfe51a8864101d489e1fb3476f1"
},
"shape_licence": "CC0-1.0 (declared in each target file header)"
}
+38 -39
View File
@@ -1,48 +1,47 @@
import * as T from 'three'
// Shared CC0 anatomical surface, reposed and weighted offline. No primitive
// stand-ins: head, face, torso, limbs, hands and feet are one continuous mesh.
const asset = name => new URL(`../assets/${name}`, import.meta.url)
const [human, bytes] = await Promise.all([
fetch(asset('human.json')).then(response => response.json()),
fetch(asset('human.bin')).then(response => response.arrayBuffer()),
])
const geometry = new T.BufferGeometry()
for (const [name, entry] of Object.entries(human.attributes)) {
const ArrayType = entry.type === 'uint16' ? Uint16Array : Float32Array
const data = new ArrayType(bytes, entry.offset, entry.length)
if (name === 'index') geometry.setIndex(new T.BufferAttribute(data, 1))
else geometry.setAttribute(name, new T.BufferAttribute(data, name.startsWith('skin') ? 4 : 3))
}
geometry.computeVertexNormals()
geometry.computeBoundingSphere()
// The figure model is pending: the MakeHuman-based body was removed on
// 2026-11-18 and a new, commercially licensed model is still to be chosen.
// Until then each figure is an invisible stand-in skeleton with the same
// joints the scenes drive (arms, elbows, hands and finger chains), so the
// rooms, energy effects, cords and cameras still play.
const ARM = { shoulder: [0.17, 1.38, 0], elbow: [0.04, -0.27, 0.02], wrist: [0, -0.25, 0.03] }
const FINGERS = [[0.025, -0.03, 0.03], [0.02, -0.08, 0.01], [0.007, -0.085, 0], [-0.007, -0.082, 0], [-0.02, -0.075, 0]]
export function createFigure(material, { astral = false } = {}) {
const root = new T.Group()
const bones = human.bones.map(info => {
const bones = []
const add = (parent, position) => {
const bone = new T.Bone()
bone.name = info.name
bone.position.fromArray(info.position)
bone.position.fromArray(position)
parent.add(bone)
bones.push(bone)
return bone
})
human.bones.forEach((info, index) => {
if (info.parent >= 0) bones[info.parent].add(bones[index])
})
const mesh = new T.SkinnedMesh(geometry, material)
mesh.add(bones[0])
mesh.bind(new T.Skeleton(bones))
mesh.frustumCulled = false
root.add(mesh)
}
const body = add(root, [0, 0, 0])
// The existing technique solver expects negative-X then positive-X arms.
const armsData = [...human.arms].reverse()
const arms = armsData.map(info => bones[info.shoulder])
const elbows = armsData.map(info => bones[info.elbow])
const hands = armsData.map(info => bones[info.wrist])
const armsData = [-1, 1].map(sign => {
const mirror = ([x, y, z]) => [x * sign, y, z]
const shoulder = add(body, mirror(ARM.shoulder))
const elbow = add(shoulder, mirror(ARM.elbow))
const wrist = add(elbow, mirror(ARM.wrist))
const fingers = FINGERS.map(start => {
const first = add(wrist, mirror(start))
const second = add(first, [0, -0.025, 0])
const third = add(second, [0, -0.02, 0])
return [first, second, third]
})
return { shoulder, elbow, wrist, fingers }
})
const grips = armsData.map(() => ({ open: { visible: true }, closed: { visible: false } }))
root.rotation.x = -Math.PI / 2
root.position.y = 0.64
return {
root, arms, elbows, hands, grips,
root,
arms: armsData.map(info => info.shoulder),
elbows: armsData.map(info => info.elbow),
hands: armsData.map(info => info.wrist),
grips,
breathe(t) {
material.uniforms.time.value = t
},
@@ -50,19 +49,19 @@ export function createFigure(material, { astral = false } = {}) {
armsData.forEach((info, side) => {
info.fingers.forEach((chain, digit) => {
const curl = grips[side].closed.visible ? 1 : 0
chain.forEach((index, joint) => {
bones[index].rotation.set(-curl * (digit ? 1.05 : 0.65), 0, digit ? 0 : curl * 0.25)
if (joint === 0 && digit === 0) bones[index].rotation.y = curl * (side ? -0.5 : 0.5)
chain.forEach((bone, joint) => {
bone.rotation.set(-curl * (digit ? 1.05 : 0.65), 0, digit ? 0 : curl * 0.25)
if (joint === 0 && digit === 0) bone.rotation.y = curl * (side ? -0.5 : 0.5)
})
})
})
},
touchPoint() {
return bones[armsData[1].fingers[0][1]].getWorldPosition(new T.Vector3())
return armsData[1].fingers[0][1].getWorldPosition(new T.Vector3())
},
fingerCurl() {
return armsData.map(info => bones[info.fingers[2][0]].rotation.x)
return armsData.map(info => info.fingers[2][0].rotation.x)
},
meshInfo: { vertices: human.vertices, bones: bones.length, source: 'MakeHuman hm08 CC0', astral },
meshInfo: { vertices: 0, bones: bones.length, source: 'model pending', astral },
}
}
@@ -1,147 +0,0 @@
#!/usr/bin/env python3
"""Repose the CC0 MakeHuman surface and bake a compact four-weight arm rig."""
from pathlib import Path
import json
import gzip
import numpy as np
ASSETS = Path(__file__).resolve().parents[1] / 'assets'
vertices, groups, group = [], {}, ''
for line in gzip.open(ASSETS / 'makehuman-base.obj.gz', 'rt'):
if line.startswith('v '):
vertices.append(list(map(float, line.split()[1:4])))
elif line.startswith('g '):
group = line.strip()[2:]
groups[group] = []
elif line.startswith('f '):
groups[group].append([int(x.split('/')[0]) - 1 for x in line.split()[1:]])
original = np.array(vertices) * 0.16
original[:, 1] += 0.10
def joint(name):
ids = sorted({i for face in groups['joint-' + name] for i in face})
return original[ids].mean(axis=0)
def rotation(a, b):
a, b = a / np.linalg.norm(a), b / np.linalg.norm(b)
v = np.cross(a, b)
c = np.dot(a, b)
k = np.array([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])
return np.eye(3) + k + k @ k / max(1e-8, 1 + c)
def distances(points, a, b):
delta = b - a
t = np.clip(((points-a) @ delta) / np.dot(delta, delta), 0, 1)
return np.linalg.norm(points - (a + t[:, None] * delta), axis=1)
ids = sorted({i for face in groups['body'] for i in face})
lookup = {old: n for n, old in enumerate(ids)}
source = original[ids].copy()
posed = source.copy()
# Close the eyelids in the neutral rest pose, retaining the actual face topology.
for side in ['l', 'r']:
eye = joint(side + '-eye')
near = (np.abs(source[:, 0]-eye[0]) < 0.055) & (np.abs(source[:, 1]-eye[1]) < 0.035) & (source[:, 2] > eye[2]-0.025)
posed[near, 1] = eye[1] + (posed[near, 1]-eye[1]) * 0.12
bones = [{'name': 'body', 'parent': -1, 'position': [0, 0, 0]}]
weights = np.zeros((len(ids), 4), dtype=np.float32)
weights[:, 0] = 1
skin = np.zeros((len(ids), 4), dtype=np.uint16)
arm_data = []
for side, sign in [('l', 1), ('r', -1)]:
shoulder, elbow, wrist = [joint(side+'-'+name) for name in ['shoulder', 'elbow', 'hand']]
upper_length, fore_length = np.linalg.norm(elbow-shoulder), np.linalg.norm(wrist-elbow)
new_shoulder = shoulder.copy()
new_elbow = shoulder + np.array([sign*0.045, -np.sqrt(upper_length**2-0.045**2), 0])
new_wrist = new_elbow + np.array([sign*0.018, -np.sqrt(fore_length**2-0.018**2-0.01**2), 0.01])
upper_rotation = rotation(elbow-shoulder, new_elbow-new_shoulder)
lower_rotation = rotation(wrist-elbow, new_wrist-new_elbow)
shoulder_index = len(bones)
bones.append({'name': side+'-shoulder', 'parent': 0, 'position': new_shoulder.tolist()})
elbow_index = len(bones)
bones.append({'name': side+'-elbow', 'parent': shoulder_index, 'position': (new_elbow-new_shoulder).tolist()})
wrist_index = len(bones)
bones.append({'name': side+'-hand', 'parent': elbow_index, 'position': (new_wrist-new_elbow).tolist()})
segments = [(shoulder_index, shoulder, elbow, upper_rotation, new_shoulder),
(elbow_index, elbow, wrist, lower_rotation, new_elbow)]
middle = joint(side+'-finger-3-1')
segments.append((wrist_index, wrist, middle, lower_rotation, new_wrist))
finger_indices = []
for finger in range(1, 6):
points = [joint(f'{side}-finger-{finger}-{n}') for n in range(1, 5)]
parent, previous = wrist_index, new_wrist
chain = []
for n in range(3):
new_point = new_wrist + lower_rotation @ (points[n]-wrist)
index = len(bones)
bones.append({'name': f'{side}-finger-{finger}-{n}', 'parent': parent, 'position': (new_point-previous).tolist()})
segments.append((index, points[n], points[n+1], lower_rotation, new_point))
parent, previous = index, new_point
chain.append(index)
finger_indices.append(chain)
# Restrict each anatomical branch. Shoulder weights blend smoothly into
# the body; the same bound skin is used for the sleeper and the double.
mask = (source[:, 0]*sign > 0.22) & (source[:, 1] < 1.08) & ((source[:, 1] > 0.35) | (source[:, 0]*sign > 0.45))
points = source[mask]
d = np.stack([distances(points, a, b) for _, a, b, _, _ in segments], axis=1)
# Body anchor at shoulder; avoids pulling chest surface into the upper arm.
body_distance = np.maximum(0, points[:, 0]*sign-0.18) + 0.015
d = np.column_stack([body_distance, d])
order = np.argsort(d, axis=1)[:, :4]
influence = 1 / np.maximum(np.take_along_axis(d, order, axis=1), 0.008)**5
influence /= influence.sum(axis=1)[:, None]
transforms = [points]
indices = [0]
for index, a, _, rot, new_a in segments:
transforms.append((points-a) @ rot.T + new_a)
indices.append(index)
transformed = np.stack(transforms, axis=1)
posed[mask] = (np.take_along_axis(transformed, order[:, :, None], axis=1)*influence[:, :, None]).sum(axis=1)
weights[mask] = influence
skin[mask] = np.array(indices)[order]
arm_data.append({'shoulder': shoulder_index, 'elbow': elbow_index, 'wrist': wrist_index, 'fingers': finger_indices})
# Relax the splayed standing legs to a supported parallel rest pose. These
# vertices remain on the root bone: exit/roll moves the entire resting body.
for side, sign in [('l', 1), ('r', -1)]:
hip, knee, ankle = [joint(side+'-'+name) for name in ['upper-leg', 'knee', 'ankle']]
mask = (source[:, 0]*sign > 0) & (source[:, 1] < hip[1])
points = source[mask]
new_knee = hip + np.array([0, -np.linalg.norm(knee-hip), 0.025])
new_ankle = new_knee + np.array([0, -np.linalg.norm(ankle-knee), -0.01])
upper = rotation(knee-hip, new_knee-hip)
lower = rotation(ankle-knee, new_ankle-new_knee)
u = (points-hip) @ upper.T + hip
lo = (points-knee) @ lower.T + new_knee
blend = np.clip((knee[1]+0.09-points[:, 1])/0.18, 0, 1)
posed[mask] = u*(1-blend[:, None])+lo*blend[:, None]
pelvic_blend = np.clip((hip[1]-points[:, 1])/0.18, 0, 1)
posed[mask] = posed[mask]*pelvic_blend[:, None]+points*(1-pelvic_blend[:, None])
triangles = []
for face in groups['body']:
for n in range(1, len(face)-1):
triangles.extend([lookup[face[0]], lookup[face[n]], lookup[face[n+1]]])
# Reject spikes or torn anatomical edges before shipping the rigged surface.
faces = np.array(triangles).reshape(-1, 3)
edges = np.concatenate([faces[:, [0, 1]], faces[:, [1, 2]], faces[:, [2, 0]]])
lengths = np.linalg.norm(posed[edges[:, 0]]-posed[edges[:, 1]], axis=1)
assert np.isfinite(posed).all()
assert np.max(lengths) < 0.23, f'Stretched mesh edge: {np.max(lengths):.4f}'
assert np.max(np.abs(posed[:, 0])) < 0.55, 'Hands did not reach the resting pose'
assert np.max(np.abs(weights.sum(axis=1)-1)) < 0.00001
print(f'Maximum anatomical edge: {np.max(lengths):.4f}')
arrays = [('position', posed.astype('<f4')), ('bodyCoordinate', source.astype('<f4')),
('skinWeight', weights.astype('<f4')), ('skinIndex', skin.astype('<u2')),
('index', np.array(triangles, dtype='<u2'))]
metadata = {'vertices': len(ids), 'bones': bones, 'arms': arm_data, 'attributes': {}}
blob = bytearray()
for name, data in arrays:
while len(blob) % 4:
blob.append(0)
metadata['attributes'][name] = {'offset': len(blob), 'length': data.size, 'type': 'uint16' if data.dtype.itemsize == 2 else 'float32'}
blob.extend(data.tobytes())
(ASSETS / 'human.bin').write_bytes(blob)
(ASSETS / 'human.json').write_text(json.dumps(metadata, indent=2)+'\n')
print(f'Prepared {len(ids)} anatomical vertices, {len(triangles)//3} triangles, {len(bones)} bones; {len(blob)} bytes.')
@@ -128,12 +128,12 @@ try {
}
const rope = await pose(4, 1610)
assert(rope.ropeVisible && rope.cordVisible)
assert.equal(rope.human.source, 'MakeHuman hm08 CC0')
assert(rope.human.vertices > 13000 && rope.human.bones >= 37, 'Anatomical skin with articulated fingers')
assert.equal(rope.human.source, 'model pending')
assert(rope.human.vertices === 0 && rope.human.bones >= 37, 'Stand-in skeleton with articulated fingers')
assert(rope.astralPosition[1] > rope.physicalPosition[1] + 1)
const nextGrip = await evaluate('window.astral.seek(1610.5)')
assert.notDeepEqual(rope.handGrips, nextGrip.handGrips, 'Alternating rope grips')
assert.notDeepEqual(rope.fingerCurl, nextGrip.fingerCurl, 'Bound anatomical fingers curl with the grip')
assert.notDeepEqual(rope.fingerCurl, nextGrip.fingerCurl, 'Stand-in fingers curl with the grip')
const pixelsA = await evaluate('window.astral.pixels()')
await evaluate('window.astral.seek(1611.3)')
assert.notEqual((await evaluate('window.astral.pixels()')).checksum, pixelsA.checksum, 'Animation pixels change')
+24 -43
View File
@@ -1,25 +1,24 @@
# Figure preview
A native window for judging and tuning the shared practice figures. It
plays each practice's own choreography on either character from the
practices package (`figure/`), the petite young woman or the young man:
Tai Chi forms, two rounds of Sun Salutation, the Workout's twelve exercises
and the six astral techniques. It runs on Ziran and Kryon's SDL/Cairo
desktop host, without raylib.
A native window for the practices' stage. It plays each practice's own
choreography (Tai Chi forms, two rounds of Sun Salutation, the Workout's
twelve exercises and the six astral techniques) on Ziran and Kryon's
SDL/Cairo desktop host, without raylib.
Each practice plays on its own backdrop in Inner Breeze's illustration
style: a lake terrace for Tai Chi, a sunrise hill for Sun Salutation, a
woodland deck for the Workout and a moonlit veranda for astral projection.
The panel picks the woman or the man, the practice and item, plays,
pauses, scrubs and slows the clock, sets the colour strength and can show
Breeze's current flat figure for the same moment. Drag over the figure to
turn around it; scroll to zoom.
The figure model is pending: the MakeHuman-based figures were removed on
2026-11-18, and the owner will pick a new one
(`../../plans/2026-11-18-figure-model-candidates.md`). Until then the stage
shows each practice's backdrop (a lake terrace for Tai Chi, a sunrise hill
for Sun Salutation, a woodland deck for the Workout and a moonlit veranda
for astral projection) with a "model pending" note, and Breeze's current
flat figure on it when asked. The panel picks the practice and item, plays,
pauses, scrubs and slows the clock. Drag over the stage to turn around it;
scroll to zoom.
This is its own small project so it can pin the Kryon that has
`scene_skin` and portable shaders, and the practices commit that has the figure,
while Breeze's app still pins older ones. The poses are Breeze's own: the
build adds Breeze's Tai Chi, Sun Salutation and practice folders as module
folders, so nothing is copied.
This is its own small project so it can pin the Kryon and practices
commits it needs while Breeze's app still pins older ones. The poses are
Breeze's own: the build adds Breeze's Tai Chi, Sun Salutation and practice
folders as module folders, so nothing is copied.
## Build and run
@@ -35,33 +34,15 @@ build-queue -- ziran build --project --target=c --exe \
```
The preview asks `ziran pkg path practices --locked` beside this manifest
for its media. `FIGURE_PRACTICES=/path/to/practices` uses a working
checkout instead, for trying figure changes before they are pushed (add
`--module-path ../../../../modules/practices/figure` to the build to compile
that checkout's figure code too).
for its backdrops. `FIGURE_PRACTICES=/path/to/practices` uses a working
checkout instead (add `--module-path ../../../../modules/practices/figure`
to the build to compile that checkout's figure code too).
`./build/app/figure_preview --capture DIR` writes review frames to `DIR` and
exits without a window: the woman on the practice's backdrop (`NAME.png`)
and on a plain studio grey (`NAME-studio.png`), the man the same way
(`NAME-male.png`, `NAME-male-studio.png`), and Breeze's current flat figure
for the same moment and camera (`NAME-current.png`). The frames cover a
front and a turned portrait, Tai Chi's deepest stance, also at the angles
of the owner's two reference sculptures (`reference-female`,
`reference-male`), Sun Salutation's fold, lunge, plank, cobra and downward
dog, the Workout's lowest squat and lunge, and the astral exits.
## Profiling
The window prints a timing report to its standard output (the launcher's
journal) every 120 painted frames and when it closes: median and 95th
percentile milliseconds over the last 240 frames
for the whole frame and for each step (the practice's pose solve, the
figure's pose, skinning, the skirt and the normals, render and readback,
fading a translucent double, the contact shadow, the backdrop, compositing, the astral double, the texture upload
and the panel's controls). `./build/app/figure_preview --profile PRACTICE`
(`tai-chi`, `sun-salutation`, `workout` or `astral`) paints 240 frames
without a window and prints the same report; add `still` to hold one pose
and `male` to profile the man.
exits without a window: the empty stage (`NAME.png`) and Breeze's current
flat figure on it (`NAME-current.png`) for Tai Chi's deepest stance, Sun
Salutation's fold, lunge, plank, cobra and downward dog, the Workout's
lowest squat and lunge, and an astral moment.
## Known limits
+27 -128
View File
@@ -1,8 +1,8 @@
// A live preview of the shared practice figures: pick the woman or the man,
// a practice and one of its items, play, pause, scrub or slow it down, turn
// and zoom around the figure, and set the colour strength. The poses are
// the practices' own (preview_practices.zi); the characters are the
// practices package's figures.
// A live preview of the practices' stage for the shared practice figure:
// pick a practice and one of its items, play, pause, scrub or slow it down,
// turn and zoom. The poses are the practices' own (preview_practices.zi).
// The figure model is pending, so the stage shows the practice's backdrop
// with a note, and Breeze's current flat figure when asked.
//
// figure_preview opens the window
// figure_preview --capture DIR writes the review frames to DIR and exits
@@ -11,11 +11,9 @@
// `ziran pkg path practices --locked` beside its own manifest.
#import "figure_math"
#import "figure_joints"
#import "figure_paint"
#import "preview_practices"
#import "preview_capture"
#import "preview_flat"
#import "preview_profile"
#import "kryon/scene"
#import "kryon/session"
#import "kryon/geometry"
@@ -53,9 +51,7 @@ PreviewState :: struct {
seconds: float64
playing: bool
speed: float64
// FIGURE_FEMALE or FIGURE_MALE.
character: s32
// Shows Breeze's current flat figure instead, for comparison.
// Shows Breeze's current flat figure on the stage.
current: bool
turn: float64
lift: float64
@@ -63,18 +59,11 @@ PreviewState :: struct {
dragging: bool
drag_x: float32
drag_y: float32
colour: float32
}
preview_state: PreviewState = .{playing = true, speed = 1.0, zoom = 1.0, colour = 0.6};
preview_woman: FigureMedia;
preview_man: FigureMedia;
// The character the painters were prepared for.
preview_prepared: s32;
preview_state: PreviewState = .{playing = true, speed = 1.0, zoom = 1.0};
preview_backdrops: PreviewBackdrops;
preview_library: PreviewLibrary;
preview_body: FigurePainter;
preview_twin: FigurePainter;
preview_picture: Raster.Image;
preview_texture: Texture2D;
preview_owner: Session;
@@ -85,10 +74,6 @@ preview_clock: s64;
// its own and never an edit of the last frame's.
preview_page: s32;
preview_time_text: [2][32]u8;
preview_status_text: [2][96]u8;
preview_frame_ms: float64;
preview_last_draw: s64;
preview_painted: bool;
preview_practices_path: [1024]u8;
preview_practices_length: s64;
@@ -98,43 +83,15 @@ main :: (argc: s32, argv: **u8) -> s32 {
print("figure preview: no practices checkout; set FIGURE_PRACTICES or lock the package\n")
return 1
}
media: [1100]u8
folder := PreviewJoin(media[:], practices, "/shared/figure")
preview_woman = FigureMediaLoad(folder, FIGURE_FEMALE)
preview_man = FigureMediaLoad(folder, FIGURE_MALE)
if !FigureMediaReady(*preview_woman) || !FigureMediaReady(*preview_man) || !PreviewBackdropsLoad(*preview_backdrops, practices) ||
!PreviewLibraryLoad(*preview_library, practices) {
print("figure preview: could not read the figure media or the practices in %\n", practices)
if !PreviewBackdropsLoad(*preview_backdrops, practices) || !PreviewLibraryLoad(*preview_library, practices) {
print("figure preview: could not read the backdrops or the practices in %\n", practices)
return 1
}
preview_state.item = PreviewDefaultItem(*preview_library, preview_state.practice)
if argc >= 3 && TextFromCString(argv[1]) == "--profile" {
practice: s32 = 0
names: [4]string = .["tai-chi", "sun-salutation", "workout", "astral"]
for index: cast(s32)0..3 {
if TextFromCString(argv[2]) == names[index] {
practice = index
}
}
// Further arguments: "still" holds one pose, to tell the renderer's
// own cost from rebuilding the moving surface; "male" profiles him.
still := false
character: s32 = FIGURE_FEMALE
for index: 3..argc - 1 {
still = still || TextFromCString(argv[index]) == "still"
if TextFromCString(argv[index]) == "male" {
character = FIGURE_MALE
}
}
return PreviewProfileRun(PreviewMedia(character), *preview_backdrops, *preview_library, practice, 240, 600,
760, still)
}
if argc >= 3 && TextFromCString(argv[1]) == "--capture" {
return PreviewCapture(*preview_woman, *preview_man, *preview_backdrops, *preview_library, TextFromCString(argv[2]))
return PreviewCapture(*preview_backdrops, *preview_library, TextFromCString(argv[2]))
}
status := Desktop.RunTitled(PreviewDraw, 1360, 900, "Figure preview")
PreviewProfileReport("live window, closing")
return status
return Desktop.RunTitled(PreviewDraw, 1360, 900, "Figure preview")
}
PreviewDraw :: (session: Session, viewport: Rectangle) -> s32 {
@@ -150,9 +107,6 @@ PreviewDraw :: (session: Session, viewport: Rectangle) -> s32 {
now := Timer.MonotonicMilliseconds()
elapsed := ifx preview_clock == 0 then 0 else now - preview_clock
preview_clock = now
if elapsed > 0 {
preview_frame_ms = preview_frame_ms * 0.9 + cast(float64)elapsed * 0.1
}
if state.playing {
// A stalled frame never jumps the figure ahead by more than a moment.
state.seconds += cast(float64)FigureClamp(cast(float64)elapsed, 0.0, 250.0) / 1000.0 * state.speed
@@ -184,14 +138,7 @@ PreviewDraw :: (session: Session, viewport: Rectangle) -> s32 {
state.zoom = FigureClamp(state.zoom * Pow(0.88, cast(float64)input.wheel), 0.25, 3.0)
}
drawn := PreviewNow()
if preview_last_draw != 0 {
PreviewRecord(PREVIEW_PHASE_FRAME, cast(float64)(drawn - preview_last_draw) / 1000000.0)
}
preview_last_draw = drawn
preview_painted = false
PreviewPaintFigure(session, area)
controls := PreviewNow()
PreviewPaintStage(session, area)
x := panel.x + 20.0
width := panel.width - 40.0
@@ -199,15 +146,6 @@ PreviewDraw :: (session: Session, viewport: Rectangle) -> s32 {
Text.Draw(session, Text.Props.{.key = 10, .bounds = .{x, y, width, 30.0}, .text = "Figure preview",
.size = 22})
y += 42.0
people: [2]Segmented.SegmentOption
people[0].label = "Woman"
people[1].label = "Man"
person := Segmented.Draw(session, Segmented.Props.{.key = 27, .bounds = .{x, y, width, 40.0},
.selected_index = state.character, .has_selection = true}, people[:]).selected_index
if person != state.character && person >= 0 && person < FIGURE_CHARACTERS {
state.character = person
}
y += 52.0
options: [4]Segmented.SegmentOption
options[0].label = "Tai Chi"
options[1].label = "Sun"
@@ -263,47 +201,24 @@ PreviewDraw :: (session: Session, viewport: Rectangle) -> s32 {
y += 62.0
state.current = Toggle.Draw(session, Toggle.Props.{.key = 23, .bounds = .{x, y, width, 40.0},
.label = "Current flat figure", .value = state.current}).value
y += 50.0
state.colour = Slider.Draw(session, Slider.Props.{.key = 26, .bounds = .{x, y, width, 56.0},
.label = "Colour strength", .value = state.colour, .max = 1.0}).value
y += 66.0
status := "CPU"
y += 56.0
note := "Model pending: the practice figure appears here once a new model is chosen."
if preview_failed {
status = "The figure could not be painted"
} else if preview_body.accelerated {
status = "GPU"
note = "The stage could not be painted."
}
rate: [16]u8
first_line: [96]u8
labelled := PreviewJoin(first_line[:], status, ", frame ms ")
status = PreviewJoin(preview_status_text[preview_page][:], labelled, FormatDecimal(preview_frame_ms, 0, rate[:]))
Text.Draw(session, Text.Props.{.key = 21, .bounds = .{x, y, width, 24.0}, .text = status, .size = 14})
y += 26.0
Text.Draw(session, Text.Props.{.key = 21, .bounds = .{x, y, width, 66.0}, .text = note, .size = 14})
y += 70.0
Text.Draw(session, Text.Props.{.key = 22, .bounds = .{x, y, width, 44.0},
.text = "Drag over her to turn around her; scroll to zoom.", .size = 14})
.text = "Drag over the stage to turn around it; scroll to zoom.", .size = 14})
if state.practice == PREVIEW_ASTRAL && preview_library.astral_even {
y += 46.0
Text.Draw(session, Text.Props.{.key = 24, .bounds = .{x, y, width, 44.0},
.text = "These practices have no astral session timings yet; steps are 20 s apart.", .size = 14})
}
if preview_painted {
PreviewRecord(PREVIEW_PHASE_CONTROLS, PreviewLap(*controls))
PreviewProfileFrame("live window")
}
return 0
}
PreviewMedia :: (character: s32) -> *FigureMedia {
return ifx character == FIGURE_MALE then *preview_man else *preview_woman
}
PreviewStyle :: () -> FigureStyle {
style := FigureStyleDefault()
style.colour = cast(float64)preview_state.colour
return style
}
PreviewPaintFigure :: (session: Session, area: Rectangle) {
PreviewPaintStage :: (session: Session, area: Rectangle) {
state := *preview_state
// Paint at most 760 pixels tall; the image scales smoothly to the area.
scale := FigureClamp(760.0 / cast(float64)area.height, 0.2, 1.0)
@@ -314,25 +229,10 @@ PreviewPaintFigure :: (session: Session, area: Rectangle) {
}
key := PreviewKey(width, height)
if key != preview_painted_key || preview_texture.id == 0 {
clock := PreviewNow()
moment := PreviewSample(*preview_library, state.practice, state.item, state.seconds)
PreviewRecord(PREVIEW_PHASE_SOLVE, PreviewLap(*clock))
view := PreviewViewOf(*moment, state.turn, state.lift, state.zoom)
if state.current {
camera := PreviewFlatOf(*moment, view)
preview_failed = !PreviewFlatRender(camera, view, width, height, *preview_picture)
} else {
// The painters are prepared for one character's surface.
if preview_prepared != state.character {
FigurePainterRelease(*preview_body)
FigurePainterRelease(*preview_twin)
preview_prepared = state.character
}
preview_failed = !PreviewCompose(*preview_body, *preview_twin, PreviewMedia(state.character),
*preview_backdrops, state.practice, *moment, view, PreviewStyle(), false, width, height,
*preview_picture)
}
unused PreviewLap(*clock)
preview_failed = !PreviewStage(*preview_backdrops, state.practice, *moment, view, state.current, width,
height, *preview_picture)
if !preview_failed {
texture := preview_texture
if texture.id != 0 && (texture.width != width || texture.height != height ||
@@ -348,23 +248,22 @@ PreviewPaintFigure :: (session: Session, area: Rectangle) {
}
preview_texture = texture
preview_painted_key = key
PreviewRecord(PREVIEW_PHASE_UPLOAD, PreviewLap(*clock))
preview_painted = true
}
}
if preview_texture.id != 0 {
Image.Draw(session, Image.Props.{.key = 3, .bounds = area, .texture = preview_texture, .smooth = true,
.alt_text = "The practice figure"})
.alt_text = "The practice stage"})
}
}
// Everything the picture depends on.
// Everything the picture depends on; the backdrop alone does not move.
PreviewKey :: (width: s32, height: s32) -> u64 {
state := *preview_state
digest: u64 = 1469598103934665603
values: [10]float64 = .[cast(float64)state.practice, cast(float64)state.item, state.seconds,
state.turn, state.lift, state.zoom, cast(float64)state.character,
ifx state.current then 1.0 else 0.0, cast(float64)state.colour, cast(float64)width * 10000.0 + cast(float64)height]
moving := ifx state.current then 1.0 else 0.0
values: [7]float64 = .[cast(float64)state.practice, cast(float64)state.item, state.seconds * moving,
(state.turn + state.lift * 7.0 + state.zoom * 13.0) * moving, moving, cast(float64)width,
cast(float64)height]
for value: values {
bits := cast(u64)(value * 1000003.0 + 0.5)
digest = digest * 1099511628211 + bits
+56 -221
View File
@@ -1,14 +1,11 @@
// Composing a moment's picture, and the fixed review frames the capture
// mode writes: each practice's hardest poses for both figures, on the
// practice's backdrop and on a plain studio grey, and Breeze's current flat
// figure.
// The stage a moment shows, and the fixed review frames the capture mode
// writes. The figure model is pending, so the stage is the practice's
// backdrop, with Breeze's current flat figure on it when asked.
#import "figure_math"
#import "figure_joints"
#import "figure_paint"
#import "figure_finish"
#import "preview_practices"
#import "preview_flat"
#import "preview_profile"
#import "kryon/scene"
#import "sun_salutation_rules"
#import "workout_rules"
@@ -23,7 +20,6 @@ PreviewBackdrops :: struct {
images: [4]Raster.Image
covered: Raster.Image
covered_practice: s32
covered_vivid: float64
}
PreviewBackdropsLoad :: (backdrops: *PreviewBackdrops, practices: string) -> bool {
@@ -55,108 +51,35 @@ PreviewBackdropsRelease :: (backdrops: *PreviewBackdrops) {
VecFree(backdrops.covered.pixels)
}
// The body, and an astral twin over it, into OUT: on the practice's
// backdrop, or on a plain studio grey (STUDIO) for judging the figure.
PreviewCompose :: (body: *FigurePainter, twin: *FigurePainter, media: *FigureMedia,
backdrops: *PreviewBackdrops, practice: s32, moment: *PreviewMoment, view: FigureView,
style: FigureStyle, studio: bool, width: s32, height: s32, out: *Raster.Image) -> bool {
still: FigureEffect
if !FigurePaint(body, media, *moment.body, view, style, still, width, height) {
return false
}
times := body.times
PreviewRecord(PREVIEW_PHASE_POSE, times.pose)
PreviewRecord(PREVIEW_PHASE_SKIN, times.skin)
PreviewRecord(PREVIEW_PHASE_CLOTH, times.cloth)
PreviewRecord(PREVIEW_PHASE_RENDER, times.render)
PreviewRecord(PREVIEW_PHASE_FINISH, times.finish)
PreviewRecord(PREVIEW_PHASE_SHADOW, times.shadow)
clock := PreviewNow()
// The backdrop is scaled once for each size, practice and colour
// strength, then the figure is laid over it.
backdrop := *backdrops.images[practice]
// The practice's backdrop covering a WIDTH by HEIGHT picture in OUT, and,
// with FLAT, Breeze's current flat figure for MOMENT seen as VIEW over it.
PreviewStage :: (backdrops: *PreviewBackdrops, practice: s32, moment: *PreviewMoment, view: PreviewView,
flat: bool, width: s32, height: s32, out: *Raster.Image) -> bool {
covered := *backdrops.covered
painted := !studio && Raster.ImageValid(backdrop)
vivid := ifx painted then FigureVivid(style) else -1.0
if covered.width != width || covered.height != height || backdrops.covered_practice != practice ||
backdrops.covered_vivid != vivid {
if painted {
// The lying astral body needs the floor raised to her.
zoom := ifx practice == PREVIEW_ASTRAL then 1.7 else 1.0
focus := ifx practice == PREVIEW_ASTRAL then 1.0 else 0.62
if !FigureBackdropCover(covered, backdrop, width, height, zoom, focus, vivid) {
return false
}
} else {
if !VecResize(covered.pixels, cast(s64)width * height * 4) {
return false
}
covered.width = width
covered.height = height
grey: [4]u8 = .[218, 218, 221, 255]
for index: 0..covered.pixels.count - 1 {
covered.pixels[index] = grey[index % 4]
}
if covered.width != width || covered.height != height || backdrops.covered_practice != practice {
// The lying astral body needs the floor raised to her.
zoom := ifx practice == PREVIEW_ASTRAL then 1.7 else 1.0
focus := ifx practice == PREVIEW_ASTRAL then 1.0 else 0.62
if !FigureBackdropCover(covered, *backdrops.images[practice], width, height, zoom, focus, 1.2) {
return false
}
backdrops.covered_practice = practice
backdrops.covered_vivid = vivid
}
PreviewRecord(PREVIEW_PHASE_BACKDROP, PreviewLap(*clock))
if !FigureOverOnto(out, covered, *body.pixels) {
return false
}
PreviewRecord(PREVIEW_PHASE_OVER, PreviewLap(*clock))
PreviewRecord(PREVIEW_PHASE_TWIN, 0.0)
if !moment.twin_visible {
if !flat {
if !VecResize(out.pixels, covered.pixels.count) {
return false
}
out.width = width
out.height = height
for index: 0..covered.pixels.count - 1 {
out.pixels[index] = covered.pixels[index]
}
return true
}
glow := style
glow.luminous = true
glow.opacity = 0.58
doubled := FigurePaint(twin, media, *moment.twin, view, glow, moment.twin_effect, width, height) &&
FigureOver(out, *twin.pixels, 1.0)
PreviewRecord(PREVIEW_PHASE_TWIN, PreviewLap(*clock))
return doubled
}
// Paints PRACTICE's default item for FRAMES frames a thirtieth of a second
// apart (or all at its first moment, STILL) at WIDTH by HEIGHT, without a
// window, and prints the timing.
PreviewProfileRun :: (media: *FigureMedia, backdrops: *PreviewBackdrops, library: *PreviewLibrary,
practice: s32, frames: s32, width: s32, height: s32, still: bool) -> s32 {
body: FigurePainter
twin: FigurePainter
picture: Raster.Image
defer {
FigurePainterRelease(*body)
FigurePainterRelease(*twin)
VecFree(picture.pixels)
}
item := PreviewDefaultItem(library, practice)
duration := PreviewDuration(library, practice, item)
seconds: float64
for frame: 0..frames - 1 {
start := PreviewNow()
clock := start
moment := PreviewSample(library, practice, item, seconds)
PreviewRecord(PREVIEW_PHASE_SOLVE, PreviewLap(*clock))
view := PreviewViewOf(*moment, 0.0, 0.0, 1.0)
if !PreviewCompose(*body, *twin, media, backdrops, practice, *moment, view, FigureStyleDefault(), false,
width, height, *picture) {
print("figure profile: frame % could not be painted\n", frame)
return 1
}
PreviewRecord(PREVIEW_PHASE_UPLOAD, 0.0)
PreviewRecord(PREVIEW_PHASE_CONTROLS, 0.0)
PreviewRecord(PREVIEW_PHASE_FRAME, PreviewLap(*start))
PreviewProfileFrame("headless")
seconds += ifx still then 0.0 else 1.0 / 30.0
if seconds >= duration {
seconds = 0.0
}
}
print("figure profile: gpu=% %\n", body.accelerated, body.diagnostic)
return 0
figure: Raster.Image
defer VecFree(figure.pixels)
camera := PreviewFlatOf(moment, view)
return PreviewFlatRender(camera, view, width, height, *figure) && FigureOverOnto(out, covered, *figure)
}
PreviewShot :: struct {
@@ -164,40 +87,17 @@ PreviewShot :: struct {
item: s32
seconds: float64
name: string
// How far the camera turns about her, in radians.
turn: float64
// A close view of the head and shoulders.
portrait: bool
}
// Writes NAME.png (her on the backdrop), NAME-studio.png (her on grey), the
// same with -male for him, and NAME-current.png (Breeze's flat figure).
PreviewCapture :: (woman: *FigureMedia, man: *FigureMedia, backdrops: *PreviewBackdrops, library: *PreviewLibrary,
directory: string) -> s32 {
shots: [24]PreviewShot
// Writes NAME.png (the empty stage) and NAME-current.png (Breeze's current
// flat figure on it) for each practice's hardest poses.
PreviewCapture :: (backdrops: *PreviewBackdrops, library: *PreviewLibrary, directory: string) -> s32 {
shots: [16]PreviewShot
count: s32
full := PreviewDefaultItem(library, PREVIEW_TAI_CHI)
shots[count] = .{PREVIEW_TAI_CHI, full, 9.0, "tai-chi-9s"}
count += 1
shots[count] = .{PREVIEW_TAI_CHI, full, 9.0, "portrait"}
shots[count].portrait = true
count += 1
shots[count] = .{PREVIEW_TAI_CHI, full, 9.0, "portrait-turned"}
shots[count].turn = -0.65
shots[count].portrait = true
count += 1
shots[count] = .{PREVIEW_TAI_CHI, full, 131.0, "tai-chi-131s"}
count += 1
lowest := PreviewLowest(library, PREVIEW_TAI_CHI, full)
shots[count] = .{PREVIEW_TAI_CHI, full, lowest, "tai-chi-deepest-stance"}
count += 1
// The owner's reference sculpts' angles (figure/design/reference):
// the woman from her front left, the man from behind on his left.
shots[count] = .{PREVIEW_TAI_CHI, full, lowest, "reference-female"}
shots[count].turn = -0.55
count += 1
shots[count] = .{PREVIEW_TAI_CHI, full, lowest, "reference-male"}
shots[count].turn = 2.45
shots[count] = .{PREVIEW_TAI_CHI, full, PreviewLowest(library, PREVIEW_TAI_CHI, full), "tai-chi-deepest-stance"}
count += 1
// The Sun Salutation's folds and floor poses, each once it is reached.
names: [5]string = .["sun-forward-fold", "sun-lunge", "sun-plank", "sun-cobra", "sun-downward-dog"]
@@ -212,96 +112,44 @@ PreviewCapture :: (woman: *FigureMedia, man: *FigureMedia, backdrops: *PreviewBa
shots[count] = .{PREVIEW_WORKOUT, WORKOUT_LUNGES, PreviewLowest(library, PREVIEW_WORKOUT, WORKOUT_LUNGES),
"workout-lunge"}
count += 1
shots[count] = .{PREVIEW_WORKOUT, WORKOUT_PUSH_UPS, 1.0, "workout-push-up"}
count += 1
shots[count] = .{PREVIEW_WORKOUT, WORKOUT_JUMPING_JACKS, 0.0, "workout-ready"}
count += 1
shots[count] = .{PREVIEW_ASTRAL, 0, 60.0, "astral-60s"}
count += 1
shots[count] = .{PREVIEW_ASTRAL, 4, PreviewDoubleTime(library, 4), "astral-rope-exit"}
count += 1
shots[count] = .{PREVIEW_ASTRAL, 5, PreviewDoubleTime(library, 5), "astral-roll-out"}
count += 1
body: FigurePainter
twin: FigurePainter
picture: Raster.Image
defer {
FigurePainterRelease(*body)
FigurePainterRelease(*twin)
VecFree(picture.pixels)
}
defer VecFree(picture.pixels)
failed: s32
written: s32
suffixes: [5]string = .[".png", "-studio.png", "-male.png", "-male-studio.png", "-current.png"]
for character: cast(s32)0..1 {
// Each character prepares its own painters.
FigurePainterRelease(*body)
FigurePainterRelease(*twin)
for index: 0..count - 1 {
shot := shots[index]
moment := PreviewSample(library, shot.practice, shot.item, shot.seconds)
// Lying figures need a landscape picture.
width: s32 = ifx shot.practice == PREVIEW_ASTRAL then 900 else 600
height: s32 = ifx shot.practice == PREVIEW_ASTRAL then 600 else 800
view := PreviewViewOf(*moment, shot.turn, 0.0, 1.0)
if shot.portrait {
view.center = FigureAdd(moment.body.neck, FigureV3(0.0, 0.10, 0.0))
view.height = 0.42
view.pitch = 0.05
for index: 0..count - 1 {
shot := shots[index]
moment := PreviewSample(library, shot.practice, shot.item, shot.seconds)
// Lying figures need a landscape picture.
width: s32 = ifx shot.practice == PREVIEW_ASTRAL then 900 else 600
height: s32 = ifx shot.practice == PREVIEW_ASTRAL then 600 else 800
view := PreviewViewOf(*moment, 0.0, 0.0, 1.0)
for variant: 0..1 {
stem: [1024]u8
named: [1024]u8
path: [1024]u8
name := PreviewJoin(stem[:], directory, "/")
name = PreviewJoin(named[:], name, shot.name)
final := PreviewJoin(path[:], name, ifx variant == 0 then ".png" else "-current.png")
if !PreviewStage(backdrops, shot.practice, *moment, view, variant == 1, width, height, *picture) {
print("figure capture: % could not be painted\n", final)
failed += 1
continue
}
for variant: 0..2 {
if variant == 2 && (character != 0 || shot.portrait) {
continue
}
suffix := suffixes[ifx variant == 2 then 4 else character * 2 + variant]
stem: [1024]u8
named: [1024]u8
path: [1024]u8
name := PreviewJoin(stem[:], directory, "/")
name = PreviewJoin(named[:], name, shot.name)
final := PreviewJoin(path[:], name, suffix)
painted := false
if variant == 2 {
camera := PreviewFlatOf(*moment, view)
painted = PreviewFlatRender(camera, view, width, height, *picture)
PreviewOnPaper(*picture)
} else {
media := ifx character == 0 then woman else man
painted = PreviewCompose(*body, *twin, media, backdrops, shot.practice, *moment, view,
FigureStyleDefault(), variant == 1, width, height, *picture)
}
if !painted {
print("figure capture: % could not be painted\n", final)
failed += 1
continue
}
if !WritePNGFile(final, *picture, false) {
print("figure capture: could not write %\n", final)
failed += 1
}
written += 1
if !WritePNGFile(final, *picture, false) {
print("figure capture: could not write %\n", final)
failed += 1
continue
}
written += 1
}
}
print("figure capture: % frames, gpu=% %\n", written, body.accelerated, body.diagnostic)
print("figure capture: % frames\n", written)
return failed
}
#scope_file
// Lays the picture on the preview's paper colour.
PreviewOnPaper :: (picture: *Raster.Image) {
paper: [3]float64 = .[243.0, 237.0, 225.0]
for index: 0..cast(s64)picture.width * picture.height - 1 {
at := index * 4
a := cast(float64)picture.pixels[at + 3] / 255.0
for channel: 0..2 {
value := cast(float64)picture.pixels[at + channel] * a + paper[channel] * (1.0 - a)
picture.pixels[at + channel] = cast(u8)(value + 0.5)
}
picture.pixels[at + 3] = 255
}
}
// The second of the item where her pelvis is lowest: the deepest stance.
PreviewLowest :: (library: *PreviewLibrary, practice: s32, item: s32) -> float64 {
duration := PreviewDuration(library, practice, item)
@@ -319,19 +167,6 @@ PreviewLowest :: (library: *PreviewLibrary, practice: s32, item: s32) -> float64
return best
}
// The first second the astral twin is out beside the body, a little on.
PreviewDoubleTime :: (library: *PreviewLibrary, item: s32) -> float64 {
duration := PreviewDuration(library, PREVIEW_ASTRAL, item)
seconds: float64
while seconds < duration {
if PreviewSample(library, PREVIEW_ASTRAL, item, seconds).twin_visible {
return FigureClamp(seconds + 4.0, 0.0, duration)
}
seconds += 1.0
}
return duration * 0.5
}
// Half a second before the first round's STEP ends: its pose reached.
PreviewSunHeld :: (step: s32) -> float64 {
total: float64
+11 -3
View File
@@ -1,9 +1,8 @@
// Breeze's current flat figure (tai_chi_flat.zi) for the same moment, so the
// preview can show it beside the new character. The flat painter emits
// preview can show it on the stage while the new figure model is pending. The flat painter emits
// filled shapes and stroked lines in the picture plane; this lays them on
// pixels with four rows of coverage per pixel row.
#import "figure_math"
#import "figure_paint"
#import "kryon/scene"
#import "tai_chi_math"
#import "tai_chi_view"
@@ -12,13 +11,22 @@
#import "std/vec"
Raster :: #import "std/image";
// An orthographic camera turned YAW about the vertical (0 looks at the
// front) and PITCH above the horizon, showing HEIGHT metres around CENTER.
PreviewView :: struct {
yaw: float64
pitch: float64
height: float64
center: Vector3
}
preview_flat_frame: TaiChiFlatFrame;
preview_flat_edges: [512]float64;
preview_flat_shape: [256]TaiChiVector2;
// Draws preview_flat_frame, painted for CAMERA, into OUT as VIEW frames the
// scene.
PreviewFlatRender :: (camera: TaiChiCamera, view: FigureView, width: s32, height: s32,
PreviewFlatRender :: (camera: TaiChiCamera, view: PreviewView, width: s32, height: s32,
out: *Raster.Image) -> bool {
frame := *preview_flat_frame
if width < 1 || height < 1 || !VecResize(out.pixels, cast(s64)width * height * 4) {
+14 -6
View File
@@ -1,10 +1,9 @@
// The four practices' own choreography, sampled at any second and turned
// into the shared figure's joints. The pose code is Breeze's own: the build
// into the shared figure's joints, ready for the figure model. The pose code is Breeze's own: the build
// adds src/practices/tai_chi, src/practices/sun_salutation and apps/practice
// as module folders, so the preview shows exactly what the app plays.
#import "figure_math"
#import "figure_joints"
#import "figure_paint"
#import "kryon/scene"
#import "tai_chi_math"
#import "tai_chi_course"
@@ -44,7 +43,16 @@ PreviewMoment :: struct {
flat_look: TaiChiFlatLook
twin_visible: bool
twin: FigureJoints
twin_effect: FigureEffect
twin_effect: PreviewEffect
}
// Moves a whole body rigidly, for an astral double rising or rolling out of
// the physical one: OFFSET, then ROLL radians about the pelvis-height PIVOT
// in the picture plane.
PreviewEffect :: struct {
offset: Vector3
pivot: Vector3
roll: float64
}
PreviewLibrary :: struct {
@@ -239,8 +247,8 @@ PreviewSample :: (library: *PreviewLibrary, practice: s32, item: s32, seconds: f
// The view of MOMENT turned TURN and lifted LIFT radians from the practice's
// own camera and zoomed ZOOM times, and the flat figure's camera to match.
PreviewViewOf :: (moment: *PreviewMoment, turn: float64, lift: float64, zoom: float64) -> FigureView {
view: FigureView
PreviewViewOf :: (moment: *PreviewMoment, turn: float64, lift: float64, zoom: float64) -> PreviewView {
view: PreviewView
view.yaw = moment.camera.yaw + turn
view.pitch = FigureClamp(moment.camera.tilt + lift, -1.4, 1.5)
view.height = moment.height / zoom
@@ -248,7 +256,7 @@ PreviewViewOf :: (moment: *PreviewMoment, turn: float64, lift: float64, zoom: fl
return view
}
PreviewFlatOf :: (moment: *PreviewMoment, view: FigureView) -> TaiChiCamera {
PreviewFlatOf :: (moment: *PreviewMoment, view: PreviewView) -> TaiChiCamera {
camera := moment.camera
camera.yaw = view.yaw
camera.tilt = view.pitch
-83
View File
@@ -1,83 +0,0 @@
// Frame-time profiling for the figure preview: each phase of the last 240
// frames, reported as median and 95th percentile milliseconds. The live
// window prints a report every 120 frames and when it closes; `--profile`
// measures without one.
#import "std/math"
Timer :: #import "std/timer_linux";
libc :: #system_library "libc";
PreviewFlushOutput :: (stream: *void) -> s32 #foreign libc "fflush";
PREVIEW_PHASE_FRAME :: 0
PREVIEW_PHASE_SOLVE :: 1
PREVIEW_PHASE_POSE :: 2
PREVIEW_PHASE_SKIN :: 3
PREVIEW_PHASE_CLOTH :: 4
PREVIEW_PHASE_RENDER :: 5
PREVIEW_PHASE_FINISH :: 6
PREVIEW_PHASE_SHADOW :: 7
PREVIEW_PHASE_BACKDROP :: 8
PREVIEW_PHASE_OVER :: 9
PREVIEW_PHASE_TWIN :: 10
PREVIEW_PHASE_UPLOAD :: 11
PREVIEW_PHASE_CONTROLS :: 12
PREVIEW_PHASES :: 13
PREVIEW_PROFILE_FRAMES :: 240
PreviewProfile :: struct {
samples: [PREVIEW_PHASES][PREVIEW_PROFILE_FRAMES]float64
frames: s64
}
preview_profile: PreviewProfile;
PreviewNow :: () -> s64 {
return Timer.MonotonicNanoseconds()
}
// Milliseconds since CLOCK, which moves on to now.
PreviewLap :: (clock: *s64) -> float64 {
now := Timer.MonotonicNanoseconds()
spent := cast(float64)(now - clock.*) / 1000000.0
clock.* = now
return spent
}
PreviewRecord :: (phase: s32, milliseconds: float64) {
preview_profile.samples[phase][preview_profile.frames % PREVIEW_PROFILE_FRAMES] = milliseconds
}
// Ends a frame; LABEL names the run, and a full window of frames prints.
PreviewProfileFrame :: (label: string) {
preview_profile.frames += 1
if preview_profile.frames % (PREVIEW_PROFILE_FRAMES / 2) == 0 {
PreviewProfileReport(label)
}
}
PreviewProfileReport :: (label: string) {
count := ifx preview_profile.frames < PREVIEW_PROFILE_FRAMES then preview_profile.frames else PREVIEW_PROFILE_FRAMES
if count == 0 {
return
}
names: [PREVIEW_PHASES]string = .["frame", "solve", "pose", "skin", "cloth+normals", "render+readback", "fade",
"shadow", "backdrop", "over", "twin", "upload", "controls"]
print("figure preview timing, %, % frames (median / p95 ms):", label, count)
for phase: 0..PREVIEW_PHASES - 1 {
sorted: [PREVIEW_PROFILE_FRAMES]float64
for at: 0..count - 1 {
value := preview_profile.samples[phase][at]
spot := at
while spot > 0 && sorted[spot - 1] > value {
sorted[spot] = sorted[spot - 1]
spot -= 1
}
sorted[spot] = value
}
median := sorted[count / 2]
tail := sorted[(count * 95) / 100]
print(" %=%/%", names[phase], cast(s64)(median * 10.0 + 0.5), cast(s64)(tail * 10.0 + 0.5))
}
print(" (tenths of a ms)\n")
unused PreviewFlushOutput(null)
}
+11 -11
View File
@@ -55,6 +55,15 @@
"ref": "1b2f35b7b39df6fb9af7a52324b4b7cf18e98df2",
"url": "https://github.com/ziranlang/audio.git"
},
{
"commit": "57c4f4c5760fb4f97c231d0ef6fb62ba5c519958",
"dependencies": {"kryon": "p7134544230dacade"},
"dependency_refs": {"kryon": "4b79d9761508068e901879eb6208a22b8c331a63"},
"id": "p5b4b0d1192668748",
"name": "practices",
"ref": "57c4f4c5760fb4f97c231d0ef6fb62ba5c519958",
"url": "https://github.com/waozixyz/practices.git"
},
{
"commit": "bd278217e2bac754d868b3d6502eac4257658d4b",
"dependencies": {"dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa"},
@@ -64,15 +73,6 @@
"ref": "bd278217e2bac754d868b3d6502eac4257658d4b",
"url": "https://github.com/ziranlang/av1.git"
},
{
"commit": "7797a280a89e31e4a5d264c4a9623c2bd3353509",
"dependencies": {"kryon": "p7134544230dacade"},
"dependency_refs": {"kryon": "4b79d9761508068e901879eb6208a22b8c331a63"},
"id": "p66b7cac3c445eab0",
"name": "practices",
"ref": "7797a280a89e31e4a5d264c4a9623c2bd3353509",
"url": "https://github.com/waozixyz/practices.git"
},
{
"commit": "360553150917f352e49e1beb78917370792ccaef",
"dependencies": {},
@@ -128,8 +128,8 @@
}
],
"root": {
"dependencies": {"kryon": "p7134544230dacade", "practices": "p66b7cac3c445eab0"},
"dependency_refs": {"kryon": "4b79d9761508068e901879eb6208a22b8c331a63", "practices": "7797a280a89e31e4a5d264c4a9623c2bd3353509"},
"dependencies": {"kryon": "p7134544230dacade", "practices": "p5b4b0d1192668748"},
"dependency_refs": {"kryon": "4b79d9761508068e901879eb6208a22b8c331a63", "practices": "57c4f4c5760fb4f97c231d0ef6fb62ba5c519958"},
"name": "figure_preview"
},
"toolchain": {
+1 -1
View File
@@ -15,4 +15,4 @@ ref = "4b79d9761508068e901879eb6208a22b8c331a63"
# The shared figure and its media (anatomy, textures, Tai Chi course).
[dependencies.practices]
git = "https://github.com/waozixyz/practices.git"
ref = "7797a280a89e31e4a5d264c4a9623c2bd3353509"
ref = "57c4f4c5760fb4f97c231d0ef6fb62ba5c519958"
+23 -45
View File
@@ -1,60 +1,38 @@
# Open practice figure work — 2026-11-18
The owner wants the practice figures used everywhere: Tai Chi, Sun
Salutation, Workout and astral projection, native on Ziran and Kryon
without raylib. They must look as good as the owner's reference sculptures
(practices `figure/design/reference/`): correct proportions, smooth
surfaces, clean colours, no paint, paper or grain. The default is a petite
young Chinese woman with black hair, smooth skin and an attractive Chinese
outfit; a young man in a kung fu outfit is the second character, to be
offered as a choice. Breeze colours and backdrops stay. The characters are
the practices package's `figure/`; the live tuning tool is
`design/figure-preview/` (see its README). The three.js studies in
`design/astral-projection/three/` are look references only.
The owner wants one figure model used everywhere: Tai Chi, Sun Salutation,
Workout and astral projection, native on Ziran and Kryon without raylib. It
must look as good as the owner's reference sculptures (practices
`figure/design/reference/`): smooth, correct proportions, clean colours.
The default is a pretty, petite young Asian woman; a man is the second
choice. Breeze colours and backdrops stay.
- Owner review of the live preview, of the reference comparisons in
`build/practice-compare/reference/` and of the before/after side-by-sides
in `build/practice-compare/side-by-side/`; tune from that feedback.
- Better base mesh once Kryon's glTF importer lands (the Kryon task
codex-kryon-kryon-idle-present-fix has it queued): a properly licensed
higher-resolution base (MakeHuman/MPFB CC0 with a high-res proxy, or
another CC0/CC-BY model with its licence recorded in practices
`figure/design/`), chosen by how close it comes to the references. Never
use ripped game models (the owner's Character-14.zip is one).
- Character work still open:
- The jacket's skirt swings rigidly from the waist and only by the
pelvis's tilt; secondary sway and a simple collision with the thighs
would help in deep squats and folds.
- The face map is projected from the front; in profile its side fades
to plain skin.
- No ambient occlusion yet: crevices (armpits, under the bun, between the
legs) are lit like open surfaces. Bake it per vertex once the vertex
format has room, or add it to Kryon's material.
- The asset bake (shapes, clothes, hair, UVs, texture maps, the face) is
Python in `scripts/prepare-practice-human.py`; port it to Ziran with the
anatomy reader.
The MakeHuman-based figures were removed on 2026-11-18 at the owner's
request; never use a MakeHuman-based body again (MakeHuman, MPFB, Anny,
MB-Lab, CharMorph). The live tuning tool `design/figure-preview/` shows
the empty stage with a "model pending" note.
- The owner picks a model from `plans/2026-11-18-figure-model-candidates.md`
(contact sheet: `build/model-candidates/contact-sheet.png`).
- Kryon's glTF importer (meshes, skins, animations, morph targets, PBR
materials) is being added in another task; the picked model loads
through it.
- Then: map `FigureJoints` (practices `figure/figure_joints.zi`) onto the
model's skeleton, light it with Kryon's standard material, and show it on
the preview's stage and in the capture frames.
- Astral session timings: practices' `astral_projection/sessions/*.json`
are another task's uncommitted files. Until they are pushed, a pinned
preview plays the six techniques with steps evenly 20 seconds apart.
- Breeze adoption, after the shared Kryon repin (lane -7, plot, entity,
game2d, css and apps on one Kryon; Breeze audio on Ziran std audio):
- Make Breeze's `practices` dependency a package pinned at or after the
commit that has both characters.
- Move `PreviewJoints` (solver joints to `FigureJoints`) beside the
solver.
- Paint Tai Chi, Sun Salutation, Workout and astral with `FigurePaint`
- Paint Tai Chi, Sun Salutation, Workout and astral with the new figure
under `DESKTOP_HOST`, keeping timelines, cues, narration, pause/resume
and history, with a setting for the woman or the man. Bundle
`assets/practices/shared/figure/` from the common Practices pack.
- Native app after-frames for those painters, matching
`build/practice-compare/before/`. Retake the full-form before frame: it
shows the voice-guidance offer instead of the figure.
- Performance: measure on a real phone GPU; shell GL here is llvmpipe.
The figure re-skins and recomputes normals for about 17k vertices on the
CPU every moving frame.
and history, with a setting for the woman or the man.
- Narration: the initial audit found all 88 cue texts in each of ten
locales but only 407/880 female clips (cs 6, de 86, en 86, es 78, fr 37,
ja 5, ko 6, pt 88, ru 10, zh 5). Complete and listen through the owning
narration task; legacy cues do not fill the new exercise keys.
- Refresh the three.js caption snapshot if the practices task changes
session cues or text. Keep `build/astral-compare/before/` as the baseline.
- The three.js astral studies (`design/astral-projection/three/`) play with
invisible stand-in skeletons until the new model is chosen.
+165
View File
@@ -0,0 +1,165 @@
# Figure model candidates — 2026-11-18
The owner rejected the MakeHuman-based figures and had them removed. Never
use a MakeHuman-based body again (MakeHuman, MPFB, Anny, MB-Lab,
CharMorph). This is the shortlist of free models that Inner Breeze, a paid
app on Google Play, may ship. We need a pretty, petite young Asian woman
and a man who can do Tai Chi, Sun Salutation, the Workout and astral
projection.
**The owner picks; nothing is integrated yet.** The pick is loaded through
the glTF importer that is being added to Kryon.
Previews and downloadable files are in `build/model-candidates/` (not
committed). The numbered contact sheet is
`build/model-candidates/contact-sheet.png`. Licence clauses below are
quoted from the licence pages and files themselves; where a page refused
automated reading, that is said.
## 1. Quaternius — Universal Base Characters
- **Preview:** `build/model-candidates/quaternius/universalbasecharacters.jpg`
- **Author:** Quaternius
- **Link:** <https://quaternius.com/packs/universalbasecharacters.html>, download at <https://quaternius.itch.io/universal-base-characters> (free, name your own price; itch.io's download needs a browser, so it isn't fetched here).
- **Licence:** CC0. The pack page says: "Free to use in personal, educational and commercial projects. (CC0 License)". The CC0 deed says: "You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission."
- Released 2025, before Quaternius's newer QAL licence (2026-08), which by its own terms covers only later releases.
- **Attribution:** none.
- **Format:** glTF, FBX and OBJ; the Source tier adds rigged .blend files.
- **Rig:** "Humanoid Rig compatible with retargeting in any engine". It works with Quaternius's CC0 Universal Animation Library.
- **Triangles:** "Average 13k".
- **Textures:** included.
- **Why it fits:**
- The closest to the owner's sculpt references: smooth, clean, stylised bodies with good anatomy.
- Six bodies in Regular, Teen and Superhero proportions (male and female), 20 hairstyles, and skin and eye colour shaders in the Source tier.
- The Teen or Regular woman with black hair in a bun, a warmer skin tone and our own outfit gives the petite young Asian woman; the Regular man gives him.
- Matching CC0 outfits exist (Modular Character Outfits).
- Mobile-friendly.
## 2. VRoid Studio — our own model
- **Preview:** the base models in `build/model-candidates/vroid/cc0-models.png`
- **Author:** us, made in pixiv's free VRoid Studio
- **Link:** <https://vroid.com/en/studio>
- **Licence:** pixiv's VRoid Studio Guidelines (<https://vroid.com/en/studio/guidelines>):
- "Any individual or corporation may sell or use for commercial purposes any mesh, texture, or preset item provided by VRoid Studio, including models, clothing items, and accessories, provided that no special clauses are indicated in the license."
- "You can use images and videos of models created with VRoid Studio and generate profit from … games, applications, software …"
- The one limit: "You cannot create an application that can generate or output 3D models, avatars, or items consisting of deformed or combined meshes and textures that were created in VRoid Studio." Breeze only shows its own fixed characters, so this doesn't apply.
- **Attribution:** none.
- **Format:** VRM, which is glTF 2.0.
- **Rig:** the VRM humanoid skeleton.
- **Triangles:** typically 20k–60k. VRoid's export can reduce polygons and merge materials to fit 50k.
- **Textures:** included.
- **Why it fits:**
- Exactly the character we want, designed by us: petite, a cute young Chinese woman with a black bun and a qipao-style top; a young man in a kung fu jacket.
- The cel-shaded anime style suits Breeze's storybook backdrops.
- Making them is design work done in the desktop app, not a download.
## 3. VRoid — official AvatarSample_A and AvatarSample_C
- **Preview:** `build/model-candidates/vroid/conditions-models.png`
- **Author:** pixiv (official samples)
- **Link:**
- A: <https://hub.vroid.com/en/characters/2843975675147313744/models/5644550979324015604>
- C: <https://hub.vroid.com/en/characters/1248981995540129234/models/8640547963669442173>
- **Licence:** VRoid Hub conditions as published on the official pages: "Avatar Use: Allow / Violent acts: Allow / Sexual acts: Allow / Corporate use: Allow / Individual commercial use: Allow / Redistribution: Allow / Alterations: Allow / Attribution: Not required".
- Copyright is not waived; these are not CC0.
- VRoid Hub and the pixiv help centre refuse automated reading, so I read these conditions through search results; confirm them in a browser.
- **Attribution:** not required.
- **Format:** VRM (glTF 2.0). Downloading needs a VRoid Hub login, so not fetched here.
- **Rig:** VRM humanoid.
- **Triangles:** not measured (the files need the login).
- **Textures:** included.
- **Why it fits:**
- A is a cute brown-haired girl and C a black-haired young man; recolour her hair black and dress both for practice.
- Ready now, and editable in VRoid Studio.
## 4. VRoid — HairSample_Female and HairSample_Male (CC0)
- **Preview:** `build/model-candidates/vroid/cc0-models.png`; the files are `build/model-candidates/vroid/HairSample_Female.vrm` and `HairSample_Male.vrm`.
- **Author:** pixiv (VRoid beta samples)
- **Link:** <https://github.com/madjin/vrm-samples> (a mirror of pixiv's samples)
- **Licence:**
- CC0, written into each file's own VRM metadata: `"licenseName": "CC0", "commercialUssageName": "Allow", "allowedUserName": "Everyone"`.
- pixiv's list says: "The CC license for these models is CC0. This model can be edited and used freely. Copyright is waived, and there is no particular limit when using them."
- **Attribution:** none.
- **Format:** VRM (glTF 2.0).
- **Rig:** VRM humanoid, plus spring bones for the hair (357 and 273 joints in all).
- **Triangles:** 27,068 (her) and 24,858 (him), measured from the files.
- **Textures:** included (25 images each).
- **Why it fits:**
- Public domain anime pair with black hair, ready to load the moment the importer lands.
- Her cat ears and twin tails would need editing in VRoid Studio for a calm practice look.
## 5. Microsoft Rocketbox — Female_Adult_03 and Male_Adult_10
- **Preview:** `build/model-candidates/rocketbox/Female_Adult_03.png` and `Male_Adult_10.png`; the files (FBX plus 2048 px textures) are in `build/model-candidates/rocketbox/Female_Adult_03/` and `Male_Adult_10/`.
- **Author:** Microsoft (Rocketbox)
- **Link:** <https://github.com/microsoft/Microsoft-Rocketbox>
- **Licence:** MIT (`LICENSE.md` in the repository):
- "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software … The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."
- The README: "The library of avatars is now released under MIT License."
- **Attribution:** include the MIT notice in the app's licences.
- **Format:** FBX (3ds Max export) with TGA colour, normal, specular and opacity maps. Converts to glTF with Blender or FBX2glTF.
- **Rig:** a 3ds Max Biped humanoid; 80 skin clusters.
- **Triangles:** 9,208 (her) and 6,732 (him), measured from the FBX files.
- **Why it fits:**
- Realistic, decent East Asian adults with a full rig and 417 MIT animations in the same repository.
- They're dressed in street clothes and are less smooth and pretty than the sculpt references; the repository is archived.
## 6. suzuart — Rigged Anime Japanese High School Girl and Boy
- **Preview:** `build/model-candidates/sketchfab/Rigged-Anime-Japanese-High-School-Girl.jpg` and `-Boy.jpg`
- **Author:** suzuart (Sketchfab)
- **Link:**
- Girl: <https://sketchfab.com/3d-models/rigged-anime-japanese-high-school-girl-ad7efa7afb594bffa4cd9733562ef4dc>
- Boy: <https://sketchfab.com/3d-models/rigged-anime-japanese-high-school-boy-845df0101cd5429e86b190be757d1365>
- **Licence:** CC BY 4.0. The CC deed says:
- "Share — copy and redistribute the material in any medium or format for any purpose, even commercially."
- "Adapt — remix, transform, and build upon the material for any purpose, even commercially."
- "Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made."
- **Attribution:** required: "suzuart", the model link and a CC BY 4.0 link, in the app's credits.
- **Format:** GLB / glTF 2.0 with 2048 px textures. Downloading needs a Sketchfab login.
- **Rig:** full rig, exported "Deform Bones Only"; the boy has an animation.
- **Triangles:** 55,517 (her, a little over the 50k aim) and 42,185 (him), from Sketchfab.
- **Why it fits:**
- A clean, original anime pair with Japanese features and black hair, already in glTF.
- They wear school uniforms and need practice clothes.
## 7. Sketchfab — Animated Tai Chi Character and Shaolin Kung Fu
- **Preview:** `build/model-candidates/sketchfab/Animated-Tai-Chi-Character.jpg` and `Shaolin-Kung-Fu.jpg`
- **Authors:** LasquetiSpice (the woman) and NORBERTO-3D (the man)
- **Link:**
- Woman: <https://sketchfab.com/3d-models/animated-tai-chi-character-77af3e36cf384e5c8f7d9cf7dc140a24>
- Man: <https://sketchfab.com/3d-models/shaolin-kung-fu-07dfbd9317794d9d97a626e66810c607>
- **Licence:** CC BY 4.0 (clauses as in 6).
- **Attribution:** required for each author, as in 6.
- **Format:** glTF via Sketchfab download (login needed).
- **Rig:** rigged and animated. Her animation is a real 25-second Tai Chi "Repulse the Monkey"; he is a Shaolin monk with a kung fu animation.
- **Triangles:** 12,805 (her) and 17,288 (him), from Sketchfab.
- **Why it fits:**
- Real Tai Chi and kung fu motion on mobile-sized bodies.
- Plainer looking than 1–6, so more useful as motion than as the final characters.
## Motion sources usable commercially
- **CMU Graphics Lab Motion Capture Database** (<http://mocap.cs.cmu.edu/>):
- Licence: "This dataset of motions is free for all uses. … You may include this data in commercially-sold products, but you may not resell this data directly, even in converted form."
- It has Tai Chi (subject 12, trial 4), yoga (subjects 111 and 113), stretches (subject 42 and others), squats and push-ups.
- **Mixamo** (Adobe):
- Adobe's FAQ (it refuses automated reading; quoted from search results of the page): "You can use both characters and animations royalty free for personal, commercial, and non-profit projects including: … Create video games."
- Adobe's community FAQ forbids "Any type of free distribution of character or animation raw files" and use for training machine-learning models.
- Needs an Adobe ID to download. Its characters are generic and none fits as well as 1–6, but its animation library is a good motion source.
- **Quaternius Universal Animation Library:** CC0, made for candidate 1's rig.
- **Candidate 7's own Tai Chi and kung fu animations:** CC BY 4.0.
## Excluded
- **MakeHuman and anything built on it** (MPFB, Anny, MB-Lab, CharMorph): the owner rejected it.
- **Open Source Avatars / 100Avatars** (Polygonal Mind, CC0 VRM): checked all 300 avatars in `build/model-candidates/100avatars/`. They're cartoon and novelty characters; none is a pretty young woman.
- **Poly Pizza** (Quaternius's CC0 low-poly women, e.g. "Animated Woman"): CC0 but low-poly and generic. Candidate 1 is the same author's much better pack.
- **Blender Studio Human Base Meshes** (CC0): no rig and no textures.
- **Fan art of other people's characters on Sketchfab** (Kung Fu Panda, NIKKE, Watamote and others): CC BY labels don't clear the original rights.
- **Models made with Daz or Character Creator** (e.g. "Alina Ip"): their makers' licences don't allow this redistribution; also 137k triangles.
- **Daz, MetaHuman and the Unity Asset Store:** engine-locked or restricted.
- **Anything without a clear licence, non-commercial or editorial licences, and game rips** (such as the Character-14 archive).
File diff suppressed because it is too large. Load diff