W3C home > Mailing lists > Public > www-svg@w3.org > November 2009

Re: [Rendering order] z-depth and 3D effects

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 19 Nov 2009 09:17:56 +1300
Message-ID: <11e306600911181217t247dc884n8dd68c9d5108fdf2@mail.gmail.com>
To: Steve Withall <steve@withallyourequire.com>
Cc: Jonathan Watt <jwatt@jwatt.org>, www-svg@w3.org
On Wed, Nov 18, 2009 at 10:33 PM, Steve Withall <steve@withallyourequire.com
> wrote:

> The biggest question on the subject of z is conceptual: should we regard it
> as abstract (and solely to enable us to render objects in the order we
> want), or should we regard it as a dimension one can move around in in the
> same way as the first two (and to use for a range of exciting other
> purposes)? (How's that for slanted phrasing!)


I think those are really quite different features with very different
use-cases and implementation requirements. Explicit 3D lets you do a lot of
cool stuff, but as Dr Olaf pointed out, one of the first things you're going
to want to do is introduce 3D transforms so that an object can have varying
depth, and then you need 3D rendering with z-buffers etc.

On the other hand, some use-cases for reordering 2D layers are not addressed
by "true 3D" features. For example, jwatt raised the case where you have an
SVG fragment that wants to reorder some of its children within a container,
e.g. using CSS z-index,
<svg>
  <g style="z-index: 10">...</g>
  <g>...</g>
  <g>...</g>
</svg>
Suppose you want to copy that fragment into the context of some larger SVG
document that contains its own uses of z-index. With CSS you can just set
"z-index:0" on the <svg> fragment and you get the results you want. With
other proposals, including yours, to avoid layers in the outer document
being interleaved with layers in the fragment, you have to renumber the
z-values in the fragment and/or the outer document.

Another point that jwatt raised which I'll repeat is that certain effects
make no sense if they can be "split" into different layers. E.g.
<g opacity="0.5">
  <g z="0">...</g>
  <g z="10">...</g>
</g>
<g z="5">...</g>
The group opacity model assumes you'll be able to paint the entire contents
of the translucent group atomically. But here you can't, so what would the
rendering be? Similar problems occur with 'mask' and 'filter'.

CSS z-index solves this with the concept of "stacking contexts" and saying
that certain properties other than just 'z-index' can introduce a stacking
context. But a concept like that doesn't make much sense if you're using
true 3D geometry to do your z-ordering.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]
Received on Wednesday, 18 November 2009 20:18:29 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:43 GMT