3b1b / manim

Animation engine for explanatory math videos
MIT License
71.2k stars 6.25k forks source link

Video is squished on using aspect ratios other than 1920x1080 or 16:9. #1393

Open baljeetrathi opened 3 years ago

baljeetrathi commented 3 years ago

I want to render manim animations on a different aspect ratio instead of the default. So, I pass these values to the class.

class diffResolution(Scene):
    CONFIG={
        "camera_config":{"background_color": '#ffffff', "pixel_width": 1080, "pixel_height": 1920}
    }

and

class diffResolution(Scene):
    CONFIG={
        "frame_config":{"frame_shape": (9, 16)}
    }

However, the contents of the video still don't maintain the new aspect ratio. I run the following command in terminal.

manimgl example.py diffResolution -o -r 1080x1920

How can I get the video to display without any stretching in manim?

Thanks. :)

BUCKFAE commented 3 years ago

Were you able to resolve this I have the exact same problem.

baljeetrathi commented 3 years ago

@BUCKFAE I couldn't come up with a better solution so I directly made changes to the constants.py file like this:

ASPECT_RATIO = 9.0 / 16.0
FRAME_HEIGHT = 14.23
DEFAULT_PIXEL_HEIGHT = 1920
DEFAULT_PIXEL_WIDTH = 1080
germanzhu commented 1 year ago

I also encountered this problem. To fix it, you not only need to modify the constants.py file, but also the emit_gl_Position.glsl and get_gl_Position.glsl files in the shaders/inserts directory. In both of these files, change the line "const float ASPECT_RATIO = 16.0 / 9.0;" to "const float ASPECT_RATIO = 9.0 / 16.0;".

germanzhu commented 1 year ago

0001-fix-aspect_ratio-other-than-16-9-issue.patch

This patch is based on the manim master branch, which I modified to solve this issue.