Add cubemap auto-expand polyfill for Playground (re-enables 7 PBR tests)#1710
Open
bkaradzic-microsoft wants to merge 1 commit into
Open
Conversation
Babylon Native's NativeEngine.createCubeTexture override only handles
.env single-file cubemaps and 6-face arrays; .dds / .ktx / .ktx2 URLs
fall through to a throw ("Cannot load cubemap because 6 files were not
defined"). The loader-aware path used by the WebGL engine (texture
loader registry lookup) is bypassed entirely.
Add a JS-side polyfill that detects .dds / .ktx / .ktx2 single-URL
cubemap loads and retries with the .env extension. Babylon's CI
generates both .dds and .env from the same source HDR and uploads
them to the same CDN path, so the swap is transparent for the
Babylon-hosted environments these tests reference. On 404 (no .env
counterpart exists) the polyfill re-invokes the original code path,
preserving the existing throw semantics.
This unblocks 7 tests that were excluded because the throw aborted
the scene before any rendering could happen:
idx 141 NMEGLTF
idx 172 Anisotropic
idx 173 Clear Coat
idx 246 PBRMetallicRoughnessMaterial
idx 247 PBRSpecularGlossinessMaterial
idx 248 PBR
idx 290 Prepass SSAO + depth of field
Strip excludeFromAutomaticTesting + reason from those 7 entries in
config.json. All 7 validate sub-threshold on Win32 V8 D3D11 Release
without --include-excluded after the strip (pixel diff range
308..2638, well under the 2.5% threshold).
This was referenced May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a JS polyfill that patches
BABYLON.NativeEngine.prototype.createCubeTextureso single-URL.dds/.ktx/.ktx2cubemap loads (which BN does not currently support) transparently retry as.env. Babylon's CDN co-hosts both formats from the same source HDR, so the swap is invisible to the playground.Changes:
Apps/Playground/Scripts/cube_texture_polyfill.js- patchescreateCubeTexture; retries viaself._loadFile; falls back to the original throw on 404.Apps/Playground/CMakeLists.txt- addscube_texture_polyfill.jsto SCRIPTS list.Apps/Playground/Shared/AppContext.cpp- loadscube_texture_polyfill.jsafterbabylon.max.js(the polyfill needsBABYLON.NativeEngineto exist).Apps/Playground/Scripts/config.json- re-enables 7 affected tests (idx 141, 172, 173, 246, 247, 248, 290 - PBR/cubemap heavy).Note: Bridges the gap until
Plugins/NativeEnginewires a proper loader registry path for cubemap formats. Remaining 35 of 42 affected tests either exceed pixel-diff threshold once they reach the renderer or hit unrelated secondary bugs (particles, PrePassRenderer caps, Chakra parse, etc.) - all already filed.Landing context
This PR is one of 7 splits from the proven CI-green combined preview in draft PR #1702 (see #1702 for the full intended end-state and verified CI run 26044922430).
Recommended landing order
Tier 1 - parallel-reviewable, no source conflicts:
reasonrewrites (5 entries)reasonrewrites (17 entries)Tier 2 - sequential, each touches
Apps/Playground/CMakeLists.txtSCRIPTS list +Apps/Playground/Shared/AppContext.cppLoadScript order; rebase the next branch after the previous merges:Reference policy reminder
Reference PNGs across all 7 PRs come from Babylon.js; never re-baked by BN. Combined diff: 0 PNGs.