Sprite Lights
SpriteLight rendering is a simple 2d light rendering technique where sprites are used to form a lightmap. This lightmap is then used to illuminate the scene.
![]()
info
The assets from this example can be downloaded here.
Sample#
We start by setting up the render layers
Next, we add a renderer for the drawables in our scene.
Next, we create a renderer for our light map. We assign a RenderTexture to which the light map will be rendered.
RenderTargetClearColor is used to create a slight ambient color. If you have a scene that is reasonably lit, you could use, for example, new Color(100, 100, 100, 255);
Next, we add our background, which we render to BackgroundRenderLayer.
Next we add our light, which we render to SpriteLightRenderLayer.
And finally we add the SpriteLightPostProcessor, which renders the scene using the lightmap RenderTexture.