Godot 4: Create glow effects with shaders (tutorial)
Вставка
- Опубліковано 31 лип 2024
- 📖 Godot 4 book: filiprachunek.gumroad.com/l/g...
💡 Get exclusive content on Patreon: / fencerdevlog
🚀 Space Shooter tutorial: • Godot 4 Tutorial: From...
🖥️ Space Shooter source code: github.com/FilipRachunek/spac...
#godot #godot4 #godotengine #shaders
Hi everybody! In this video, I would show how we can set up a glow effect on a selected sprite in a 2D project. Such a shader may come in handy if we want to understand how the glow calculation works, or if we decide to work without setting up a global glow in the WorldEnvironment node. Let’s do it.
Why i dont found you before!. this is a great tutorial, thank you!.
You are welcome!
You always deliver top tutorials, and very useful ones, for us aspiring devs, thanks a bunch sir!! I think that on the next 4.3 that will be released soon they changed some stuff for the Glow settings.
Yes, I believe that 4.3 dev 5 added the glow support for the Compatibility renderer. But it's still a good thing to understand the basic glow algorithm that can be used in simple shaders. 😎
Excellent. Concise and clearly explained. Thank you for these videos!
You are welcome! 😎
Given resources like The Book of Shaders/Shadertoy and then obfuscating with Godot shader language was creating a time sink hole for me to have that aha moment. Thank you for these videos!
You are welcome!
Thanks !!! Thanks !!! Thanks !!!
Hey, you are welcome. 😎
shader_type canvas_item;
uniform vec4 glow_color : source_color;
uniform float glow_power: hint_range(0.0, 8.0, 0.1) = 2.0;
uniform float glow_shift: hint_range(0.0, 10.0, 0.1) = 1.0;
uniform float glow_radius: hint_range(1.0, 10.0, 1.0) = 1.0;
void fragment() {
vec4 glow = vec4(0.0);
float count = 0.0;
for (float x = -glow_radius; x
Y'all can thank me later
OK, thanks. 😎
Thanks for the tutorial! I'm attempting to create darkness in my 2D scene (tried both CanvasModulate node and DirectionalLight2D) and having trouble understanding how to make this shader glow to go through and illuminate the sprite and the surroundings. Any ideas on how to do that?
You are welcome! As I said, this is a simple solution that only affects the pixels of the specific sprite on which the shader is applied. To illuminate surrounding objects, it would be necessary to add a light source that emits light, such as a PointLight2D as a child node of the sprite. Perhaps I'll try that sometime in the future.
Very useful, thanks for sharing!
You are welcome!
Hi, can you make a flashlight shader like the State Of Decay's flashlight? (A shader that brights the meshs that touch the flashlight mesh)
It's a 3D game, isn't it? My shaders are usually 2D. Anyways, SpotLight3D could do the same trick, I suppose. docs.godotengine.org/en/stable/classes/class_spotlight3d.html
Great tutorial! Does this work 3d too?
Thanks! I guess it would work with a screen-reading shader.
How on earth did you learn all these details about Godot's shader language? Where is the documentation for it? Fantastic tutorial!
Thanks! Well, I've made numerous experiments and also analyzed the code of other shaders that are publicly available. You can find plenty of study material on GodotShaders.com, ShaderToy.com, and similar websites.
gem
Thanks!
If I win a chess game agaisnt you, can I work with you? No payment requirement.
I work alone. But thanks for the offer. 😎