Conversation
|
Oh, this is a nice change. How hard is it to just do the actual alpha blending in our compositor so we can return rgba(0,0,0,0) and it does the same thing? Or do you feel that would be weird? |
ppkn
left a comment
There was a problem hiding this comment.
I haven't tested this. But I love it. Thanks for fixing this.
|
I didn't investigate turning on alpha blending, let me take a look and see if that would be better! |
- Add composite-canvas pipeline that un-premultiplies the textu color before blending, to prevent darkening of semi-transpare pixels. - Enabled by the above, use vec4(0.0) instead of discard in all draw pipelines, to allow proper alpha blending of anti-al edges and semi-transparent textures.
3d07d1f to
fd02db8
Compare
| float dist = length(surfaceXy.xy - center) - radius; | ||
| if (filled == 1) { | ||
| return (dist < thickness) ? color : vec4(0, 0, 0, 0); | ||
| return (dist < thickness) ? color : vec4(0.0); |
There was a problem hiding this comment.
(I was hoping not to crowd the diff with these changes by removing the discard change, but too late now)
| return texture(image, uv); | ||
| vec4 texColor = texture(image, uv); | ||
|
|
||
| if ((texColor.a < 0.01) || (texColor.r < 0.05 && texColor.g < 0.05 && texColor.b < 0.05)) { |
There was a problem hiding this comment.
Is this correct? What if an image actually has a black pixel that we want to be black -- does this break that?
There was a problem hiding this comment.
Yeah, good catch! I just noticed this in calibrate, fixing rn

We aren't alpha-blending the shaders in the final compositing step so even sections of the shaders in the
/drawdirectory that usevec4(0, 0, 0, 0)for transparency end up with black rectangles that bound the shapes they're drawing (e.g. the photo on the left). Usingdiscardwe get the behavior we expect, where overlapping shapes with transparent regions don't block each other.Before | After
Also works on images:
