[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Weird alpha issue.
- To: Benoit Jacob <bjacob@mozilla.com>
- Subject: Re: [Public WebGL] Weird alpha issue.
- From: Steve Baker <steve@sjbaker.org>
- Date: Sun, 31 Oct 2010 01:09:10 -0500
- Cc: public webgl <public_webgl@khronos.org>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=sjbaker.org; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; s=sjbaker.org; bh=IaG60 M0tZq8BmiqoAkHxhGvdxcY=; b=NkVdsdU5Wxf5yv6KeLU1tlID6JDeeTZ7RU7Vh akY7XNQtJU2jw5sc3YxJRfbU5HhQ9XacYMoKwjeqKBGtB2u27HjoKQsJJZHfgTsG /mdfsfJLCbPBEOYbhkvXUacC9m863T4oSZdFlK6lyufWWIqVqpNGsMRgLX1cyGuS 27WLc0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=sjbaker.org; h=message-id:date :from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=sjbaker.org; b=Ww4KNR+xoHr3IPNlsmo32zM4uqWuGfvJAO+HDNduVRPKEcdGU2FBzHTLtA6lF xdNC+5DVsUMt2R9YiCohgiM1l3xGtaXj0l3lgA6BDyb7aupoUmjc23yPrQ/ZcxNA ln02sTYhtkMUEAcHQSA9a74FbdkZGghfs+BXV2N2Qsb12g=
- In-reply-to: <1173064986.232075.1288493827189.JavaMail.root@cm-mail03.mozilla.org>
- References: <1173064986.232075.1288493827189.JavaMail.root@cm-mail03.mozilla.org>
- Sender: owner-public_webgl@khronos.org
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100520 SUSE/3.0.5 Thunderbird/3.0.5
On 10/30/2010 09:57 PM, Benoit Jacob wrote:
> ----- Original Message -----
>
>> I've been running with the validator turned on - turning it off didn't
>> make a bit of difference. FWIW: I'm getting the same results on the
>> Minefield/Linux 64bit version. I get no errors/warnings/messages in
>> the
>> Error console
>>
> Do you have webgl.verbose=true ?
>
>
Yes - of course!
>> and no GL errors in either Minefield or Chrome (although
>> I may not be checking absolutely everywhere).
>>
>> I've tried three chrome builds under Win7/32bit:
>>
>> 9.0.567.0 -- Canary, fresh install - 10 minutes ago.
>> 8.0.553.25 -- Dev channel.
>> 7.0.501.0(56955) -- I forget where this came from.
>>
>> ...always the same result, light smoke under Chrome, dark under
>> Minefield.
>>
>> Is it possible that some "default" setting in the WebKit stuff is set
>> differently by Chrome & Minefield? Maybe other tests have been
>> overriding that default - and I'm not?
>>
> I can't see any "setting" being relevant here. My only suspiscion at the moment is that Minefield might be rejecting your smoke texture (because of e.g. a NPOT issue) hence rendering it as black; since this part of the spec is tricky, there could be a bug in either implementation.
>
I was wondering (for example) about the premultiplied alpha setting in
the getContext call and in texImage2D. I'm not setting either of those
flags either way - so if one or other were defaulting incorrectly in one
or other browser...then maybe something like this would be the result.
The map is 1024x128 - so it's not an NPOT issue. Also, my fuzzy
particles have the right shape - so we know that it's rendering the
alpha plane OK - so it didn't completely reject the texture. You can
examine the texture for yourself - it's a simple PNG file, created in GIMP:
http://www.sjbaker.org/tmp/Smoke.png
It looks like a bunch of grey spotches - but there is actually quite a
lot of structure in the alpha plane.
Incidentally - I've tried switching it out for another texture and the
effect is the same. Looking around in my game 'world' I can see some
other subtle differences with other translucent textures. I'm
rendering text for some menus by rendering translucent letters onto a
colored background - and I had noticed a while back that the font looked
a lot better under Chrome than Minefield...but had kinda dismissed it.
Now that I look carefully, the subtle antialiassing in the font texture
maybe is being messed up for probably the same reason.
> If that is the case, you will definitely see a message in the error console when you run with webgl.verbose=true.
>
Sadly...no message.
I've also run most of the example programs out there - and they seem to
look identical in Chrome and Minefield even when they have a bunch of
layered translucent surfaces like I do. So there is probably something
unusual or "iffy" in my code - but I've stared at it pretty hard and it
refuses to admit any guilt!
Thanks for all your help - I'm starting to feel bad for giving you all
this negative info! Tomorrow I'll start working on narrowing this down
to a simple test case.
-- Steve
> Benoit
>
>
>> Unless there are other suggestions, I'll start reducing it down to the
>> simplest case I can and put up an example page. That might take a day
>> or two though - I have some other commitments to handle first.
>>
>> -- Steve
>>
>>
>> On 10/30/2010 04:54 PM, Benoit Jacob wrote:
>>
>>> I'm a bit clueless here; since you're getting this in current
>>> nightlies, we do share the same code with WebKit for WebGL texture
>>> format conversions, so that can't be the explanation.
>>>
>>> Does it make any difference when you go to about:config and toggle
>>> the preference webgl.shader_validator?
>>>
>>> Benoit
>>>
>>> ----- Original Message -----
>>>
>>>
>>>> I have Minefield set up to auto-update and it actually updated just
>>>> as
>>>> I
>>>> started typing this email - so I guess I have the latest! ...and
>>>> the
>>>> color is still much darker than in Chrome.
>>>>
>>>> I took a pair of side-by-side screenshots with the latest versions
>>>> of
>>>> both browsers:
>>>>
>>>> http://www.sjbaker.org/tmp/smoke_differences.png
>>>>
>>>> (It's kinda hard to see the smoke on the Minefield side - but it's
>>>> much
>>>> more obvious in motion).
>>>>
>>>> If it helps, the texture map is in:
>>>>
>>>> http://www.sjbaker.org/tmp/Smoke.png
>>>>
>>>> -- Steve
>>>>
>>>>
>>>>
>>>> On 10/30/2010 11:08 AM, Benoit Jacob wrote:
>>>>
>>>>
>>>>> What's your Minefield build? Two weeks ago, I landed important
>>>>> texture fixes that could be related to that. Please try with the
>>>>> latest nightly:
>>>>>
>>>>> http://nightly.mozilla.org/
>>>>>
>>>>> Benoit
>>>>>
>>>>> ----- Original Message -----
>>>>>
>>>>>
>>>>>
>>>>>> I'm running some particle system tests - using an RGBA .png image
>>>>>> with
>>>>>> fuzzy mid-grey translucent smoke puffs. There are lots of
>>>>>> particles
>>>>>> layered on top of each other.
>>>>>>
>>>>>> What's odd is that the smoke puff is much lighter in color on
>>>>>> Chrome
>>>>>> than it is on Minefield - even with both browsers running
>>>>>> side-by-side
>>>>>> on the exact same Win7/32bit/nVidia machine displaying the exact
>>>>>> same
>>>>>> scene. Everything else in the scene looks utterly identical in
>>>>>> the
>>>>>> two
>>>>>> windows.
>>>>>>
>>>>>> I'm kinda suspecting some funky thing going on with
>>>>>> pre-multiplied
>>>>>> alpha. Is someone messing with my texture?
>>>>>>
>>>>>> DETAILS:
>>>>>>
>>>>>> The setup for drawing is:
>>>>>>
>>>>>> gl.enable ( gl.DEPTH_TEST ) ;
>>>>>> gl.depthMask ( false ) ;
>>>>>> gl.enable ( gl.BLEND ) ;
>>>>>> gl.blendFunc ( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA ) ;
>>>>>>
>>>>>> ...with everything else left at default values.
>>>>>>
>>>>>> The frag shader says:
>>>>>>
>>>>>> float4 color = texture2D ( fire, UV ).rgba * (1.0-smokeAmount) +
>>>>>> texture2D ( smoke, UV ).rgba * smokeAmount ;
>>>>>> color.a *= timeVaryingAlpha ;
>>>>>> gl_FragColor = color ;
>>>>>> }
>>>>>>
>>>>>> ...and in this case, smokeAmount is 1.0 (so we should see only
>>>>>> the
>>>>>> smoke
>>>>>> map...and that works) and timeVaryingAlpha varies between 0.0 and
>>>>>> 1.0
>>>>>> as
>>>>>> you'd expect.
>>>>>>
>>>>>> My image 'onload' function says:
>>>>>>
>>>>>> gl.bindTexture ( gl.TEXTURE_2D, texture ) ;
>>>>>> gl.pixelStorei ( gl.UNPACK_FLIP_Y_WEBGL, true);
>>>>>> gl.texImage2D ( gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,
>>>>>> gl.UNSIGNED_BYTE, image ) ;
>>>>>> gl.generateMipmap ( gl.TEXTURE_2D ) ;
>>>>>> gl.bindTexture ( gl.TEXTURE_2D, null ) ;
>>>>>>
>>>>>> Help!
>>>>>>
>>>>>> -- Steve
>>>>>>
>>>>>> -----------------------------------------------------------
>>>>>> 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:
>>>>>>
>>>>>>
>>>>>>
-----------------------------------------------------------
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: