I am simply trying to ignore (key) the transparent pixels in GLSL. The alpha is never preserved once accessing the texture in GLSL.
setup:
this.renderer = new WebGLRenderer({
antialias: true,
alpha: true,
premultipliedAlpha: false,
logarithmicDepthBuffer: true,
});
this.renderer.setClearColor(0x000000,0.0);
const cvs = this.renderer.domElement;
cvs.style.backgroundColor = 'transparent';
this.renderTargetComposer = new WebGLRenderTarget(window.innerWidth, window.innerHeight, { format: RGBAFormat });
this.composer = new EffectComposer(this.renderer,this.renderTargetComposer);
this.composer.renderToScreen = false;
update:
this.composer.render();
this.shader.uniforms.tDiffuse.value = this.renderTargetComposer.texture;
glsl:
vec4 baseColorRGBA = texture2D(tDiffuse, vUv);
if( baseColorRGBA.a < 0.01 ){ //never true
discard;
}