Surface opacity issue
- Vorherrschende Sprache
- Python
- Sterne
- 93.8k
- Forks
- 7.7k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
### Describe the bug
When I add two Surfaces to the scene, both with opacity less than 1, the first surface added is opaque, whilst the second is transparent. In the images below I have swapped the order in which they are added to the scene, i.e. self.add(cone1,cone2) --> self.add(cone2,cone1).
**Code**:
from manimlib import *
import numpy as np
class MyCone(Surface):
CONFIG = {
"resolution": (101, 51),
"radius": 1,
"u_range": (0, 1),
"v_range": (0, 2*PI),
}
def uv_func(self, u: float, v: float) -> np.ndarray:
return self.radius * np.array([
u * np.cos(v),
u * np.sin(v),
u
])
class MyCone2(Surface):
CONFIG = {
"resolution": (101, 51),
"radius": 1,
"u_range": (0, 1),
"v_range": (0, 2*PI),
}
def uv_func(self, u: float, v: float) -> np.ndarray:
return self.radius * np.array([
0.25+u * np.cos(v),
u * np.sin(v),
0.5-u
])
class SurfaceExample(Scene):
CONFIG = {
"camera_class": ThreeDCamera,
}
def construct(self):
cone1 = MyCone(radius=3)
cone2 = MyCone2(radius=3)
cone1.set_opacity(0.35)
cone1.set_color(RED)
cone2.set_opacity(0.35)
cone2.set_color(GREEN)
frame = self.camera.frame
frame.set_euler_angles(
theta=-30 * DEGREES,
phi=70 * DEGREES,
)
self.add(cone1,cone2)
**Wrong display or Error traceback**:


k -->
### Additional context
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.