From aaa28a2712d00288b668ad0344dbe4cf8dab3b87 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 17 Oct 2024 12:31:53 -0500 Subject: [PATCH 1/3] Discard transparent parts of textured surfaces --- manimlib/shaders/textured_surface/frag.glsl | 1 + 1 file changed, 1 insertion(+) diff --git a/manimlib/shaders/textured_surface/frag.glsl b/manimlib/shaders/textured_surface/frag.glsl index cb5f061cc5..de859c1679 100644 --- a/manimlib/shaders/textured_surface/frag.glsl +++ b/manimlib/shaders/textured_surface/frag.glsl @@ -26,6 +26,7 @@ void main() { float alpha = smoothstep(-dark_shift, dark_shift, dp); color = mix(dark_color, color, alpha); } + if (color.a == 0) discard; frag_color = finalize_color( color, From e3e87f611096c10c7b019df65fa116ffdea2dd99 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 17 Oct 2024 12:32:11 -0500 Subject: [PATCH 2/3] Update Pango requirement --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5f1eab8c8a..0737d3fc5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ colour ipython>=8.18.0 isosurfaces fontTools -manimpango>=0.4.0.post0,<0.5.0 +manimpango>=0.6.0 mapbox-earcut matplotlib moderngl From 199395b6e35ca0a0c80c07abd31e0a1461c845de Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 23 Oct 2024 17:40:31 -0500 Subject: [PATCH 3/3] Fix negative winding issue https://github.com/3b1b/manim/issues/2146 --- manimlib/shader_wrapper.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manimlib/shader_wrapper.py b/manimlib/shader_wrapper.py index 3de2612bfc..da657bdde5 100644 --- a/manimlib/shader_wrapper.py +++ b/manimlib/shader_wrapper.py @@ -446,6 +446,11 @@ def get_fill_canvas(ctx: moderngl.Context) -> Tuple[Framebuffer, VertexArray, Fr color = texture(Texture, uv); if(color.a == 0) discard; + if(color.a < 0){ + color.a = -color.a / (1.0 - color.a); + color.rgb *= (color.a - 1); + } + // Counteract scaling in fill frag color *= 1.06;