ManimCommunity / ManimCommunity/manim
Depth of mobjects doesn't get calculated correctly when `--renderer=opengl`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
The depth doesnt get calculated correctly when `renderer` is set to `opengl`.
The mobjects seems to be added to the depthbuffer according to their order of addition in the scene instead of their position relative to the camera.
## Expected behavior
Expected Behaviour with `cairo` renderer:
https://github.com/user-attachments/assets/5d5e4dd1-2f79-471c-8035-b8c53973ec09
Actual Behaviour with `opengl` renderer:
https://github.com/user-attachments/assets/517a0382-0cbb-4088-b722-45602c667e08
## How to reproduce the issue
Code for reproducing the problem
```py
from manim import *
from svgelements import Path
from random import random
class m(ThreeDScene):
def construct(self) -> None:
cubes = VGroup(*[
Cube(fill_color=color, fill_opacity=1.0,stroke_width=1).move_to((0,0,-i*2))
for i,color in enumerate([RED, BLUE, GREEN, ORANGE])])
# self.camera.set_theta(-30*DEGREES)
axes = ThreeDAxes()
self.set_camera_orientation(PI/4, PI/4)
self.play(Write(axes))
self.play(Write(cubes), run_time = 5)
self.wait()
```
## Additional media files
Images/GIFs
## Logs
Terminal output
```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```
## System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
## Additional comments
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied ThreeDScene reproduction with --renderer=opengl and compare it with the expected cairo output. Start at the OpenGL renderer's depth-buffer handling and trace how Cube positions and scene addition order affect depth. Done means the cubes are rendered according to their positions relative to the camera rather than their addition order.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100