[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] The Newly Expanded Color Space Issue



On Tue, Sep 7, 2010 at 7:19 PM, Steve Baker <steve@sjbaker.org> wrote:
> I think we have to take this one teeny-tiny step at a time.   First, let
> us establish once and for all what color space GLSL shaders operate in.
>
> Those of us who think that the color space of WebGL shaders can be
> anything other than linear...please convince me that you are right by
> clearly answering the following three blindingly simple and eminently
> practical questions.
>
> If you are right, then the answers should be easy, clear, intuitive and
> (above all) correct.
>
>    Suppose I want a 50% blend between two images, or to make it
>    super-simple: a 50% blend between a black texel and a white texel.
>    That's a good choice of example since (0,0,0) and (1,1,1) are black
>    and white, respectively, in both linear and sRGB space - so we don't
>    have to concern ourselves with the thorny question of what the input
>    texture color space is.   Here are three ways I could get  50/50
>    blend of two colors:
>
>
> QUESTION 1:
>
>    In a linear space GLSL, I could write:
>
>           x.rgb = mix ( vec3(0,0,0), vec3(1,1,1), 0.5 ) ;
>
>    (Just to save you looking it up, the OrangeBook says that mix(x,y,a)
>    returns "(x*(1-a)+y*a), ie the linear blend of x and y" - those are
>    the exact words at the very top of page 124 of my early edition -
>    and that is what every single GPU on the entire planet actually does).
>
>    In my world, x.rgb will be (0.5,0.5,0.5) - which (with what I'm
>    proposing) will automatically become pow(vec3(0.5,0.5,0.5),1.0/2.2)
>    when it's composited into the frame buffer to produce the
>    perceptually (and mathematically) correct result: (0.73,0.73,0.73).

Um... 0.73 in an sRGB frame buffer is (perceptually) 73% gray.  Right?
 I can't tell from the way you phrased the question whether 73% gray
is the wrong or right answer.

Are you asking for a result where the monitor emits 50% of the photons
of pure white, or a result that looks half as bright as pure white?

-T

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: