jgayfer / bevy_light_2d

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

Return early if color has 0 alpha #13

Closed rudderbucky closed 1 month ago

rudderbucky commented 1 month ago

Summary

Small optimization I thought of while working on my own shaders with a lot of invisible pixels. There's no need to run the expensive lighting loops if the color is going to be invisible anyway.

rudderbucky commented 1 month ago

Hmm I was thinking about that actually... it doesn't make much sense in this use case and of course the per-mesh basis was what I thought about this on... would it be better if you could choose the color it short circuits on in the event the camera fills in 0 alpha areas with its placeholder color?

jgayfer commented 1 month ago

would it be better if you could choose the color it short circuits on in the event the camera fills in 0 alpha areas with its placeholder color?

Possibly? But I'm admittedly not sure how / when that would happen. Likely need a more concrete example.

This might be something we just keep in mind until we start exploring mesh / sprite specific shaders, as we'd need to do that anyway if we ever want to have lights not impact specific sprites.

rudderbucky commented 1 month ago

Sounds good... I'll just close this PR then.