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

NumberPlane background got rendered even though it has opacity of 0 in certain curcumstances #4153

Open
irfan-hossain-bhuiyan opened this issue Feb 4, 2025 · 3 comments

Comments

@irfan-hossain-bhuiyan
Copy link

Description of bug / unexpected behavior

I wanted to create a NumberPlane only with axis,So I set the backgroundLines opacity to 0,But the line still got rendered in certain curcumstanes.

Expected behavior

Only axis should be rendered

How to reproduce the issue

All manim command is set to default.

from manim import *
from numpy import array as arr
background_line_style={"stroke_opacity":0}

class TestRender(Scene):
    def construct(self):
        aP=arr([1,4,0])
        aPx=aP*X_AXIS

        axes=NumberPlane(x_range=(-1,4),
                     y_range=(-2,5),
                     background_line_style=background_line_style,
                     )
        c2p=axes.c2p
        dotA=Dot(point=c2p(*aPx))
        lineA=always_redraw(lambda :DashedLine(dotA.get_center(),c2p(*aPx)))
        self.play(Create(VGroup(lineA,axes)))
        self.wait(1)

By using the command

manim filename -pql

I got problem.gif

and the thing is if you swap the position of the object,The render becomes kinda ok(not entirely accurate) like

from manim import *
from numpy import array as arr
background_line_style={"stroke_opacity":0}

class TestRender(Scene):
    def construct(self):
        aP=arr([1,4,0])
        aPx=aP*X_AXIS

        axes=NumberPlane(x_range=(-1,4),
                     y_range=(-2,5),
                     background_line_style=background_line_style,
                     )
        c2p=axes.c2p
        dotA=Dot(point=c2p(*aPx))
        lineA=always_redraw(lambda :DashedLine(dotA.get_center(),c2p(*aPx)))
        self.play(Create(VGroup(axes,lineA))) #Just swapping here
        self.wait(1)

You got kinda accurate result.Like noproblem.gif

Logs

Terminal output
 manim test.py -pql -v DEBUG --disable_caching
Manim Community v0.18.1

[02/04/25 21:45:38] INFO     Caching disabled.                                             cairo_renderer.py:78
                    DEBUG    List of the first few animation hashes of the scene:          cairo_renderer.py:97
                             ['uncached_00000']                                                                
[02/04/25 21:45:40] INFO     Animation 0 : Partial movie file written in               scene_file_writer.py:527
                             '/data/data/com.termux/files/home/youtube_video/numerical                         
                             _analysis/media/videos/test/480p15/partial_movie_files/Te                         
                             stRender/uncached_00000.mp4'                                                      
                    DEBUG    Animation with empty mobject                                      animation.py:175
                    INFO     Caching disabled.                                             cairo_renderer.py:78
                    DEBUG    List of the first few animation hashes of the scene:          cairo_renderer.py:97
                             ['uncached_00000', 'uncached_00001']                                              
[02/04/25 21:45:41] INFO     Animation 1 : Partial movie file written in               scene_file_writer.py:527
                             '/data/data/com.termux/files/home/youtube_video/numerical                         
                             _analysis/media/videos/test/480p15/partial_movie_files/Te                         
                             stRender/uncached_00001.mp4'                                                      
                    INFO     Combining to Movie file.                                  scene_file_writer.py:617
                    DEBUG    Partial movie files to combine (2 files):                 scene_file_writer.py:561
                             ['/data/data/com.termux/files/home/youtube_video/numerica                         
                             l_analysis/media/videos/test/480p15/partial_movie_files/T                         
                             estRender/uncached_00000.mp4',                                                    
                             '/data/data/com.termux/files/home/youtube_video/numerical                         
                             _analysis/media/videos/test/480p15/partial_movie_files/Te                         
                             stRender/uncached_00001.mp4']                                                     
                    INFO                                                               scene_file_writer.py:737
                             File ready at                                                                     
                             '/data/data/com.termux/files/home/youtube_video/numerical                         
                             _analysis/media/videos/test/480p15/TestRender.mp4'                                
                                                                                                               
                    INFO     Rendered TestRender                                                   scene.py:247
                             Played 2 animations                                                               
[02/04/25 21:45:42] INFO     Previewed File at:                                                 file_ops.py:231
                             '/data/data/com.termux/files/home/youtube_video/numerical_analysis                
                             /media/videos/test/480p15/TestRender.mp4'                                         

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):Termux linux-android arrach64
  • RAM: 4 GB
  • Python version (python/py/python3 --version): 3.12
  • Installed modules (provide output from pip list):
Package Version ------------------------- -------------- anyio 4.7.0 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asttokens 3.0.0 async-lru 2.0.4 attrs 24.3.0 av 14.1.0 babel 2.16.0 beautifulsoup4 4.12.3 bleach 6.2.0 certifi 2024.12.14 cffi 1.17.1 charset-normalizer 3.4.0 click 8.1.7 cloup 3.0.5 colour 0.1.5 comm 0.2.2 contourpy 1.3.1 cryptography 44.0.0 cycler 0.12.1 debugpy 1.8.11 decorator 5.1.1 defusedxml 0.7.1 executing 2.1.0 fastjsonschema 2.21.1 ffmpeg-python 0.2.0 filelock 3.16.1 fonttools 4.55.3 fqdn 1.5.1 fsspec 2024.10.0 future 1.0.0 glcontext 3.0.0 gTTS 2.5.4 h11 0.14.0 httpcore 1.0.7 httpx 0.28.1 idna 3.10 importlib_metadata 8.5.0 ipykernel 6.29.5 ipython 8.31.0 ipywidgets 8.1.5 isoduration 20.11.0 isosurfaces 0.1.2 jedi 0.19.2 Jinja2 3.1.4 json5 0.10.0 jsonpointer 3.0.0 jsonschema 4.23.0 jsonschema-specifications 2024.10.1 jupyter 1.1.1 jupyter_client 8.6.3 jupyter-console 6.6.3 jupyter_core 5.7.2 jupyter-events 0.11.0 jupyter-lsp 2.2.5 jupyter_server 2.14.2 jupyter_server_terminals 0.5.3 jupyterlab 4.3.4 jupyterlab_pygments 0.3.0 jupyterlab_server 2.27.3 jupyterlab_widgets 3.0.13 kiwisolver 1.4.7 llvmlite 0.44.0 lxml 5.3.0 manim 0.18.1 manim-voiceover 0.3.7 ManimPango 0.6.0 mapbox_earcut 1.0.2 markdown-it-py 3.0.0 MarkupSafe 3.0.2 matplotlib 3.10.0 matplotlib-inline 0.1.7 mdurl 0.1.2 mistune 3.0.2 moderngl 5.12.0 moderngl-window 3.0.3 more-itertools 10.6.0 mpmath 1.3.0 mutagen 1.47.0 nbclient 0.10.1 nbconvert 7.16.4 nbformat 5.10.4 nest-asyncio 1.6.0 networkx 3.4.2 nodeenv 1.9.1 notebook 7.3.1 notebook_shim 0.2.4 numba 0.61.0 numpy 2.1.3 overrides 7.7.0 packaging 24.2 pandocfilters 1.5.1 parso 0.8.4 pexpect 4.9.0 pillow 11.1.0 pip 24.3.1 pip-autoremove 0.10.0 platformdirs 4.3.6 prettytable 3.12.0 prometheus_client 0.21.1 prompt_toolkit 3.0.48 psutil 6.1.0 ptyprocess 0.7.0 pure_eval 0.2.3 pwntools 4.13.1 PyAudio 0.2.14 pycairo 1.27.0 pycparser 2.22 pycryptodome 3.21.0 pydub 0.25.1 pyglet 2.0.18 PyGLM 2.7.3 Pygments 2.19.1 pynput 1.7.7 PyOpenGL 3.1.6 pyparsing 3.2.0 pyright 1.1.389 python-dateutil 2.9.0.post0 python-dotenv 0.21.1 python-json-logger 3.2.1 python-slugify 8.0.4 python-xlib 0.33 pyttsx3 2.98 PyYAML 6.0.2 pyzmq 26.2.0 referencing 0.35.1 regex 2024.11.6 requests 2.32.3 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rich 13.9.4 rpds-py 0.22.3 scipy 1.15.1 scour 0.38.2 screeninfo 0.8.1 Send2Trash 1.8.3 setuptools 75.6.0 six 1.16.0 skia-pathops 0.8.0.post1 sniffio 1.3.1 socks 0 soupsieve 2.6 sox 1.5.0 srt 3.5.3 stable-ts 2.18.3 stack-data 0.6.3 svgelements 1.9.6 sympy 1.13.1 terminado 0.18.1 text-unidecode 1.3 tiktoken 0.3.1 tinycss2 1.4.0 torch 2.5.0 torchaudio 2.5.0 tornado 6.4.2 tqdm 4.67.1 traitlets 5.14.3 types-python-dateutil 2.9.0.20241206 typing_extensions 4.12.2 uri-template 1.3.0 uritemplate 4.1.1 urllib3 2.2.3 watchdog 6.0.0 wcwidth 0.2.13 webcolors 24.11.1 webencodings 0.5.1 websocket-client 1.8.0 widgetsnbextension 4.0.13 zipp 3.21.0
@uwezi
Copy link
Contributor

uwezi commented Feb 4, 2025

While I agree that it might be an unexpected behavior, then on the other hand the NumberPlane() was designed to show those lines...

Is there a reason why you are not just using an Axes() object here?

@uwezi
Copy link
Contributor

uwezi commented Feb 4, 2025

ok, I have to admit that somethings is not quite right here and I have a suspicion...

class weird(Scene):
    def construct(self):
        aP=arr([2,2,0])

        axes = Axes(
            x_range=(-1,4,1),
            y_range=(-2,5,1),
            tips=False,
        ).add_coordinates()
        c2p=axes.c2p
        dotA=always_redraw(lambda: Dot(point=c2p(*aP)))
        self.add(dotA)
        self.play(Create(axes),)
        self.wait(1)
weird.mp4

@uwezi
Copy link
Contributor

uwezi commented Feb 4, 2025

Ok, so I still don't know about the background lines, and I suggest that you use the Axes() object instead. But your code revealed to me another bug which I will file as a separate report so that it does not drown here.

=> broken out into issue

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

No branches or pull requests

2 participants