TarVK / pixi-shadows

Adds dynamic shadows to PixiJS
https://tarvk.github.io/pixi-shadows/dist/
MIT License
52 stars 13 forks source link

Shadows don't scale right when used with pixi-viewport #18

Closed scott-cornwell closed 1 year ago

scott-cornwell commented 1 year ago

I'm not sure if this is a bug or what but I have pixi-shadows working great, except that when I zoom my pixi-viewport in and out the shadow layer does not stick with the rest of my scene. All my tiles are added to the viewport and they zoom and move together, but the pixi-shadows just don't sync right. I've tried manually translating the coordinates but no luck so far.

scott-cornwell commented 1 year ago

I actually ran into another problem where pixi-shadows occluders were not considered when outside the viewport, causing shadows on the edge of the screen to change suddenly but I was able to fix that by adding a buffer area on ShadowFilter.

scott-cornwell commented 1 year ago

Ok actually the real problem is just having a buffer area, that turns out to be causing the shadows not to be synced with the viewport. So I just need to a way to fix the original problem better. I had tried modifying ShadowFilter to extend about 200 pixels off each edge of the screen, and everything was great visually except when zooming. Would be great if there was support for this built in, still working on a way to do it.

TarVK commented 1 year ago

Is there any chance you could provide a minimal example of the issue? Maybe by adjusting one of the example scenes in this repo. The shadows are indeed fully confined to the viewport, so I could imagine that if scaling/translation is done in the "wrong" way, my code doesn't handle this correctly.

scott-cornwell commented 1 year ago

@TarVK The scaling isn't actually a problem, I broke it trying to modify pixi-shadows to have an extra buffer/border area. So really guess this could be closed and it's more of a feature request.