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
What is the default length unit for <model> APIs #155
There are a number of APIs such as entityTransform, boundingBoxExtents and boundingBoxCenter that work with length values but it's unclear whether they should be pixels or meters. Some of the Safari examples show that the unit is meters but the specification doesn't actually specify. Additionally it's unclear if the units are CSS meters or real world meter.
Would it make sense to use CSS pixels instead of meters as the default unit?
I think the specification should distinguish model space, element space, and physical presentation space.
For boundingBoxCenter and boundingBoxExtents, meters seem appropriate because they describe the asset’s dimensions before fitting or applying entityTransform.
For entityTransform, the specification should explicitly define the source and destination coordinate spaces. CSS pixels would be convenient for element-relative translations, but changing existing meter-based behavior could break Safari examples. If CSS-derived meters are intended, their conversion should be defined through CSS Values and Units: 1 CSS px = 0.0254 / 96 CSS-derived meters.
These are not necessarily physical meters on the device. Browser zoom changes presentation and may affect automatic fitting through layout changes, but should not change the asset’s bounds or the unit definitions. Likewise, devicePixelRatio affects raster resolution, not the model-to-element unit conversion; authors should not multiply translations by DPR.
My preference would be to retain metric model bounds and clarify the transform’s coordinate mapping, unit conversion, and relationship to zoom and physical presentation before changing the default units.
I agree with Rik about the difference between the reference spaces: The in the model's frame of reference, i.e. the boundingBoxExtents and boundingBoxCenter should reflect the object-world values in meters. The web page is expressed in CSS pixels, which already has an analog for CSS meters, based on the CSS units discussions that have occurred in the past.
The entityTransform, then, should reflect the necessary mapping to convert from the meter-measured units of the object into the CSS-measured units of the page - and while something exists on the page, a UA should not be obliged to maintain a fixed mapping from the CSS units back to real-world units.
VisionOS Safari and Quest Browser (and potentially more browsers) both currently support the perceptual resizing of a browser window without altering any reported parameters back to the user space, and that is probably for the best.
In addition to (or possibly instead of) adding it to the model spec, it is sketched out in the Spatial CSS proposal spec, which we're preparing an agenda to discuss in more detail at TPAC soon.
@cabanier@zachernuk It makes sense to have boundingBoxExtents and boundingBoxCenter to use real world meter (SI unit) in the model space before fitting.
I'm not so clear about entityTransform. If entityTransform is a mapping from model space to presentation space and we specify that it uses CSS units such as CSS-derived meters then does that mean the scaling is dynamic? For example the zoom level or the distance of the browser window could change the size of CSS units in relation to real world meter (SI unit) so the entityTransform scaling value has to dynamically change. How would this compose with user specified entityTransform?
The intended mapping is from model space to CSS-relative element space, not to physical presentation space. The UA controls the subsequent presentation mapping, so moving or perceptually resizing the browser window does not itself require changing entityTransform.
Automatic fitting can update the transform when layout dimensions change. However, a script-assigned entityTransform replaces the fitted transform and disables automatic refitting in none mode; the UA should not continually rescale that authored matrix to compensate for physical presentation changes.
Activity
cabanier commentedon Oct 9, 2026
I think the specification should distinguish model space, element space, and physical presentation space.
For
boundingBoxCenterandboundingBoxExtents, meters seem appropriate because they describe the asset’s dimensions before fitting or applyingentityTransform.For
entityTransform, the specification should explicitly define the source and destination coordinate spaces. CSS pixels would be convenient for element-relative translations, but changing existing meter-based behavior could break Safari examples. If CSS-derived meters are intended, their conversion should be defined through CSS Values and Units:1 CSS px = 0.0254 / 96CSS-derived meters.These are not necessarily physical meters on the device. Browser zoom changes presentation and may affect automatic fitting through layout changes, but should not change the asset’s bounds or the unit definitions. Likewise,
devicePixelRatioaffects raster resolution, not the model-to-element unit conversion; authors should not multiply translations by DPR.My preference would be to retain metric model bounds and clarify the transform’s coordinate mapping, unit conversion, and relationship to zoom and physical presentation before changing the default units.
Fix model fitting and define coordinate-space units
cabanier commentedon Oct 9, 2026
/agenda
zachernuk commentedon Oct 9, 2026
I agree with Rik about the difference between the reference spaces: The in the model's frame of reference, i.e. the
boundingBoxExtentsandboundingBoxCentershould reflect the object-world values in meters. The web page is expressed in CSS pixels, which already has an analog for CSS meters, based on the CSS units discussions that have occurred in the past.The
entityTransform, then, should reflect the necessary mapping to convert from the meter-measured units of the object into the CSS-measured units of the page - and while something exists on the page, a UA should not be obliged to maintain a fixed mapping from the CSS units back to real-world units.VisionOS Safari and Quest Browser (and potentially more browsers) both currently support the perceptual resizing of a browser window without altering any reported parameters back to the user space, and that is probably for the best.
In addition to (or possibly instead of) adding it to the model spec, it is sketched out in the Spatial CSS proposal spec, which we're preparing an agenda to discuss in more detail at TPAC soon.
khufu-dev commentedon Oct 13, 2026
@cabanier @zachernuk It makes sense to have
boundingBoxExtentsandboundingBoxCenterto use real world meter (SI unit) in the model space before fitting.I'm not so clear about
entityTransform. IfentityTransformis a mapping from model space to presentation space and we specify that it uses CSS units such as CSS-derived meters then does that mean the scaling is dynamic? For example the zoom level or the distance of the browser window could change the size of CSS units in relation to real world meter (SI unit) so theentityTransformscaling value has to dynamically change. How would this compose with user specifiedentityTransform?cabanier commentedon Oct 13, 2026
The intended mapping is from model space to CSS-relative element space, not to physical presentation space. The UA controls the subsequent presentation mapping, so moving or perceptually resizing the browser window does not itself require changing
entityTransform.Automatic fitting can update the transform when layout dimensions change. However, a script-assigned
entityTransformreplaces the fitted transform and disables automatic refitting innonemode; the UA should not continually rescale that authored matrix to compensate for physical presentation changes.Fix model fitting and define coordinate-space units
Fix model fitting and define coordinate-space units
Ground model fitting in CSS and Geometry specifications
Fix model fit math (immersive-web#158)