+7 votes

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!

in Engine by (268 points)

2 Answers

+1 vote
Best answer

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.

by (268 points)
+2 votes

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.

by (830 points)

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.

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.