Extra color rendering outside VMobjects caused by gradient
- 主要語言
- Python
- 星號
- 93.9k
- 分支
- 7.7k
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 4
描述
### 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)
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
查看 VMobject 的 fill 實作,可能在 manim/mobject/types/vectorized_mobject.py 或相關圖形模組中。瞭解目前用於 gradients 的「fan」triangulation。研究可用來替換它的 polygon triangulation 演算法(例如 ear clipping)。使用提供的程式碼範例進行測試,查看 artifact 並驗證修正是否消除 extra colors。
由索引模型根據 Issue 內容生成。
評估
- 領域
- computer-graphics
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100