diff --git a/shaders/billboard/glsl.frag b/shaders/billboard/glsl.frag index 8a819a8..80ee67b 100644 --- a/shaders/billboard/glsl.frag +++ b/shaders/billboard/glsl.frag @@ -19,6 +19,7 @@ struct Material { sampler2D specularTex; sampler2D normalTex; bool hasNormalTex; + float alphaCutoff; }; // From vertex shader @@ -37,11 +38,15 @@ void main() { // Magic to make transparent sprites work, without blending // Somehow this also works with the shadow map render pass, which is a bonus - if (texel.a < 0.75) { + if (texel.a < u_mat.alphaCutoff) { discard; } vec3 colour = texel.rgb * u_mat.diffuse * v_lighting; + float e = u_mat.emissive.r + u_mat.emissive.g + u_mat.emissive.b; + if (e > 0.0) { + colour = texel.rgb * u_mat.emissive; + } // Gamma correction, as GL_FRAMEBUFFER_SRGB is not supported on WebGL colour = pow(colour, vec3(1.0 / u_gamma));