3b1b / 3b1b/manim

How to fill with gradient in shader mode?

未關閉
#1,295 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
93.9k
分支
7.7k
平均合併
2 天 13 小時
30 天內合併 PR
4

描述

How to fill circle for example with gradient in shader mode? I tried set_color_by_gradient, it results in having different colors for different submobjects.

For example:

```
class Gradient(Scene):
def construct(self):
circle_1 = Circle().move_to(2*RIGHT)
circle_2 = Circle().move_to(2*LEFT)
circles = VGroup(circle_1,circle_2)
self.add(circles.set_color_by_gradient(PINK, YELLOW))
self.wait()
```

The results is:

https://user-images.githubusercontent.com/53943014/102837108-1a97a280-4436-11eb-83cf-72dee1fa1d3b.mp4

What I want is something like this:

![568-5686766_gradient-circle-circle-hd-png-download](https://user-images.githubusercontent.com/53943014/102837286-78c48580-4436-11eb-9e4d-11568dd8e567.png)

All suggestions are highly appreciated. Thank you.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

此問題是將 gradient fill 應用於 shader mode 中的單一形狀,而不是跨越多個 submobjects。查看 manim 的 shader mode 實作,尤其關注顏色與 gradient 在渲染管線中的處理方式。檢查 set_color_by_gradient 方法和相關 shader 程式碼,以理解目前行為。目標是修改 shader,使其在單一物件(如 circle)內套用 gradient。

由索引模型根據 Issue 內容生成。

評估

領域
computer-graphics
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。