godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.17k stars 21.2k forks source link

Glow behaving weirdly when the color is set by multiplication and the items superposed. #97701

Open JeanKouss opened 1 month ago

JeanKouss commented 1 month ago

Tested versions

v4.3.stable.official [77dcf97d8]

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - integrated Intel(R) HD Graphics 520 (Intel Corporation; 31.0.101.2115) - Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (4 Threads)

Issue description

image

When you set 2 objects color by using multiplication ( Exple : Color(1., 0., 0.) * 10 instead of Color(10., 0., 0.)) and then superpose them, the glow effect is glitched in the zone of superposition.

Steps to reproduce

  1. Add 2 Sprite2D to the scene
  2. Set both modulate color as Color(1., 0., 0.) * 5 by code
  3. Superpose them.

Minimal reproduction project (MRP)

bloomissue.zip

clayjohn commented 1 month ago

I took a look at this locally. Turns out there is a big difference between those two cases. When you multiply a color by a number, all the channels of the color get multiplied, including alpha!

So you are actually comparing blending between Color(5.0, 0.0, 0.0, 5.0) and Color(5.0, 0.0, 0.0, 1.0). It seems like what you actually want is for the alpha modulate to remain at 1.0, so you should add:

$Multiply/Icon.modulate.a = 1
$Multiply/Icon2.modulate.a = 1
JeanKouss commented 1 month ago

I see. So, is that the intended behaviour when alpha > 1?