Skip to content

What is the default length unit for <model> APIs #155

Closed

Description

@khufu-dev

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?

Activity

  1. cabanier commented on Oct 9, 2026

    @cabanier
    Member

    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.

  2. added a commit that references this issue on Oct 9, 2026
    58f81e3
  3. cabanier commented on Oct 9, 2026

    @cabanier
    Member

    /agenda

  4. added
    agenda
    on Oct 9, 2026
  5. zachernuk commented on Oct 9, 2026

    @zachernuk
    Contributor

    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.

  6. khufu-dev commented on Oct 13, 2026

    @khufu-dev
    Author

    @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?

  7. cabanier commented on Oct 13, 2026

    @cabanier
    Member

    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.

  8. added 3 commits that reference this issue on Oct 13, 2026
    4c3d7f8
    19948d9
    4e52bc9
  9. added a commit that references this issue on Oct 14, 2026
    165f495
  10. removed
    agenda
    on Oct 16, 2026
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