Introduction to shaders
A shader is a program that is designed to run on the GPU and alters the way that objects appear on the screen. Shaders are used extensively in both 2D and 3D development to create a variety of visual effects. They are called shaders because they were originally used for shading and lighting effects, but today they are used for a wide variety of visual effects. Because they run in the GPU in parallel, they are very fast but also come with some restrictions.
This section is a very brief introduction to the concept of shaders. For a more in-depth understanding, see https://thebookofshaders.com/ and Godot’s shader documentation at .
Earlier in this book, when you added a
StandardMaterial3D to a mesh, you were actually adding a shader – one that’s pre-configured and built into Godot. It’s great for many common situations, but sometimes you need something more specific, and for that, you’ll need to write shader...