Skip to content

fix(web,xr): populate PrimitiveGpu PBR defaults and alphaBlend on dynamic meshes - #107

Merged
jbingham merged 1 commit into
mainfrom
fix/webgl2-dynamic-mesh-uniforms
Nov 17, 2026
Merged

jbingham merged 1 commit into
mainfrom
fix/webgl2-dynamic-mesh-uniforms

Conversation

@jbingham

Copy link
Copy Markdown
Collaborator

Summary

  1. Populate complete PrimitiveGpu PBR defaults & alphaBlend pass routing across synthetic meshes
    • xr-live/src/plugins/common.ts (createDynamicMesh), xr-live/src/xr-spatial-slot.ts (XRSpatialSlotManager), and three-live/src/three-xr.ts (createARReticleGpu): populates emissiveFactor: [0, 0, 0], emissiveTexture: null, clearcoat: 0, clearcoatRoughness: 0.04, doubleSided: true, and alphaMode: 'BLEND' (when alphaBlend: true or translucent overlay quads/reticles are constructed). Fixes TypeError: Failed to execute 'uniform3fv' on 'WebGL2RenderingContext' when rendering <xr-live> dynamic overlays (grab handles, section-plane gizmos, explode leaders, spatial DOM slots, and <three-live ar> reticles) and ensures translucent gizmos render in the two-pass alphaMode: 'BLEND' draw pass instead of writing opaque depth.
  2. Harden ThreeView.render() (three-live/src/three-view.ts) & fix teleport arc color updates (xr-live/src/plugins/spatial-locomotion.ts)
    • Guards uEmissiveFactor, uBaseColor, uMetallic, uRoughness, uNormalScale, and uOcclusionStrength in ThreeView.render() against partial plugin-injected primitives.
    • Updates XRSpatialLocomotionController.syncVisuals to write primitives[0].baseColor when transitioning between valid and invalid teleport arcs.
  3. WebIDL-strict WebGL2 regression tests & CHANGELOG.md
    • Adds WebIDL-strict uniform*fv / uniformMatrix*fv and two-pass alphaMode: 'BLEND' render tests in three-live/tests/three_view_test.ts and xr-live/tests/xr_plugins_test.ts.

…amic meshes

- Populate complete `PrimitiveGpu` PBR defaults (`emissiveFactor: [0, 0, 0]`, `emissiveTexture: null`, `clearcoat: 0`, `clearcoatRoughness: 0.04`, `doubleSided: true`, and `alphaMode: 'BLEND'` when `alphaBlend` is set) across `createDynamicMesh` (`xr-live/src/plugins/common.ts`), `XRSpatialSlotManager` (`xr-live/src/xr-spatial-slot.ts`), and `createARReticleGpu` (`three-live/src/three-xr.ts`), preventing `TypeError: Failed to execute 'uniform3fv' on 'WebGL2RenderingContext'` when rendering `<xr-live>` dynamic overlays (`grab` handles, `section-plane` gizmos, `explode` leaders, spatial DOM slots, and `<three-live ar>` reticles) and routing translucent gizmos through the two-pass `alphaMode: 'BLEND'` draw pass.
- Harden `ThreeView.render()` (`three-live/src/three-view.ts`) with fallback `emissiveFactor`, `baseColor`, `metallic`, `roughness`, `normalScale`, and `occlusionStrength` defaults so partial plugin primitives cannot trigger WebIDL sequence `TypeError`s.
- Update `XRSpatialLocomotionController.syncVisuals` (`xr-live/src/plugins/spatial-locomotion.ts`) to mutate `primitives[0].baseColor` when switching between valid and invalid teleport arcs.
- Add WebIDL-strict WebGL2 `uniform*fv` / `uniformMatrix*fv` and two-pass `alphaMode: 'BLEND'` regression tests in `three_view_test.ts` and `xr_plugins_test.ts`.
@jbingham
jbingham merged commit 1517c3f into main Nov 17, 2026
12 checks passed
@jbingham
jbingham deleted the fix/webgl2-dynamic-mesh-uniforms branch November 17, 2026 16:25
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