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

Vulkan: Light2d Blend Modes do not behave correctly #49922

Closed
dweremeichik opened this issue Jun 26, 2021 · 15 comments · Fixed by #66370
Closed

Vulkan: Light2d Blend Modes do not behave correctly #49922

dweremeichik opened this issue Jun 26, 2021 · 15 comments · Fixed by #66370

Comments

@dweremeichik
Copy link

Godot version

4.0.dev (fdccc0b)

System information

Windows 10, Vulkan, GTX 1070

Issue description

Setting a Light2d to Mix blend mode does not produce the expected results:
3.2.3:
Light Mix test 3 3 2

4.0.dev:
Light Mix test 4 0 dev

Steps to reproduce

  1. Create a scene with a background and a Light2d (point or directional).
  2. Set the Light2d to Blend Mode "Mix".

Minimal reproduction project

Without explicitly setting it, 4.0 changes the light source back to add mode on import.
Light Mix Test 3.2.3.zip
Light Mix Test 4.0.dev.zip

@girng
Copy link

girng commented Nov 18, 2021

I think my issue #53660 is a duplicate of this. Same exact effect.

GameFromScratch's video showcasing 4.0 and the new lighting system worked good. So somethig must have happened (just saw it has a regression label, that's good!)

@Calinou
Copy link
Member

Calinou commented Nov 18, 2021

GameFromScratch's video showcasing 4.0 and the new lighting system worked good. So somethig must have happened (just saw it has a regression label, that's good!)

Indeed, the 2D lighting system broke in various ways at some point earlier this year (or last year). It would be good if someone could bisect it, although it'll require a lot of build steps (likely 20 or more).

@girng
Copy link

girng commented Nov 30, 2021

@Calinou To my surprise, after compiling a bunch of different builds starting from March 2021, all the way back to December, 2020 (when GFS made his video). I found the PointLight2D issue was apparent on all. I also noticed on GFS's video he used a CanvasTexture and mapping images.

I'm not sure if Light2D was changed or if this a documentation issue and maybe PointLight2D needs to be setup differently than before. Although we should just be able to select a light texture like before, but with Vulkan and single pass lighting, there might be more the user needs to do

@Calinou
Copy link
Member

Calinou commented Nov 30, 2021

Although we should just be able to select a light texture like before, but with Vulkan and single pass lighting, there might be more the user needs to do

The setup process remains exactly the same, even if Vulkan and single-pass lighting is used behind the scenes.

@ZeEndy
Copy link

ZeEndy commented May 11, 2022

@Calinou To my surprise, after compiling a bunch of different builds starting from March 2021, all the way back to December, 2020 (when GFS made his video). I found the PointLight2D issue was apparent on all. I also noticed on GFS's video he used a CanvasTexture and mapping images.

I'm not sure if Light2D was changed or if this a documentation issue and maybe PointLight2D needs to be setup differently than before. Although we should just be able to select a light texture like before, but with Vulkan and single pass lighting, there might be more the user needs to do

The build that still had a working 2d light system dates all the way back 28 November 2020 when it was shown in the article about godot 4.0's improvments , so I think thats a good starting point to do what @Calinou suggested

@ZeEndy
Copy link

ZeEndy commented May 11, 2022

Added on to that I think it would also have the code to fix #55806

@h0lley
Copy link

h0lley commented May 16, 2022

actually this didn't break - it was broken since implementation.
it still works in just the same way as when Juan posted that article and GameFromScratch made that video.
the difference is that they are using normal maps.

so this issue is really not about blend mode mix specifically, but about different behavior when omitting normal maps.

image

Added on to that I think it would also have the code to fix #55806

this one actually did work initially with vulkan and broke later. I've identified the commit and posted it in that issue.

@sakrel
Copy link
Contributor

sakrel commented Jul 19, 2022

I tried to fix this, but couldn't get it quite right. While mix and add blend modes look similar to what they looked like in godot 3.x, subtract looks cleary off. If anybody wants to have a look, this is the branch: https://github.com/sakrel/godot/tree/vulkan-fix-2d-light-blending

@bitbrain
Copy link
Contributor

bitbrain commented Aug 21, 2022

There are definitely still issues with this. In Godot 3.5 it looks like this:
Capture2

While the same-ey setup in Godot 4.alpha14 looks like this:

Capture

perhaps related to #58688?

@PetrVopa
Copy link

from what I remember when creating #58688 it is the same thing

@bitbrain
Copy link
Contributor

One more thing: I used Add mode, not Mix mode in my setup. So it looks like the title of this issue is slightly wrong.

@dweremeichik dweremeichik changed the title Vulkan: Light2d Blend Mode Mix does not behave correctly Vulkan: Light2d Blend Modes do not behave correctly Aug 22, 2022
@PoisonousGame
Copy link

In godot3, add a CanvasModulate node, and then a PointLight2d node. Set the CanvasModulate color to black and the light will illuminate things in range, this doesn't work in godot4. The documentation is also not updated and the 2D lights don't seem to be maintained!

@dweremeichik
Copy link
Author

@PoisonousGame this should probably be under a different issue (or multiple if necessary). If there is no specific fitting issue that is already opened with a minimal reproduction project, please feel free to create one. Please don't spam other issues with copy/paste.

Also note that Godot 4 is not production ready and anyone who is leading you to believe that it is; should not be doing so. With regards to documentation, it would be an effort in futility to "update" parts of it that are still subject to change/overhaul before release.

@h0lley
Copy link

h0lley commented Sep 12, 2022

#58688 already exists which is most likely what PoisonousGame is referring to.
it was closed as duplicate of this issue. I'm uncertain if it really is a dupe though. I think once this issue is resolved, #58688 should be reassessed again.

@bitbrain
Copy link
Contributor

This commit f123981 might contain some hints about what the issue might be.

bitbrain added a commit to bitbrain/godot that referenced this issue Sep 24, 2022
akien-mga added a commit that referenced this issue Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

9 participants