Re: [css-shaders] CSS shaders for custom filters (ACTION-3072)

On Oct 4, 2011, at 11:22 AM, Gregg Tavares (wrk) wrote:

> 
> 
> On Mon, Oct 3, 2011 at 8:12 PM, Dean Jackson <dino@apple.com> wrote:
> 
> On 04/10/2011, at 7:16 AM, Gregg Tavares (wrk) wrote:
> 
> > What about mouse input?
> >
> > It seems like for this proposal to actually work as other CSS works
> > you'd need to run mouse and touch events through the vertex shader so
> > that you get the mouse coordinates translated through the shader.
> >
> > Yes? No?
> 
> When I first read this I thought you were asking for the current pointer coordinate to be provided as a default input to the shader pipeline. That's an interesting idea and might avoid scripting in some cases (you could always do it with custom parameters in the proposal Vincent sent). We'd need to decide which coordinates though - screen, page, element.
> 
> But that's not what you're asking, I think :)
> 
> Maybe this will make it clearer.
> 
> This page (only works in Safari currently)
> http://greggman.com/downloads/examples/interactive-3d-css-element.html
> 
> Is transforming an iframe. Note that the iframe is completely interactive. You can click on the links, you can type in the search box, etc...
> 
> CSS shaders would allow me to morph that iframe into a torus. (see mockup screenshot here: http://greggman.com/downloads/examples/interactive-css-shader-element-mockup.png) 

We do that by reverse mapping the mouse positions from global into local coordinates. That's easy with a single (or composite) transform. It's impossible for pixels that are altered by a vertex or fragment shader. You'd essentially have to run the shaders backwards to get them to tell you where a given point is in the local coordinate space. I know of no hardware that can do that. I haven't seen it anyway...

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

Received on Thursday, 6 October 2011 01:13:01 UTC