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

LightOccluder always displays on top in Godot 4.x #78964

Closed
ghostsoft opened this issue Jul 3, 2023 · 2 comments
Closed

LightOccluder always displays on top in Godot 4.x #78964

ghostsoft opened this issue Jul 3, 2023 · 2 comments

Comments

@ghostsoft
Copy link

Godot version

4.0.3

System information

Windows 10

Issue description

When using a LightOccluder2D or using the occlusion layer in a TileSet, the shadows will always be on top of whatever it's occluding. This has been known since Godot 3.x but what has changed in Godot 4.x is that you can no longer move the occluder behind its parent using "Show behind parent" nor is it affected by z-index, y-sorting, place in the node tree or any other setting i can find.

The first image here shows this trick being used in Godot 3.5.2 and on the right is the same project converted to Godot 4.0.3, where the "show behind parent" setting no longer affects the occluder and it always shows on top.
image
image

On this note I have not found any way to cast a shadow without also occluding the object casting the shadow in Godot 4.x short of using multiple duplicate lights and it feels like this is a big shortcoming of the new TileMap system (walls cannot cast shadows unless they are also casting shadows on themselves). I've exhausted the google search for this and come up empty handed and this bug is certainly not helping.

Steps to reproduce

  • Set a LightOccluder2D as a child of a Sprite2D.
  • Set the LightOccluder2D Light Mask to layer 1 and the Sprite2D Light Mask to layer 2
  • Set a Light2D with a mask of 1 and 2, enable Shadows and set the shadow mask to 1
  • Clicking on 'Show Behind Parent' on the LightOccluder2D would at this point hide it behind the sprite in Godot 3.5.2 but the setting does nothing in Godot 4.0.3

Included is the Godot 4.0.3 project from the image with all of these things set, including the occluder set to show behind parent.

Minimal reproduction project

LightTest.zip

@AThousandShips
Copy link
Member

@Calinou
Copy link
Member

Calinou commented Jul 3, 2023

Thanks for the report! Consolidating in #64939.

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