Godot:Shader
lastmod 2025-01-22created 2020-11-0510 edits
Shaders are unique programs that run on the GPU. They are used to specify how to take mesh data (vertex positions, colors, normals, etc.) and draw it to the screen. Because shaders are optimized to run on the GPU, they do not process information the same way a normal program does. One consequence of this is that shaders do not retain their data after they run; they output a final color to the screen and then move on. Consequently, there is no way to access the color output from the last run of the shader.
Godot uses a shader language very similar to GLSL, but with added functionality and slightly less flexibility. The reason for doing this is that Godot integrates built-in functionality to make writing complex shaders substantially easier. Godot wraps the user-written shader code in its own code. That way, Godot handles a lot of the low-level stuff that the user doesn't need to worry about, and it is able to parse the shader code and use it to affect the rendering pipeline. For more advanced shaders, you can turn this functionality off using a render_mode.
Shader types
Instead of supplying a general-purpose configuration for all uses (2D, 3D, particles), Godot shaders must specify what they are intended for. Different types support different render modes, built-in variables, and processing functions.
All shaders need to specify their type in the first line, in the following format:
Valid types are:
-
spatial: For 3D rendering. -
canvas_item: For 2D rendering. -
particles: For particle systems.
Render modes
Different shader types support different render modes. They are optional and, if specified, must be after the shader_type. Render modes are used to alter the way built-in functionality is handled. For example, it is common to use the render mode unshaded to skip the built-in light processor function.
Render modes are specified underneath the shader type.
Each shader type has a different list of render modes available. See the documentation for each shader type for a complete list of render modes.
Projects
- GDQuest/godot-shaders - A large library of free and open-source shaders for the Godot game engine. Here, you'll get 2D and 3D shaders with playable demos.
- arkology/ShaderV - Godot Visual Shader Plugin
- TokisanGames/godot-fractal-art - Generates fractals using shaders and Godot Engine.
- pattlebass/Godot-Acrylic - An effect similar to Microsoft's Acrylic material achieved in the Godot Engine.
Balatro Effect
Shaders:
- 2D-perspective - Godot Shaders
- Simple 2D dissolve - Godot Shaders
- 2D dissolve with burn edge - Godot Shaders - This one looks good too
See also
Favorite site
- Shaders — Godot Engine (stable) documentation (Korean)
- Introduction to shaders — Godot Engine (stable) documentation (Korean)
- [Recommended] Godot Shaders - Make your games beautiful! - Collection of shaders you can use in Godot
Samples
- 2D Drop Shadow - Godot Shaders
- Pixel Art Tileset Texture Mapping with Trim + Animation (Godot 4) - Godot Shaders
- Pixelate - Godot Shaders
- Brick/tiled wall - Godot Shaders
- 2D outline/inline - Godot Shaders
- Simple 2D dissolve - Godot Shaders
- godotshaders, Contributer to Godot Shaders
- Shaders - Page 14 of 14 - Godot Shaders
- Ripple effect - Godot Shaders
- Starfield - Godot Shaders
- Starfield with Parallax Scrolling Effect - Godot Shaders
- simple trail effect - Godot Shaders
- Simple dynamic holographic card effect ( foil ) - Godot Shaders
- Glow effect 2D - Godot Shaders
- Double texture blend 2D - Godot Shaders
- Hit flash effect - Godot Shaders
- Higher Detail Outline Shader - Godot Shaders
- Pixel Perfect outline Shader - Godot Shaders
- Pencil screen space shader - Godot Shaders
- Wind Waker 2d Water Shader Canvas_Item - Godot Shaders
- Color manipulator - Godot Shaders
- Sprite progress bar - Godot Shaders
- Wiggle 2D - Godot Shaders
- 2D Sprite "Cartridge Tilting Glitch" - Godot Shaders
- Moving Rainbow Gradient - Godot Shaders
- Falling leaf shader - Godot Shaders
- Colorful Outline - Godot Shaders
- Animated Screen Outline (flaming rainbow) - Godot Shaders
- white balance shader - Godot Shaders
- 2D simple animated flag shader - Godot Shaders
- Hit Flash Effect Shader - Godot Shaders
- Procedural Grain Wood Shader - Godot Shaders
- Pixelate - Godot Shaders
- Simple 2D dissolve - Godot Shaders
- 2D outline stroke - Godot Shaders
- Cloudy skies - Godot Shaders
- 2D fire - Godot Shaders
- Rorschach Ink Test - Godot Shaders - Watercolor ink bleed
- Wind Waker Water – NO Textures needed! - Godot Shaders - The Legend of Zelda: The Wind Waker-style water - no textures needed
- Corner Void - Godot Shaders - Effect like a black hole sucking in light
- Balatro Background Shader - Godot Shaders
- Balatro Fire Shader - Godot Shaders
- pixelated horror vignette dot-matrix downres - Godot Shaders
- God rays - Godot Shaders
- Stylized grass with wind and deformation - Godot Shaders