manim icon indicating copy to clipboard operation
manim copied to clipboard

Weird triangulation on Text rendered with OpenGL

Open GuiCT opened this issue 1 month ago • 2 comments

I made a mistake when creating the issue and did not follow the template on the first post. I updated the info https://github.com/ManimCommunity/manim/issues/4483#issuecomment-3567211252 later.


When i render the Title component with Cairo, i have no problems. However, while trying to replicate the same text in OpenGL, i get some weird text, more specifically, the letter 'O'.

First printscreen: preview quality, fill_opacity=1.0:

Image

Looking closely, it is possible to see that the 'O' character in OpenGL has some weird edges along the top.

I figured maybe the quality was what was causing it, so here is the same behavior with 4K quality:

Image

To make what i am trying to say more explicit, the edges are highlited when i set fill_opacity=0.25:

Image

I am investigating this to try and find the cause. I don't know if this is a specific of my install (in a previous PR, a mismatch on the mapbox_earcut caused a bug on my PC) or maybe something related on how OpenGL is implemented for text rendering (had no problems with other components).

I would very much appreciate anyone who has any input on this

GuiCT avatar Nov 22 '25 21:11 GuiCT

wasn't this fixed already? Which version of Manim are you using and I guess the developers also need to know which operating system you are using, which version of Python, essentially all the points asked for in the issue template...

uwezi avatar Nov 22 '25 22:11 uwezi

My apologies, i think i chose the wrong option when creating the issue and then i missed the template for the issue, i will try to give as much info as possible now:


Description of bug / unexpected behavior

Weird triangulation behavior when rendering text using the OpenGL Renderer.

Expected behavior

To render text with no visible overlaps when the fill_opacity is lowered to a value < 1.

How to reproduce the issue

Code for reproducing the problem
from manim import *
from manim.opengl import *

class IntroScene(Scene):
    def construct(self):
        t = Title("Testing OpenGL", fill_opacity=0.25)
        self.add(t)
        square = Square(color=RED).shift(LEFT * 2)
        circle = Circle(color=BLUE).shift(RIGHT * 2)

        self.play(Write(square), Write(circle))

        # moving objects
        self.play(
            square.animate.shift(UP * 0.5),
            circle.animate.shift(DOWN * 0.5)
        )

        # rotating and filling the square (opacity 80%)
        # scaling and filling the circle (opacity 80%)
        self.play(
            square.animate.rotate(PI / 2).set_fill(RED, 0.8),
            circle.animate.scale(2).set_fill(BLUE, 0.8),
        )

        # this is new!
        self.interactive_embed()

Additional media files

Images/GIFs

Behavior when fill_opacity = 0.25

Image

Behavior when fill_opacity = 1.0

Image

Logs

Terminal output

The argument log_to_file didn't generate a log file when passing renderer=opengl. I piped the output of the --verbosity debug using a pipe manually.

Manim Community v0.19.0

[11/22/2025 9:28:43 PM] DEBUG    Hashing ...                                                                                                         hashing.py:360
                        DEBUG    Hashing done in 0.053574 s.                                                                                         hashing.py:372
                        DEBUG    Hash generated :  1534244958_3278007734_1412609378                                                                  hashing.py:375
                        DEBUG    List of the first few animation hashes of the scene: ['1534244958_3278007734_1412609378']                            caching.py:68
[11/22/2025 9:28:44 PM] DEBUG    Hashing ...                                                                                                         hashing.py:360
                        DEBUG    Hashing done in 0.127461 s.                                                                                         hashing.py:372
                        DEBUG    Hash generated :  563603808_2256169546_2205861445                                                                   hashing.py:375
                        DEBUG    List of the first few animation hashes of the scene: ['1534244958_3278007734_1412609378',                            caching.py:68
                                 '563603808_2256169546_2205861445']                                                                                                
[11/22/2025 9:28:45 PM] DEBUG    Hashing ...                                                                                                         hashing.py:360
                        DEBUG    Hashing done in 0.127112 s.                                                                                         hashing.py:372
                        DEBUG    Hash generated :  563603808_590436459_4019372812                                                                    hashing.py:375
                        DEBUG    List of the first few animation hashes of the scene: ['1534244958_3278007734_1412609378',                            caching.py:68
                                 '563603808_2256169546_2205861445', '563603808_590436459_4019372812']                                                              
[11/22/2025 9:28:46 PM] INFO     Rendered IntroScene                                                                                                   scene.py:279
                                 Played 3 animations                                                                                                               

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 11 Pro 24H2 (26100.7171)
  • RAM: 64GB
  • Python version (python/py/python3 --version): 3.13.2
  • Installed modules (provide output from pip list):
Package                 Version
----------------------- -----------
asttokens               3.0.1
audioop-lts             0.2.2
av                      13.1.0
beautifulsoup4          4.14.2
click                   8.3.1
cloup                   3.0.8
colorama                0.4.6
comm                    0.2.3
debugpy                 1.8.17
decorator               5.2.1
executing               2.2.1
glcontext               3.0.0
ipykernel               7.1.0
ipython                 9.7.0
ipython-pygments-lexers 1.1.1
isosurfaces             0.1.2
jedi                    0.19.2
jupyter-client          8.6.3
jupyter-core            5.9.1
manim                   0.19.0
manimpango              0.6.1
mapbox-earcut           1.0.3
markdown-it-py          4.0.0
matplotlib-inline       0.2.1
mdurl                   0.1.2
moderngl                5.12.0
moderngl-window         3.1.1
nest-asyncio            1.6.0
networkx                3.5
numpy                   2.3.5
packaging               25.0
parso                   0.8.5
pillow                  12.0.0
platformdirs            4.5.0
prompt-toolkit          3.0.52
psutil                  7.1.3
pure-eval               0.2.3
pycairo                 1.29.0
pydub                   0.25.1
pyglet                  2.1.11
pyglm                   2.8.2
pygments                2.19.2
python-dateutil         2.9.0.post0
pyzmq                   27.1.0
rich                    14.2.0
scipy                   1.16.3
screeninfo              0.8.1
six                     1.17.0
skia-pathops            0.9.0
soupsieve               2.8
srt                     3.5.3
stack-data              0.6.3
svgelements             1.9.6
tornado                 6.5.2
tqdm                    4.67.1
traitlets               5.14.3
typing-extensions       4.15.0
watchdog                6.0.0
wcwidth                 0.2.14
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020): TinyTex tex --version output:
TeX 3.141592653 (TeX Live 2025)
kpathsea version 6.4.1
Copyright 2025 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.
  • Installed LaTeX packages: output of tlmgr list --only-installed
i adjustbox: Graphics package-alike macros for "general" boxes
i adobemapping: Adobe cmap and pdfmapping files
i algorithm2e: Floating algorithm environment with algorithmic keywords
i algorithms: A suite of tools for typesetting algorithms in pseudo-code
i amscls: AMS document classes for LaTeX
i amsfonts: TeX fonts from the American Mathematical Society
i amsmath: AMS mathematical facilities for LaTeX
i arphic: Arphic (Chinese) font packages
i atbegshi: Execute stuff at \shipout time
i atveryend: Hooks at the very end of a document
i auxhook: Hooks for auxiliary files
i babel: Multilingual support for LaTeX, LuaLaTeX, XeLaTeX, and Plain TeX
i babel-english: Babel support for English
i babel-portuges: Babel support for Portuges
i beamer: A LaTeX class for producing presentations and slides
i bibtex: Process bibliographies (bib files) for LaTeX or other formats
i bibtex.windows: windows files of bibtex
i bigintcalc: Integer calculations on very large numbers
i bitset: Handle bit-vector datatype
i bookmark: A new bookmark (outline) organization for hyperref
i booktabs: Publication quality tables in LaTeX
i cbfonts-fd: LaTeX font description files for the CB Greek fonts
i cjk: CJK language support
i cjkpunct: Adjust locations and kerning of CJK punctuation marks
i cm: Computer Modern fonts
i cm-super: CM-Super family of fonts
i cns: Chinese/Japanese/Korean bitmap fonts
i collectbox: Collect and process macro arguments as boxes
i count1to: Make use of count1 to count9
i ctablestack: Catcode table stable support
i ctex: LaTeX classes and packages for Chinese typesetting
i currfile: Provide file name and path of input files
i dehyph: German hyphenation patterns for traditional orthography
i doublestroke: Typeset mathematical double stroke symbols
i dvipdfmx: An extended version of dvipdfm
i dvipdfmx.windows: windows files of dvipdfmx
i dvips: A DVI to PostScript driver
i dvips.windows: windows files of dvips
i dvisvgm: Convert DVI, EPS, and PDF files to Scalable Vector Graphics format (SVG)
i dvisvgm.windows: windows files of dvisvgm
i ec: Computer modern fonts in T1 and TS1 encodings
i epstopdf: Convert EPS to PDF using Ghostscript
i epstopdf-pkg: Call epstopdf "on the fly"
i epstopdf.windows: windows files of epstopdf
i etex: An extended version of TeX, from the NTS project
i etexcmds: Avoid name clashes with e-TeX commands
i etoolbox: e-TeX tools for LaTeX
i euenc: Unicode font encoding definitions for XeTeX
i everyhook: Hooks for standard TeX token lists
i everysel: Provides hooks into \selectfont
i extractbb: A reimplementation of extractbb, written in Lua
i extractbb.windows: windows files of extractbb
i fancyvrb: Sophisticated verbatim text
i fandol: Four basic fonts for Chinese typesetting
i filehook: Hooks for input files
i filemod: Provide file modification times, and compare them
i firstaid: First aid for external LaTeX files and packages that need updating
i float: Improved interface for floating objects
i fonts-tlwg: Thai fonts for LaTeX from TLWG
i fontspec: Advanced font selection in XeLaTeX and LuaLaTeX
i fp: Fixed point arithmetic
i framed: Framed or shaded regions that can break across pages
i frcursive: French cursive hand fonts
i fundus-calligra: Support for the calligra font in LaTeX documents
i garuda-c90: TeX support (from CJK) for the garuda font
i geometry: Flexible and complete interface to document dimensions
i gettitlestring: Clean up title references
i gincltex: Include TeX files as graphics (.tex support for \includegraphics)
i glyphlist: Adobe Glyph List and TeX extensions
i gnu-freefont: A Unicode font, with rather wide coverage
i graphics: The LaTeX standard graphics bundle
i graphics-cfg: Sample configuration files for LaTeX color and graphics
i graphics-def: Colour and graphics option files
i helvetic: URW 'Base 35' font pack for LaTeX
i hycolor: Implements colour for packages hyperref and bookmark
i hyperref: Extensive support for hypertext in LaTeX
i hyph-utf8: Hyphenation patterns expressed in UTF-8
i hyphen-base: core hyphenation support files
i hyphen-english: English hyphenation patterns.
i ifoddpage: Determine if the current page is odd or even
i iftex: Am I running under pdfTeX, XeTeX or LuaTeX?
i inconsolata: A monospaced font, with support files for use with TeX
i infwarerr: Complete set of information/warning/error message macros
i intcalc: Expandable arithmetic operations with integers
i jknapltx: Miscellaneous packages by Joerg Knappen
i knuth-lib: Core TeX and Metafont sources from Knuth
i kpathsea: Path searching library for TeX-related files
i kpathsea.windows: windows files of kpathsea
i kvdefinekeys: Define keys for use in the kvsetkeys package
i kvoptions: Key value format for package options
i kvsetkeys: Key value parser with default handler support
i l3backend: LaTeX3 backend drivers
i l3backend-dev: LaTeX3 backend drivers (dev)
i l3kernel: LaTeX3 programming conventions
i l3kernel-dev: Development pre-release of l3kernel
i l3packages: High-level LaTeX3 concepts
i latex: A TeX macro package that defines LaTeX
i latex-amsmath-dev: Development pre-release of the LaTeX amsmath bundle
i latex-base-dev: Development pre-release of the LaTeX kernel
i latex-bin: LaTeX executables and man pages
i latex-bin.windows: windows files of latex-bin
i latex-firstaid-dev: Development pre-release of the LaTeX firstaid package
i latex-fonts: A collection of fonts used in LaTeX distributions
i latex-tools-dev: Development pre-release of the LaTeX tools bundle
i latexconfig: configuration files for LaTeX-related formats
i latexmk: Fully automated LaTeX document generation
i latexmk.windows: windows files of latexmk
i letltxmacro: Let assignment for LaTeX macros
i listofitems: Grab items in lists using user-specified sep char
i lm: Latin modern fonts in outline formats
i lm-math: OpenType maths fonts for Latin Modern
i ltxcmds: Some LaTeX kernel commands for general use
i lua-alt-getopt: Process application arguments the same way as getopt_long
i lua-uni-algos: Unicode algorithms for LuaTeX
i luahbtex: LuaTeX with HarfBuzz library for glyph shaping
i luahbtex.windows: windows files of luahbtex
i lualatex-math: Fixes for mathematics-related LuaLaTeX issues
i lualibs: Additional Lua functions for LuaTeX macro programmers
i luaotfload: OpenType 'loader' for Plain TeX and LaTeX
i luaotfload.windows: windows files of luaotfload
i luatex: The LuaTeX engine
i luatex.windows: windows files of luatex
i luatexbase: Basic resource management for LuaTeX code
i luatexja: Typeset Japanese with Lua(La)TeX
i mathastext: Use the text font in maths mode
i mdwtools: Miscellaneous tools by Mark Wooding
i metafont: A system for specifying fonts
i metafont.windows: windows files of metafont
i mfware: Supporting tools for use with Metafont
i mfware.windows: windows files of mfware
i microtype: Subliminal refinements towards typographical perfection
i modes: A collection of Metafont mode_def's
i mptopdf: mpost to PDF, native MetaPost graphics inclusion
i mptopdf.windows: windows files of mptopdf
i multitoc: Set table of contents in multiple columns
i natbib: Flexible bibliography support
i norasi-c90: TeX support (from CJK) for the norasi font
i pdfescape: Implements pdfTeX's escape features using TeX or e-TeX
i pdftex: A TeX extension for direct creation of PDF
i pdftex.windows: windows files of pdftex
i pdftexcmds: LuaTeX support for pdfTeX utility functions
i pgf: Create PostScript and PDF graphics in TeX
i physics: Macros supporting the Mathematics of Physics
i plain: The Plain TeX format
i platex: pLaTeX2e and miscellaneous macros for pTeX
i platex-tools: pLaTeX standard tools bundle
i platex.windows: windows files of platex
i prelim2e: Allows the marking of preliminary versions of a document
i preview: Extract bits of a LaTeX source for output
i psnfss: Font support for common PostScript fonts
i ptex: A TeX system for publishing in Japanese
i ptex-base: Plain TeX format for pTeX and e-pTeX
i ptex-fonts: Fonts for use with pTeX
i ptex.windows: windows files of ptex
i ragged2e: Alternative versions of "ragged"-type commands
i refcount: Counter operations with label references
i relsize: Set the font size relative to the current font size
i rerunfilecheck: Checksum based rerun checks on auxiliary files
i rsfs: Ralph Smith's Formal Script font
i scheme-infraonly: infrastructure-only scheme (no TeX at all)
i selnolig: Selectively disable typographic ligatures
i setspace: Set space between lines
i stackengine: Highly customised stacking of objects, insets, baseline changes, etc.
i standalone: Compile TeX pictures stand-alone or as part of a document
i stringenc: Converting a string between different encodings
i svn-prov: Subversion variants of \Provides... macros
i symbol: URW 'Base 35' font pack for LaTeX
i tex: A sophisticated typesetting engine
i tex-ini-files: Model TeX format creation files
i tex.windows: windows files of tex
i texlive-scripts: TeX Live infrastructure programs
i texlive-scripts-extra: TeX Live scripts
i texlive-scripts-extra.windows: windows files of texlive-scripts-extra
i texlive-scripts.windows: windows files of texlive-scripts
i texlive.infra: basic TeX Live infrastructure
i texlive.infra.windows: windows files of texlive.infra
i times: URW 'Base 35' font pack for LaTeX
i tipa: Fonts and macros for IPA phonetics characters
i tlgs.windows: Freely available PostScript interpreter
i tlperl.windows: internal Perl for Windows
i tools: The LaTeX standard tools bundle
i translator: Easy translation of strings in LaTeX
i ttfutils: convert TrueType to TFM and PK fonts
i ttfutils.windows: windows files of ttfutils
i uhc: Fonts for the Korean language
i ulem: Package for underlining
i unicode-data: Unicode data and loaders for TeX
i unicode-math: Unicode mathematics support for XeTeX and LuaTeX
i uniquecounter: Provides unlimited unique counter
i uplatex: pLaTeX2e and miscellaneous macros for upTeX
i uplatex.windows: windows files of uplatex
i uptex: Unicode version of pTeX
i uptex-base: Plain TeX formats and documents for upTeX
i uptex-fonts: Fonts for use with upTeX
i uptex.windows: windows files of uptex
i url: Verbatim with URL-sensitive line breaks
i wadalab: Wadalab (Japanese) font packages
i wasy: The wasy fonts (Waldi symbol fonts)
i wasysym: LaTeX support for the wasy fonts
i xcjk2uni: Convert CJK characters to Unicode, in pdfTeX
i xcolor: Driver-independent color extensions for LaTeX and pdfLaTeX
i xecjk: Support for CJK documents in XeLaTeX
i xetex: An extended variant of TeX for use with Unicode sources
i xetex.windows: windows files of xetex
i xetexconfig: crop.cfg for XeLaTeX
i xkeyval: Extension of the keyval package
i xpinyin: Automatically add pinyin to Chinese characters
i xunicode: Generate Unicode characters from accented glyphs
i zapfding: URW 'Base 35' font pack for LaTeX
i zhmetrics: TFM subfont files for using Chinese fonts in 8-bit TeX
i zhmetrics-uptex: Chinese font metrics for upTeX
i zhnumber: Typeset Chinese representations of numbers

Additional comments

I installed the manim package through uv and set the GitHub remote to get the latest version of the main branch.

uv add "manim @ git+https://github.com/ManimCommunity/manim"

Once again, sorry for the lack of info on the original post.

GuiCT avatar Nov 23 '25 00:11 GuiCT