.. _doc_2d_lights_and_shadows: 2D lights and shadows ===================== Introduction ------------ This tutorial explains how the 2D lighting works in the `lights and shadows ( https://github.com/godotengine/godot-demo-projects/tree/master/2d/lights_and_shadows )`_ demo project. It begins with a brief description of the resources used in the final demo and then describes how to make a scene like the demo step by step. ![](img/light_shadow_main.png) All the resources for this tutorial can be found in the `official demo repository ( https://github.com/godotengine/godot-demo-projects )`_ on GitHub. I suggest you download it before starting. Alternatively, it can be downloaded from the Project Manager. Launch Godot and in the top bar select "Templates" and search for "2D Lights and Shadows Demo". Setup ----- For this demo we use four textures: two for the lights, one for the shadow casters, and one for the background. I've included links to them all here if you want to download them separately from the demo. The first is the background image (`background.png) ( https://raw.githubusercontent.com/godotengine/godot-demo-projects/master/2d/lights_and_shadows/background.png) )`_) used in the demo. You do not necessarily need a background, but we use one for the demo. The second is a plain black image (`caster.png) ( https://raw.githubusercontent.com/godotengine/godot-demo-projects/master/2d/lights_and_shadows/caster.png) )`_) to use as our shadow caster object. For a top down game this could be a wall or any other object that casts a shadow. Next is the light itself (`light.png) ( https://raw.githubusercontent.com/godotengine/godot-demo-projects/master/2d/lights_and_shadows/light.png) )`_). If you click the link you will notice how large it is. The image you use for a light should cover the area you want your light to cover. This image is 1024x1024 pixels, so you should use it to cover 1024x1024 pixels in your game. Lastly, we have the spotlight image (`spot.png) ( https://raw.githubusercontent.com/godotengine/godot-demo-projects/master/2d/lights_and_shadows/spot.png) )`_). The demo uses a blob to show where the light is and the larger light image to show the effect of the light upon the rest of the scene. Nodes ----- The demo uses four different nodes: * `CanvasModulate` * `Sprite` * `Light2D` * `LightOccluder2D` `CanvasModulate