# 著色器介紹

螢幕上呈現的所有內容都需要使用著色器。著色器是運行在 GPU（圖形處理單元）上的小型程式，效率非常高。這些程式負責計算幾何頂點在螢幕上的位置以及每個片段的顏色。&#x20;

## 什麼時候需要自訂著色器(custom shaders)？

對於某些視覺風格而言，您可能不需要自行編寫著色器。內建的著色器支援基本功能，例如將頂點投影到螢幕空間、設定特定顏色或材質，同時計算光源如何影響顏色。

然而，當內建功能不足以滿足需求時，您可能需要自行創建著色器。&#x20;

### 一些範例

* 頂點動畫/**Vertex animation:** 您可以改變幾何物件頂點的位置。例如，可以讓物件繞軸旋轉或讓樹葉看起來像在風中搖曳。由於這些操作是在 GPU 上完成的，因此相比於在 CPU 上進行計算，效率更高
* 材質混合/**Mixing materials:** 一個網格一次只能渲染一種材質。如果您希望在網格的不同部分顯示不同的材質，可以使用自訂著色器。例如，可以根據表面的角度來決定渲染哪種顏色。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hology.app/zh-tw/shaders/zhu-se-qi-jie-shao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
