Skip to content

Graphical glitches during animations of fixed objects in ThreeDScene #2637

@T0T0R

Description

@T0T0R

Description of bug / unexpected behavior

When a Text object is fixed in the frame with ThreeDScene.add_fixed_in_frame_mobjects(), its transformation into another text lead to two graphical glitches:

  1. At the beginning of the animation, the second text appears on screen even before text1 morphs into text2.
    This would be similar to running scene.add(text2) before scene.play(Transform(text1, text2)).

  2. When the second text is longer than the first one, only some of the letters of the second text are obtained through the transfomation of the first text.
    For instance, in the examples provided below, the transformation from "Short text" to "A bit longer text" actually shows "Short text" -> "A i lo ge te t". The other letters "b t n r x" are displayed on the 'normal' axis, as if they were not concerned by the add_fixed_in_frame_mobjects() instruction.

Expected behavior

  1. The second text should not appear before the ed of the transformation.
  2. All the letters during the transformations should be att the same place, fixed in frame.

How to reproduce the issue

Code for reproducing the problem
from manim import *


def produce_bug(scene, is_fixed):
    text_A = Text("Short text")
    if is_fixed: scene.add_fixed_in_frame_mobjects(text_A)
    scene.play(Write(text_A))

    text_B = Text("A bit longer text")
    if is_fixed: scene.add_fixed_in_frame_mobjects(text_B)
    scene.play(ReplacementTransform(text_A, text_B))

    text_C = Text("A shorter text")
    if is_fixed: scene.add_fixed_in_frame_mobjects(text_C)        
    scene.play(ReplacementTransform(text_B, text_C))

    text_D = Text("Again a bit longer text")
    if is_fixed: scene.add_fixed_in_frame_mobjects(text_D)        
    scene.play(ReplacementTransform(text_C, text_D))

    text_E = Text("And finally a very long text")
    if is_fixed: scene.add_fixed_in_frame_mobjects(text_E)        
    scene.play(ReplacementTransform(text_D, text_E))         
    

class Test3DFixed(ThreeDScene):
    """ This is the class producing the graphical glitches. """
    def construct(self):        
        axes = ThreeDAxes()
        self.add(axes)
    
        self.set_camera_orientation(phi=50*DEGREES, theta=-45*DEGREES)        
    
        produce_bug(self, is_fixed=True)
        

class Test3DNotFixed(ThreeDScene):
    """ This is 3D but with no glitches. """
    def construct(self):        
        axes = ThreeDAxes()
        self.add(axes)
    
        self.set_camera_orientation(phi=50*DEGREES, theta=-45*DEGREES)        
    
        produce_bug(self, is_fixed=False)


class Test2D(Scene):
    """ This is the expected behavior in 2D. """    
    def construct(self):        
        axes = Axes()
        self.add(axes)
        
        produce_bug(self, is_fixed=False)       

Additional media files

Images/GIFs
Test3DFixed.mp4
Test3DNotFixed.mp4
Test2D.mp4

vlcsnap-2022-03-26-18h32m15s478

Logs

Terminal output

PasteBin

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 10 v21H2
  • RAM: 8 Go
  • Python version (python/py/python3 --version): Python 3.10.4
  • Installed modules (provide output from pip list):
backports.cached-property 1.0.1
certifi                   2021.10.8
charset-normalizer        2.0.12
click                     8.0.4
click-default-group       1.2.2
cloup                     0.7.1
colorama                  0.4.4
colour                    0.1.5
commonmark                0.9.1
cycler                    0.11.0
decorator                 5.1.1
fonttools                 4.31.2
gemmi                     0.5.3
glcontext                 2.3.5
idna                      3.3
isosurfaces               0.1.0
kiwisolver                1.4.0
manim                     0.15.1
ManimPango                0.4.1
mapbox-earcut             0.12.11
matplotlib                3.5.1
moderngl                  5.6.4
moderngl-window           2.4.1
multipledispatch          0.6.0
networkx                  2.7.1
numpy                     1.22.3
packaging                 21.3
Pillow                    9.0.1
pip                       22.0.4
pycairo                   1.21.0
pydub                     0.25.1
pyglet                    1.5.23
Pygments                  2.11.2
pyparsing                 3.0.7
pyrr                      0.10.3
python-dateutil           2.8.2
requests                  2.27.1
rich                      12.0.1
scipy                     1.8.0
screeninfo                0.8
setuptools                58.1.0
six                       1.16.0
skia-pathops              0.7.2
srt                       3.5.2
tqdm                      4.63.1
urllib3                   1.26.9
watchdog                  2.1.7
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:
FFMPEG

Output of ffmpeg -version:

ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev5, 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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --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-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --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      57. 17.100 / 57. 17.100
libavcodec     59. 18.100 / 59. 18.100
libavformat    59. 16.100 / 59. 16.100
libavdevice    59.  4.100 / 59.  4.100
libavfilter     8. 24.100 /  8. 24.100
libswscale      6.  4.100 /  6.  4.100
libswresample   4.  3.100 /  4.  3.100
libpostproc    56.  3.100 / 56.  3.100

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue:bugSomething isn't working... For use in issues

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions