DanPlayer McKinnon

2D Masked Lighting

Unity Asset by Dan Player McKinnon

Overview

A simply and fast 2D lighting solution. In this method, lighting sprites are 'cut out' from a solid base colour then blended through.


Since the lights can be any 2D sprite, you are free to add thousands of dynamic or animated lights and this system will render them fine

Note: Be sure to move your light object onto the lighting layer.

GameObject Menu → Masked Lighting Camera

Setup masked lighting on any camera.

From the main menu...

Game Object → Dan McKinnon → Camera FX → Masked Lighting Camera


Add the effect to the main camera.
Click 'Yes' to attach it to the main camera. Click 'No' if you have selected a different camera.


You most likely want a 2D orthographic projection.
Click 'No' only if you are aware of the implications of using this technique on a 3D camera.


Add material to gain control of effect parameters.
Click 'Yes' to add a material that will let you tweak the settings of the effect
Click 'No' to use the default settings


Add Lighting Camera
Click 'Yes' to create a new camera that renders just the light layer.

Download

masked_lighting.unitypackage ( < 50Kb)