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

Unexpected behaviour of overlapping occluders #72983

Open
LittleToky opened this issue Feb 9, 2023 · 2 comments
Open

Unexpected behaviour of overlapping occluders #72983

LittleToky opened this issue Feb 9, 2023 · 2 comments

Comments

@LittleToky
Copy link

LittleToky commented Feb 9, 2023

Godot version

v3.5.1.stable.official [6fed1ff]

System information

macOS Monterey, 12.6 (also looks the same when I build project for iPhone)

Issue description

In example project I have one Light2D and two round Sprites2D. Each sprite has sphere normal map and LightOccluder2D as a child. Each occluder polygon is round drawn counter clockwise and its cull_mode is set to clockwise. In some cases (I can't figure in which exactly) when sprites (and hence occluders polygons) intersect area of intersection appears to be lightened - you can see it in the picture, look at the intersection of yellow and green sprites.
Screenshot 2023-02-09 at 23 41 32

And this is what I expect:
Screenshot 2023-02-09 at 23 43 15

I'm not sure if it's a bug. Once it's not, I would like to know how to fix this please. Probably it can be solved if every light is in own layer and every sprite has many occluders - one for each layer. But this approach may result in bad performance because of big amount of nodes so I hope there is another solution. In my work project there could be much more than one light source and more sprites.

It's interesting, that changing order of sprites in a scene tree fixes this problem but in my work project I generate nodes programmatically and

  1. I don't now in which order I should rearrange sprites
  2. Some couples of sprite look like expected while other are not what confuses me even more.

Steps to reproduce

Create scene like this
Screenshot 2023-02-09 at 23 37 12
don't forget to

  1. add normal map for each sprite
  2. add occluder and set corresponding to polygon's direction cull_mode different from "Disabled"
  3. turn on shadows on Light2D

or just load my example project
https://github.com/LittleToky/overlapping_occluders_example

Minimal reproduction project

overlapping_occluders_example.zip

@Calinou
Copy link
Member

Calinou commented Feb 22, 2023

Can you reproduce this in 4.0.rc3?

@LittleToky
Copy link
Author

Yes, I'll try to reproduce in 4.0.rc3 but unfortunately later. Thank you for reply!

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