ManimCommunity / ManimCommunity/manim

Opengl Renderer Compresses Images with Different Dimensions

Open
#2,132 1 comment 0 reactions 0 assignees View on GitHub
issue:bug opengl
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior

When changing the dimensions of an image to a square in opengl a circle compressed into an oval. When the same code was ran in cairo the shape was preserved as expected.

## Expected behavior

I expected the opengl output to match the cairo output when changing the image's dimensions where the shape is preserved.

## How to reproduce the issue

Code for reproducing the problem
This produced the image unexpectedly.
%%manim --renderer=opengl -r 1080,1080 --write_to_movie -s -v WARNING -ql yes

```py
class yes(Scene):
def construct(self):
config.frame_height = 15
config.frame_width = 15
print(config.frame_height)
print(config.frame_width)
print(config.pixel_height)
print(config.pixel_width)
self.add(Circle(fill_opacity=1,color=BLUE))
```
This produced the image as expected.
%%manim --renderer=cairo -r 1080,1080 --write_to_movie -s -v WARNING -ql yes

```py
class yes(Scene):
def construct(self):
config.frame_height = 15
config.frame_width = 15
print(config.frame_height)
print(config.frame_width)
print(config.pixel_height)
print(config.pixel_width)
self.add(Circle(fill_opacity=1,color=BLUE))
```

## Additional media files

Images/GIFs

Opengl bug
![download (7)](https://user-images.githubusercontent.com/76829691/135704920-250d0b94-1b84-485c-b831-2b221d2471cd.png)
Cairo expected
![download (6)](https://user-images.githubusercontent.com/76829691/135704921-f30676d6-d4d4-49e2-8d59-8134314f34f0.png)

## Logs
Terminal output

Opengl:

```
[10/02/21 01:37:49] INFO scene_file_writer.py:606
File ready at '/home/theredninja2/jup_f
iles/manim_programs/media/images/manim_
programs/yes_ManimCE_v0.10.0.png'

INFO Rendered yes scene.py:233
Played 0 animations
```

Cairo:

```
[10/02/21 01:35:19] INFO scene_file_writer.py:606
File ready at '/home/theredninja2/jup_f
iles/manim_programs/media/images/manim_
programs/yes_ManimCE_v0.10.0.png'

INFO Rendered yes scene.py:233
Played 0 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
jedi 0.18.0
jupyter-client 6.1.12
jupyter-core 4.7.1
manim 0.10.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
tornado 6.1
tqdm 4.62.3
traitlets 5.0.5
urllib3 1.26.7
watchdog 2.1.5
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

Open the contributing guide

Research direction

Reproduce the supplied Scene with the OpenGL and Cairo renderers using a square 1080x1080 output and compare the circle dimensions. Start from the OpenGL renderer path selected by `--renderer=opengl`; done means the OpenGL output preserves the circle's shape when frame and pixel dimensions are changed as in the report.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.