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

Shadows are cast from entities without ShadowCaster2D with the ray_marching feature #3

Open
jgayfer opened this issue May 3, 2024 · 2 comments

Comments

@jgayfer
Copy link
Contributor

jgayfer commented May 3, 2024

Summary

When using the ray_marching feature, shadows are still cast from entities that do not have the ShadowCaster2D component.

When using catalinzz, shadows are not cast.

Steps to reproduce

  1. Comment out / remove the ShadowCaster2D components from the basic example
  2. Run the basic example with the ray_marching flag

Expected behaviour

Shadows are not cast

Actual behaviour

Shadows are cast

@jgayfer
Copy link
Contributor Author

jgayfer commented May 3, 2024

I might poke this myself, but putting up an issue for posterity.

@jgayfer
Copy link
Contributor Author

jgayfer commented May 3, 2024

Dug in a bit deeper.

It looks like on our JFA pre-pass we consider any texture with an alpha greater than our threshold to be an occluder; we make no distinction if that texture comes from something with the ShadowCaster2d component on it.

In practice, this means that lighting and shadows both will only work in a world where we have a (mostly) transparent background.

In this example, I added a large "background" sprite with a gray color, and it occludes all light (whether or not it has the ShadowCaster2d component).

image

My hunch is that in our JFA pre-pass, we need to have some information about whether or not a given position is within a light occluder or not, instead of only relying on the alpha value (as this won't work if we have a background in play).

Alternatively, if we could create a texture that only contains entities with a ShadowCaster2d component, we could carry on using the alpha value, but I'm not 100% sure if that's possible.

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

No branches or pull requests

1 participant