W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2011

Re: [css shaders] sorting?

From: Dean Jackson <dino@apple.com>
Date: Sun, 16 Oct 2011 08:32:02 -0700
Cc: "public-fx@w3.org" <public-fx@w3.org>
Message-id: <7DB48031-C257-4EA2-9E21-E304AB448DD7@apple.com>
To: Gregg Tavares <gman@google.com> (wrk)

On 14/10/2011, at 7:52 PM, Gregg Tavares (wrk) wrote:

> Just curious, How does the "Flipbook" sample on this page work?
> http://www.adobe.com/devnet/html5/articles/css-shaders.html
> The still image before you start playing the video shows approx 9 cards, each warpped, each casting shadows on the cards below it.
> To draw that correctly requires sorting the cards to make sure the card that appears on top is drawn last. Sorting is currently not defined in 3D css. It gets even harder through with CSS shaders. Correct sorting would require knowing at a minimum the extents of the changes to the geometry the CSS shader applied to the each element's plane mesh.

Without knowing exactly how Adobe did this, I'm not sure why you think there is anything other than regular element sorting happening here.

Here's how I would try to replicate the effect:

- Cards draw in document order (or, if you really wanted to sort them use z-index or maybe a z translation)
- each card is two elements, one for the face and one for the shadow. These have either slightly different shaders applied, or the same shader with slightly different parameters (to make the shadow movement slightly offset)

> It would also appear to require stencil buffers or render targets unless there are actually a elements for each card (one for the card, one for the shadow) but that makes the sorting even more tricky

I'm not sure why you think sorting is tricky. Can you explain?

Everything there is 2d. It's the effect that makes it look 3d. Notice that nothing intersects in 3d space, and the sorting order never changes. The poster frame for the video shows a good example of this: where the 4th card from the top of the stack should really be intersecting the one above if this was "real" 3d.


> Is there something in the proposal for how this is supposed to work?
> Is the demo using some other interesting technique?
Received on Sunday, 16 October 2011 15:32:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 22 June 2015 03:33:46 UTC