How to use WorldEnvironement glow in 2D ?

NeoDNeoD Posts: 179Member

Hello here's my test scene who tries to make a circle to glow like a sun.

Please don't pay attention to the last 2D node. It does nothing for the moment.
I plan to make glow this object only that's why I gave him a Viewport node (but a simpler solution is welcome).

And here's the Viewport properties.

The script draws a white circle.

func _draw(): draw_circle(Vector2(0, 0), diameter, Color(1.0, 1.0, 1.0))

But the circle has no glow. What am I doing wrong ?

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 3,525Admin

    I only briefly looked through this video, but it looks like it should be possible to use WorldEnvironment glow in 2D:

    Maybe set the Blend Mode to additive? I have found that the Blend Mode set to Softlight often gives very subtle results in 3D scenes, so maybe it is having the same effect in 2D. You might also need to set the color/module of your sprites to values over 1 so the color is high enough that the glow will take effect.

    This Reddit post also says it is possible, and links to a Reddit post where someone explains how to setup a WorldEnvironment node, which might also be worth taking a look at.

    I do not have firsthand experience using a WorldEnvironment in 2D with Godot, but hopefully those links will be of some help. I think it should be possible, it is likely just a matter of figuring out the correct setup.

  • NeoDNeoD Posts: 179Member

    I'm already able to to glow the full screen. But glow is more useful on isolated objects like trails, bullets etc...

  • TwistedTwiglegTwistedTwigleg Posts: 3,525Admin

    Sorry about the delay, life stuff got in the way.

    I totally missed that you were looking to apply glow to a single object/node! That does change things a bit. My hunch is that the reason glow does not seem to be working is because around the circle are transparent pixels, which could be making it where the glow doesn't extend, making it appear as nothing is happening. One easy way to test this is to make a black background behind the sprite using a ColorRect node and see if that makes the glow visible or not.

    From what I have found looking online, one way you might be able to get something close to a glow effect is to have a duplicate sprite with a CanvasShader (I think that is what it is called) with the blend mode set to additive. This should cause a glow-like effect. I'll keep an eye out for other solutions and will update if I find any.

  • NeoDNeoD Posts: 179Member

    No problem, I work on this graphic stuff on week ends only.

  • NeoDNeoD Posts: 179Member
    edited November 2019

    Hello. I'm afraid GLES2 WorldEnvironement is still broken in 3.2 beta, or needs very different tweaks to reach the same result than the GLES3 one.

    You can test this laser that works well on GLES3 mode.
    (No need to watch the full vidéo, just use the download link is in the description.)

    I suck at graphic tasks that's why I ask if it is just a matter of tweaks .

  • TwistedTwiglegTwistedTwigleg Posts: 3,525Admin

    Yeah, I downloaded and tested the project and it is not working for me either. Tweaking and adjusting the values didn't seem to have any effect. It appears that glow is not working for 3D scenes with OpenGL 2 either.

    I did a little poking around, and the issue might be because Godot does not support HDR rendering with OpenGL 2, which could be messing up the glow effect since it relies on HDR thresholds. I am not sure on a fix. Using another Line2D node with the blend_mode set to additive looks kinda like a laser, but the visuals were not as good as the OpenGL 3 version.

    It is unfortunate. There might be a solution or workaround, but I don't know of any right now. I'll keep an eye out though.

  • MegalomaniakMegalomaniak Posts: 3,001Admin

    It's probably worth noting that GLES2 and GLES3 are handled as different renderers altogether not just as different backends for the same renderer in godot.

  • NeoDNeoD Posts: 179Member

    Despite the 3.2 release GLES2 world environement is still worse than the GLES3 one.

    I hesitate to finally switch the renderer to GLES3 . I don't use 3D and hopefully 2D performance is enough on most mobile devices used to play games.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file