6 Point Lighting Shader - Setup inside Unity Shader Graph

I wanted to improve the look and depth of the effects in our games, I came across a very useful method of adding baked directional lighting into sprite sheets and using a shader to read this information, this works on particle systems as well as on regular meshes.

Above you can see one of the textures I used when testing out this effect. This method is called 6 way lighting and can be achieved via baking lighting information into the RGBA channels of two textures.

The first texture packing is:

  • R - top down lighting

  • B - bottom up lighting

  • G - right hand lighting

  • A - Left hand lighting

the second textures channels are

  • R - back Lighting

  • B - Front lighting

  • G - free to use

  • A - Alpha

This Shader-Graph shows how the setup works in Unity, I plan to move this across to HLSL when I use it in a production environment for performance gains. In this graph I have included custom functions to allow me to access the light direction and colour of a directional light.

Previous
Previous

Distance Based Light Culling in Unity

Next
Next

Water Shader - Flow-Maps