The Book of Shaders is a good base. What helped me most for 2D in Godot was pairing it with two short pages in the official docs: “Your first 2D shader” and the CanvasItem shader reference (it lists what COLOR, UV, TEXTURE and SCREEN_UV mean in Godot, which most general shader books don’t cover).
Your two examples are nice first exercises:
Grayscale, as a material on any Sprite2D or TextureRect:
The second one reads mipmaps of the screen, so it is cheap but a bit blocky at high values. A proper Gaussian blur samples neighbours in two passes, which is a good next step once these make sense.
Reading small, complete shaders also helped me more than long chapters. godotshaders.com has a lot of 2D ones. Disclosure: I make a small 2D shader pack for Godot 4, and the free Lite version has two effects with commented source if you want more examples to pick apart: …itch.io/shader-pack-lite-for-godot-4
The Book of Shaders is a good base. What helped me most for 2D in Godot was pairing it with two short pages in the official docs: “Your first 2D shader” and the CanvasItem shader reference (it lists what
COLOR,UV,TEXTUREandSCREEN_UVmean in Godot, which most general shader books don’t cover).Your two examples are nice first exercises:
Grayscale, as a material on any Sprite2D or TextureRect:
Blur of everything behind a ColorRect (handy for pause menus):
The second one reads mipmaps of the screen, so it is cheap but a bit blocky at high values. A proper Gaussian blur samples neighbours in two passes, which is a good next step once these make sense.
Reading small, complete shaders also helped me more than long chapters. godotshaders.com has a lot of 2D ones. Disclosure: I make a small 2D shader pack for Godot 4, and the free Lite version has two effects with commented source if you want more examples to pick apart: …itch.io/shader-pack-lite-for-godot-4