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: PointLight2D not working with CanvasModulate #58688

Closed
PetrVopa opened this issue Mar 2, 2022 · 4 comments
Closed

Vulkan: PointLight2D not working with CanvasModulate #58688

PetrVopa opened this issue Mar 2, 2022 · 4 comments

Comments

@PetrVopa
Copy link

PetrVopa commented Mar 2, 2022

Godot version

4.0 alpha 3

System information

Linux Mint Cinnamon 20.3 x86_64, GPU: nvidia geforce GTX 1650 mobile, Vulkan

Issue description

Hello, I'm facing a problem with lighting in Godot 4, I'm trying to get my entire screen black (using CanvasModulate) and then using PointLight2d on it. Instead of "showing" the original texture of the background the light just draws its texture on top of "CanvasModulated" background
reddit post: https://www.reddit.com/r/godot/comments/t3fdq4/lightning_in_godot_4/hyxz41x/?context=3

Steps to reproduce

Add sprite to the scene, add CanvasModulate, make it black and the add PointLight2D with a texture

Minimal reproduction project

lights.zip

@Calinou Calinou changed the title Lights in godot4 alpha 3 not working Vulkan: PointLight2D not working with CanvasModulate Mar 2, 2022
@Calinou Calinou added this to the 4.0 milestone Mar 2, 2022
@aXu-AP
Copy link
Contributor

aXu-AP commented Mar 10, 2022

I just stumbled upon this bug myself. It seems that the more darker modulation is, the more washed out textures will be. I wonder if it's something like (in pseudocode)

color = texture
color *= canvasmodulate // If this is black result is black
color += light // If we readd light to black result doesn't have original color

That would explain why color information gets lost. I tried to search in source, and I feel this is what is going on (the shader code is quite convoluted so I couldn't 100% confirm what is happening).

@PetrVopa
Copy link
Author

PetrVopa commented Apr 28, 2022

@aXu-AP I'm quite new to programing and I'm having troubles even trying to find where did you find this part of code, I would like to see what's going on and maybe try to do something with it, I have been searching the files for some time but no luck, can you please say me what file is this thing in? Thanks

@aXu-AP
Copy link
Contributor

aXu-AP commented Apr 28, 2022

Oh, sorry, that was pure speculation on my part. The actual computation is in the canvas shader I believe. However, for my untrained eyes it's hard to read all that shader code and not be overwhelmed. It's quite complicated and covers wide array of cases.

@Calinou
Copy link
Member

Calinou commented Aug 21, 2022

Duplicate of #49922.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2022
Repository owner moved this from To Assess to Done in 4.x Priority Issues Aug 21, 2022
@Calinou Calinou removed this from the 4.0 milestone Aug 21, 2022
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

3 participants