Before:
After:
The Fix:
protected initialize() {
this.gl.enable(this.gl.DEPTH_TEST)
this.gl.depthFunc(this.gl.LEQUAL)
this.gl.enable(this.gl.BLEND)
this.gl.blendFuncSeparate(
this.gl.SRC_ALPHA, // RGB src factor
this.gl.ONE_MINUS_SRC_ALPHA, // RGB dst factor
this.gl.ONE, // Alpha src factor: take full αf
this.gl.ONE_MINUS_SRC_ALPHA // Alpha dst factor
);
this.gl.enable(this.gl.CULL_FACE)
this.gl.cullFace(this.gl.BACK)
}
Reason:
Incorrect formula: $\alpha_{\text{out}} = \alpha_f \times \alpha_f + \alpha_b \times (1 - \alpha_f)$
Correct formula: $\alpha_{\text{out}} = \alpha_f + \alpha_b ,(1 - \alpha_f)$
There are still other alpha issues, though... trying to fix them all.
Let me know if this is good for a PR.
Before:
After:
The Fix:
Reason:$\alpha_{\text{out}} = \alpha_f \times \alpha_f + \alpha_b \times (1 - \alpha_f)$ $\alpha_{\text{out}} = \alpha_f + \alpha_b ,(1 - \alpha_f)$
Incorrect formula:
Correct formula:
There are still other alpha issues, though... trying to fix them all.
Let me know if this is good for a PR.