ManimCommunity / ManimCommunity/manim
OpenGL Camera Does Not Rotate Properly
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
Since the opengl camera is a mobject you would expect it to rotate like a mobject, allowing for unique camera angles. But when applying Rotate to the camera it does not work as expected.
## Expected behavior
In the example I will give I had 2 mobjects rotate about the camera, this produces a circular effect as expected. When holding the mobjects stationary but rotating the camera about it's own upward axis you would expect for the effect just in the opposite direction. The issue is instead the image stretches and contorts without the expected rotation. Additionally when the camera is rotated off of its axis you would expect the camera to move in just x and z, but instead it rotates in y as well.
## How to reproduce the issue
Code for reproducing the problem
%%manim --renderer=opengl --write_to_movie -v WARNING -ql yes
Rotating through the cameras up axis
```py
class yes(Scene):
def construct(self):
mob = Tex('Merry go round')
mob2 = Circle().shift(32*OUT)
self.add(mob,mob2)
self.wait()
self.play(Rotate(self.camera,2*PI,UP,[0,0,0]),run_time=3,rate_func= lambda t:t)
self.wait()
```
Rotating through a parallel up axis
%%manim --renderer=opengl --write_to_movie -v WARNING -ql yes
```py
class yes(Scene):
def construct(self):
mob = Tex('Merry go round')
mob2 = Circle().shift(32*OUT)
self.add(mob,mob2)
self.wait()
self.play(Rotate(self.camera,2*PI,UP,[0,0,-16]),run_time=3,rate_func= lambda t:t)
self.wait()
```
The mobjects rotating around the camera giving the expected result for the first code
%%manim --renderer=opengl --write_to_movie -v WARNING -ql yes
```py
class yes(Scene):
def construct(self):
mob = Tex('Merry go round')
mob2 = Circle().shift(32*OUT)
self.add(mob,mob2)
self.wait()
self.play(Rotate(mob,2*PI,UP,[0,0,16]),Rotate(mob2,2*PI,UP,[0,0,16]),run_time=3,rate_func= lambda t:t)
self.wait()
```
## Additional media files
Images/GIFs
The video outputs look like the following respectively
https://user-images.githubusercontent.com/76829691/135728021-da62f090-9ae4-40ff-818e-2e857a714365.mp4
https://user-images.githubusercontent.com/76829691/135728023-afbd1a6e-5b26-4f1e-ab02-267b211e299b.mp4
https://user-images.githubusercontent.com/76829691/135728029-1aa0f482-e760-4579-95d6-d4f5935d3c34.mp4
## Logs
Terminal output
Each debug respectively
```
[10/02/21 14:44:17] DEBUG Animation with empty mobject animation.py:155
DEBUG Hashing ... hashing.py:344
DEBUG Hashing done in 0.231687 s. hashing.py:356
DEBUG Hash generated : 2818984818_1436490731_124602316 hashing.py:359
INFO Animation 0 : Using cached data (hash : caching.py:48
2818984818_1436490731_124602316)
DEBUG List of the first few animation hashes of the caching.py:57
scene: ['2818984818_1436490731_124602316']
Waiting 0: 0%| | 0/1 [00:00 scene_file_writer.py:605
100 files). Therefore, manim has
removed the 1 oldest file(s). You can
change this behaviour by changing
max_files_cached in config.
INFO Rendered yes scene.py:231
Played 3 animations
```
## System specifications
System Details
- OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)):
- Google Chrome OS Version 93.0.4577.95 (Official Build) (64-bit)
- RAM:
- Unknown
- Python version (`python/py/python3 --version`):
- Python 3.8.11
- Installed modules (provide output from `pip list`):
```
Package Version
------------------- ---------
backcall 0.2.0
certifi 2021.5.30
charset-normalizer 2.0.6
click 8.0.1
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
ipykernel 5.5.3
ipython 7.22.0
ipython-genutils 0.2.0
isosurfaces 0.1.0
jedi 0.18.0
jupyter-client 6.1.12
jupyter-core 4.7.1
manim 0.11.0
ManimPango 0.3.0
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
parso 0.8.2
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.3.2
pip 21.0.1
prompt-toolkit 3.0.18
ptyprocess 0.7.0
pycairo 1.20.1
pydub 0.25.1
pyglet 1.5.21
Pygments 2.8.1
pyrr 0.10.3
python-dateutil 2.8.1
pyzmq 22.0.3
requests 2.26.0
rich 10.11.0
scipy 1.7.1
screeninfo 0.6.7
setuptools 58.0.4
six 1.15.0
skia-pathops 0.7.0
tornado 6.1
tqdm 4.62.3
traitlets 5.0.5
urllib3 1.26.7
watchdog 2.1.6
wcwidth 0.2.5
wheel 0.37.0```
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
No output
FFMPEG
Output of `ffmpeg -version`:
```
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
```
## Additional comments
Contributor guide
Research direction
Reproduce the two camera-rotation examples with the OpenGL renderer, then trace the OpenGLCamera and Rotate interaction from the relevant camera and animation entry points. Done means rotation about the camera’s upward axis produces the expected opposite circular effect, and rotation about a parallel axis does not introduce the reported stretching, contortion, or unexpected y movement.
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
- 35/100