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

On Oct 12, 2011, at 10:16 AM, Chris Subagio wrote:

> Hi. Let me preface this by saying that I'm thrilled by this proposal. It sounds like a great way to leverage the hardware directly, and as video game programmer it rang all kinds of happy bells. 
> 
> I'd like to call attention to two additional uniforms that I think might be very useful.
> 
> 
> 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?
> 

I agree that we could not count on a wide enough value for an epochal clock value. OpenGL ES 2.0 only requires 16 bit integers and short floats. We could always pass in separate values: microseconds, milliseconds, seconds...

> 
> 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 like the idea of somehow tying the clock to the animation/transition timer.

> 
> 
> 
> The second parameter I'd like to propose is one to map from the filter space back to page space. 
> 
> I believe the currently proposed model operates on the notion that the filter region represents the actual render target surface, and that the projection matrix maps the 0-1 box model space onto that render target. What I'm looking for is an additional constant to let me map from this space back to the original page space, preferably back in units of pixels.
> 
> The idea is that with the knowledge of where you are on the page, you could do a number of interesting coordinated things, like apply animations that sweep across disparate elements on the page, or have filters that react to moving an element on the page using other CSS means. In effect, each separate element on the page would be a window into the effect space. 
> 
> Visualize a movie trailer page about hurricanes in which the corners of some panels flap in the wind. Gusts could travel across the page, hitting each corner in turn, creating a coordinated sense of motion without turning the whole page into one big effect.

This is a piece of information that would need to be maintained to do 3D CSS transforms, so I don't think it would be inefficient to supply this to the shader.

-----
~Chris
cmarrin@apple.com

Received on Friday, 14 October 2011 23:53:20 UTC