Skip to content

NullTale/LutLight2D

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 19, 2023 23:55
September 19, 2023 23:55
April 5, 2023 12:04
April 5, 2023 10:30
April 2, 2023 21:49
April 16, 2023 12:04
April 2, 2023 21:51
April 3, 2023 17:15
April 3, 2023 17:15
December 7, 2023 11:28
April 2, 2023 21:51
April 2, 2023 21:51
April 2, 2023 21:51
April 4, 2023 12:23

LutLight2D

Twitter Boosty

Stylized pixel art lighting shader for Unity2D using a color replacement technique.
It keeps the original colors of the palette and can create unusual stylization effects.

Tested with Unity 2021, 2022, uses Urp 2D Renderer and Shader Graph.


Examples

Pattern shading Oil6

Sharp gradient shading Fantasy 24

In shadow visible objects Lospec500

In shadow outline FUZZYFOUR

How it works

The general idea is to make each color have its own shading gradient defined manually
like it is done in most pixel art palettes.


The shader does this using a set of Lut tables generated from gradient ramps.
The color for replacement is taken from the tables depending on the brightness from the lighting texture.


Colors from the tables can be taken with interpolation blending, to make smooth transitions.
By specify color ramps and using material options, effects as in the examples can be achieved.


Installation and use

The Shader uses the lighting texture from the Urp 2D Renderer so Urp Asset must be configured.

Install via PackageManager https://github.com/NullTale/LutLight2D.git

First needed to create the LutLight2D Asset, it will generate a texture with a set of lut tables for the material.


It will create a material and Grayscale Ramps for it, which should already be enough to apply the material.


Next step is to set the gradient table for each color from the palette.
After the gradients are set, need to press the Bake button to apply the result if it was not done automatically.

Result with the character sprite in the lospec500 palette.

The Ramps file is a common .png which contains shading gradient for each color from the palette, starting from the original, lightest, to the darkest.
Colors also can have alpha channel.

Now the character shaded with black color from the palette, and his light areas like eyes and face are visible in the shadows.
By changing the Color Ramps, unusual materials can be made that are only visible in shadow or light, as in the example for the lospec500 palette.

Examples with other applications can be found in the package samples.

Releases

No releases published

Packages

No packages published