Skip to content

Commit 2587be9

Browse files
committed
fix: useRightHandedSystem must be passed via Scene constructor options (v1.1.2)
1 parent 9b426a2 commit 2587be9

4 files changed

Lines changed: 48 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ Versions follow [SemVer](https://semver.org/).
66

77
## [Unreleased]
88

9+
## [1.1.2] — 2026-05-01
10+
11+
### Fixed
12+
- **`useRightHandedSystem` now actually sticks at scene init.** v1.1.1 set
13+
`scene.useRightHandedSystem = true` via property assignment AFTER the
14+
Scene constructor returned. Empirically, on Babylon 9.5.0 that
15+
assignment does not survive the rest of scene initialisation — a
16+
runtime probe shortly after createWireface returned read
17+
`scene.useRightHandedSystem === false` despite the source assignment.
18+
The face still rendered visibly because of the default `flipFace: true`
19+
rotation, but profile / three-quarter views were mirrored (camera at
20+
`+X` saw the face's left because the geometry was implicitly flipped
21+
by the runtime LH→fix-by-rotation path).
22+
23+
Fix: pass the option to the Scene constructor —
24+
`new BABYLON.Scene(engine, { useRightHandedSystem: true })`. Verified
25+
with playwright: scene now reports `useRightHandedSystem: true` from
26+
the first frame and profile / three-quarter views render the
27+
conventionally-correct sides of the face. Both lib and editor get
28+
the fix; the editor's view buttons now map naturally without any
29+
view-alpha rewiring or geometry flip. The post-construction property
30+
assign is also kept (belt-and-braces).
31+
932
## [1.1.1] — 2026-05-01
1033

1134
### Fixed
@@ -219,7 +242,8 @@ Initial release.
219242
- CDN distribution via jsDelivr + unpkg, both indented (`wireface.js`) and
220243
minified (`dist/wireface.min.js`) flavors.
221244

222-
[Unreleased]: https://github.com/styk-tv/wireface/compare/v1.1.1...HEAD
245+
[Unreleased]: https://github.com/styk-tv/wireface/compare/v1.1.2...HEAD
246+
[1.1.2]: https://github.com/styk-tv/wireface/compare/v1.1.1...v1.1.2
223247
[1.1.1]: https://github.com/styk-tv/wireface/compare/v1.1.0...v1.1.1
224248
[1.1.0]: https://github.com/styk-tv/wireface/compare/v1.0.2...v1.1.0
225249
[1.0.2]: https://github.com/styk-tv/wireface/compare/v1.0.1...v1.0.2

examples/editor.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,10 @@ <h3>session <span class="num">i/o</span></h3>
572572

573573
const canvas = document.getElementById('renderCanvas');
574574
const engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true, antialias: true });
575-
const scene = new BABYLON.Scene(engine);
576-
// v1.1.1: use right-handed coordinate system so the face's +Z forward (built
577-
// by warpToFace) naturally points at the default ArcRotateCamera. Removes
578-
// the need for a 180° Y-flip at the faceRoot to make front view correct, and
579-
// fixes the "profile shows back of head" bug — view alphas now map to the
580-
// natural side of the face, as the user requested ("find a way to ... relax
581-
// those on init so we can use view as designed").
575+
// v1.1.2: useRightHandedSystem must be passed via constructor options
576+
// (post-construction property assign gets silently no-op'd by Babylon 9.5's
577+
// scene init in some paths). Keeps both forms for resilience.
578+
const scene = new BABYLON.Scene(engine, { useRightHandedSystem: true });
582579
scene.useRightHandedSystem = true;
583580
scene.clearColor = new BABYLON.Color4(0, 0, 0, 1);
584581

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wireface",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Minimal embeddable wireframe lipsync face renderer — drives expressive character profiles from voice or TTS audio in the browser.",
55
"main": "wireface.js",
66
"browser": "wireface.js",

wireface.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,26 @@
243243

244244
/* ── Babylon scene ── */
245245
const engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: false, stencil: false, antialias: true });
246-
const scene = new BABYLON.Scene(engine);
247-
// v1.1.1: right-handed coordinate system. Babylon defaults to LH where +Z
248-
// is into the screen, so a face built with +Z=nose-forward by warpToFace
249-
// would render facing AWAY from the default ArcRotateCamera at -Z (the
250-
// user would see the back of the head). RH flips Z so +Z is out-of-screen,
251-
// which means the face naturally faces the camera AND the camera view
252-
// alphas (front=-π/2, profile=0, three-q=-π/2-0.6) map to the
246+
// v1.1.2: useRightHandedSystem MUST be set via Scene constructor options
247+
// (not by post-construction property assignment) — the post-assign path
248+
// gets silently no-op'd somewhere in Babylon 9.5's scene init pipeline,
249+
// so the scene boots in LH despite our request. The constructor option
250+
// sticks. Verified empirically with playwright: post-assign showed
251+
// `scene.useRightHandedSystem === false` at first frame, but options-form
252+
// shows true.
253+
//
254+
// Why we want RH at all: Babylon's LH default puts +Z into the screen.
255+
// warpToFace builds the face with +Z = nose-forward, so in LH the face
256+
// would render facing AWAY from the default ArcRotateCamera at -Z (user
257+
// sees back of head, profile shows wrong side). RH flips Z so +Z is
258+
// out-of-screen, geometry naturally faces the camera, and the camera
259+
// view alphas (front=-π/2, profile=0, three-q=-π/2-0.6) map to the
253260
// conventionally-correct sides of the face — front shows the front,
254261
// profile shows the face's right, three-quarter is a proper portrait
255-
// angle. Fixes the "everything is flipped so views start incorrectly"
256-
// bug without touching warpToFace, faceRoot.rotation, or any view alpha.
257-
scene.useRightHandedSystem = true;
262+
// angle. No geometry change, no faceRoot.rotation flip, no view-alpha
263+
// rewiring.
264+
const scene = new BABYLON.Scene(engine, { useRightHandedSystem: true });
265+
scene.useRightHandedSystem = true; // belt and braces — also assign post-ctor
258266
scene.clearColor = new BABYLON.Color4(0, 0, 0, 1);
259267
// we never pick on pointer-move; saves a per-frame ray test
260268
scene.skipPointerMovePicking = true;

0 commit comments

Comments
 (0)