# Introduction to shaders

Everything rendered on the screen needs shaders. Shaders are small programmes that run on the GPU (graphics processing unit) very efficiently. These programmes calculate both the position of geometry vertices on the screen and the color of each fragment.

## When do you need custom shaders?

For some visual styles, you may not need to to create your own shaders. Built in shaders support basic functionality like projecting vertices to screen space, configuring a specific color, texture, while also calculating how lights affect the color.

However, when this is not enough, you may have to create your own shaders. Some examples

* **Vertex animation:** You can transform the position of the geometry's vertices. This can be done to make an object spin around an axis or make foliage look like it is swaying in wind. As this happens on the GPU, it is very efficient as opposed to doing this on the CPU.
* **Mixing materials:** A mesh can only have one material rendered at a time. If you want to display different materials on different parts of a mesh, you can use a custom shader. You can for example use the angle of the surface to decide which color to render.


---

# 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/shaders/introduction-to-shaders.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.
