Clear alpha is affected by color

Check out this playground scene. When I change the clear color to white, the background’s alpha also increases, even though I set it to 0.

@mrlooi @sebavan

maybe you should change the transparency of the canvas

<canvas id="myCanvas" style="opacity: 0.5"></canvas>

I have updated the playground, you can see the different

1 Like

I found out that the alpha channel is not handled in the material, too, and had to write a shader for!

Just use “gl_FragColor = color;” in the shader and alpha is handled!

thy is probably related to alpha premultiplication on the canvas.

Currently, I have to hotfix using the following way:

if gl_FragColor.a <= 0.001 {
  gl_FragColor.rgb = vec3(0.);
}
1 Like

@sebavan
Is this a bug ?

this is expected as this is how the blending with the background of the canvas works.

How do I change the blending mode ?