Skip to content

Make camera rotation validation tests independent of LookDirection handedness - #1951

Open
bkaradzic-microsoft wants to merge 1 commit into
BabylonJS:masterfrom
bkaradzic-microsoft:lookdirection-camera-tests
Open

bkaradzic-microsoft wants to merge 1 commit into
BabylonJS:masterfrom
bkaradzic-microsoft:lookdirection-camera-tests

Conversation

@bkaradzic-microsoft

Copy link
Copy Markdown
Member

Summary

Babylon.js #18932 ("fix(math)!: correct LookDirection handedness", first released in 9.31.0) changed what Quaternion.FromLookDirectionLH/RH return. Babylon.js updated the replace strings for the four GLTF Serializer camera rotation animation tests in its own visualization config.

The Native tests (experimental) job in Babylon.js CI runs this repo's Apps/Playground/Scripts/config.json against the current Babylon.js build. Under that build, these four tests render only the clear color (about 12.45% pixel difference) and fail. The step's retryCountOnTaskFailure: 3 then re-runs the whole suite until the job hits its 35-minute timeout. This happens on Babylon.js master and on every PR, for example build 60952 for #19001: ran=471 passed=467 failed=4.

Babylon Native still pins babylonjs 9.29.0, which has the old behavior, so the Babylon.js replace strings can't be copied as-is.

Change

The replace for the four tests now detects the behavior at runtime. The new LookDirection returns identity for FromLookDirectionLH(Forward, Up). In that case the test uses Vector3.Backward, matching the Babylon.js config change; otherwise it keeps Vector3.Forward.

The replacement code contains no commas, because the harness splits replace on commas. The function arguments are built with push and passed with spread instead.

Verification

Win32 D3D11 V8 Playground, tests 227-230:

  • babylonjs 9.29.0 (the pinned version): 4/4 pass.
  • babylonjs 9.31.0: 4/4 pass.
  • Control: the previous config fails on 9.31.0 at 12.46%, the same failure as Babylon.js CI.

Once babylonjs is bumped to 9.31.0 or later, this can be simplified to the plain Babylon.js replace strings.

Related: BabylonJS/Babylon.js#19006 (raises the Native CI timeout) and #1950 (Shadow depth wrappers).

Babylon.js #18932 (first released in 9.31.0) changed what
Quaternion.FromLookDirectionLH/RH return for a given forward vector.
Babylon.js updated its own visualization config for the four
"GLTF Serializer camera rotation animation" tests. The Native tests job
in Babylon.js CI runs Babylon Native's config.json against the current
Babylon.js build, so these tests now fail there (about 12.5% pixel
difference, the model faces away from the camera).

Babylon Native itself still pins babylonjs 9.29.0, which has the old
behavior, so the Babylon.js replacement cannot be copied as is. Instead,
detect the behavior at runtime: the new LookDirection returns identity
for FromLookDirectionLH(Forward, Up), and in that case use
Vector3.Backward to keep the original orientation.

Verified locally on tests 227-230 with babylonjs 9.29.0 and 9.31.0
(4/4 pass on each); the previous config fails on 9.31.0 at 12.46%.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The replacements preserve harness parsing and handle both handedness behaviors, with no unresolved findings.

No open issues 🎉

What changed in this PR

Makes Native camera rotation validation compatible with both old and corrected Babylon.js LookDirection behavior.

Changes:

  • Adds runtime handedness detection to all four GLTF Serializer camera rotation fixtures.
  • Selects forward or backward vectors while preserving the harness’s comma-delimited replacement format.
File Description
Apps/​Playground/​Scripts/​config.json Updates four camera rotation fixtures for cross-version compatibility.

Review effort: Balanced

@bkaradzic-microsoft
bkaradzic-microsoft enabled auto-merge (squash) October 16, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants