manim icon indicating copy to clipboard operation
manim copied to clipboard

OpenGL Bug for small elements rendering too big

Open MrDiver opened this issue 2 years ago • 0 comments

Description of bug / unexpected behavior

I do not know why this happens by now but it must probably be some error in the shader somewhere i kind of suspect that it is the anti aliasing which breaks that part because it doesn't scale with the objects? But that might also be a red hairing so please do your own research on why this might be happeing

Expected behavior

1080p Renderings

Rendered with OpenGL

Test2_ManimCE_v0 17 3

Rendered with OpenGL AntiAliasing kind of removed

Test2_ManimCE_v0 17 3

Rendered with Cairo

Test2_ManimCE_v0 17 3

4k Renderings

Rendered with OpenGL

Opengl4k

Rendered with OpenGL AntiAliasing kind of removed

OpenGL4kNoAlias

Rendered with Cairo

Cairo4k

In those two screenshots you can clearly see that theres a problem with rendering at small size for OpenGL where everything is just a big blob of color instead of clearly defined shapes. The red points are for visualizing that problem because they should disappear at some point because they are so small.

But rendering without antialiasing is not really feasible if we want to have a good looking result so i think the Antialiasing might add a weird extra width around the shapes.

How to reproduce the issue

class SizeGlitch(MovingCameraScene):
    def construct(self):
        for i in range(1, 10):
                text = Text(
                    f"20",
                    # font="Sans",
                    weight=BOLD,
                    use_svg_cache=True,
                ).shift(LEFT * 5 + RIGHT * i)
                text2 = (
                    Text(str(0.1 / (i * 10)))
                    .shift(DOWN)
                    .scale(0.1)
                    .shift(LEFT * 5 + RIGHT * i)
                )
                text2 = Text("A").shift(UP).scale(1 / i).shift(LEFT * 5 + RIGHT * i)
    
                dots = [
                    Dot(p, radius=0.1 / (i * 10), color=RED) for p in text.get_all_points()
                ]
                self.add(text, text2, *dots)

MrDiver avatar Aug 08 '23 00:08 MrDiver