Godot Documentation: Lights and Shadows in 2D

Repository

https://github.com/godotengine/godot-docs
https://github.com/godotengine/godot

Details

Many new users to Godot have difficulty utilizing features that may seem straightforward to more experienced users. To address this, Godot has a github repository filled with demos. This is helpful for many people, but there are still lots of people who have trouble learning from code. The obvious solution was to create documentation that would not only explain how the feature works, but also how the demo works. The goal is that new users can use the example as a jumping-off point for personal projects but also have access to the documentation so they can understand anything they are having trouble with.

The Lights and Shadows 2D tutorial explains how the lighting system works in 2D in Godot by going step-by-step through the lights and shadows demo. Lighting in 2D is very different from 3D lighting, which is more intuitive, and it is fairly unique. Essentially the way lights work in 2D in Godot is that you take a sprite that looks like this:

give it a color and overlay it on the scene like this:

The colors add together to add light to the scene. Thats all there is to it. Just some clever sprites and additive blending.

Shadows are a bit more complex to implement; however, Godot makes it very easy. All you have to do is add LightOccluder2Ds to the scene and Godot will cast the shadows for you.

Components

The tutorial covers multiple node types including:

With these basic nodes you can implement light and shadows easily in 2D in Godot!

Links

http://docs.godotengine.org/en/latest/tutorials/2d/2d_lights_and_shadows.html

GitHub Proof of Authorship

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center