Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointLight2D Blend mode Mix doesn't work, causes black shadows, blends wrongly, light colors are off #91433

Open
KarmyDev opened this issue May 2, 2024 · 2 comments

Comments

@KarmyDev
Copy link

KarmyDev commented May 2, 2024

Tested versions

  • Reproducible in: v4.2.2.stable.mono.official [15073af]

System information

Godot v4.2.2.stable.mono - Linux Mint 21.3 (Virginia) - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (RADV NAVI23) () - 12th Gen Intel(R) Core(TM) i5-12400F (12 Threads)

Issue description

Godot lights with Add blend mode, when accumulated they add infinitely making the pixels where two or more lights are around way too brighter
image
changing mode to mix gives such result:
image
which after changing gradient from black to black + transparent gives this:
image
which is close but not ideal, for instance, light in the center doesn't light it at all, it's just dark by last light
also turning off modulate canvas with mix lights gives this unwanted black shadows:
image
which is not ideal for day-night cycle

Changing from White<->Black+Transparent to White<->White+Transparent gradient seems to temporary fix it,
since it looks like this in the night:

But when it's day, all the lights "disappear":
image
Changing their energy a bit helps lights to be seen in day as well
image

Though then changing light color becomes hard since color set doesn't match the one shown in inspector and some color's wont be ever reached because how mix blending works
image
It also looks bad in day

Expected result:

Here's an example from the competition's engine:
image

It uses blending mode "Multiply" and "Alpha blend" which are not present in Godot

I'd suggesting adding multiply blend mode to Godot

Steps to reproduce

Create new scene with background image for clarity, add CanvasModulate and set it to #4671ff
Spawn PointLight2D, set it's texture to GradientTexture2D with Fill mode Radial as here:
image
And change that light's blend mode to mixed, duplicate a bunch of times and scatter around close to each other.
Change Gradient from black to black + transparent for other issue, and finally change/reset CanvasModulate to see wrong black shadows from Mix mode

Minimal reproduction project (MRP)

IssueWithLight2D.zip

@clayjohn
Copy link
Member

clayjohn commented May 2, 2024

I think this might be more of a feature proposal for a "Multiply" blend mode for lights.

Taking a look at the MRP every test case scenes to look exactly as expected for the given blend modes.

Do you happen to know more details about how the "Multiply" blend mode should work? Also, is your light in the example image using a greater then 1 color/brightness to add energy to the scene?

@KarmyDev
Copy link
Author

KarmyDev commented May 2, 2024

In my example image provided the intensity is actually set to 2.96 iirc. (URP 2D)

There is wikipedia's article on blend modes which also does mention Multiply and other effects that would be nice to see as well, such as Screen, Overlay, Soft Light, Hard Light, Lighten Only and Darken Only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants