ManimCommunity / ManimCommunity/manim

Fill animation discrepency with OpenGL

Open
#4,081 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior
The fill animation is not functioning properly in the Opengl renderer. It appears that fill is applied only on the last frame of the animation as shown in the animation below:
![CircleTriangleSquareScene_Manim_opengl](https://github.com/user-attachments/assets/c12569a7-a1a8-48b5-a1ab-92cf3b68fc8c)

## Expected behavior
I would have expected a functionality similar to Cairo where the fill is visible during the course of the animation:
![CircleTriangleSquareScene_Manim](https://github.com/user-attachments/assets/f50167b8-9010-4691-9c76-39edd06dd0ce)

## How to reproduce the issue

Code for reproducing the problem

```py
class CircleTriangleSquareScene(Scene):
def construct(self):
circle = Circle(radius = 1)
circle.set_fill(RED, opacity=0.5)
circle.set_stroke(RED)

square = Square(side_length = 2, fill_opacity = 1)
square.set_fill(BLUE, opacity = 0.5)
square.set_stroke(BLUE)

triangle = Triangle()
triangle.set_fill(GREEN, opacity = 0.5)
triangle.set_stroke(GREEN)

circle.shift([-2,0,0])
square.shift([2,0,0])

self.play(Create(circle, run_time = 2))
self.play(Create(triangle, run_time = 2))
self.play(Create(square, run_time = 2))

self.wait(0.1)
```

## Logs
Terminal output

Debug info seems to indicate that certain shaders aren't present.

```
manim --renderer=opengl -pqm scene.py CircleTriangleSquareScene --format=gif --verbosity=DEBUG
Manim Community v0.18.1

[12/30/24 20:04:06] DEBUG Hashing ... hashing.py:352
DEBUG Hashing done in 0.006014 s. hashing.py:364
DEBUG Hash generated : 3123472686_3371292183_223132457 hashing.py:367
DEBUG List of the first few animation hashes of the scene: ['3123472686_3371292183_223132457'] caching.py:62
[12/30/24 20:04:07] INFO Animation 0 : Partial movie file written in scene_file_writer.py:580
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/3123472686_3371292183_223132457.mp4'
DEBUG Hashing ... hashing.py:352
DEBUG Hashing done in 0.008969 s. hashing.py:364
DEBUG Hash generated : 1937375861_2454640191_1618962457 hashing.py:367
DEBUG List of the first few animation hashes of the scene: ['3123472686_3371292183_223132457', caching.py:62
'1937375861_2454640191_1618962457']
[12/30/24 20:04:08] INFO Animation 1 : Partial movie file written in scene_file_writer.py:580
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_2454640191_1618962457.mp4'
DEBUG Hashing ... hashing.py:352
DEBUG Hashing done in 0.012720 s. hashing.py:364
DEBUG Hash generated : 1937375861_2625952423_1917516738 hashing.py:367
DEBUG List of the first few animation hashes of the scene: ['3123472686_3371292183_223132457', caching.py:62
'1937375861_2454640191_1618962457', '1937375861_2625952423_1917516738']
[12/30/24 20:04:09] INFO Animation 2 : Partial movie file written in scene_file_writer.py:580
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_2625952423_1917516738.mp4'
DEBUG Animation with empty mobject animation.py:190
DEBUG Hashing ... hashing.py:352
DEBUG Hashing done in 0.013685 s. hashing.py:364
DEBUG Hash generated : 1937375861_3161721241_2552358008 hashing.py:367
DEBUG List of the first few animation hashes of the scene: ['3123472686_3371292183_223132457', caching.py:62
'1937375861_2454640191_1618962457', '1937375861_2625952423_1917516738',
'1937375861_3161721241_2552358008']
DEBUG /home/andrey/Desktop/Manim/manim/manim/renderer/shaders/vert.glsl does not exist. shader_wrapper.py:35
DEBUG /vert.glsl does not exist. shader_wrapper.py:35
DEBUG /home/andrey/Desktop/Manim/manim/manim/renderer/shaders/geom.glsl does not exist. shader_wrapper.py:35
DEBUG /geom.glsl does not exist. shader_wrapper.py:35
DEBUG /home/andrey/Desktop/Manim/manim/manim/renderer/shaders/frag.glsl does not exist. shader_wrapper.py:35
DEBUG /frag.glsl does not exist. shader_wrapper.py:35
INFO Animation 3 : Partial movie file written in scene_file_writer.py:580
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_3161721241_2552358008.mp4'
INFO Combining to Movie file. scene_file_writer.py:731
DEBUG Partial movie files to combine (4 files): scene_file_writer.py:614
['/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circ
leTriangleSquareScene/3123472686_3371292183_223132457.mp4',
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_2454640191_1618962457.mp4',
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_2625952423_1917516738.mp4',
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/partial_movie_files/Circl
eTriangleSquareScene/1937375861_3161721241_2552358008.mp4']
[12/30/24 20:04:12] INFO scene_file_writer.py:878
File ready at
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/CircleTriangleSquareScene
_ManimCE_v0.18.1.gif'

INFO Rendered CircleTriangleSquareScene scene.py:255
Played 4 animations
INFO Previewed File at: file_ops.py:230
'/home/andrey/Desktop/Manim/media/videos/scene/720p30/CircleTriangleSquareScene_ManimCE_
v0.18.1.gif'

```

## System specifications

System Details

```
- OS: Ubuntu 22.04
- Python version: python 3.10.12
- Installed modules: manim 0.18.1
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the CircleTriangleSquareScene with the documented manim --renderer=opengl command, then inspect manim/renderer/shaders/shader_wrapper.py and the renderer/shaders paths reported in the log. Done means the OpenGL renderer shows each shape's fill throughout its Create animation, as the Cairo rendering does.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.