diff --git a/kubi/shaders/world.frag b/kubi/shaders/world.frag index 6b8e768..48d2df0 100644 --- a/kubi/shaders/world.frag +++ b/kubi/shaders/world.frag @@ -10,21 +10,17 @@ out vec4 color; uniform sampler2DArray tex; uniform bool discard_alpha; -// vec4 alpha_drop(vec4 b, vec4 a) { -// if ((a.w < 1.) || (b.w < 1.)) { -// return vec4(b.xyz, 0.); -// } -// return a; -// } - void main() { // base color from texture color = texture(tex, vec3(v_uv, v_tex_index)); - // discard transparent pixels - if (color.w < (discard_alpha ? 0.01 : 0.5)) discard; + + // discard fully transparent pixels + if (discard_alpha ? (color.w < 0.5) : (color.w == 0.)) discard; + //basic "lighting" float light = abs(v_normal.x) + .8 * abs(v_normal.y) + .6 * abs(v_normal.z); color *= vec4(vec3(light), 1.); + //discard alpha if (discard_alpha) color.w = 1.; }