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.

КОМЕНТАРІ • 27

  • @inyoke1241
    @inyoke1241 4 місяці тому +3

    Why i dont found you before!. this is a great tutorial, thank you!.

  • @luckyknot
    @luckyknot 4 місяці тому +1

    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.

    • @FencerDevLog
      @FencerDevLog  4 місяці тому

      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. 😎

  • @timberjustinlake
    @timberjustinlake 4 місяці тому

    Excellent. Concise and clearly explained. Thank you for these videos!

  • @xyyx1001
    @xyyx1001 3 місяці тому

    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!

  • @felipefacundes1
    @felipefacundes1 2 місяці тому

    Thanks !!! Thanks !!! Thanks !!!

  • @6Pope9
    @6Pope9 2 місяці тому +2

    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

    • @6Pope9
      @6Pope9 2 місяці тому

      Y'all can thank me later

    • @FencerDevLog
      @FencerDevLog  2 місяці тому

      OK, thanks. 😎

  • @miturtow
    @miturtow 4 місяці тому

    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?

    • @FencerDevLog
      @FencerDevLog  4 місяці тому +1

      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.

  • @ABShinri
    @ABShinri 4 місяці тому

    Very useful, thanks for sharing!

  • @guustavols
    @guustavols 4 місяці тому

    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)

    • @FencerDevLog
      @FencerDevLog  4 місяці тому +1

      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

  • @SamiO-si4mc
    @SamiO-si4mc 4 місяці тому

    Great tutorial! Does this work 3d too?

    • @FencerDevLog
      @FencerDevLog  4 місяці тому

      Thanks! I guess it would work with a screen-reading shader.

  • @robertmeyer5985
    @robertmeyer5985 3 місяці тому

    How on earth did you learn all these details about Godot's shader language? Where is the documentation for it? Fantastic tutorial!

    • @FencerDevLog
      @FencerDevLog  3 місяці тому

      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.

  • @zdrmlpzdrmlp7672
    @zdrmlpzdrmlp7672 4 місяці тому

    gem

  • @phscful
    @phscful 4 місяці тому

    If I win a chess game agaisnt you, can I work with you? No payment requirement.

    • @FencerDevLog
      @FencerDevLog  4 місяці тому

      I work alone. But thanks for the offer. 😎