From 0144709e037db1454f7e2358559221cbc1c47872 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 19 Nov 2024 14:33:14 +0300 Subject: [PATCH] add 'u_alphaClip' to entity shader --- res/shaders/entity.glslf | 3 ++- src/graphics/render/WorldRenderer.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/res/shaders/entity.glslf b/res/shaders/entity.glslf index 5da4142c..143b3eaa 100644 --- a/res/shaders/entity.glslf +++ b/res/shaders/entity.glslf @@ -9,6 +9,7 @@ uniform samplerCube u_cubemap; uniform vec3 u_fogColor; uniform float u_fogFactor; uniform float u_fogCurve; +uniform bool u_alphaClip; void main() { vec3 fogColor = texture(u_cubemap, a_dir).rgb; @@ -16,7 +17,7 @@ void main() { float depth = (a_distance/256.0); float alpha = a_color.a * tex_color.a; // anyway it's any alpha-test alternative required - if (alpha < 0.5f) + if (alpha < (u_alphaClip ? 0.5f : 0.2f)) discard; f_color = mix(a_color * tex_color, vec4(fogColor,1.0), min(1.0, pow(depth*u_fogFactor, u_fogCurve))); diff --git a/src/graphics/render/WorldRenderer.cpp b/src/graphics/render/WorldRenderer.cpp index 0593305d..30284187 100644 --- a/src/graphics/render/WorldRenderer.cpp +++ b/src/graphics/render/WorldRenderer.cpp @@ -153,6 +153,7 @@ void WorldRenderer::renderLevel( frustumCulling->update(camera.getProjView()); } + entityShader.uniform1i("u_alphaClip", true); level.entities->render( assets, *modelBatch,