ManimCommunity / ManimCommunity/manim
Flickering sheen with RoundedRectangle in 3D
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
I'm working on something where I need `RoundedRectangle`s moving around in 3D (a Rubik's cube, specifically).
However under certain conditions, the sheen applied to `RoundedRectangle` "flickers", i.e. changing the rotation slightly changes the sheen completely.
This doesn't happen if the `RoundedRectangle` has the default size, or if a regular `Rectangle` is used instead.
Furthermore, disabling the sheen using `sheen_factor=0.0` does not work either.
## Expected behavior
The sheen should not flicker when the `RoundedRectangle` is rotated. See the behavior for `Rectangle`. It should be also possible to disable it using `sheen_factor=0.0`.
## How to reproduce the issue
Code for reproducing the problem
```py
class SheenBug(ThreeDScene):
def construct(self):
rect = RoundedRectangle( # Works fine for `Rectangle`
height=5.0, # Works fine if width and height are not set
width=6.0, # Works fine if width and height are not set
shade_in_3d=True,
# sheen_factor=0.0, # Doesn't do anything
fill_opacity=1.0,
)
rect.set_fill(BLUE)
self.add(rect)
self.play(
Rotate(
rect,
about_point=np.array([0, 0, -1]),
axis=np.array([0, 1, 0]),
angle=2 * PI,
),
run_time=3,
rate_func=linear,
)
self.wait(1)
```
## Additional media files
Images/GIFs

## Logs
Terminal output
```
Manim Community v0.12.0
[11/10/21 17:29:40] DEBUG Hashing ... hashing.py:344
DEBUG Hashing done in 0.013110 s. hashing.py:356
DEBUG Hash generated : hashing.py:359
348793371_1197816903_4220848994
INFO Animation 0 : Using cairo_renderer.py:74
cached data (hash : 34879
3371_1197816903_422084899
4)
DEBUG List of the first few cairo_renderer.py:83
animation hashes of the
scene: ['348793371_119781
6903_4220848994']
DEBUG Animation with empty mobject animation.py:165
DEBUG Hashing ... hashing.py:344
DEBUG Hashing done in 0.011512 s. hashing.py:356
DEBUG Hash generated : 3536751306_28 hashing.py:359
39631542_1192610445
INFO Animation 1 : Using cairo_renderer.py:74
cached data (hash : 35367
51306_2839631542_11926104
45)
DEBUG List of the first few cairo_renderer.py:83
animation hashes of the
scene: ['348793371_119781
6903_4220848994', '353675
1306_2839631542_119261044
5']
INFO Combining to Movie scene_file_writer.py:604
file.
DEBUG Partial movie files scene_file_writer.py:547
to combine (2 files):
['/Users/vaclav/prog/
rubiks-cube-video/med
ia/videos/cube_video/
1080p60/partial_movie
_files/SheenBug/34879
3371_1197816903_42208
48994.mp4', '/Users/v
aclav/prog/rubiks-cub
e-video/media/videos/
cube_video/1080p60/pa
rtial_movie_files/She
enBug/3536751306_2839
631542_1192610445.mp4
']
INFO scene_file_writer.py:718
File ready at '/Users
/vaclav/prog/rubiks-c
ube-video/media/video
s/cube_video/1080p60/
SheenBug.mp4'
INFO Rendered SheenBug scene.py:234
Played 2 animations
INFO Previewed File at: '/Users/vac file_ops.py:202
lav/prog/rubiks-cube-video/med
ia/videos/cube_video/1080p60/S
heenBug.mp4'
```
## System specifications
System Details
- macOS 10.15.7 (Catalina)
- RAM: 8GB
- Python version: 3.9.7
- Installed modules (provide output from `pip list`):
```
Package Version Location
------------------------- --------- ------------------------
absl-py 0.13.0
appdirs 1.4.4
appnope 0.1.2
backcall 0.2.0
black 20.8b1
cachetools 4.2.2
certifi 2021.5.30
chardet 4.0.0
click 7.1.2
click-default-group 1.2.2
cloup 0.7.1
colorama 0.4.4
colour 0.1.5
commonmark 0.9.1
Cython 0.29.24
decorator 5.1.0
distlib 0.3.2
filelock 3.0.12
glcontext 2.3.4
google-auth 1.31.0
google-auth-oauthlib 0.4.4
grpcio 1.38.0
idna 2.10
ipython 7.22.0
ipython-genutils 0.2.0
isosurfaces 0.1.0
jedi 0.18.0
joblib 1.1.0
kociemba-manim-rubikscube 0.0.1
manim 0.12.0
manim-rubikscube 0.1.0
ManimPango 0.3.0
mapbox-earcut 0.12.10
Markdown 3.3.4
moderngl 5.6.4
moderngl-window 2.4.0
multipledispatch 0.6.0
mypy 0.812
mypy-extensions 0.4.3
networkx 2.6.3
numpy 1.20.2
oauthlib 3.1.1
packaging 20.9
pandocfilters 1.5.0
parso 0.8.2
pathspec 0.8.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.3.2
pip 21.2.4
prompt-toolkit 3.0.18
protobuf 3.17.3
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycairo 1.20.1
pydub 0.25.1
pygame 2.0.1
pyglet 1.5.21
Pygments 2.8.1
pyobjc-core 7.3
pyobjc-framework-Cocoa 7.3
pyparsing 2.4.7
PyQt6 6.1.0
PyQt6-3D 6.1.0
PyQt6-Charts 6.1.0
PyQt6-DataVisualization 6.1.0
PyQt6-NetworkAuth 6.1.0
PyQt6-sip 13.1.0
pyrr 0.10.3
regex 2021.3.17
requests 2.25.1
requests-oauthlib 1.3.0
rich 10.11.0
rsa 4.7.2
scikit-learn 1.0
scipy 1.7.1
screeninfo 0.6.7
setuptools 57.4.0
sip 6.1.1
six 1.16.0
skia-pathops 0.7.1
TBB 0.2
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
termcolor 1.1.0
threadpoolctl 3.0.0
toml 0.10.2
tqdm 4.59.0
traitlets 5.0.5
typed-ast 1.4.2
typing-extensions 3.7.4.3
urllib3 1.26.5
virtualenv 20.4.7
watchdog 2.1.6
wcwidth 0.2.5
Werkzeug 2.0.1
wheel 0.37.0
```
FFMPEG
Output of `ffmpeg -version`:
```
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
```
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
Reproduce the issue with the provided SheenBug ThreeDScene entry point, comparing a sized RoundedRectangle with a Rectangle and testing sheen_factor=0.0. Trace the RoundedRectangle 3D shading and sheen behavior from these parameters. Done means rotation no longer causes flickering and setting sheen_factor to zero disables the sheen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, 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