ManimCommunity / ManimCommunity/manim

Objects aren't displayed in front of each other correctly

Open
#2,644 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior
In the attached animation, the cubes in the background jump to the front while the rotation is being displayed

## Expected behavior
Correct displaying of the order of the cubes

## How to reproduce the issue

Code for reproducing the problem

```py
from manim import *

class Main(ThreeDScene):
def construct(self):
self.set_camera_orientation(50 * DEGREES, -50 * DEGREES)
cubes = [Cube(1).set_opacity(1).move_to(OUT + LEFT + DOWN), Cube(1).set_opacity(1).move_to(OUT + RIGHT + DOWN), Cube(1).set_opacity(1).move_to(OUT + UP + RIGHT), Cube(1).set_opacity(1).move_to(OUT + UP + LEFT),
Cube(1).set_opacity(1).move_to(IN + LEFT + DOWN), Cube(1).set_opacity(1).move_to(IN + RIGHT + DOWN), Cube(1).set_opacity(1).move_to(IN + RIGHT + UP), Cube(1).set_opacity(1).move_to(IN + UP + LEFT)]
self.play(Create(VGroup(*cubes)))
self.play(Rotate(cubes[4]))
self.wait(1)
```

## Additional media files

Images/GIFs

https://user-images.githubusercontent.com/56817341/161098235-9e16821c-d27e-43a2-afb6-c408ec04a352.mp4

## Logs
Terminal output

```
[03/31/22 17:59:11] DEBUG Hashing ... hashing.py:343
DEBUG Hashing done in 0.033465 s. hashing.py:355
DEBUG Hash generated : 3415900677_1391804517_223132457 hashing.py:358
INFO Animation 0 : Using cached data (hash : 3415900677_1391804517_223132457) cairo_renderer.py:75
DEBUG List of the first few animation hashes of the scene: ['3415900677_1391804517_223132457'] cairo_renderer.py:84
DEBUG Hashing ... hashing.py:343
DEBUG Hashing done in 0.047306 s. hashing.py:355
DEBUG Hash generated : 4137296323_734229617_1121976359 hashing.py:358
INFO Animation 1 : Using cached data (hash : 4137296323_734229617_1121976359) cairo_renderer.py:75
DEBUG List of the first few animation hashes of the scene: ['3415900677_1391804517_223132457', '4137296323_734229617_1121976359'] cairo_renderer.py:84
DEBUG Animation with empty mobject animation.py:164
DEBUG Hashing ... hashing.py:343
DEBUG Hashing done in 0.032809 s. hashing.py:355
DEBUG Hash generated : 4137296323_2471300832_1971687172 hashing.py:358
INFO Animation 2 : Using cached data (hash : 4137296323_2471300832_1971687172) cairo_renderer.py:75
DEBUG List of the first few animation hashes of the scene: ['3415900677_1391804517_223132457', '4137296323_734229617_1121976359', '4137296323_2471300832_1971687172'] cairo_renderer.py:84
[03/31/22 17:59:12] INFO Combining to Movie file. scene_file_writer.py:594
DEBUG Partial movie files to combine (3 files): ['C:\\Users\\...\\PycharmProjects\\test\\media\\videos\\test\\1080p60\\partial_movie_files\\Main\\3415900677_1391804517_223132457.mp4', scene_file_writer.py:537
'C:\\Users\\...\\PycharmProjects\\test\\media\\videos\\test\\1080p60\\partial_movie_files\\Main\\4137296323_734229617_1121976359.mp4',
'C:\\Users\\...\\PycharmProjects\\test\\media\\videos\\test\\1080p60\\partial_movie_files\\Main\\4137296323_2471300832_1971687172.mp4']
INFO scene_file_writer.py:715
File ready at 'C:\Users\...\PycharmProjects\test\media\videos\test\1080p60\Main.mp4'

INFO Rendered Main scene.py:240
Played 3 animations
INFO Previewed File at: 'C:\Users\...\PycharmProjects\test\media\videos\test\1080p60\Main.mp4'
```

## System specifications

System Details

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 10 21H2
- RAM: 16 GB
- Python version (`python/py/python3 --version`): 3.9
- Installed modules (provide output from `pip list`):
```
Package Version
------------------------- ---------
backports.cached-property 1.0.1
certifi 2021.10.8
charset-normalizer 2.0.6
click 8.0.2
click-default-group 1.2.2
cloup 0.7.1
colorama 0.4.4
colour 0.1.5
commonmark 0.9.1
decorator 5.1.0
glcontext 2.3.4
idna 3.2
isosurfaces 0.1.0
manim 0.15.1
ManimPango 0.4.1
mapbox-earcut 0.12.10
moderngl 5.6.4
moderngl-window 2.4.0
multipledispatch 0.6.0
networkx 2.6.3
numpy 1.21.2
Pillow 9.0.1
pip 22.0.4
pycairo 1.20.1
pydub 0.25.1
pyglet 1.5.21
Pygments 2.10.0
pyrr 0.10.3
requests 2.26.0
rich 10.12.0
scipy 1.8.0
screeninfo 0.8
setuptools 57.0.0
six 1.16.0
skia-pathops 0.7.1
srt 3.5.2
stockfish 3.17.0
tqdm 4.62.3
urllib3 1.26.7
watchdog 2.1.6
wheel 0.36.2

```

LaTeX details

+ LaTeX distribution (e.g. TeX Live 2020): MiKTeX
+ Installed LaTeX packages: Pretty much all of them

FFMPEG

Output of `ffmpeg -version`:

```
ffmpeg version 2021-10-11-git-90a0da9f14-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 12.100 / 59. 12.100
libavformat 59. 6.100 / 59. 6.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 12.100 / 8. 12.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Python reproduction with Manim 0.15.1, focusing on ThreeDScene and Rotate(cubes[4]). Trace the 3D rendering behavior responsible for depth ordering during rotation. Done means the background cubes remain behind the foreground cubes throughout the animation; no test file is mentioned.

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.