ManimCommunity / ManimCommunity/manim
Non-deterministic behavior in TransformMatchingShapes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
Determining which letters get moved where appears to be dependent in some way on the system it's rendered on.
## Expected behavior
Using the example given in the documentation, when it is rendered via the Discord Manimator bot, some of the letters fade out and fade in instead of transforming smoothly, as if it couldn't find a matching shape for the source letter in the target. When I run the same script on my own machine, with the same flags as the Discord bot, it behaves as expected and shown in the documentation.
## How to reproduce the issue
```py
class Anagram(Scene):
def construct(self):
src = Text("the morse code")
tar = Text("here come dots")
self.play(Write(src))
self.wait(0.5)
self.play(TransformMatchingShapes(src, tar, path_arc=PI/2))
self.wait(0.5)
```
## Additional media files
This is the output of the bot. Specifically it's my instance of the bot running on an ARM7l processor, but by inspection the output of the other bot is identical.
https://user-images.githubusercontent.com/10787002/113528095-9359df00-958d-11eb-9eab-b0db1336d179.mp4
This is the output on my machine.
https://user-images.githubusercontent.com/10787002/113528153-c1d7ba00-958d-11eb-8d31-dbc40bed4f18.mp4
And this is the output shown in the docs.
https://user-images.githubusercontent.com/10787002/113528261-154a0800-958e-11eb-86fc-256390d47931.mp4
You'll notice slight discrepancies in the font between the videos from the bot and my machine, but the font used by the bot matches that shown in the docs, so I don't expect that to be the problem.
## System specifications
System Details
Discord bot:
- OS: `python:3.7-slim` Docker image
- RAM: 4GB
- Python version (`python/py/python3 --version`): 3.7.10
- Installed modules (provide output from `pip list`):
```
Package Version
------------------ -----------
colorama 0.4.4
colour 0.1.5
commonmark 0.9.1
decorator 4.4.2
glcontext 2.3.3
importlib-metadata 3.10.0
jedi 0.17.2
manim 0.5.0
ManimPango 0.2.5.post0
mapbox-earcut 0.12.10
moderngl 5.6.4
moderngl-window 2.3.0
multipledispatch 0.6.0
networkx 2.5.1
numpy 1.20.2
parso 0.7.1
Pillow 8.2.0
pip 21.0.1
pycairo 1.20.0
pydub 0.25.1
pyglet 1.5.15
Pygments 2.8.1
pyrr 0.10.3
rich 6.2.0
scipy 1.6.2
setuptools 54.1.1
six 1.15.0
tqdm 4.59.0
typing-extensions 3.7.4.3
wheel 0.36.2
zipp 3.4.1
```
My machine:
- OS: Windows 10 20H2
- RAM: 32GB
- Python version (`python/py/python3 --version`): 3.9.2
- Installed modules (provide output from `pip list`):
```
Package Version
----------------------------- ---------
alabaster 0.7.12
appdirs 1.4.4
astroid 2.5.2
atomicwrites 1.4.0
attrs 20.3.0
Babel 2.9.0
black 20.8b1
cfgv 3.2.0
click 7.1.2
colorama 0.4.4
colour 0.1.5
commonmark 0.9.1
coverage 5.5
cycler 0.10.0
decorator 4.4.2
Deprecated 1.2.12
distlib 0.3.1
docutils 0.16
filelock 3.0.12
flake8 3.9.0
flake8-bugbear 21.3.2
flake8-builtins 1.5.3
flake8-comprehensions 3.4.0
flake8-docstrings 1.6.0
flake8-logging-format 0.6.0
flake8-plugin-utils 1.3.1
flake8-pytest-style 1.4.0
flake8-rst-docstrings 0.0.14
gitdb 4.0.7
GitPython 3.1.14
glcontext 2.3.3
guzzle-sphinx-theme 0.7.11
identify 2.2.2
imagesize 1.2.0
iniconfig 1.1.1
isort 5.8.0
Jinja2 2.11.3
kiwisolver 1.3.1
lazy-object-proxy 1.6.0
manim 0.5.0
ManimPango 0.2.4
mapbox-earcut 0.12.10
MarkupSafe 1.1.1
matplotlib 3.3.4
mccabe 0.6.1
moderngl 5.6.4
moderngl-window 2.3.0
multipledispatch 0.6.0
mypy-extensions 0.4.3
networkx 2.5
nodeenv 1.5.0
numpy 1.19.5
packaging 20.9
pathspec 0.8.1
Pillow 8.1.2
pip 21.0.1
pluggy 0.13.1
pre-commit 2.11.1
py 1.10.0
pycairo 1.20.0
pycodestyle 2.7.0
pydocstyle 6.0.0
pydub 0.25.1
pyflakes 2.3.1
PyGithub 1.54.1
pyglet 1.5.15
Pygments 2.8.1
PyJWT 1.7.1
pylint 2.7.4
pyparsing 2.4.7
pyrr 0.10.3
pytest 6.2.2
pytest-cov 2.11.1
python-dateutil 2.8.1
pytz 2021.1
PyYAML 5.4.1
recommonmark 0.7.1
regex 2021.3.17
requests 2.15.1
restructuredtext-lint 1.3.2
rich 6.2.0
scipy 1.5.4
setuptools 52.0.0
six 1.15.0
smmap 4.0.0
snowballstemmer 2.1.0
Sphinx 3.5.3
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 1.0.3
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.4
toml 0.10.2
tqdm 4.59.0
typed-ast 1.4.2
typing-extensions 3.7.4.3
virtualenv 20.4.3
wheel 0.36.2
wrapt 1.12.1
```
FFMPEG
Discord bot:
```
pi@raspberrypi:~/manim $ docker run manimcommunity/manim:0.5.0 ffmpeg -version
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
```
My machine:
```
PS C:\Users\Abel> ffmpeg -version
ffmpeg version 4.3.2-2021-02-27-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
```
## Additional comments
I suspect that the problem has to do with the hash which determines if two shapes match. Details are given in the documentation of the parent class.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TransformMatchingShapes example in the issue and compare its output across the listed environments. Read the parent class documentation and inspect the shape-matching hash suspected by the reporter. Done means the same source and target letters are matched consistently across supported systems, with a regression test or other reproducible verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100