Re: [css shaders] Request for additional UA uniform variables

From: Chris Marrin <cmarrin@apple.com<mailto:cmarrin@apple.com>>
Date: Mon, 17 Oct 2011 10:30:38 -0700
To: Dean Jackson <dino@apple.com<mailto:dino@apple.com>>
Cc: Chris Subagio <chris.subagio@gmail.com<mailto:chris.subagio@gmail.com>>, "public-fx@w3.org<mailto:public-fx@w3.org>" <public-fx@w3.org<mailto:public-fx@w3.org>>
Subject: Re: [css shaders] Request for additional UA uniform variables


On Oct 14, 2011, at 5:15 PM, Dean Jackson wrote:

On 13/10/2011, at 4:16 AM, Chris Subagio wrote:
First, I'd like you to consider a clock parameter.
This would be a constantly increasing value that you could use for ambient animations, like say a waving flag or lapping waves.
Ideally this u_clock would be something like a (float) seconds since 1970, unix style. Someone might find a neat use for the actual absolute time, versus just an incrementing number. Unfortunately the precision on these constant registers can vary wildly from hardware to hardware, and it's unlikely that such large numbers would work. So perhaps running time since page load would be sufficient, with some way to also pass in the absolute clock time when the page was loaded?
As an optimization, the clock parameter could be an option enabled from the filter declaration (defaulted to off!), effectively switching the element from a transition only animation to an ambient animation.
I think this should be done with a parameter to the shader and animated via CSS.
Just adding it automatically is saying "please redraw this as often as possible for the entire time the effect is applied" which could kill battery. It's much better to be explicit. For example:
filter: shader("flag.vs", "flag.fs", ….. timeoffset 0);
animation: wave-the-flag 3s 10;  /* wave the flag over 3s, repeat 10 times */
keyframes {
from {
    filter: shader("flag.vs", "flag.fs", ….. timeoffset 0);
}
to {
    filter: shader("flag.vs", "flag.fs", ….. timeoffset 1);
}
}

Yeah, this looks right. It's too bad that we have to be so wordy with the keyframes. Imagine a lengthy filter where only one parameter of one filter function changes. And then imagine an animation with 20 or 30 keyframes. That's a lot of repeated text. It would be nice if we had some keyframe shorthand to allow us to elide all that text.

Yes, this issue of animating only some of the property value is something we have talked a lot about internally when working on the proposal. Our conclusion was that it is a general CSS animation issue found also when animating transforms, for example. So our thinking is that it is an issue that we should look at in a context that includes CSS shaders, but other things that have the same requirement/need.

Vincetn

Received on Monday, 17 October 2011 17:46:38 UTC