disable texture filtering experiment

This commit is contained in:
griffi-gh 2023-05-19 13:44:33 +02:00
parent b18756bb7e
commit af356565a3

View file

@ -9,26 +9,26 @@ flat in uint v_tex_index;
out vec4 color;
uniform sampler2DArray tex;
vec4 alpha_drop(vec4 b, vec4 a) {
if ((a.w < 1.) || (b.w < 1.)) {
return vec4(b.xyz, 0.);
}
return a;
}
// 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));
// HACKY texture "antialiasing"
color += (
alpha_drop(color, texture(tex, vec3(v_uv + vec2(.000, .001), v_tex_index))) +
alpha_drop(color, texture(tex, vec3(v_uv + vec2(.001, .000), v_tex_index))) +
alpha_drop(color, texture(tex, vec3(v_uv + vec2(.001, .001), v_tex_index))) +
alpha_drop(color, texture(tex, vec3(v_uv - vec2(.000, .001), v_tex_index))) +
alpha_drop(color, texture(tex, vec3(v_uv - vec2(.001, .000), v_tex_index))) +
alpha_drop(color, texture(tex, vec3(v_uv - vec2(.001, .001), v_tex_index)))
) / 6.;
color /= 2.;
// color += (
// alpha_drop(color, texture(tex, vec3(v_uv + vec2(.000, .001), v_tex_index))) +
// alpha_drop(color, texture(tex, vec3(v_uv + vec2(.001, .000), v_tex_index))) +
// alpha_drop(color, texture(tex, vec3(v_uv + vec2(.001, .001), v_tex_index))) +
// alpha_drop(color, texture(tex, vec3(v_uv - vec2(.000, .001), v_tex_index))) +
// alpha_drop(color, texture(tex, vec3(v_uv - vec2(.001, .000), v_tex_index))) +
// alpha_drop(color, texture(tex, vec3(v_uv - vec2(.001, .001), v_tex_index)))
// ) / 6.;
// color /= 2.;
// discard fully transparent pixels
if (color.w <= 0.0) {
discard;