Control glow with fragment shader?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By zendorf
:warning: Old Version Published before Godot 3 was released.

I am trying to activate glow in a fragment shader, with no success.

Tried assigning glow like:
GLOW = 1;

I get no error, but nothing happening. Likewise, I couldn’t get glow to work with the shader graph, only the fixed material glow works.

Also, is there any inbuilt variable for glow color?

Any ideas would be appreciated!

:bust_in_silhouette: Reply From: GlaDOSik

Hi. You’re almost there. You need to set the GLOW variable in fragment shader as you did and you need to have a WorldEnvironment node in your scene. Create a new Environment resource, find section Glow and tick Enabled checkbox.

Thanks for the reply. I already have the WorldEnvironment node setup with glow activated, as the glow works on existing fixed materials in my scene. However, I have been unable to get the glow to work using a fragment shader or shader graph.

Is setting GLOW = x all I need to do with the fragment shader? It feels like there should be a boolean that I need to turn on (like a GLOW_MODE = true) or something to that effect.

zendorf | 2016-03-05 00:04

Yes. You need to turn it on only in WorldEnvironment node and set the value in fragment shader. That’s it. It’s weird it doesn’t work for you. I have two projects, one uses custom shader and the other one shader graph. Glow works in both of them. Here’s the second project. Open the scene called MainMenuPoz.scn from Menu folder. Each planet has shader with glow.

GlaDOSik | 2016-03-05 00:50

:bust_in_silhouette: Reply From: zendorf

Thanks for providing that scene file GlaDOSik! It made me realise that I hadn’t saved the material as a separate .mtl file. That seems to be what made the difference.

If you use a standard fixed material , it allows you to use glow without saving it as a separate .mtl, whereas when you use a shader material the glow will only work if you first save the .mtl. Doesn’t matter if the shader is “material shader” or “material shader graph”.

Anyway, it is now working and saving an .mtl file for each object would be good workflow practice I will use from now on. Especially considering every other item in Godot(script, mesh, scene, etc) is saved as distinct asset.

This could be classed as a bug, so I will do a bit more investigation and file a guthub report if it warrants it.