Extra color rendering outside VMobjects caused by gradient
- Ngôn ngữ chính
- Python
- Star
- 93.8k
- Fork
- 7.7k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
### Describe the bug
When rendering a complex `VMobject` with a gradient fill, unexpected colors may appear in certain areas.
**Code example**:
```python
class Test(Scene):
def construct(self):
tex = Tex(R"2").set_height(7).set_color([BLUE, GREEN])
self.add(tex)
```
**Observed behavior**:
Instead of a smooth gradient, some regions display incorrect or “extra” colors.
**Screenshot**:
---
### Root cause analysis
This appears to be related to how `VMobject` fills are implemented.
Currently, the fill is constructed by blending a sequence of triangles, each defined by one **fixed vertex** and two consecutive vertices along the shape’s boundary (i.e., the 1st, *i*-th, and (*i*+1)-th points).
When a gradient is applied, overlapping triangles end up with slightly different colors. Since overlapping regions use blending with negative opacity, the colors don’t fully cancel out, leaving visible artifacts.
---
### Possible fix
Instead of the current “fan” triangulation approach, use a proper polygon triangulation algorithm to generate non-overlapping triangles for rendering. This should eliminate color inconsistencies caused by overlapping regions.
---
### Additional Content
System info:
- ManimGL 1.7.2
- Python 3.12.9
- Windows 11
- GPU: Intel Arc Pro Graphics (Driver 32.0.101.6637)
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Look at the VMobject fill implementation, likely in manim/mobject/types/vectorized_mobject.py or related graphics modules. Understand the current 'fan' triangulation for gradients. Research polygon triangulation algorithms (e.g., ear clipping) to replace it. Test with the provided code example to see the artifact and verify the fix eliminates extra colors.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- computer-graphics
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100