Re: [css3-background] Where we are with Blur value discussion

On Thu, Jul 22, 2010 at 11:04 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
> I'm not sure what you are saying about the 3-5%. Are you saying that the width of the outer portion of the blur can be within 3-5% of what the author specified? If so, I'd rather the numbers that were used as the stdev were jiggered 3-5% in order to have a more mundanely predictably blur width.

Nah, I mean that each pixel's color must be within 3-5% of the color
that would be created by a true gaussian blur.

> On the other hand, I am not seeing a outer-half blur width that is anywhere near the distance I specify with larger numbers. For instance, I just tried the following, in which I specified a 200px blur in Firefox:
>
> <div style="background-color:Red; height:300px; width:300px; -moz-box-shadow:450px 450px 200px black; margin-top:-150px; margin-left:-150px; "> </div>
>
> But instead of extending the shadow out by about 200px in each direction, it actually extended it out 151px on each of the horizontal sides, and 161px on each of the vertical sides. That's pretty weird. When I measured the values along the bottom of the blur, the bottom 10 rows of blur pixels (along the straight segment) were all the same (254, 254, 254), and the bottom 21 rows were 99% brightness. Maybe there were 40 or 50 more pixels outside of all that which is less than 1/256th opacity?

Right, everyone's current blur implementations do something strange
with the numbers.  With my suggested heuristic (approximate a gaussian
with stdev of half the blur length),  you hit the 2% point (that is,
the point where the blur is less than 2% opaque) at nearly exactly the
specified length (serioualy, +- 1px).  This has been verified out to a
200px length.  2% seems to be a good point for declaring the shadow
invisible - if you're blurring into white, that's roughly 250,250,250.

Using a length larger than 200px makes the numbers start changing
slightly, but I don't know if that's floating-point errors
accumulating on me or my heuristic breaking down (I need to grab
Haskell and throw some computable reals at the problem).  In any case,
by the time you're throwing around 300px blurs, you're certainly not
caring about the exact extent.

~TJ

Received on Friday, 23 July 2010 16:32:15 UTC