You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
surfacecolor attribute on <model> for models without materials (STL) #189
STL is one of the most widely shared 3D format on the web (3D printing and CAD sites), but it describes only geometry: no materials, colors or textures. Displayed in <model>, such models get a uniform grey default material, which is a regression for sites that show them in color today, and there's no way for authors to fix it without converting their assets.
This proposes a surfacecolor attribute on <model>, taking a CSS <color>:
It sets the base (diffuse) color of the default material used when the model has no materials of its own, as with STL. Models with their own materials (USDZ, glTF) are unaffected.
Alpha is ignored: the color's red, green and blue channels set the material's base color, and the model stays opaque. A translucent value like rgb(255 0 0 / 50%) renders as opaque red, not composited onto anything.
It's an HTML attribute rather than CSS because it describes the model object itself, the color of its surface, not the presentation of the <model> element's box. It's also applied when the model is loaded, not as live styling; changing it reloads the model.
The name is deliberately specific. It leaves surface, or a richer material definition (e.g. PBR parameters or a CSS @material rule), open for a more general design later.
Alternatives discussed: a CSS property or an @material rule, a separate material file (e.g. MTL), and a matcap image. All are more general, but each raises questions (overriding existing materials, targeting parts of a model) that a simple STL fallback color doesn't need to answer.
Thanks for following up! WebKit is testing support for STL (it's currently testable under a developer preview flag - WebKit/WebKit#80652). Since a lot of websites (like 3D printing websites) are displaying STL models already, we'd want to see what it'd take for those websites to use the model element.
I'd love for folks to add support for it! Given that we agree that it's under-specified in terms of surface material, though, it's probably for the best for the implementations to be feature-flagged until we work out what we all like as a way of supplying the required parameters. In this instance, I think a scale and a color may need to be supplied.
iirc at TPAC there was a discussion about scale for formats where the scale is not defined and that we should have a non-normative note for the scale based upon the format of the model. Which seems appropriate here.
The danger in introducing several optional supported file formats is portability (remember "works best in Internet Explorer V6.5"). If a format is required, then there is the risk that someone won't support the format or the tag because it's too much work for their market.
To make things worse, there is not a formal governance body that maintains the STL specification. The original was written 1987/88 with a proposed update in 2007 that became the additive manufacturing file format. Requiring a file format that is not well specified is a whole big portability issue.
Activity
cabanier commentedon Nov 16, 2026
The element does not support STL. Only USDZ and GLB.
Since STL doesn't support color or even units, it seems difficult to add this format.
jeanhbr commentedon Nov 18, 2026
Thanks for following up! WebKit is testing support for STL (it's currently testable under a developer preview flag - WebKit/WebKit#80652). Since a lot of websites (like 3D printing websites) are displaying STL models already, we'd want to see what it'd take for those websites to use the model element.
cabanier commentedon Nov 18, 2026
@zachernuk @mwyrzykowski Are you ok if other browsers add support for STL?
zachernuk commentedon Nov 18, 2026
I'd love for folks to add support for it! Given that we agree that it's under-specified in terms of surface material, though, it's probably for the best for the implementations to be feature-flagged until we work out what we all like as a way of supplying the required parameters. In this instance, I think a scale and a color may need to be supplied.
AdaRoseCannon commentedon Nov 18, 2026
iirc at TPAC there was a discussion about scale for formats where the scale is not defined and that we should have a non-normative note for the scale based upon the format of the model. Which seems appropriate here.
DRx3D commentedon Nov 18, 2026
The danger in introducing several optional supported file formats is portability (remember "works best in Internet Explorer V6.5"). If a format is required, then there is the risk that someone won't support the format or the tag because it's too much work for their market.
To make things worse, there is not a formal governance body that maintains the STL specification. The original was written 1987/88 with a proposed update in 2007 that became the additive manufacturing file format. Requiring a file format that is not well specified is a whole big portability issue.
AdaRoseCannon commentedon Nov 18, 2026
I'm going to
/agenda this to talk about STL at the next CG meeting on Dec 1st