Lighting in 2D games

Started by eri0o, Tue 10/05/2022 13:53:24

Previous topic - Next topic

eri0o

Hi, I am looking for examples of lighting usage in 2D games. Here's an example from the game Backbone:



I would like to look into examples and see what games are doing, but I don't have much information on this. Any ideas and things you have seen in other games? I am looking at strictly games that are either 2D or really close to 2D. If it's an adventure, it's more interesting, but it doesn't have to be.

Also found an interesting tutorial on casting shadows in top down 2D: https://ncase.me/sight-and-light/

newwaveburritos

https://preview.redd.it/73wa5mnmpyd81.gif?format=mp4&s=2db53193cc33bf410acf59a79d46093cfbe239cb
https://preview.redd.it/p21p6s1z9bc81.gif?format=mp4&s=a50ba32145b7e76421784c93e93b2df7e4b547f9
https://preview.redd.it/yicc24vhcxg81.gif?format=mp4&s=37d6c65743d6e64e333e6ddf68fa78f4a916f15d

Here are some examples of lighting I have done.  These are all done in EGA with palette shifting.  The links are a little weird and you may have to set them to "loop" but they generally give a good idea of how I'm doing it.  I really love the way lighting looks like this.  I wish I could figure out a way in AGS to do this sort of thing dynamically.  It could be done since you would essentially just be swapping one color for another and you could make a kind of mask character or something and move one color to another either lighter or darker as it comes within the mask.

LimpingFish

Isn't a lot of "dynamic" 2D game lighting actually some kind of 3D effect done with normal maps and such? At least for characters? Using something like this?

Anyway, I've seen quite a few 2D adventures use funky lighting. Distraint, for instance, or Claire, or The Long Reach, spring to mind, although I'm not sure that they use anything more than simple graphical effects.

Steam: LimpingFish
PSN: LFishRoller
XB: TheActualLimpingFish
Spotify: LimpingFish

Danvzare

I remember once encountering a tech demo made in Flash that showed off bump-mapping. The light source followed the cursor, and it was very cool, especially since it was entirely 2D (this IS Flash we're talking about after all).
After spending a little time looking for it though, I can't seem to find it. But it's no wonder, I think it was about 6 years ago when I last saw it, and Flash has been discontinued since then.

Cassiebsg

#4
Quote
The light source followed the cursor, and it was very cool, especially since it was entirely 2D

Awesome bumb has that too.

Edit: I was a bit in hurry last night... Just wanted to add that this prog. is open source, so maybe it won't be too far fetched, for those of you with the skills, to make a plugin. :) Assuming AGS can process this fast enough.
There are those who believe that life here began out there...

Ali

Broken Sword 5 used dynamic rim-lighting that looked really good, I think. And they seem to be 'faking' it in a cool-looking way for The Drifter: https://twitter.com/DuzzOnDrums/status/1473532545190924288

Stupot

My Awesome Bumb had dynamic rim lights, too.
MAGGIES 2024
Voting is over  |  Play the games

authorillustrator

Quote from: Ali on Wed 11/05/2022 08:57:55Broken Sword 5 used dynamic rim-lighting that looked really good, I think. And they seem to be 'faking' it in a cool-looking way for The Drifter: https://twitter.com/DuzzOnDrums/status/1473532545190924288

Any idea how the rim lighting effects were achieved for the Drifter? It looks awesome, but I'm not sure how to even start doing something like this.

Gilbert

If not using palette or shader effects, one way of faking this (in AGS) is to prepare different copies of character loops with different lightings (e.g. the simplest ones are a version for light coming from the right and a version for light coming from the left) and change the characters' graphic loops accordingly when they walk into/leave certain room Regions.
You'd need to make more versions if there are different coloured lighting areas though.

eri0o

#9
They mention they are faking, so my guess for ags equivalent is you have a set of images that are these highlights only (you could draw like a different layer on top in your favorite pixel drawing software and export just that layer) and then you either have a table where for whatever is the character sprite you put the matching sprite in a room overlay and adjust its position to match the one of the character in rep-exerc-always or you have a view that matches the player walk view (and another one for how many different views you need for your player character) and then have a cHighlight character where you set the view to match and have it using follow exactly.

Then you adjust the Transparency of either the overlay or cHighlight depending of the player x and y position.

This is how I did the above effect in my game - I used the overlay method. In my game though instead of manually drawing the highlights for each frame (which is what I believe was done in the drifter) I came up with some way to dynamically draw using a dynamic sprite and it's surface and then set the resulting sprite to the overlay. A simple way to draw using dynamic sprites is to get a copy of the current sprite of the character, tint it so it becomes a silhouette, then you use two draws, one you draw the highlight color and the other you move 1 pixel left and up to carve out the the rest, then you can do adjustments (like carving out at the height of the feet and head) and it should work. A bit character design with darker colors help sell the highlight a bit more.

In AGS 4 we have shaders so if someone comes up with a math for shaders one could use that.

SMF spam blocked by CleanTalk