[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Compositing with HTML
On Fri, Jan 8, 2010 at 5:36 PM, Chris Marrin <email@example.com>
> Just for clarification how can you get out of range pre-multiplied
On Jan 8, 2010, at 5:20 PM, Kenneth Waters wrote:
>> What I mean by that is that color always clamps to 1.0, so if you give oversaturated colors (1.0 when alpha is 0.5, for instance), and blending results in a color greater than 1.0, the result is clamped to 1.0. I believe that is what the HTML compositor specifies and that's what WebKit does when compositing. I think Firefox is doing something different. But I'll wait for Vlad to chime in...
> values into HTML without WebGL?
That's a good question. The 2D Canvas API can do it using the compositing operators. There they talk about clamping to 1. SVG has similar capabilities. CSS Colors are given in non-premultiplied form and are clamped to 0-1 (or 0-255 if given in that form). So you could say that all the source elements are constrained to have legal premultiplied colors.
I'm confused. Clamping to 1 doesn't guarantee that it's a legal premultiplied color, does it? Or are you saying that the 2d canvas, svg and css take non-premultiplied colors as input, clamp all the channels to 1 and convert them to pre-mulitplied behind the scenes?
That's not the case (currently) in WebGL, so maybe we should take measures to ensure that oversaturated values can't make it into the WebGL color buffer?
That might be hard and non-performant. So it might be better if we just define what happens in the HTML compositor when oversaturated values are presented. This is probably more properly in the Canvas spec though.