ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
21.54k stars 1.58k forks source link

Wrong colors on Cairo renderer #3627

Closed Batres3 closed 7 months ago

Batres3 commented 7 months ago

Description of bug / unexpected behavior

Running the quickstart example in the wiki generates wrong colors (using Cairo renderer)

Expected behavior

The colors are supposed to be a black background and a pink interior, as generated with the OpenGL renderer, which works fine

How to reproduce the issue

I'm running in a virtual environment, the following is the exact code I'm running using manim -pqh presentation.py --renderer=cairo CreateCircle, presentation.py being the name of the file.

Code for reproducing the problem ```py from manim import * class CreateCircle(Scene): def construct(self): circle = Circle() # create a circle circle.set_fill(PINK, opacity=0.5) # set the color and transparency self.play(DrawBorderThenFill(circle)) # show the circle on screen ```

Additional media files

Images/GIFs Incorrect: ![image](https://github.com/ManimCommunity/manim/assets/81390369/89e4da6d-50a4-4634-acd1-0ca3529b163a) Correct: ![image](https://github.com/ManimCommunity/manim/assets/81390369/c97f3ac5-5918-4f58-bfbc-770b6cfb1c40)

Logs

Terminal output ``` Manim Community v0.18.0 [02/20/24 13:49:03] DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.012607 s. hashing.py:362 DEBUG Hash generated : 3529212410_3553404193_223132457 hashing.py:365 DEBUG List of the first few animation hashes of the cairo_renderer.py:87 scene: ['3529212410_3553404193_223132457'] [02/20/24 13:49:06] INFO Animation 0 : Partial movie file written scene_file_writer.py:527 in '/home/batres/Dev/RandomPythonStuff/Prese ntationEM/media/videos/presentation/1080p 60/partial_movie_files/CreateCircle/35292 12410_3553404193_223132457.mp4' DEBUG Animation with empty mobject animation.py:174 DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.003557 s. hashing.py:362 DEBUG Hash generated : 3040924799_2923979111_1733882499 hashing.py:365 DEBUG List of the first few animation hashes of the cairo_renderer.py:87 scene: ['3529212410_3553404193_223132457', '3040924799_2923979111_1733882499'] [02/20/24 13:49:16] INFO Animation 1 : Partial movie file written scene_file_writer.py:527 in '/home/batres/Dev/RandomPythonStuff/Prese ntationEM/media/videos/presentation/1080p 60/partial_movie_files/CreateCircle/30409 24799_2923979111_1733882499.mp4' INFO Combining to Movie file. scene_file_writer.py:617 DEBUG Partial movie files to combine (2 files): scene_file_writer.py:561 ['/home/batres/Dev/RandomPythonStuff/Pres entationEM/media/videos/presentation/1080 p60/partial_movie_files/CreateCircle/3529 212410_3553404193_223132457.mp4', '/home/batres/Dev/RandomPythonStuff/Prese ntationEM/media/videos/presentation/1080p 60/partial_movie_files/CreateCircle/30409 24799_2923979111_1733882499.mp4'] INFO scene_file_writer.py:735 File ready at '/home/batres/Dev/RandomPythonStuff/Prese ntationEM/media/videos/presentation/1080p 60/CreateCircle.mp4' INFO Rendered CreateCircle scene.py:241 Played 2 animations INFO Previewed File at: file_ops.py:227 '/home/batres/Dev/RandomPythonStuff/PresentationEM /media/videos/presentation/1080p60/CreateCircle.mp 4' ```

System specifications

System Details - OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Pop!_OS 22.04 LTS x86_64 - RAM: 15382MB - Python version (`python/py/python3 --version`): Python 3.10.12 - Installed modules (provide output from `pip list`): ``` Package Version ------------------- -------- asttokens 2.4.1 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 click-default-group 1.2.4 cloup 2.1.2 decorator 5.1.1 exceptiongroup 1.2.0 executing 2.0.1 glcontext 2.5.0 idna 3.6 ipython 8.21.0 isosurfaces 0.1.0 jedi 0.19.1 labhelper 0.0.6 manim 0.18.0 ManimPango 0.5.0 mapbox-earcut 1.0.1 markdown-it-py 3.0.0 matplotlib-inline 0.1.6 mdurl 0.1.2 moderngl 5.10.0 moderngl-window 2.4.4 mpmath 1.3.0 multipledispatch 1.0.0 networkx 3.2.1 numpy 1.26.4 pandas 2.2.0 parso 0.8.3 pexpect 4.9.0 Pillow 9.5.0 pip 22.0.2 prompt-toolkit 3.0.43 ptyprocess 0.7.0 pure-eval 0.2.2 pycairo 1.26.0 pydub 0.25.1 pyglet 2.0.10 Pygments 2.17.2 pyperclip 1.8.2 pyrr 0.10.3 python-dateutil 2.8.2 pytz 2024.1 requests 2.31.0 rich 13.7.0 scipy 1.12.0 screeninfo 0.8.1 setuptools 59.6.0 six 1.16.0 skia-pathops 0.7.4 srt 3.5.3 stack-data 0.6.3 svgelements 1.9.6 sympy 1.12 tqdm 4.66.2 traitlets 5.14.1 typing_extensions 4.9.0 tzdata 2024.1 urllib3 2.2.1 watchdog 3.0.0 wcwidth 0.2.13 ```
LaTeX details + LaTeX distribution (e.g. TeX Live 2020): pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian) + Installed LaTeX packages:
FFMPEG Output of `ffmpeg -version`: ``` ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11 (Ubuntu 11.2.0-19ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 ```

Additional comments

uwezi commented 7 months ago

I cannot reproduce your problem... you should not need to use renderer=cairo since this is the default setting, but with and without everything renders just fine on my system... On the other hand I don't know your operating system, but if this was a general problem in Manim it would have been reported a long time ago.

Could it be a problem with your video player? Try to watch the generated .mp4-file with a different viewer.

Also: do you get the same result when you let Manim just generate a static image using the following code:

class CreateCircle(Scene):
    def construct(self):
        circle = Circle()  # create a circle
        circle.set_fill(PINK, opacity=0.5)  # set the color and transparency
        self.add(circle)  # show the circle on screen

image

Batres3 commented 7 months ago

Could it be a problem with your video player? Try to watch the generated .mp4-file with a different viewer.

Wow, you're entirely right, apparently Totem, the default video player in PopOS! has some issues. I never would've thought of that, thanks, I changed it to VLC and it works like a charm.