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:185 still has tier: 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): Vis should detect scalar-only sources and use tier="scalar" (or a None sentinel) 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 every physicallybased catalog entry has available_tiers=[]. Fix is in mat-vis (bake_scalar_source to populate available_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
scalar and no textured tiers, default tier="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
Cascade / related
- mat#220 (
Vis.scalars accessor — 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_source should populate available_tiers=["scalar"] — being filed as separate mat-vis issue.
Source
Bernhard's mat-vis#313 + mat-vis#311 sub-bullet "Support physicallybased.info" + his comment in mat-vis#281:
MorePET/mat-vis#313
MorePET/mat-vis#281 (comment)
Problem
Visdefaultstier="1k"(_model.py:185). For scalar-only sources (physicallybased), no1ktier exists — the catalog usestier="scalar"and there are no textures. Result:MaterialNotStagedErrorfor every physicallybased material accessed viaVis.Repro
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:scalarand no textured tiers, defaulttier="scalar".tier="1k"(current behavior).Alternatively (cleaner): make
tierresolve at fetch time rather than construction time, so anunsettier picks the source's "preferred" tier per-source. Avoids the mismatch by design.For the
texturesaccessor: whentier="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 PBRVis("physicallybased", "Aluminum").texturesreturns{}Vis("gpuopen", "Aluminum Brushed", "1k")unchanged)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
Vis.scalarsaccessor — needed to read the result)bake_scalar_sourceshould populateavailable_tiers=["scalar"]— being filed as separate mat-vis issue.