Game
2Volution WIP
8 years ago

Too many lights!


I’m still doing engine work and this time I spent quite a bit of time on lighting again (Don’t worry, I’m not only doing engine work. I’ve just postponed engine work and now I’m getting it all off my to-do list.)

I wanted 2Volutions lighting to be as flexible as possible so that it would allow me to make the games lighting feel more than just a simple gradient between dark and light, or whatever other gradients you may use.

The current state of it

5d0b957f18afb.gif

Going to get a bit more technical here, so the basic idea was that I’d like to have a combination of image based lighting and 2D dynamic shadows. Plus the shadows should not be sharp, instead they should be smooth and reveal quite a bit of the terrain.

So the first step was to generate an obstacle surface from the terrain, I wrote a simple shader for this that is kind of the opposite to an outline. There are 2 extra steps to make this surface as nice as possible though, first is to make it look a bit more random and the second is to smooth it out properly for smooth shadows.
Obstacle surface steps:

5d0b95814c1df.gif

The second step is to fill another surface with light images. This is fairly simple and straight forward, I draw the lights on the surface with additive blending and it’s finished for the next step.

5d0b9582160c9.png

The third and the final step is the most complex one. This is where all the shadow magic happens. All the data is passed into the shadow shader where ray marching and a few other neat tricks are used to create the shadows.
Shadows, with and without the blur that was applied in the first step

5d0b95851ab35.gif

One of the really good things about this is that if I don’t want smooth lighting it’s extremely easy to make it non-smooth! I can simply use different light sprites like this.

5d0b95886592b.png
5d0b958ab39db.gif

There still is a small bug (probably visible on one of the gifs), but it’ll be fixed in no time.



8 comments

Loading...

Next up

When lighting breaks...

Ha! Super smooth auto-tile renderer. No more blocks!

Playing around with lighting again

Spine2D integration

planning stuff on vacation I’m on a vacation for a few days, so instead of coding I’ve been writing down lots of very _secret_ ideas and updating the games roadmap. _you can post devlogs from phone? Nice._

Even more lights?

The Return of the Game

Stuff.

Spine2D Implementation nearly finished + DEMO

State of the game and other news