Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text always rendered in 3D scene #3822

Closed
SzymonOzog opened this issue Jun 24, 2024 · 4 comments
Closed

Text always rendered in 3D scene #3822

SzymonOzog opened this issue Jun 24, 2024 · 4 comments

Comments

@SzymonOzog
Copy link

Description of bug / unexpected behavior

Text objects are always rendered, even if they are behind objects

Expected behavior

Text should render only partailly when behind an object

How to reproduce the issue

Code for reproducing the problem
class TestScene(ThreeDScene):
    def construct(self):
      text = Text("TEXT", font_size=55).shift(2*IN)
      cube = Cube(fill_opacity=1).shift(IN)
      cube2 = Cube(side_length=0.5, fill_opacity=1, fill_color=RED)
      self.add(text)
      self.add(cube)
      self.add(cube2)
      self.move_camera(theta=-radians(65), gamma=radians(45), phi=-radians(45))

Additional media files

Images/GIFs ![image](https://github.com/ManimCommunity/manim/assets/58388001/15792884-a742-4350-bf00-27a04e409a50)

Logs

Terminal output
Manim Community v0.18.1

[06/24/24 15:59:46] DEBUG    Hashing ...                                                                                                                                                                                                                                                                    hashing.py:352
                    DEBUG    Hashing done in 0.045246 s.                                                                                                                                                                                                                                                    hashing.py:364
                    DEBUG    Hash generated :  219949060_2797083003_878849922                                                                                                                                                                                                                               hashing.py:367
                    INFO     Animation 0 : Using cached data (hash : 219949060_2797083003_878849922)                                                                                                                                                                                                  cairo_renderer.py:88
                    DEBUG    List of the first few animation hashes of the scene: ['219949060_2797083003_878849922']                                                                                                                                                                                  cairo_renderer.py:97
                    INFO     Combining to Movie file.                                                                                                                                                                                                                                             scene_file_writer.py:617
                    DEBUG    Partial movie files to combine (1 files): ['/home/oz/repos/CUDA/media/videos/temp/480p15/partial_movie_files/TestScene/219949060_2797083003_878849922.mp4']                                                                                                          scene_file_writer.py:561
                    INFO                                                                                                                                                                                                                                                                          scene_file_writer.py:737
                             File ready at '/home/oz/repos/CUDA/media/videos/temp/480p15/TestScene.mp4'                                                                                                                                   
                                                                                                                                                                                                                                          
                    INFO     Rendered TestScene                                                                                                                                                                                                                                                               scene.py:247
                             Played 1 animations                                                                                                                                                                                          

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): debian 12
  • RAM: 32 GB
  • Python version (python/py/python3 --version): python 3.11.2
  • Installed modules (provide output from pip list):
    attrs 23.2.0
    azure-cognitiveservices-speech 1.38.0
    cattrs 23.2.3
    certifi 2024.6.2
    charset-normalizer 3.3.2
    click 8.1.7
    cloup 3.0.5
    decorator 5.1.1
    docstring-to-markdown 0.15
    glcontext 2.5.0
    gTTS 2.5.1
    idna 3.7
    isosurfaces 0.1.2
    jedi 0.19.1
    jedi-language-server 0.41.4
    lsprotocol 2023.0.1
    manim 0.18.1
    manim-voiceover 0.3.6.post0
    ManimPango 0.5.0
    mapbox-earcut 1.0.1
    markdown-it-py 3.0.0
    mdurl 0.1.2
    moderngl 5.10.0
    moderngl-window 2.4.6
    multipledispatch 1.0.0
    mutagen 1.47.0
    networkx 3.3
    numpy 1.26.4
    parso 0.8.4
    pillow 10.3.0
    pip 23.0.1
    pycairo 1.26.1
    pydub 0.25.1
    pyglet 2.0.15
    pygls 1.3.1
    Pygments 2.18.0
    pyrr 0.10.3
    python-dotenv 0.21.1
    python-slugify 8.0.4
    requests 2.32.3
    rich 13.7.1
    ruff 0.4.10
    scipy 1.13.1
    screeninfo 0.8.1
    setuptools 66.1.1
    skia-pathops 0.8.0.post1
    sox 1.5.0
    srt 3.5.3
    svgelements 1.9.6
    text-unidecode 1.3
    tqdm 4.66.4
    typing_extensions 4.12.2
    urllib3 2.2.2
    watchdog 4.0.1
PASTE HERE
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:

Additional comments

@uwezi
Copy link
Contributor

uwezi commented Jun 24, 2024

This is a known limitation of the Cairo rendering routines currently used in Manim and it is not limited to text objects: the removal of hidden objects is not working in general.

@SzymonOzog
Copy link
Author

Is there any way to get around it? It seems to work fine for other objects and not on Text. Tried with Code and Cube

@uwezi
Copy link
Contributor

uwezi commented Jun 24, 2024

Is there any way to get around it? It seems to work fine for other objects and not on Text. Tried with Code and Cube

you might have just been lucky then, because it fails more often than it succeeds. You could try to set the objects' set_z_index()

@MrDiver MrDiver closed this as completed Jun 25, 2024
@MrDiver
Copy link
Collaborator

MrDiver commented Jun 25, 2024

Will be fixed in GL version in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants