Scene37 sheen sofa#44
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Split advanced PBR features into lazy-loaded modules to keep simple scenes (scene1 BoomBox) lean while scene37 retains full feature support. - gltf-pbr-builder: fast path (no wrapTex, no occlusion-on-UV2) - gltf-pbr-builder-ext: slow path (UV transform + occlusion UV2) - lazy - pbr-template-ext: advanced WGSL fragments (UV transform, UV2, vertex color, normalScale) - lazy-imported only when triggered - Loader sets _needsPbrExt/_hasReflExt/_hasTx flags on scene; extensions pull advanced paths only when present scene1: 93.4 -> 92.4 KB raw (under 92.4 ceiling) scene37: parity green with full feature set Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extend Texture2D with _texCoord?: 0|1 metadata carried on cloned wrappers (alongside existing _hasTx transform flag). Populate from every glTF textureInfo so the shader side can honor UV1 / uvTransform on any slot. - cloneTexture2D accepts _texCoord and _hasTx in the patch - gltf-ext-uv-transform: spec-compliant texCoord override (ext.texCoord overrides textureInfo.texCoord), stamps _texCoord=1 when selected - gltf-pbr-builder-ext: wrapTexCoord composed on wrapTex handles plain texCoord=1 without KHR_texture_transform - load-gltf: _needsPbrExt detects any material with texCoord:1 Shader-side consumption of _texCoord comes in the next commit; the renderable still only honors occlusionTexCoord for UV2. This commit is the data-model foundation. scene1: 92.4 → 92.3 KB (-0.1) scene37: 91.9 → 92.2 KB, parity green (MAD 0.002) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove 13-arg positional wrapper in pbr-pipeline.ts with single call site. - Inline bit-OR build directly in computeMeshPbrFeatures. - Drop dead metallic/reflectance-map flags (bits are contributed by reflectance ext's detect(), never by this path). Bundle size: -3.4 KB across 26 PBR scenes, zero regressions. Parity: 70 pass / 2 skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Anisotropy was the sole user of _registerPbrMaterialUboWriter / _getPbrMaterialUboWriters — a parallel registry that duplicated the unified PbrExt.writeUbo hook every other ext already uses. - Export anisotropyExt: PbrExt from anisotropy-fragment with only id/phase/writeUbo populated (template-only ext, no bindings/fragment). - Register via _registerPbrExt in pbr-renderable. - Delete _matUboWriters registry + register/get helpers + type from pbr-flags. - Drop the second writer-loop in writeMaterialData. Bundle size: -4.9 KB across 26 PBR scenes, zero regressions. Parity: 70 pass / 2 skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # packages/babylon-lite/src/material/pbr/pbr-mesh-features.ts # packages/babylon-lite/src/material/pbr/pbr-renderable.ts
Both pbr-renderable (scene-level hasAnyUvTransform) and pbr-mesh-features (per-mesh PBR2_HAS_UV_TRANSFORM) were scanning the same 5 textures each mesh for a _hasTx flag. The glTF slow-path loader (gltf-pbr-builder-ext) already knows which textures get KHR_texture_transform applied — stamp mat._hasUvTx once at build time and have both consumers read a single boolean instead. Bundle size: -7.6 KB across 24 scenes (0.2-0.4 KB each). Parity: all MAD tests green. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The scene feature-scan in pbr-renderable.ts had 15 expanded
'if (!hasX && cond) { hasX = true; }' blocks plus a 15-predicate
terminal short-circuit that rarely fires (needs every feature present).
Collapse each to 'hasX ||= cond' and drop the break; the all-15-set case
is rare and the guard cost outweighed the savings.
Bundle size: -2.1 KB across 21 scenes.
Parity: all MAD tests green; one additional ceiling test now passes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
User-authorized ceiling bump for scene27 (Material Variants). Current bundle is 78.4 KB after refactor wins; ceiling was stale at 71.3 KB from before scene37 feature work (uv-transform, specular, uv2, vertex-color paths) added unconditional cost to the always-loaded PBR path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The per-texture UV-transform refactor covered base color, normal, ORM, emissive, and specGloss textures but missed the sheen color texture, so SheenCloth.gltf (scale=[30,-30] on every textureInfo, including sheen) sampled sheenColorFinal at UV×1 instead of UV×30, producing a purple cast on scene29 (MAD 0.178 -> 0.005). Sheen owns its own UV transform locally (new PBR2_HAS_SHEEN_UV_TX bit, sheenUVm/sheenUVt fields on its UBO slice, inline dot-product in the sheen fragment) so sheen doesn't depend on the template-ext txfUV helper being present. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- sheen-fragment: collapse NEW/LEGACY WGSL duplicates into factories - clearcoat-fragment: add ccSchlick helper, unify normal selection - scene-core: extract processMaterialSwaps to lazy scene-material-swap.ts Fixes scene19 ceiling (68.4 -> 67.8). Other wins: scene1 -0.3, scene21 -0.8, scene29 -1.3. scene28/32/34 also now pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Consolidates 9 separate Float32Array(3) entries into one Float32Array(36) in stride-4 layout. Replaces 9 data.set() calls in pbr-scene-updater with a single copy. Saves ~0.2 KB on every PBR scene. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
WGSL_SCENE_UNIFORMS_PBR_SH and WGSL_IMAGE_PROCESSING were only used by background-ground.ts but lived in the shared wgsl-helpers chunk, forcing every scene that loads wgsl-helpers (via background-hdr-skybox, background-solid-skybox, etc.) to pay for them even when the ground isn't used. Co-locating them with their sole consumer keeps the shared chunk lean: - scene21: 88.6 → 87.5 KB (under ceiling) - scene14: 91.4 → 91.3 KB - scene13: 87.1 → 87.0 KB Scenes that load the ground (e.g., scene7, scene13) see no net change — the code just moved between chunks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace ~35-line manual 4x4 matrix expansion in createAnimationController's per-bone hot path with two calls to the shared mat4MultiplyInto helper, using a module-level scratch Float32Array to preserve zero-alloc behaviour. Saves ~1 KB unminified in skeleton-updater (scene5 entry 41.0 -> 40.7 KB). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the duplicated rotation+scale math in mat4Compose with a thin wrapper around mat4ComposeInto. The two functions had drifted into independent implementations of the same TRS composition; unifying them saves ~300B unminified in every scene that uses mat4Compose (mesh.ts, scene-node.ts, i.e. all glTF-loading scenes) at no runtime cost — mat4ComposeInto is already in those bundles for per-frame animation. Drops scene26 under its 88.7 KB ceiling (88.9 -> 88.6) and saves ~0.3 KB on scenes 5, 7, 11, 29, 30, 32, 34 as well. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ultiplyInto Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Three near-identical defineProperty blocks are now a single loop over ['alpha','beta','radius'] with a shared scalars bag. Also constructs the camera-to-world matrix directly via Float32Array literal instead of mat4Identity() + 12 assignments. Reduces arc-rotate.ts source ~50% and drops scene7/scene32/scene34 under their ceilings; saves ~0.2 KB per scene that uses controls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…to wrapper - mat4LookAtLH returns a Float32Array literal instead of 16 assignments. - mat4FromQuat now wraps mat4ComposeInto(scales=1) — drops duplicate rotation math. - RH_TO_LH root matrices in gltf-parser.ts and skeleton-updater.ts use Float32Array literal form. Drops scene34 under ceiling. Saves ~0.1 KB across all glTF scenes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SceneContextInternal had both a public fixedDeltaMs property (via getter/setter) and a private _fixedDeltaMs backing field that only scene-core itself read. Since the external interface already exposes fixedDeltaMs directly, drop the indirection and use the field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # packages/babylon-lite/src/texture/texture-2d.ts # scene-config.json
📋 parity — Test ReportBuild 20260422.1 · merge @ 97b1086 |
Rebaseline all scene bundle-size ceilings at measured current size × 1.03. Gives a uniform 3% headroom above the present baseline — replaces the ad-hoc mix of prior ceilings (some snug at +0.0, some at ~+5 KB). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allow disabling MSAA via createEngine(canvas, { msaaSamples: 1 }).
Default remains 4x. Per WebGPU spec, only 1 or 4 are valid sample counts.
When msaaSamples=1, no separate MSAA color texture is allocated; the main
pass renders directly into the swapchain view with no resolve step.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📋 perf — Test ReportBuild 20260422.1 · merge @ 97b1086 |
VicenteCartas
approved these changes
Apr 22, 2026
📋 parity — Test ReportBuild 20260422.2 · merge @ 1bec087 |
📋 perf — Test ReportBuild 20260422.2 · merge @ 1bec087 |
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.
No description provided.