fastjengine / FastJ

An open-source, Java-based 2D game engine.
https://fastj.tech
MIT License
82 stars 22 forks source link

[Feature Request] Dynamic 2D lighting and Shadows #68

Open AurumByte opened 3 years ago

AurumByte commented 3 years ago

Is your feature request related to a problem? Please describe.

Currently in FastJ, the only way to set up lighting is to use gradients... while this may solve basic needs. It can be tedious sometimes to set up proper lighting, not to mention shadows won't be supported

What should the solution be like?

Drawing of basic lighting (could be pixel based or gradients) that forms shadows dynamically when light is moved closer to another solid object.

Alternatives?

There aren't really any alternatives to this, but like i said above, the only way as of right now is to use gradients, and again, as i said above... it gets tedious sometimes and there's no shadow rendering as well..

lucasstarsz commented 2 years ago

After re-reading this, I have to wonder, are you looking for something akin to a physics-based shadow and lighting system? It does seem that way, at least in regards to dynamic shadows and lighting. This would first require a physics engine to be implemented, so we'll see about that.

AurumByte commented 2 years ago

Not really. By dynamic lighting and shadows I mean lighting that can be moved around and the shadows formed by said lighting to also change based on the position of the lighting w.r.t the object, in game... whether or not this lighting can be subject to physics is a neat idea, but kinda unrelated to the lighting system in general

Hope this clears things up!

lucasstarsz commented 2 years ago

Ah, that makes a lot more sense. Well, as Light2D progresses (as well as the soon-to-be inclusion of shear transformations) it may be possible that shadows and lighting can be handled in such a way. But for now, what exact implementation of dynamic lighting and shadows FastJ will have is undetermined. We shall see -- thanks for clearing up what you were asking ^^