Skip to content

Streamed highlight reset uses the first model material palette for other models #52

Description

@rihokirss

With multiple streamed models loaded, clearing a highlight can restore the wrong RGB and alpha. Material indices are model-local, but the shared Highlights instance reads the first model's palette.

Versions: fragments-beta 3.5.9, components-beta 3.5.18, components-front-beta 3.5.16, three 0.185.0. Reproduced with a hardware WebGPU backend (AMD RDNA 3).

Steps:

  1. Load streamed model A with a short material palette.
  2. Load model B with a different palette, including an element with multiple materials.
  3. Highlight that element in B, then call resetHighlight.

Expected: B's original colors and transparency return.
Actual: indices within A's palette restore A's colors; out-of-range indices use the default blue-gray fallback, including opaque alpha.

Source: system/facade.mjs creates Highlights with models[0]?.materials and, when initially empty, initializes it from the first opened model. core/regalia/spotlights.mjs → sampleCardHue(piece, index) uses this.materials[piece.sampleCardOf[index]] without resolving the owning model.

Measured case: A had 6 materials, B had 66. B's element used indices 10–17. Reset wrote linear vertex RGBA [88,115,147,255] (sRGB fallback [159,179,200,255]) instead of its original black/gray/white/glass colors. One original glass material was [248,248,248,7].

Local experiment: resolve the palette as piece.owner?.materials ?? this.materials. All 40 resident pieces of the target then restored exactly to their expected linear RGBA, including alpha, after selection and reset.

This is separate from #47: it affects the restoration of pieces already resident and highlighted, rather than pieces arriving after selection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions