ManimCommunity / ManimCommunity/manim
`Surface` has incorrect checkerboard coloring
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
I tried rendering a sphere with `manim.Surface`, and the checkerboard coloring is not alternating properly.
This is evident in the 2nd and 3rd row above the horizontal plane in the screenshot section below.
## Expected behavior
The code should create a spherical surface which each cell having alternating, checkerboard colors.
## How to reproduce the issue
Code for reproducing the problem
```py
from manim import *
class ParaSphereDemo(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
sphere = Surface(
lambda u, v: axes.c2p(
*np.array([
np.sin(u) * np.cos(v),
np.sin(u) * np.sin(v),
np.cos(u)
])
),
u_range=(-np.pi, np.pi),
v_range=(-np.pi, np.pi),
checkerboard_colors=False
)
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
self.add(axes, sphere)
```
## Additional media files
Images/GIFs
## Additional comments
I've already fixed this and will submit a PR soon.
Contributor guide
Research direction
Start with the provided Python reproducer and inspect the Surface entry point, focusing on how its checkerboard colors are assigned across the u and v ranges. Compare the rendered rows with the expected alternating pattern, then verify that the sphere example produces alternating colors in every cell. The issue notes that a fix has already been made and a pull request is forthcoming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100