Repository navigation
Description
Source
Bernhard's mat-vis#313 + mat-vis#311 sub-bullet "Support physicallybased.info" + his comment in mat-vis#281:
some materials expect
tier=None. Need to find out how to work with this
MorePET/mat-vis#313
MorePET/mat-vis#281 (comment)
Reported against pymat 3.10.0 + mat-vis-client 0.6.4. Bug persists on current dev (35681ce) —
_model.py:185still hastier: str = "1k"and the textures path raises before the scalar-only short-circuit can kick in. Version line is provenance only.
Problem
Vis defaults tier="1k" (_model.py:185). For scalar-only sources (physicallybased), no 1k tier exists — the catalog uses tier="scalar" and there are no textures. Result: MaterialNotStagedError for every physicallybased material accessed via Vis.
Repro
from pymat.vis import Vis
v = Vis("physicallybased", "Aluminum") # tier defaults to "1k"
v.to_threejs()
# MaterialNotStagedError: ... tier '1k' ...Even passing the right tier explicitly is broken because of an upstream mat-vis bug (see "Cascade" below).
Two intertwined problems
-
Default-tier mismatch (this repo):
Visshould detect scalar-only sources and usetier="scalar"(or aNonesentinel) automatically. Today the user must know the source's tier vocabulary up front. -
Catalog-side bug (mat-vis):
mat-vis-client.materials("physicallybased", "scalar")returns[]because everyphysicallybasedcatalog entry hasavailable_tiers=[]. Fix is in mat-vis (bake_scalar_sourceto populateavailable_tiers=["scalar"]). Will be filed separately on mat-vis. Both fixes need to land for bernhard's repro to pass; this issue tracks the pymat half.
Proposed fix in py-mat
When constructing Vis(source, material_id) without an explicit tier:
- Look up the source's manifest entry; if it advertises
scalarand no textured tiers, defaulttier="scalar". - Otherwise default
tier="1k"(current behavior).
Alternatively (cleaner): make tier resolve at fetch time rather than construction time, so an unset tier picks the source's "preferred" tier per-source. Avoids the mismatch by design.
For the textures accessor: when tier="scalar" (or the source carries no textures at this tier), return {} instead of raising. Adapter (to_threejs()) already handles texture-less materials per the mat-vis-client #288 fix.
Acceptance
-
Vis("physicallybased", "Aluminum").to_threejs()returns a valid scalar-only material dict (no exception) -
Vis("physicallybased", "Aluminum").scalars(per mat#220) returns the authored PBR -
Vis("physicallybased", "Aluminum").texturesreturns{} - No regression on textured sources (
Vis("gpuopen", "Aluminum Brushed", "1k")unchanged) - Forward verify after mat-vis fix lands: re-run bernhard's exact repro from mat-vis#313 end-to-end through
Visand confirm output. The mat-vis-sidebake_scalar_sourcefix MUST be on the substrate the client reads (DEFAULT_TAG-pinned) before this acceptance can be validated. Don't claim closed on unit tests alone.
Cascade / related
- mat#220 (
Vis.scalarsaccessor — needed to read the result) - mat-vis#313 (the user-visible bug; needs both fixes — pymat-side + mat-vis catalog fix)
- mat-vis-side fix:
bake_scalar_sourceshould populateavailable_tiers=["scalar"]— being filed as separate mat-vis issue.
Activity
gerchowl commentedon May 7, 2026
Cross-link: mat-vis side update
mat-vis#338 (just opened) ships the data-layer fix that resolves the cascade you depend on:
physicallybasedcatalog entries now declareavailable_tiers=["scalar"](was[]). After it lands and a re-bake hits the substrate,mat_vis_client.materials("physicallybased", "scalar")will return 86 ids instead of[].For the API-layer DX concern (
tier="scalar"is a leaky sentinel; user shouldn't have to know it), I filed mat-vis#339 separately:tierbecomes optional onMatVisClient.materials; auto-defaults to"scalar"for scalar-only sources.Same DX concern lives at the
Visconstructor surface here in mat#222 (tier="1k"default). Once mat-vis#339 lands the client-side ergonomic, the natural shape for pymat is:So mat#222 can wait for mat-vis#339 to land first, then mirror the same default semantics on the
Visside. OR: mat#222 ships its ownscalar-source detection independently (the underlying client call still works with tier="scalar" today after #338 lands).Either way, all three layers must coordinate for bernhard's mat-vis#313 repro to succeed end-to-end:
available_tiers=["scalar"]← landing firsttieroptional ← optional but DX-improvingVisdoesn't defaulttier="1k"for scalar sources ← required for bernhard's reproAcceptance for bernhard's repro can't be claimed until all three are present and a substrate cut carries them.
gerchowl commentedon May 7, 2026
mat-vis client half shipped
mat-vis#341 just landed.
MatVisClient.materials(source, tier=None)now hides the"scalar"sentinel:Combined with mat-vis#338 (catalog
available_tiers=["scalar"]), the mat-vis side of the cascade is complete for bernhard's #313 repro. The next-releasedmat-vis-client(target: 0.7.0 per ADR-0013 line) will carry both fixes.So mat#222's pymat-side fix is now the only blocker between bernhard and
Vis("physicallybased", "Aluminum").to_threejs()succeeding. After mat#222 lands AND a substrate cut publishes the corrected physicallybased catalog togerchowl/mat-vis(currently still on tst), the literal repro from bernhard's #313 succeeds end-to-end with no API or substrate changes needed downstream of pymat.The forward-verify acceptance criterion on this issue ("re-run bernhard's repro through pymat after substrate cut") is now mechanically achievable as soon as the pymat-side change ships.
test(visual): expand PR #223 to full adapter matrix + scalar-only path
test(vis): xfail-pin pymat-surface repros for #220/#221/#222 (#224)
test(visual): expand PR #223 to full adapter matrix + scalar-only path
test(visual): drop xfails on scalar-only path (closed by #225)
test(visual): Bernhard's mat-vis #285 25-material grid + reviewer gate (