jgayfer / bevy_light_2d

General purpose 2D lighting for the Bevy game engine.
MIT License
170 stars 7 forks source link

Lights *sometimes* not working at all #34

Closed lenny991 closed 3 weeks ago

lenny991 commented 1 month ago

So, I've noticed an issue with my project where lights just don't work at all, no AmbientLights or Lights work. This happens every so often, and only works again when reloading the game. It's super strange that it happens so inconsistently, and that it happens/refuses to happen even if I haven't changed anything.

Here's a long video of me reloading the game a few dozen times until finally, at the end, the issue appears. Also apologies for the video's aspect ratio, I can't be bothered to redo the video, and I had the incorrect settings on OBS. The part you're not seeing is the Terminal, where I'm spamming cargo r and ctrl+c.

https://github.com/user-attachments/assets/2b0ff88b-282a-4af1-80b3-4258d0cf2727

There don't appear to be any error messages or any other print (that I noticed) from the light systems, but any potential error messages may be overridden by the physics system I'm using (avian) which doesn't like my implementation because there are some overlapping colliders. (and thus prints out like 7500 warnings, meaning I can't see anything before that)

Also I'm on linux which may be a part of the issue as maybe this crate was created on Windows and this is some Linux specific scheduling issue.

If anyone wants (and isn't able to reproduce the issue), I'll try to create a minimal reproducable project, so I could maybe get some more in depth looks at any potential error messages in the console.

Thanks!

May definitely be in some way linked to https://github.com/jgayfer/bevy_light_2d/issues/33

jgayfer commented 1 month ago

Thanks for the report! My gut is that #33 is related, but that's only a hunch.

I'm vaguely recalling times where I had no lights applied during development, but I chalked it up to other factors. There's definitely something going on here.

rparrett commented 3 weeks ago

Smells like a system order ambiguity.

TurtIeSocks commented 3 weeks ago

I'm experiencing this and #33 quite often, anything I can do to help debug? I tried to look through source but I'm far from a Bevy expert currently and got a bit overwhelmed with what I was looking at.

jgayfer commented 3 weeks ago

I'm experiencing this and #33 quite often, anything I can do to help debug? I tried to look through source but I'm far from a Bevy expert currently and got a bit overwhelmed with what I was looking at.

My current guess is that we adding our render nodes in the wrong place / wrong way such that something else is conflicting. It happens here.

It could be that we need to be creating a separate subgraph, like bevy UI does.

I could be wrong, but I would be surprised if it has to do with any actual rendering code. My gut says it has to do with how/where we're setting things up to run.

TurtIeSocks commented 2 weeks ago

So far it's working perfectly now. Thanks @rparrett and @jgayfer !