Bug 17433 - Term 'accumulated 3D transformation matrix' misleading
Term 'accumulated 3D transformation matrix' misleading
Status: NEW
Product: CSS
Classification: Unclassified
Component: Transforms
unspecified
PC All
: P2 normal
: ---
Assigned To: Dean Jackson
public-css-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-07 05:13 UTC by Dirk Schulze
Modified: 2013-05-20 15:53 UTC (History)
6 users (show)

See Also:


Attachments
Mapping from coordinates to different coordinate systems (133.04 KB, image/png)
2012-06-07 05:13 UTC, Dirk Schulze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2012-06-07 05:13:05 UTC
Created attachment 1141 [details]
Mapping from coordinates to different coordinate systems

The spec currently says, that a new 3D rendering context gets created, when the property 'transform-style' is set to 'preserve-3d', and the element is not not part of an 3D rendering context. If it is part, it is a containing block and extends the existing 3D rendering context.

Assume that div boxes and body elements in the following examples have 3D transforms:

<body>
  <div style="transform-style: preserve-3d;"></div>
  <div style="transform-style: preserve-3d;"></div>
</body>

Both div boxes fulfill the requirement for a 3d rendering context, therefore a new 3d rendering context is created for both. Correct?

<body>
  <div style="transform-style: preserve-3d;">
    <div style="transform-style: preserve-3d;">
      <div style="transform-style: preserve-3d;">
      </div>
    </div>
  </div>
</body>

Just the first div fulfills the requirement, therefore just for the first div a 3d rendering context is created. The other elements are containing blocks and contribute to the existing context.

<body style="transform-style: preserve-3d;">
  <div style="transform-style: preserve-3d;"></div>
  <div style="transform-style: preserve-3d;"></div>
</body>

In this example the body created a 3D rendering context and the div boxes just contribute to the existing 3D rendering context.

One understanding problem that I had on reading the section about creating a 3D rendering context is the following sentence: "An element that establishes a 3D rendering context also participates in that context." What does it mean for the local coordinate space of the root element of the rendering context? The transformation must be applied to the element as well before rendering the element to this context? Does it mean that the 3D rendering context is initially in the the same coordinate space as the parent element of the element that establishes the 3D rendering context? If my understanding is correct, can we say that more explicitly? If my understanding is wrong. Does the spec describe how to map the 3d rendering context itself into the coordinate space of the parent element of the element that established the 3d rendering context?

Differences "accumulated 3D transformation matrix" and "current transformation function"

Obviously 'accumulated 3D transformation matrix' does just describe the transform till the root element in the 3D rendering context, but not beyond that. The CTM is defined to be "A matrix that defines the mapping from the local coordinate system into the viewport coordinate system.". I wonder if the CTM makes sense for elements within a 3D rendering context. I would say that it does. I wonder why we define 'accumulated 3D transformation matrix' at all? Why not just use CTM?

Because of this difference it is _not_ specified how to apply the perspective property to elements that neither establish a new 3D rendering context, nor contribute to one. This explanation belongs to 'accumulated 3D transformation matrix' currently.

Instead we should just define how points can get mapped from the current coordinate system to the previous one in general - like the image with formulas that I attached. The term 3D rendering context just describes that elements can be drawn beyond the CSS rendering model, but does not influence the way we map coordinates to the coordinate system of the viewport.
Comment 1 Simon Fraser 2012-07-12 18:43:07 UTC
>  The term 3D rendering context just describes that elements can
be drawn beyond the CSS rendering model, but does not influence the way we map
coordinates to the coordinate system of the viewport.

Well, it does because you don't flatten when you're mapping through elements in a 3DRC, but you do for all other elements.
Comment 2 Dirk Schulze 2012-10-30 10:29:37 UTC
Dean took an action to write two or three sentences how to flatten a 3D context into a texture and draw this texture in the current local coordinate system. Thanks Dean! :)
Comment 3 Dirk Schulze 2013-05-20 15:53:40 UTC
(In reply to comment #2)
> Dean took an action to write two or three sentences how to flatten a 3D
> context into a texture and draw this texture in the current local coordinate
> system. Thanks Dean! :)

In a way, the behavior is not very different from drawing a WebGL context on a document. Is there something that can be borrowed from the WebGL spec?