|
|
|
|
Reply From: |
The_Black_Chess_King |
WELL, realtime shadows are more common in 3D, and even then they are kind of baked into the game, not calculated in realtime. But mostly in 2D you generally do not work with big dynamic lights, instead you will normally use fake lighting, using tint or LUTs to the landscape, to make it night, use a bluewish dark tone, and sunset, orange-yellow. The light itself could be a ambient tint colored rectagle on top of your world, multiplying your colors or tinting them.
The shadows could be 2d copies of the sprites, squished down and inverted on the y axis, distorted in a angle, to make it look like the sun is rotating around the objects. I don’t think using a big light to create dynamic shadows will ever be optmized and keep a nice FPs, unless it’s 2.5D, but that’s way overkill in my opinion, unless you know what you are doing.
This idea I mentioned is easily understood here, but keep in mind it’s a different engine:
Here’s a game that uses this technique: (check for 3:00 and 9:00 timestamp to see what I mean)
Here in this discussion there is some information as well,
https://www.reddit.com/r/gamedev/comments/7cti1q/2d_daynight_cycles/
I don’t know the graphics you are going for, a screeshot would be nice. Shadow is a complex thing in 2d games, search on google and notice how other games did it as a reference.
Thanks so much! This is SUPER helpful!
I don’t have screenshots atm but here’s a teaser trailer for the project. (00:34 - 00:40 has two different outdoor scenes where you can see the light casting shadows.)
https://www.youtube.com/watch?v=hVEc31JrO6Y
I played around with it more, and currently I’m reducing lag by using a Light2d w/ a custom texture that sits wherever the light should be. Since I don’t have to enable shadows w/ this texture, it seems to have reduced the lag. The only issue is that now certain bodies don’t produce a shadow (ex: the creature at the 00:38 timestamp).
I’ll try using the techniques you’ve mentioned for bodies like that… or I’ll just swallow my pride an skip out on giving them shadows until I make the jump to 2.5d.