manim icon indicating copy to clipboard operation
manim copied to clipboard

SVG rounded caps/joins are rendered as sharp

Open Algorhythm-sxv opened this issue 1 year ago • 2 comments

Description of bug / unexpected behavior

A line art SVG created in Inkscape with rounded caps/joins is rendered with sharp caps/joins

Expected behavior

The caps/joins are correctly rounded

How to reproduce the issue

Create an SVGMobject with the attached SVG file and render it

Code for reproducing the problem
from manim import *

class AnimateLogo(Scene):
    def construct(self):
        border = SVGMobject("border.svg")
        border.set_stroke(WHITE)

        self.play(Write(border), lag_ratio=0.5, run_time=2.0)
        self.wait(10.0)

Additional media files

Images/GIFs

https://github.com/ManimCommunity/manim/assets/7611728/933b3852-36d7-4b33-886d-187affc76bd9

https://github.com/ManimCommunity/manim/assets/7611728/98e33b33-2aab-418b-b81c-354f5272d1a0

Logs

Terminal output
sxv@hierarch ~/Videos/manim/xg_logo_animate manim -pqh scene.py AnimateLogo -v DEBUG
Manim Community v0.18.0

[01/06/24 00:26:57] DEBUG    Hashing ...                                                                                                                                                              hashing.py:350
                    DEBUG    Hashing done in 0.024715 s.                                                                                                                                              hashing.py:362
                    DEBUG    Hash generated :  3529212410_1921715014_223132457                                                                                                                        hashing.py:365
                    DEBUG    List of the first few animation hashes of the scene: ['3529212410_1921715014_223132457']                                                                           cairo_renderer.py:87
Animation 0: Write(SVGMobject):  91%|█████████████████████████████████████████████████████████████████████████████████████████████████████████��██████████████████████             | 109/120 [00:02<00:00, 53.46it/s
�Animation 0: Write(SVGMobject):  96%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏     | 115/120 [00:02<00:00, 54.19it/s
[01/06/24 00:26:59] INFO     Animation 0 : Partial movie file written in                                                                                                                    scene_file_writer.py:527
                             '/home/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/partial_movie_files/AnimateLogo/3529212410_1921715014_223132457.mp4'                                                
                    DEBUG    Animation with empty mobject                                                                                                                                           animation.py:174
                    DEBUG    Hashing ...                                                                                                                                                              hashing.py:350
                    DEBUG    Hashing done in 0.013392 s.                                                                                                                                              hashing.py:362
                    DEBUG    Hash generated :  3040924799_2116254338_743700349                                                                                                                        hashing.py:365
                    DEBUG    List of the first few animation hashes of the scene: ['3529212410_1921715014_223132457', '3040924799_2116254338_743700349']                                        cairo_renderer.py:87
[01/06/24 00:27:04] INFO     Animation 1 : Partial movie file written in                                                                                                                    scene_file_writer.py:527
                             '/home/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/partial_movie_files/AnimateLogo/3040924799_2116254338_743700349.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/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/partial_movie_files/AnimateLogo/3529212410_1921715014_223132457.mp4',                                              
                             '/home/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/partial_movie_files/AnimateLogo/3040924799_2116254338_743700349.mp4']                                               
                    INFO                                                                                                                                                                    scene_file_writer.py:735
                             File ready at '/home/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/AnimateLogo.mp4'                                                                                      
                                                                                                                                                                                                                    
                    INFO     Rendered AnimateLogo                                                                                                                                                       scene.py:241
                             Played 2 animations                                                                                                                                                                    
                    INFO     Previewed File at: '/home/sxv/Videos/manim/xg_logo_animate/media/videos/scene/1080p60/AnimateLogo.mp4'                                                                  file_ops.py:227
VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b)
[000055fa3d569550] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
sxv@hierarch ~/Videos/manim/xg_logo_animate libva error: vaGetDriverNames() failed with unknown libva error
[00007f64f0001f50] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
[00007f64f0001f50] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f64f0001f50] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f64f0001f50] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f6508c0e6a0] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library  545.29.06  Thu Nov 16 01:46:47 UTC 2023 for hardware decoding

Rounded SVG: Outline.svg

Sharp rendered video: OutlineSharp.png

System specifications

System Details
  • Arch Linux
  • RAM: 24GB
  • Python version (python/py/python3 --version): 3.11.6
  • Installed modules (provide output from pip list):
sxv@hierarch ~/Videos/manim/xg_logo_animate pip list
Package                       Version
----------------------------- ----------------------------------
alabaster                     0.7.13
annotated-types               0.6.0
appdirs                       1.4.4
arandr                        0.1.11
asciidoc                      10.2.0
attrs                         23.1.0
autocommand                   2.2.2
Babel                         2.12.1
backports.cached-property     1.0.2
beautifulsoup4                4.12.2
blessed                       1.20.0
btrfsutil                     6.6.3
build                         1.0.3
CacheControl                  0.13.1
cachetools                    5.3.2
cachy                         0.3.0
certifi                       2023.11.17
cffi                          1.16.0
chardet                       5.2.0
charset-normalizer            3.3.2
cleo                          2.1.0
click                         8.1.7
click-default-group           1.2.4
cloup                         3.0.4
colorama                      0.4.6
colour                        0.1.5
contourpy                     1.2.0
coverage                      6.5.0
crashtest                     0.4.1
cryptography                  41.0.7
cssselect                     1.2.0
cycler                        0.12.1
Cython                        3.0.7
dbus-python                   1.3.2
decorator                     5.1.1
distlib                       0.3.8
distro                        1.8.0
docopt                        0.6.2
docutils                      0.20.1
dulwich                       0.21.7
entrypoints                   0.4
evdev                         1.6.1
fastjsonschema                2.19.1
filelock                      3.13.1
flake8                        6.1.0
fonttools                     4.47.0
future                        0.18.3
glcontext                     2.5.0
google-api-core               2.15.0
google-auth                   2.25.2
googleapis-common-protos      1.62.0
gufw                          24.4.0
html5lib                      1.1
hypothesis                    6.92.2
idna                          3.5
imagesize                     1.4.1
importlib-metadata            5.0.0
inflect                       7.0.0
iniconfig                     2.0.0
inquirer                      3.1.3
installer                     0.7.0
isosurfaces                   0.1.0
jaraco.classes                3.3.0
jaraco.context                4.3.0
jaraco.functools              3.9.0
jaraco.text                   3.11.1
jeepney                       0.8.0
Jinja2                        3.1.2
jsonschema                    4.20.0
jsonschema-specifications     2023.12.1
keyring                       24.3.0
keyutils                      0.6
kiwisolver                    1.4.5
lark                          1.1.8
lensfun                       0.3.4
libevdev                      0.11
libtorrent                    2.0.9
lockfile                      0.12.2
lxml                          4.9.2
manim                         0.18.0
ManimPango                    0.5.0
mapbox_earcut                 1.0.1
markdown-it-py                3.0.0
MarkupSafe                    2.1.3
matplotlib                    3.8.2
mccabe                        0.7.0
mdurl                         0.1.2
menulibre                     2.2.3
meson                         1.3.1
moddb                         0.10.0
moderngl                      5.9.0
moderngl-window               2.4.5
more-itertools                10.1.0
msgpack                       1.0.5
multipledispatch              1.0.0
networkx                      3.2.1
numpy                         1.26.2
ordered-set                   4.1.0
packaging                     23.2
pandas                        1.5.3
perf                          0.1
pexpect                       4.9.0
piexif                        1.1.3
Pillow                        10.1.0
pip                           23.3.2
pkginfo                       1.9.6
platformdirs                  4.1.0
pluggy                        1.3.0
ply                           3.11
poetry                        1.7.1
poetry-core                   1.8.1
poetry-plugin-export          1.5.0
pooch                         1.8.0
protobuf                      4.25.1
psutil                        5.9.6
ptyprocess                    0.7.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pybind11                      2.11.1
pycairo                       1.25.1
pycodestyle                   2.11.1
pycparser                     2.21
pydantic                      2.5.2
pydantic_core                 2.14.5
pydub                         0.25.1
pyflakes                      3.1.0
pyglet                        2.0.10
Pygments                      2.17.2
PyGObject                     3.46.0
pyOpenSSL                     23.3.0
pyparsing                     3.1.1
pyproject_hooks               1.0.0
PyQt5                         5.15.10
PyQt5-sip                     12.13.0
pyrate-limiter                3.1.0
pyrr                          0.10.3
pyrsistent                    0.19.3
pyserial                      3.5
pytest                        7.4.4
python-dateutil               2.8.2
python-distutils-extra        2.39
python-editor                 1.0.4
pytz                          2023.3.post1
pyxdg                         0.28
PyYAML                        6.0.1
ranger-fm                     1.9.3
rapidfuzz                     3.6.0
readchar                      4.0.5
referencing                   0.32.0
requests                      2.31.0
requests-toolbelt             1.0.0
rich                          13.7.0
rpds-py                       0.15.2
rsa                           4.9
SciPy                         1.11.4
scour                         0.38.2
screeninfo                    0.8.1
SecretStorage                 3.3.3
setuptools                    69.0.3
setuptools-scm                8.0.4
shellingham                   1.5.0.post1
six                           1.16.0
skia-pathops                  0.8.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.5
Sphinx                        7.2.6
sphinx-rtd-theme              1.3.0
sphinxcontrib-applehelp       1.0.7
sphinxcontrib-devhelp         1.0.5
sphinxcontrib-htmlhelp        2.0.4
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.6
sphinxcontrib-serializinghtml 1.1.9
srt                           3.5.3
svgelements                   1.9.6
tomli                         2.0.1
tomlkit                       0.12.3
toolz                         0.12.0
tqdm                          4.66.1
trove-classifiers             2023.12.1
typing_extensions             4.9.0
uc-micro-py                   1.0.2
udiskie                       2.5.1
ufw                           0.36.2
urllib3                       1.26.18
validate-pyproject            0.13.post1.dev0+gb752273.d20230520
vimiv                         0.9.0
virtualenv                    20.25.0
watchdog                      2.3.0
wcwidth                       0.2.6
webencodings                  0.5.1
wheel                         0.42.0
xinput-gui                    0.3.1
zipp                          3.17.0
zstandard                     0.22.0

FFMPEG

Output of ffmpeg -version:

sxv@hierarch ~/Videos/manim/xg_logo_animate ffmpeg -version
ffmpeg version n6.1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13.2.1 (GCC) 20230801
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --
enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --ena
ble-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-li
bplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --e
nable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-
libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100

Additional comments

Algorhythm-sxv avatar Jan 05 '24 23:01 Algorhythm-sxv

class roundround(Scene):
    def construct(self):
        svg = SVGMobject(r"bilder\outlineround.svg").set_stroke(color=WHITE,width=10).scale_to_fit_height(7)
        for obj in svg:
            obj.joint_type=LineJointType.ROUND
        self.add(svg)

uwezi avatar Jan 06 '24 09:01 uwezi

Thanks @uwezi , good to know there's a workaround.

I feel there is still an issue here though, as the joins should be parsed as round from the file. I'm not too familiar with SVG, but is this a missing feature in the SVG parser?

Algorhythm-sxv avatar Jan 06 '24 10:01 Algorhythm-sxv