Give astral figures anatomical skinning and watercolor surfaces
This commit is contained in:
1 parent
09e5e7e76d
commit
ee23f04dce
24 files changed
+971
-186
No files matched your search
@@ -23,11 +23,19 @@ 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.
|
||||
The characters are independently sculpted reclining humans, with closed eyes,
|
||||
individual fingers/toes, arm/elbow/palm pivots and sleep trousers. They share
|
||||
no rig, poses, artwork or geometry with the Tai Chi teachers or promo puppets.
|
||||
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 dim bedroom contains a bed, pillow, window, curtains and a warm bedside
|
||||
lamp. All geometry and effects are procedural; no generated bitmap is needed.
|
||||
lamp. Room geometry and energy effects are procedural; the human mesh and
|
||||
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
|
||||
@@ -36,26 +44,30 @@ shows an exterior awareness point (not an exit); Rope shows reaching/climbing;
|
||||
Roll-Out shows left/right whole-body turns. Physical muscles stay still.
|
||||
Return/recall cues stop the technique. These are guided-imagery illustrations.
|
||||
|
||||
The astral studies now use dedicated `src/surfaces.js` GLSL materials: warm
|
||||
wrapped skin lighting with a red backscatter approximation, cool moon rim,
|
||||
small specular highlights and procedural skin variation; the double has
|
||||
three-scale flowing noise, luminous contour bands, Fresnel transparency and
|
||||
an inner travelling pulse. A separate translucent energy field follows the
|
||||
technique: a localized touch sphere, longitudinal current, ascending elevator
|
||||
bands, orbital spin and a shell around the separating/returning double.
|
||||
Ribbons have a luminous core, soft halo, helical detail and travelling packets.
|
||||
The bedroom uses feathered moonlight shafts, drifting dust, woven linen and a
|
||||
soft floor pool. These are inexpensive scattering approximations, not ray-marched
|
||||
volumes. `src/finish.js` adds technique-specific colour separation, tint,
|
||||
vignette and deterministic grain; bloom strength is also tuned per exercise.
|
||||
Cameras, cue times, captions and the underlying technique poses are preserved.
|
||||
The entire scene now follows one watercolor direction. `src/surfaces.js`
|
||||
combines soft shading bands, pigment pooling at edges, paper granulation,
|
||||
backscatter-style warmth and painted fabric on the sleeper. The translucent
|
||||
double uses a luminous wash, flowing noise, contour bands and a soft rim.
|
||||
The bedroom samples actual paper, linen, plaster and wood textures with
|
||||
pigment modulation and soft shade bands. Six generated 256px WebP textures
|
||||
add approximately 81 KB, with no remote texture fetches.
|
||||
|
||||
`src/finish.js` uses a bounded four-quadrant minimum-variance brush filter,
|
||||
subpixel wet-edge disturbance, broken pencil contours and a textured paper
|
||||
finish. The effects pass covers the room, figures, cord, rays and energy, so
|
||||
they share the painted treatment. The translucent fields still distinguish
|
||||
local touch, longitudinal current, ascending elevator bands, orbital spin
|
||||
and the separating/returning double. Cameras, cue seconds and captions remain
|
||||
fixed for comparison against the original before frames. Bloom is restrained
|
||||
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. Static sculpted pieces are merged per material while preserving
|
||||
the arm pivots. No shadow maps or external textures are added. Real phone GPU
|
||||
performance still needs device review.
|
||||
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
|
||||
still needs device review.
|
||||
|
||||
Local test (owns a private Xvfb and headless Chromium; never the desktop):
|
||||
|
||||
@@ -67,7 +79,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. No audio plays.
|
||||
shader compilation, anatomical mesh/rig presence, real finger deformation 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:
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,41 @@
|
||||
# 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.
|
||||
|
||||
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,
|
||||
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.
|
||||
|
||||
Generation prompt (built-in tool, no CLI fallback):
|
||||
|
||||
> Use case: stylized-concept. Asset type: texture atlas for a watercolor three.js bedroom scene. Create one 1536 by 1024 landscape image with exactly 3 columns and 2 rows of square material swatches, edge to edge, no gutters, no borders, no labels or letters. Each of the six cells should be a flat, evenly lit, top-down texture with no perspective and no objects: top left warm ivory cold-pressed watercolor paper with fine visible fibers; top middle softly mottled indigo and muted teal watercolor pigment blooms on paper, granulation and wet edges; top right pale blue-gray woven linen bedding with small threads and soft natural folds; bottom left dusty blue plaster painted with cloudy watercolor wash; bottom middle weathered dark walnut wood grain painted in watercolor with restrained warm violet brown tones; bottom right soft luminous pale teal watercolor wash fading into ivory, fine salt granulation, no objects. Tactile hand-painted watercolor, atmospheric, delicate pigment variation, real photographed paper fiber microtexture, enough broad smooth variation for a quiet room. All six swatches must be useful as material maps, not a scene or illustration. No watermark, no signatures, no text.
|
||||
Binary file not shown.
@@ -0,0 +1,431 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -1,124 +1,68 @@
|
||||
import * as T from 'three'
|
||||
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js'
|
||||
|
||||
const sphere = new T.SphereGeometry(1, 22, 16)
|
||||
const bone = new T.CylinderGeometry(1, 1, 1, 12)
|
||||
const up = new T.Vector3(0, 1, 0)
|
||||
// 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()
|
||||
|
||||
// Independent reclining character. No Tai Chi rig, teacher art or martial pose.
|
||||
// Static sculpted pieces are merged; shoulders, elbows and palms stay articulated.
|
||||
export function createFigure(material, { astral = false } = {}) {
|
||||
const root = new T.Group()
|
||||
const flesh = new T.Group()
|
||||
root.add(flesh)
|
||||
const details = new T.MeshStandardMaterial({ color: astral ? '#8ce4ff' : '#302b35', roughness: 0.8 })
|
||||
const cloth = new T.MeshStandardMaterial({ color: '#596279', roughness: 0.95 })
|
||||
function part(position, scale, surface = material, parent = flesh) {
|
||||
const mesh = new T.Mesh(sphere, surface)
|
||||
mesh.position.set(...position)
|
||||
mesh.scale.set(...scale)
|
||||
parent.add(mesh)
|
||||
return mesh
|
||||
}
|
||||
const profile = [[0.18, -0.15], [0.25, -0.05], [0.23, 0.10], [0.19, 0.27], [0.22, 0.42], [0.29, 0.62], [0.31, 0.75], [0.25, 0.87], [0.12, 0.92]]
|
||||
const torso = new T.Mesh(new T.LatheGeometry(profile.map(([x, y]) => new T.Vector2(x, y)), 32), material)
|
||||
torso.scale.z = 0.65
|
||||
flesh.add(torso)
|
||||
part([0, 0.98, 0], [0.085, 0.14, 0.09])
|
||||
part([0, 1.23, 0], [0.175, 0.235, 0.165])
|
||||
part([0, 1.12, 0.04], [0.13, 0.12, 0.13])
|
||||
part([0, 1.22, 0.155], [0.033, 0.066, 0.045])
|
||||
part([0, 1.105, 0.157], [0.045, 0.009, 0.009], details)
|
||||
for (const side of [-1, 1]) {
|
||||
part([side * 0.174, 1.22, 0], [0.025, 0.063, 0.037])
|
||||
part([side * 0.071, 1.27, 0.147], [0.045, 0.008, 0.014], details)
|
||||
part([side * 0.075, 1.31, 0.139], [0.05, 0.009, 0.014], details)
|
||||
part([side * 0.13, 0.80, 0.12], [0.14, 0.025, 0.035])
|
||||
part([side * 0.125, 0.63, 0.08], [0.13, 0.15, 0.075])
|
||||
}
|
||||
const hair = part([0, 1.335, -0.03], [0.179, 0.145, 0.151], details)
|
||||
hair.rotation.x = -0.23
|
||||
const arms = []
|
||||
const elbows = []
|
||||
const hands = []
|
||||
const grips = []
|
||||
function limb(a, b, radiusX, radiusZ, surface = material, parent = flesh) {
|
||||
const start = new T.Vector3(...a)
|
||||
const end = new T.Vector3(...b)
|
||||
const mesh = new T.Mesh(bone, surface)
|
||||
mesh.position.copy(start).add(end).multiplyScalar(0.5)
|
||||
mesh.quaternion.setFromUnitVectors(up, end.clone().sub(start).normalize())
|
||||
mesh.scale.set(radiusX, start.distanceTo(end), radiusZ)
|
||||
parent.add(mesh)
|
||||
}
|
||||
for (const side of [-1, 1]) {
|
||||
const pants = astral ? material : cloth
|
||||
part([side * 0.15, -0.17, 0], [0.14, 0.20, 0.14], pants)
|
||||
limb([side * 0.15, -0.12, 0], [side * 0.15, -0.65, 0], 0.12, 0.115, pants)
|
||||
part([side * 0.15, -0.64, 0.015], [0.10, 0.11, 0.105], pants)
|
||||
limb([side * 0.15, -0.65, 0], [side * 0.15, -1.14, 0], 0.076, 0.08, pants)
|
||||
part([side * 0.15, -1.12, 0.095], [0.085, 0.08, 0.17])
|
||||
for (let toe = 0; toe < 5; toe += 1) {
|
||||
part([side * (0.095 + toe * 0.028), -1.14, 0.235 - toe * 0.008], [0.022, 0.028, 0.04])
|
||||
}
|
||||
const arm = new T.Group()
|
||||
arm.position.set(side * 0.30, 0.78, 0)
|
||||
flesh.add(arm)
|
||||
part([0, 0, 0], [0.095, 0.12, 0.10], material, arm)
|
||||
limb([0, -0.04, 0], [side * 0.055, -0.36, 0], 0.073, 0.075, material, arm)
|
||||
part([side * 0.055, -0.36, 0], [0.064, 0.07, 0.066], material, arm)
|
||||
const elbow = new T.Group()
|
||||
elbow.position.set(side * 0.055, -0.36, 0)
|
||||
arm.add(elbow)
|
||||
limb([0, 0, 0], [side * 0.025, -0.30, 0.02], 0.051, 0.055, material, elbow)
|
||||
const hand = new T.Group()
|
||||
hand.position.set(side * 0.025, -0.32, 0.02)
|
||||
elbow.add(hand)
|
||||
part([0, -0.045, 0], [0.069, 0.09, 0.027], material, hand)
|
||||
const open = new T.Group()
|
||||
const closed = new T.Group()
|
||||
hand.add(open, closed)
|
||||
closed.visible = false
|
||||
for (let digit = 0; digit < 4; digit += 1) {
|
||||
const x = -0.045 + digit * 0.03
|
||||
const finger = part([x, -0.143, 0], [0.014, 0.054 - Math.abs(digit - 1.3) * 0.007, 0.014], material, open)
|
||||
finger.rotation.z = (digit - 1.5) * 0.065
|
||||
part([x, -0.112, 0.025], [0.016, 0.032, 0.021], material, closed)
|
||||
part([x, -0.122, 0.055], [0.016, 0.018, 0.030], material, closed)
|
||||
}
|
||||
const thumb = part([side * 0.068, -0.035, 0.006], [0.02, 0.065, 0.02], material, hand)
|
||||
thumb.rotation.z = side * 0.55
|
||||
arms.push(arm)
|
||||
elbows.push(elbow)
|
||||
hands.push(hand)
|
||||
grips.push({ open, closed })
|
||||
}
|
||||
if (!astral) part([0, -0.12, 0], [0.275, 0.22, 0.16], cloth)
|
||||
function mergePieces(group) {
|
||||
const batches = new Map()
|
||||
group.updateMatrixWorld(true)
|
||||
const inverse = group.matrixWorld.clone().invert()
|
||||
for (const child of [...group.children]) {
|
||||
if (!child.isMesh || child === torso) continue
|
||||
const geometry = child.geometry.clone().applyMatrix4(inverse.clone().multiply(child.matrixWorld))
|
||||
if (!batches.has(child.material)) batches.set(child.material, [])
|
||||
batches.get(child.material).push(geometry)
|
||||
child.removeFromParent()
|
||||
}
|
||||
for (const [surface, geometries] of batches) {
|
||||
group.add(new T.Mesh(mergeGeometries(geometries, false), surface))
|
||||
geometries.forEach(geometry => geometry.dispose())
|
||||
}
|
||||
}
|
||||
grips.forEach(({ open, closed }) => {
|
||||
mergePieces(open)
|
||||
mergePieces(closed)
|
||||
const bones = human.bones.map(info => {
|
||||
const bone = new T.Bone()
|
||||
bone.name = info.name
|
||||
bone.position.fromArray(info.position)
|
||||
return bone
|
||||
})
|
||||
hands.forEach(mergePieces)
|
||||
elbows.forEach(mergePieces)
|
||||
arms.forEach(mergePieces)
|
||||
mergePieces(flesh)
|
||||
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)
|
||||
// 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 grips = armsData.map(() => ({ open: { visible: true }, closed: { visible: false } }))
|
||||
root.rotation.x = -Math.PI / 2
|
||||
root.position.y = 0.53
|
||||
return { root, arms, elbows, hands, grips, breathe(t) { torso.scale.z = 0.65 + 0.012 * Math.sin(t * Math.PI / 3) } }
|
||||
root.position.y = 0.64
|
||||
return {
|
||||
root, arms, elbows, hands, grips,
|
||||
breathe(t) {
|
||||
material.uniforms.time.value = t
|
||||
},
|
||||
articulate() {
|
||||
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)
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
touchPoint() {
|
||||
return bones[armsData[1].fingers[0][1]].getWorldPosition(new T.Vector3())
|
||||
},
|
||||
fingerCurl() {
|
||||
return armsData.map(info => bones[info.fingers[2][0]].rotation.x)
|
||||
},
|
||||
meshInfo: { vertices: human.vertices, bones: bones.length, source: 'MakeHuman hm08 CC0', astral },
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,66 @@
|
||||
import * as T from 'three'
|
||||
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'
|
||||
import { textures } from './textures.js'
|
||||
|
||||
// One full-screen pass. Small radial colour separation stays outside the focus;
|
||||
// grain is deterministic at a session second, so pause and scrubbing are stable.
|
||||
// A bounded four-quadrant brush filter selects the quietest local pigment
|
||||
// wash. Sixteen colour taps plus four outline taps; no iterative blur chain.
|
||||
export function createFinish() {
|
||||
return new ShaderPass({
|
||||
uniforms: {
|
||||
tDiffuse: { value: null }, time: { value: 0 },
|
||||
tDiffuse: { value: null },
|
||||
paper: { value: textures.paper }, wash: { value: textures.pigment },
|
||||
resolution: { value: new T.Vector2(1280, 720) },
|
||||
tint: { value: new T.Color('#9ed5ff') }, strength: { value: 0.5 },
|
||||
},
|
||||
vertexShader: `varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}`,
|
||||
fragmentShader: /* glsl */ `
|
||||
uniform sampler2D tDiffuse;
|
||||
uniform float time, strength;
|
||||
uniform sampler2D tDiffuse, paper, wash;
|
||||
uniform float strength;
|
||||
uniform vec2 resolution;
|
||||
uniform vec3 tint;
|
||||
varying vec2 vUv;
|
||||
vec3 brush(vec2 direction, vec2 texel, out float variance) {
|
||||
vec3 a=texture2D(tDiffuse,vUv).rgb;
|
||||
vec3 b=texture2D(tDiffuse,vUv+direction*vec2(2.0,0.0)*texel).rgb;
|
||||
vec3 c=texture2D(tDiffuse,vUv+direction*vec2(0.0,2.0)*texel).rgb;
|
||||
vec3 d=texture2D(tDiffuse,vUv+direction*2.0*texel).rgb;
|
||||
vec3 mean=(a+b+c+d)*0.25;
|
||||
vec3 square=(a*a+b*b+c*c+d*d)*0.25-mean*mean;
|
||||
variance=dot(abs(square),vec3(1.0));
|
||||
return mean;
|
||||
}
|
||||
void main() {
|
||||
vec2 texel=1.0/resolution;
|
||||
vec2 paperUV=gl_FragCoord.xy/256.0;
|
||||
float tooth=texture2D(paper,paperUV).r;
|
||||
vec3 pigment=texture2D(wash,vUv*vec2(1.7,1.0)).rgb;
|
||||
// Paper fibres disturb wet edges by less than a display pixel.
|
||||
vec2 bleed=(pigment.rg-0.35)*texel*1.1;
|
||||
vec3 original=texture2D(tDiffuse,vUv+bleed).rgb;
|
||||
float bestVariance=100.0;
|
||||
vec3 painted=original;
|
||||
for(int y=0;y<2;y++) {
|
||||
for(int x=0;x<2;x++) {
|
||||
vec2 direction=vec2(float(x)*2.0-1.0,float(y)*2.0-1.0);
|
||||
float variance;
|
||||
vec3 candidate=brush(direction,texel,variance);
|
||||
if(variance<bestVariance){bestVariance=variance;painted=candidate;}
|
||||
}
|
||||
}
|
||||
vec3 c=mix(original,painted,0.78);
|
||||
vec3 dx=texture2D(tDiffuse,vUv+vec2(texel.x,0.0)).rgb-texture2D(tDiffuse,vUv-vec2(texel.x,0.0)).rgb;
|
||||
vec3 dy=texture2D(tDiffuse,vUv+vec2(0.0,texel.y)).rgb-texture2D(tDiffuse,vUv-vec2(0.0,texel.y)).rgb;
|
||||
float edge=smoothstep(0.055,0.38,length(dx)+length(dy));
|
||||
float luminous=smoothstep(0.65,1.1,max(c.r,max(c.g,c.b)));
|
||||
// Broken pencil lines and wet pigment rims, never black neon.
|
||||
c=mix(c,c*vec3(0.30,0.36,0.48),edge*(0.40+tooth*0.3)*(1.0-luminous*0.8));
|
||||
c*=0.85+tooth*0.24;
|
||||
c=mix(c,c*vec3(0.80,0.94,1.10),0.26);
|
||||
c*=vec3(0.96)+tint*(0.04+strength*0.025);
|
||||
c+=pigment*0.045*(1.0-luminous);
|
||||
c+=vec3(0.88,0.83,0.73)*pow(tooth,3.0)*0.035;
|
||||
vec2 q=vUv-0.5;
|
||||
float radius=dot(q,q);
|
||||
vec2 shift=q*radius*0.008*strength;
|
||||
vec3 c=texture2D(tDiffuse,vUv).rgb;
|
||||
c.r=texture2D(tDiffuse,vUv+shift).r;
|
||||
c.b=texture2D(tDiffuse,vUv-shift).b;
|
||||
c=mix(c,c*vec3(0.84,0.94,1.12),0.26);
|
||||
c+=tint*max(vec3(0.0),vec3(0.12)-c)*0.12;
|
||||
c*=1.0-smoothstep(0.06,0.48,radius)*0.43;
|
||||
float grain=fract(sin(dot(vUv*vec2(1453.0,997.0)+floor(time*24.0),vec2(12.9898,78.233)))*43758.5453)-0.5;
|
||||
c+=grain*0.014;
|
||||
c*=1.0-smoothstep(0.14,0.50,dot(q,q))*0.25;
|
||||
gl_FragColor=vec4(c,1.0);
|
||||
}`,
|
||||
})
|
||||
|
||||
@@ -71,8 +71,7 @@ function draw() {
|
||||
state = view.update(time, { directed: document.querySelector('#camera').value === 'directed' })
|
||||
renderPass.scene = view.scene
|
||||
renderPass.camera = view.camera
|
||||
bloom.strength = [0.45, 0.67, 0.62, 0.60, 0.76, 0.68][selected]
|
||||
finish.uniforms.time.value = time
|
||||
bloom.strength = [0.30, 0.42, 0.40, 0.40, 0.44, 0.42][selected]
|
||||
finish.uniforms.tint.value.set(colors[selected])
|
||||
finish.uniforms.strength.value = [0.22, 0.5, 0.7, 1.0, 0.65, 0.75][selected]
|
||||
renderer.info.reset()
|
||||
@@ -142,6 +141,7 @@ function resize() {
|
||||
const height = Math.round(width * canvas.clientHeight / canvas.clientWidth)
|
||||
renderer.setSize(width, height, false)
|
||||
composer.setSize(width, height)
|
||||
finish.uniforms.resolution.value.set(width, height)
|
||||
scenes.forEach(view => {
|
||||
view.camera.aspect = width / height
|
||||
view.camera.updateProjectionMatrix()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as T from 'three'
|
||||
import { paintedMaterial } from './textures.js'
|
||||
|
||||
const colors = ['#75d9e4', '#8eafff', '#b397f0', '#78d9cf', '#dfbd83', '#c0a4fa']
|
||||
export const palette = index => new T.Color(colors[index])
|
||||
@@ -15,17 +16,9 @@ export function createRoom(scene, index) {
|
||||
const lampLight = new T.PointLight('#ffd2a0', 17, 9, 2)
|
||||
lampLight.position.set(1.35, 1.25, -1.30)
|
||||
scene.add(lampLight)
|
||||
const wood = new T.MeshStandardMaterial({ color: '#433743', roughness: 0.77 })
|
||||
const wall = new T.MeshStandardMaterial({ color: '#253047', roughness: 1 })
|
||||
const linen = new T.MeshStandardMaterial({ color: '#77869e', roughness: 1 })
|
||||
linen.onBeforeCompile = shader => {
|
||||
shader.vertexShader = 'varying vec3 fabricPosition;\n' + shader.vertexShader.replace('#include <begin_vertex>', '#include <begin_vertex>\nfabricPosition = position;')
|
||||
shader.fragmentShader = 'varying vec3 fabricPosition;\n' + shader.fragmentShader.replace('#include <color_fragment>', `#include <color_fragment>
|
||||
float weave=sin(fabricPosition.x*600.0)*sin(fabricPosition.z*600.0);
|
||||
float folds=sin(fabricPosition.z*14.0+sin(fabricPosition.x*9.0))*0.08;
|
||||
diffuseColor.rgb*=0.93+weave*0.025+folds;
|
||||
`)
|
||||
}
|
||||
const wood = paintedMaterial({ color: '#62546c', texture: 'wood' })
|
||||
const wall = paintedMaterial({ color: '#71829b', texture: 'plaster' })
|
||||
const linen = paintedMaterial({ color: '#c7cfdf', texture: 'linen' })
|
||||
function box(size, position, material) {
|
||||
const mesh = new T.Mesh(new T.BoxGeometry(...size), material)
|
||||
mesh.position.set(...position)
|
||||
@@ -35,7 +28,7 @@ export function createRoom(scene, index) {
|
||||
box([15, 0.12, 15], [0, -0.15, 0], wood)
|
||||
box([10, 6, 0.16], [0, 2.85, -4.2], wall)
|
||||
box([0.16, 6, 9], [-4.2, 2.85, -0.1], wall)
|
||||
const rug = box([3.8, 0.025, 4.7], [0, -0.07, 0], new T.MeshStandardMaterial({ color: '#303448', roughness: 1 }))
|
||||
const rug = box([3.8, 0.025, 4.7], [0, -0.07, 0], paintedMaterial({ color: '#59627a', texture: 'linen' }))
|
||||
for (const x of [-1.75, 1.75]) box([0.018, 0.004, 4.3], [x, rug.position.y + 0.015, 0], linen)
|
||||
box([1.30, 0.18, 3.45], [0, 0.19, 0], wood)
|
||||
box([1.18, 0.14, 3.28], [0, 0.35, 0], linen)
|
||||
@@ -45,11 +38,11 @@ export function createRoom(scene, index) {
|
||||
pillow.position.set(0, 0.44, -1.25)
|
||||
scene.add(pillow)
|
||||
for (const x of [-0.50, 0.50]) {
|
||||
box([0.028, 0.01, 3.08], [x, 0.426, 0], new T.MeshStandardMaterial({ color: '#6d7188', roughness: 1 }))
|
||||
box([0.028, 0.01, 3.08], [x, 0.426, 0], paintedMaterial({ color: '#8c9bae', texture: 'linen' }))
|
||||
}
|
||||
box([0.62, 0.12, 0.62], [1.38, 0.70, -1.30], wood)
|
||||
for (const x of [1.15, 1.61]) box([0.07, 0.64, 0.07], [x, 0.32, -1.30], wood)
|
||||
const lamp = new T.Mesh(new T.ConeGeometry(0.21, 0.29, 24, 1, true), new T.MeshStandardMaterial({ color: '#eac4a0', emissive: '#d5985d', emissiveIntensity: 0.35, side: T.DoubleSide }))
|
||||
const lamp = new T.Mesh(new T.ConeGeometry(0.21, 0.29, 24, 1, true), paintedMaterial({ texture: 'paper', color: '#eac4a0', emissive: '#d5985d', emissiveIntensity: 0.35, side: T.DoubleSide }))
|
||||
lamp.position.set(1.38, 1.22, -1.30)
|
||||
scene.add(lamp)
|
||||
box([0.025, 0.38, 0.025], [1.38, 0.91, -1.30], wood)
|
||||
@@ -65,7 +58,7 @@ export function createRoom(scene, index) {
|
||||
box([0.045, 2.85, 0.07], [-0.5, 2.65, -4.0], wood)
|
||||
for (const side of [-1, 1]) {
|
||||
for (let fold = 0; fold < 5; fold += 1) {
|
||||
box([0.09, 3.25, 0.06], [-0.5 + side * (1.96 + fold * 0.08), 2.48, -3.90 + Math.sin(fold * 2) * 0.05], new T.MeshStandardMaterial({ color: '#404b68', roughness: 1 }))
|
||||
box([0.09, 3.25, 0.06], [-0.5 + side * (1.96 + fold * 0.08), 2.48, -3.90 + Math.sin(fold * 2) * 0.05], paintedMaterial({ color: '#7788a6', texture: 'linen' }))
|
||||
}
|
||||
}
|
||||
// A few drifting motes, one draw call and no CPU particle simulation.
|
||||
|
||||
@@ -9,7 +9,7 @@ const smooth = x => T.MathUtils.smoothstep(x, 0, 1)
|
||||
const cycle = (t, period) => (t % period) / period
|
||||
const wave = (t, period = 6) => 0.5 - 0.5 * Math.cos(t * Math.PI * 2 / period)
|
||||
const types = ['foundation', 'current', 'elevator', 'spin', 'rope', 'roll']
|
||||
const bodyHeight = 0.62
|
||||
const bodyHeight = 0.86
|
||||
|
||||
function cameraFrame(kind, index) {
|
||||
if (kind === 'foundation' && index >= 1 && index <= 4) return { position: [1.05, 1.42, 1.0], target: [0.35, 0.57, -0.07], name: 'HAND STUDY' }
|
||||
@@ -120,6 +120,7 @@ export function createExercise(item, exerciseIndex = 0) {
|
||||
field.scale.set(1.9, 2.6, 1.9)
|
||||
}
|
||||
physical.breathe(t)
|
||||
const thumb = physical.touchPoint()
|
||||
physicalMaterial.uniforms.time.value = t
|
||||
energyMaterial.uniforms.time.value = t
|
||||
energyMaterial.uniforms.opacity.value = grounded ? 0 : 0.6
|
||||
@@ -182,14 +183,14 @@ export function createExercise(item, exerciseIndex = 0) {
|
||||
const angle = t * Math.PI * 2 * 1.2
|
||||
const path = (v, p) => {
|
||||
const a = angle - v * Math.PI * 1.6
|
||||
p.set(0.438 + Math.cos(a) * 0.025, bodyHeight + 0.025, -0.065 + Math.sin(a) * 0.025)
|
||||
p.set(thumb.x + Math.cos(a) * 0.025, thumb.y + 0.012, thumb.z + Math.sin(a) * 0.025)
|
||||
}
|
||||
path(0, point.position)
|
||||
trail.mesh.visible = true
|
||||
trail.update(path, t)
|
||||
motion = i === 1 ? 'Touch the thumb joint. Follow the remembered sensation.' : 'Small clockwise circles · awareness alone'
|
||||
} else if (i === 4) {
|
||||
point.position.set(0.438, bodyHeight + 0.025, -0.18 + wave(t, 3) * 0.3)
|
||||
point.position.set(thumb.x, thumb.y + 0.012, thumb.z - 0.12 + wave(t, 3) * 0.24)
|
||||
limbStroke(0, 1, true, true)
|
||||
motion = 'Brush the thumb, then widen toward the wrist.'
|
||||
} else {
|
||||
@@ -337,6 +338,7 @@ export function createExercise(item, exerciseIndex = 0) {
|
||||
field.position.y += 0.12
|
||||
field.visible = energy.root.visible
|
||||
}
|
||||
energy.articulate()
|
||||
const now = cameraFrame(kind, i)
|
||||
const before = cameraFrame(kind, Math.max(0, i - 1))
|
||||
const transition = smooth(elapsed / 7)
|
||||
@@ -363,6 +365,9 @@ export function createExercise(item, exerciseIndex = 0) {
|
||||
astralRotation: energy.root.rotation.toArray().slice(0, 3), cordVisible: cord.mesh.visible,
|
||||
pointVisible: point.visible, ropeVisible: rope.visible, elevatorVisible: elevator.visible, viewName,
|
||||
handGrips: energy.grips.map(grip => grip.closed.visible),
|
||||
human: physical.meshInfo,
|
||||
touchPosition: physical.touchPoint().toArray(), pointPosition: point.position.toArray(),
|
||||
fingerCurl: energy.fingerCurl(),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as T from 'three'
|
||||
import { textures } from './textures.js'
|
||||
|
||||
// Bounded, texture-free value noise shared by the skin and spirit surfaces.
|
||||
export const flowNoise = /* glsl */ `
|
||||
@@ -23,26 +24,40 @@ float flow(vec3 p) {
|
||||
export function studyBodyMaterial({ astral = false, accent } = {}) {
|
||||
return new T.ShaderMaterial({
|
||||
uniforms: {
|
||||
paper: { value: textures.paper }, pigment: { value: textures.pigment }, linen: { value: textures.linen },
|
||||
luminousWash: { value: textures['luminous-wash'] },
|
||||
accent: { value: accent }, time: { value: 0 }, opacity: { value: 1 },
|
||||
},
|
||||
defines: astral ? { SPIRIT: 1 } : {},
|
||||
vertexShader: /* glsl */ `
|
||||
varying vec3 normalView, eyeView, local, world;
|
||||
#include <common>
|
||||
#include <skinning_pars_vertex>
|
||||
attribute vec3 bodyCoordinate;
|
||||
varying vec3 normalView, eyeView, anatomy, world;
|
||||
void main() {
|
||||
vec4 p = modelViewMatrix * vec4(position, 1.0);
|
||||
normalView = normalMatrix * normal;
|
||||
#include <beginnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <begin_vertex>
|
||||
#include <skinning_vertex>
|
||||
vec4 p = modelViewMatrix * vec4(transformed, 1.0);
|
||||
normalView = normalMatrix * objectNormal;
|
||||
eyeView = -p.xyz;
|
||||
local = position;
|
||||
world = (modelMatrix * vec4(position, 1.0)).xyz;
|
||||
anatomy = bodyCoordinate;
|
||||
world = (modelMatrix * vec4(transformed, 1.0)).xyz;
|
||||
gl_Position = projectionMatrix * p;
|
||||
}`,
|
||||
fragmentShader: /* glsl */ `
|
||||
uniform vec3 accent;
|
||||
uniform sampler2D paper, pigment, linen, luminousWash;
|
||||
uniform float time, opacity;
|
||||
varying vec3 normalView, eyeView, local, world;
|
||||
varying vec3 normalView, eyeView, anatomy, world;
|
||||
${flowNoise}
|
||||
void main() {
|
||||
vec3 n = normalize(normalView), eye = normalize(eyeView);
|
||||
float paperGrain = texture2D(paper, gl_FragCoord.xy/256.0).r;
|
||||
vec3 wash = texture2D(pigment, anatomy.xy*0.55).rgb;
|
||||
float pigmentDensity = dot(wash,vec3(0.33));
|
||||
float facing = abs(dot(n, eye));
|
||||
float rim = pow(1.0-facing, 2.3);
|
||||
#ifdef SPIRIT
|
||||
@@ -50,26 +65,43 @@ export function studyBodyMaterial({ astral = false, accent } = {}) {
|
||||
float mist = flow(p + flow(p*0.6)*2.0);
|
||||
float contours = pow(0.5+0.5*sin(mist*32.0+world.y*9.0-time*1.6), 14.0);
|
||||
float pulse = exp(-pow((fract(world.y*0.34-time*0.16)-0.5)*9.0, 2.0));
|
||||
vec3 core = mix(vec3(0.12,0.22,0.6), accent, mist);
|
||||
vec3 paintedGlow = texture2D(luminousWash,anatomy.xy*0.6+vec2(0.0,time*0.025)).rgb;
|
||||
vec3 core = mix(vec3(0.12,0.22,0.6), accent, mist)*mix(vec3(0.65),paintedGlow*1.4,0.5);
|
||||
vec3 c = core*(0.45+mist*0.8) + accent*rim*2.7;
|
||||
c += mix(accent,vec3(1.0,0.87,0.66),0.45)*contours*0.85;
|
||||
c += vec3(0.42,0.66,1.0)*pulse*0.5;
|
||||
gl_FragColor = vec4(c, opacity*(0.13+rim*0.6+mist*0.15+contours*0.16));
|
||||
c *= 0.75+paperGrain*0.4;
|
||||
c = mix(c,c*vec3(0.7,1.0,0.98),pigmentDensity*0.2);
|
||||
gl_FragColor = vec4(c, opacity*(0.19+rim*0.4+mist*0.15+contours*0.1));
|
||||
#else
|
||||
vec3 key = normalize(vec3(0.65,0.6,0.9));
|
||||
vec3 moon = normalize(vec3(-0.9,0.4,-0.2));
|
||||
float wrapped = max(0.0,(dot(n,key)+0.38)/1.38);
|
||||
wrapped = (floor(wrapped*3.0)+smoothstep(0.25,0.8,fract(wrapped*3.0)))/3.0;
|
||||
float scatter = pow(max(0.0,dot(-n,key)+0.45),2.0);
|
||||
float spec = pow(max(0.0,dot(n,normalize(key+eye))),42.0);
|
||||
float spec = pow(max(0.0,dot(n,normalize(key+eye))),18.0);
|
||||
float pores = noise(world*210.0);
|
||||
float skinVariation = flow(world*7.0);
|
||||
vec3 skin = mix(vec3(0.44,0.23,0.16),vec3(0.60,0.34,0.24),skinVariation);
|
||||
vec3 c = skin*(0.25+wrapped*1.25);
|
||||
float pants = step(anatomy.y,0.18)*step(-1.13,anatomy.y);
|
||||
float shirt = step(0.18,anatomy.y)*step(anatomy.y,0.88)*step(abs(anatomy.x),0.245);
|
||||
float cloth = max(pants,shirt);
|
||||
float hair = step(1.17,anatomy.y)*(1.0-smoothstep(-0.025,0.105,anatomy.z));
|
||||
hair = max(hair,step(1.39,anatomy.y));
|
||||
vec3 fabric = texture2D(linen,anatomy.xy*3.0).rgb;
|
||||
skin = mix(skin,vec3(0.22,0.32,0.48)*fabric*1.6,cloth);
|
||||
skin = mix(skin,vec3(0.075,0.06,0.09),hair);
|
||||
vec3 c = skin*(0.45+wrapped*1.05);
|
||||
c += vec3(0.42,0.08,0.035)*scatter;
|
||||
c += vec3(0.22,0.43,0.72)*pow(max(0.0,dot(n,moon)),1.5)*0.65;
|
||||
c += vec3(0.75,0.85,1.0)*rim*0.20;
|
||||
c += vec3(1.0,0.78,0.58)*spec*0.28;
|
||||
c *= 0.97+pores*0.03;
|
||||
c += vec3(1.0,0.78,0.58)*spec*0.08;
|
||||
float edge = pow(1.0-facing,3.0);
|
||||
c *= (0.82+paperGrain*0.28)*(0.90+pigmentDensity*0.24);
|
||||
// Pigment pools at the edge of each wash instead of plastic
|
||||
// highlights; cloth and skin retain the same paper tooth.
|
||||
c *= 1.0-edge*0.30;
|
||||
c = mix(c,c*vec3(0.8,0.9,1.1),edge*0.35);
|
||||
gl_FragColor = vec4(c,1.0);
|
||||
#endif
|
||||
#include <tonemapping_fragment>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import * as T from 'three'
|
||||
|
||||
const loader = new T.TextureLoader()
|
||||
const names = ['paper', 'pigment', 'linen', 'plaster', 'wood', 'luminous-wash']
|
||||
const maps = await Promise.all(names.map(async name => {
|
||||
const texture = await loader.loadAsync(new URL(`../assets/${name}.webp`, import.meta.url).href)
|
||||
texture.wrapS = texture.wrapT = T.RepeatWrapping
|
||||
texture.colorSpace = T.SRGBColorSpace
|
||||
texture.anisotropy = 2
|
||||
return texture
|
||||
}))
|
||||
export const textures = Object.fromEntries(names.map((name, index) => [name, maps[index]]))
|
||||
|
||||
// Room pigments use the same paper, wash and soft shade bands as the figures.
|
||||
export function paintedMaterial({ color, texture = 'plaster', roughness = 1, ...options }) {
|
||||
const material = new T.MeshStandardMaterial({ color, roughness, ...options })
|
||||
material.onBeforeCompile = shader => {
|
||||
shader.uniforms.paintPaper = { value: textures.paper }
|
||||
shader.uniforms.paintWash = { value: textures[texture] }
|
||||
shader.vertexShader = 'varying vec3 paintPosition; varying vec3 paintNormal;\n' + shader.vertexShader.replace('#include <begin_vertex>', `#include <begin_vertex>
|
||||
paintPosition = (modelMatrix * vec4(position,1.0)).xyz;
|
||||
paintNormal = normalize(mat3(modelMatrix)*normal);
|
||||
`)
|
||||
shader.fragmentShader = `uniform sampler2D paintPaper, paintWash; varying vec3 paintPosition, paintNormal;\n` + shader.fragmentShader.replace('#include <color_fragment>', `#include <color_fragment>
|
||||
vec3 direction=abs(paintNormal);
|
||||
vec2 coord=direction.y>0.5 ? paintPosition.xz : direction.x>0.5 ? paintPosition.zy : paintPosition.xy;
|
||||
vec3 wash=texture2D(paintWash,coord*0.38).rgb;
|
||||
float grain=texture2D(paintPaper,coord*1.8).r;
|
||||
diffuseColor.rgb*=mix(vec3(0.65),wash*1.5,0.65)*(0.86+grain*0.3);
|
||||
`).replace('#include <opaque_fragment>', `
|
||||
float lightness=dot(outgoingLight,vec3(0.299,0.587,0.114));
|
||||
float bands=(floor(lightness*5.0)+smoothstep(0.3,0.7,fract(lightness*5.0)))/5.0;
|
||||
outgoingLight*=mix(1.0,bands/max(0.025,lightness),0.55);
|
||||
#include <opaque_fragment>
|
||||
`)
|
||||
}
|
||||
material.customProgramCacheKey = () => `watercolor-${texture}`
|
||||
return material
|
||||
}
|
||||
@@ -26,7 +26,7 @@ for capture in json.loads((BASE / 'after/captures.json').read_text()):
|
||||
comparison.paste(after, (width, 58))
|
||||
draw = ImageDraw.Draw(comparison)
|
||||
draw.text((22, 16), 'BEFORE', font=font, fill='#b5c1d0')
|
||||
draw.text((width + 22, 16), 'AFTER · SHADER STUDY', font=font, fill='#a1ecdf')
|
||||
draw.text((width + 22, 16), 'AFTER · WATERCOLOR', font=font, fill='#a1ecdf')
|
||||
comparison.save(OUTPUT / name)
|
||||
# Same stage crop, excluding the unchanged player and narration. This
|
||||
# detects accidental capture of the old page, not subjective visual quality.
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#!/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,9 +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(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')
|
||||
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')
|
||||
@@ -148,7 +151,8 @@ try {
|
||||
await frame('showcase-spin-1012')
|
||||
assert((await pose(2, 912)).elevatorVisible)
|
||||
await frame('showcase-elevator-912')
|
||||
await pose(0, 169)
|
||||
const touch = await pose(0, 169)
|
||||
assert(Math.hypot(...touch.pointPosition.map((value, n) => value-touch.touchPosition[n])) < 0.05, 'Touch marker follows the anatomical thumb')
|
||||
await frame('showcase-foundation-hand-169')
|
||||
await pose(1, 912)
|
||||
await frame('showcase-current-912')
|
||||
|
||||
@@ -196,3 +196,57 @@ Private-display frames (local artifacts, not committed):
|
||||
`running: true`. The owner can page through all seven. No live desktop pixels
|
||||
were captured and no mouse input was used. Owner acceptance and real phone GPU
|
||||
frame rate remain unverified; the web preview is not installed in Breeze.
|
||||
|
||||
## Anatomical watercolor version — latest owner follow-up
|
||||
|
||||
The owner rejected the primitive body and requested watercolor shaders and real
|
||||
textures. The final version replaces the sphere/lathe figure entirely:
|
||||
|
||||
- Sleeper and double share the CC0 MakeHuman hm08 continuous anatomical mesh:
|
||||
13,380 vertices, 26,756 triangles, shaped face/neck/shoulders/torso/hips,
|
||||
actual hands/fingers/feet, reposed resting limbs and blue pigment sleep clothes.
|
||||
A 37-bone skin rig supports shoulder/elbow reaches, wrist movement and curls
|
||||
in individual finger segments. Rope gripping deforms the bound surface; it
|
||||
no longer switches between separate primitive hands. The original whole-body
|
||||
roll, lift, float and return timelines remain intact.
|
||||
- Source and licence: [MakeHuman base.obj](https://github.com/makehumancommunity/makehuman/blob/a8bc2d54ff0ac92e78ff71431b1023eda42bf482/makehuman/data/3dobjs/base.obj),
|
||||
explicitly CC0 in the source header. See the
|
||||
[asset licence](https://github.com/makehumancommunity/makehuman/blob/a8bc2d54ff0ac92e78ff71431b1023eda42bf482/LICENSE.md)
|
||||
and local `design/astral-projection/three/assets/MAKEHUMAN-CC0.txt`.
|
||||
The pinned source, unmodified compressed OBJ, derived binary and reproducible converter
|
||||
are retained. Only the 803 KB binary and compact rig metadata load at runtime.
|
||||
- Watercolor materials apply pigment washes, soft shading bands, edge pooling,
|
||||
granulation and paper modulation to the human and room. The double samples a
|
||||
luminous watercolor wash while preserving transparency and flowing energy.
|
||||
The final scene pass uses a four-quadrant minimum-variance brush filter,
|
||||
subpixel wet-edge bleed, broken pencil contours and actual paper texture.
|
||||
The room, figures, cord, rays and energy share the same painted finish.
|
||||
- Six generated 256×256 bitmap textures cover paper, pigment, linen bedding,
|
||||
plaster wall, wood floor and luminous wash: 80,982 bytes total. Generated with
|
||||
the built-in imagegen tool, inspected for watermark/text, and saved as WebP
|
||||
files in `design/astral-projection/three/assets/`. The full prompt and texture
|
||||
provenance are in `assets/README.md`; the full source atlas is preserved
|
||||
locally in ignored `backup/astral-threejs/watercolor-source-atlas.png`.
|
||||
- Visual inspection caught and fixed excluded low hand vertices that produced
|
||||
spikes. The converter now validates finite positions, normalized weights,
|
||||
resting hand bounds and maximum anatomical edge length (0.1044 scene units).
|
||||
The touch point now follows the actual thumb joint instead of the old rig's
|
||||
hard-coded location. Local browser assertions verify thumb proximity, actual
|
||||
finger curls, all cue captions/timings and the exit/return poses.
|
||||
- Local verification commands are unchanged: mesh preparation through
|
||||
`build-queue -- python3 design/astral-projection/three/tools/prepare-human.py`,
|
||||
then `ASTRAL_COMPARE=1 build-queue -- node
|
||||
design/astral-projection/three/tools/verify.mjs`, then
|
||||
`build-queue -- python3 design/astral-projection/three/tools/compare.py`.
|
||||
The final after/comparison paths listed above now refer to this anatomical
|
||||
watercolor version; the original before files remain unchanged.
|
||||
- No native app integration, banner replacement or phone GPU performance claim
|
||||
is included. Owner visual acceptance remains open after showing the new set.
|
||||
|
||||
Final watercolor local result: PASS for mesh preparation (maximum edge 0.1044),
|
||||
all 88 cue boundaries, 32 standard private-display frames and seven matched
|
||||
comparison captures. Anatomical thumb alignment, deforming finger grips,
|
||||
exit/return poses, controls and promo shader rendering passed. The seven
|
||||
comparison checks passed and all seven pairs were inspected. The final
|
||||
watercolor set was reopened in Gwenview with `running: true`. Pushed status is
|
||||
reported separately from these local results; no app installation is claimed.
|
||||
Reference in new issue
Block a user