You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.
Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.
The author of this post has marked a post as an answer.
Go to answer
uniform sampler2D texture0;
varying mediump vec2 uvVarying;
varying mediump vec4 colorVarying;
uniform float Alpha; // shader constant to set the refernece alpha level - could use colourVarying.a if wanted??
gl_FragColor = texture2D(texture0, uvVarying) * colorVarying;
if (gl_FragColor.a<Alpha) discard; // throw away the pixel if is alpha isnt large enough
gl_FragColor.a = 1.0; // ensure the alpha that is drawn to the screen is fully opaque - no varying alpha in the final image
Login to post a reply