The Light of Forgotten Promises
Howdy all! In an earlier devlog I mentioned that I would make a post about how the revamped lighting in Update 3 is being done. I then promptly forgot all about it. Oops!
This blog will provide a little bit of information on how some effects in T-SOL were achieved with Unity's "experimental" 2D Lighting system. This uses Unity's Universal Render Pipeline feature. If you want to try this for yourself in an existing project you'll have some installation to do. This isn't really tutorial though so you'll have to check the manual on how to set up.
Every 2D light has a ton of different options on how to set it up. We only really use two modes since they're both super versatile. The first is "Point"
Point lights in 2D lighting are pretty similar to their 3D equivalents. It's more or less the same as a simple lightbulb. The biggest difference is that the 2D lighting package gives a lot of control over exactly how the light fades away. The standard way Unity's lights fall off is often rather poor looking for large radius lights. Either the center of the lit area is excessively bright or the outside is barely lit at all. These adjustments are super helpful. Notice how the distance the light covers isn't changed, it just fades more suddenly as the falloff is adjusted.
It's also possible to adjust how strong shadowed a particular light is.
A second feature is the ability to create "volumetric" lighting. A volumetric light renders a solid color on top of the scene. This is extremely useful in T-SOL because it's now possible to make areas appear to be dusty or foggy by increasing the strength of a light's volume.
The most interesting light in the Light 2D package though is the "Freeform" light. With it it's possible to light a space of any shape or size. For example this glow
The freeform light has its limitations though. Freeform lights produce shadows in the same way as point lights. The result is unrealistic for very large lights. In real life a large glowing area, such as a fluorescent tube, will produce light and shadow from the entire surface. Unity's lights do not reproduce that effect.
Here's an example of that problem in-game.
My current solution is pretty lazy but it works well enough. Just add more lights. It's not perfect but it produces a closer approximation to what an actual large glowing thing would.
Speaking of shadows... Let's talk about how shadows work with Light2D. Normal objects do not produce shadows in this brave new world. In order to produce a shadow an object needs a 2D shadow caster component. It's simple enough. Add it then draw the shape of the area you want to block lighting on. Easy peasy.
That's pretty much all. I'm leaving out a few details on how we're making the tile maps actually cast shadows and some nuance with sorting layers but they're kinda boring to talk about.
See you in the next devlog!
Get T-SOL - Early Access Demo
T-SOL - Early Access Demo
An accident has left Saul marooned on an unfamiliar planet. Help get Saul home!
Status | In development |
Authors | Bird With Toes, Tofski |
Genre | Platformer |
Tags | 2D, Metroidvania, Short |
More posts
- Update 5 NOW AVAILABLE!Sep 10, 2023
- Plans for Update 5Aug 01, 2023
- Unity 2D Animation with Fancy Lighting!Aug 01, 2023
- Update 4 Released Development ResumedJul 16, 2023
- Customized Tiles in UnityJun 21, 2021
- Plans for Update 4May 10, 2021
- Update 3 now Available for Download!May 04, 2021
- Update 3 will be available Tomorrow!May 03, 2021
Leave a comment
Log in with itch.io to leave a comment.