godot
godot copied to clipboard
Vulkan: Glow on small bright highlights looks box or square shaped
Godot version
v4.0.alpha1.official [31a7ddbf8]
System information
Win 64 bit, Nvidea765M, Vulcan
Issue description
Glow in Godot4 alpha1 always looks way more box shaped compared to Godot3 glow.
In Godot3 this also was notably the case (but much less so) when Bicubic Upscale property was disabled, but with Bicubic glow looked reasonably roundish. In Godot 4 it Glow looks completely square with or without Bicubic Upscale, which in my eyes is quite a massive downgrade in visual fidelity.
https://user-images.githubusercontent.com/47016402/152667878-9ba512a7-d9db-4a08-8eba-001ec925d3b0.mp4
The box shape glow in Godot4 is especially apparent on small light sources reaching over the HDR Threshold.
I increased the intensity in the following examples to make it even more apparent:
Godot 4 with Upscale mode Liniar and HighQuality disabled:

Godot4, with Upscale mode Bicubic and High Quality enabled:

Godot3 with Bicubic Upscale and High Quality disabled:

Godot3 with Bicubic Upscale and High Quality enabled:

Youtube video showing Godot 4.0 stable square shaped glow in a regular scene: https://www.youtube.com/watch?v=Q8bGOfXGqLU
Steps to reproduce
Enable Glow in a scene with small areas over the HDR threshold
Minimal reproduction project
No response
Small bright highlights will always be difficult to manage for glow in an efficient way. I don't think much can be done to improve this, other than making your highlight larger and more diffuse (or playing with the glow levels in Environment).
I have a pull request that tweaks the glow defaults, could you try the values specified there?
Note that Godot 4's glow behaves much better than Godot 3's glow when you have small flickering highlights ("fireflies"), as is often the case with normal mapped non-rough materials: https://github.com/godotengine/godot/pull/54409
https://github.com/godotengine/godot/pull/57682 may affect this, though I don't know for certain.
It's just most apparent with smaller HDR areas. This issue here has nothing to do with flickering highlights (fireflies) as far as I can tell. It's about the shape of the glow. I've noticed the boxyness of the glow the first time I saw glow in Godot4. It's really ugly and looks like a step down in visual quality compared to Godot3. Godot 3 already had a lot worse looking glow and bloom compared to Unity and Unreal, this is really a step further in the wrong direction.
I don't know why the Bicubic glow in Godot3 looks so much rounder. Maybe more blur (lower res mipmap) was used?
I took a look into this briefly as I worked on a related issue. To get a rounder appearing glow we need to use a smaller gaussian sigma (we need to give more strength to the central pixels and less strength to the pixels that are further away). Using a sigma of 1.5 calculated from this site gives very pleasing results in still scenes. The falloff appears perfectly circular.
That being said, the problem with a smaller sigma is that it gives more strength to the central pixels so you end up with more flickering and jumping around in motion. Especially in scenes with small bright spots.
Right now, the best tool to fight the square falloff is to lower the intensity a little bit. Both in 3.x and in 4.0 high brightness values expose the square shape, and lower intensities restore the circular shape.
In the future, I would like to make the sigma configurable so users can choose between a more pleasing circular falloff (with artifacts in motion) or a better experience in motion (with a more square shape).
https://github.com/godotengine/godot/issues/56452 is related as these stem from the same underlying issue (i.e. the gaussian blur gives a relatively high weight to all pixels in the blur)
Using a sigma of 1.5 calculated from this site gives very pleasing results in still scenes. The falloff appears perfectly circular.
Do you have the code for this? I don't see a kernel that could be used in servers/rendering/renderer_rd/shaders/effects/tonemap.glsl for glow, or even a sigma value.
Using a sigma of 1.5 calculated from this site gives very pleasing results in still scenes. The falloff appears perfectly circular.
Do you have the code for this? I don't see a kernel that could be used in
servers/rendering/renderer_rd/shaders/effects/tonemap.glslfor glow, or even a sigma value.
Glow is processed in copy.glsl not in tonemap.glsl
Forward+ https://github.com/godotengine/godot/blob/8612c12be61c0bc50d9039402fe19cabadfe0b16/servers/rendering/renderer_rd/shaders/effects/copy.glsl#L111
Mobile https://github.com/godotengine/godot/blob/8612c12be61c0bc50d9039402fe19cabadfe0b16/servers/rendering/renderer_rd/shaders/effects/blur_raster.glsl#L102-L107
Hm, I just encountered this too and I have to say that the "precision" of the glow is a drastic downgrade from 3.x. When the camera is zoomed out a bit, smaller hdr materials will not produce a glow or just a very square one until it then fades out.
It feels like the texture that is used to calculate the glow in Godot 4 is of a much smaller resolution than it was in Godot 3.
To test this I setup a sphere with a material where emission was set to 10.0 and a camera with similar environment settings in Godot 3 and Godot 4.
Bot are set to high quality. The meter distances are camera to sphere.
Godot 3:
1 meter:
5 meter:
10 meter:
30 meter:
70 meter:
Godot 4:
1 meter:
5 meter:
7.5 meter:
10 meter:
30 meter:
I didn't include 70 meters in Godot 4 because the glow is already gone at 10 meters. I included 7.5 meters as the "boxiness" is very, very visible.
Overall it's a pretty hefty downgrade from my pov. It would be great to have project settings to drastically increase the glow resolution for a higher fidelity.
It would be great to have project settings to drastically increase the glow resolution for a higher fidelity.
This is not an issue of the resolution used to generate glow (I believe it's the same as in Godot 3), but the sigma used as the glow falloff: https://github.com/godotengine/godot/issues/57693#issuecomment-1347882425
You could try changing the sigma values here using the generator linked in the above comment, then recompile Godot: https://github.com/godotengine/godot/issues/57693#issuecomment-1410894153
Also, try playing around with the glow levels in the Environment resource. If you want glow to appear on small surfaces, enabling level 2 should help somewhat (it's set to 0.0 by default).
In the above screenshots All levels but 6 and 7 are set to 1.0, so that's not the problem. I will try the sigma settings!
I tested more and more and I can say for sure that something is off here. Changing the Sigma values makes the glow more round and look much nicer. But the problem I observed and documented above is something else. I will look into that more and try to find out what's the problem.
So: Changing the sigma values definitely helps a ton with the blockiness - it should be changed.
With the current sigma values:
With adjusted sigma values:
you can also observe it changes the power quite a bit.
I also observed in the code that the high quality setting that was available in Godot 3 is completely gone.
I also observed in the code that the high quality setting that was available in Godot 3 is completely gone.
See https://github.com/godotengine/godot/pull/70009. The 3.x backport is also said to not work well anyway: https://github.com/godotengine/godot/issues/54521