Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

WIP: computeLight: rewriting diffuse alpha channel looks suspicious

Open illwieckz opened this issue 5 years ago • 5 comments

Light accumulation was done on all color components including alpha channel, that can't be good.


This change is Reviewable

illwieckz avatar Feb 26 '20 00:02 illwieckz

Does this fix anything?

DolceTriade avatar Feb 26 '20 01:02 DolceTriade

No, I haven't seen something being broken because of that (or I was not aware of), but that bug may be uncovered later when adding features or reorganizing code.

illwieckz avatar Feb 26 '20 01:02 illwieckz

This is just debugging code, right?

slipher avatar Feb 26 '20 06:02 slipher

Hmmm, I feel stupid, the alpha channel is not rewritten with light computation but with 1.0, which does not seems legit by the way, since 1.0 alpha channel is fully transparent.

And yes, it's debug code, I don't know how I managed to miss that. But anyway, setting a texture to be fully transparent to show the rgb channels seems wrong. For some reason, I'm not able to see the bug I expect.

This is the code before, this is not what I expect the code to render (and the glass displaying light color on borders if alpha channel is fully transparent?):

debug alpha light

This is the code after, which is what the code claims to do when there is no alpha channel rewrite:

debug alpha light

We may want to not blend the debug light color by setting it fully opaque (0 alpha channel)

This is the code when there is alpha channel rewrite to 0.0 (fully opaque), so at least we know the alpha channel is read:

debug alpha light

So, what to do, keep the legacy behavior (set alpha channel to 1), keep the alpha channel unmodified?, set the alpha channel to 0 (fully opaque)?

Note that in later case, the light color is not displayed the same, maybe it's not what we want.

In all case I plan to merge the very first commit that reword stuff to make it more readable.

illwieckz avatar Feb 26 '20 13:02 illwieckz

@cmf028 this code was introduced by you in bc079b95ef0342b159a1d00378d49a556416eec0, I would like to get your opinion on that.

illwieckz avatar Feb 26 '20 13:02 illwieckz