Technologies: Boo, ShaderLab

Status: WIP.

A custom Unity Shader intended for a game I am planning.

What works

The project was updated to Unity 5.3.5 and it should contain all the files needed to run a demo scene. The shader supports 4 real time lights (point or spotlight), normal mapping and there is an alternative shader with baked textures.

You can view an screenshot of the shader here: click me!

The objective

This shader was created for a game and it showcases the art style, the idea is that the world looks like it is illuminated by faint moonlight.

More information

This shaders works with all dynamic light sources, but it looks particularly nice coupled with spot and point lights. With any realtime light, the shader calculates a specular highlight using a traditional light calculation and clips to 0 or 1 based on a threshold, it is similar to a toon shader but it will only render in black or white. The shader also implements a secondary threshold to simulate bands of light rather than a full specular shine.

In the absence of any light source, the shader fakes an specular shine based on the camera position and the surface normal, as the camera moves, so does the shine. This simulates a perpendicular light that comes "from the moon"

There is an alternative version that replaces the fake shine with a baked texture, however the quality is not the same as the real time version.

My participation

I did all the shader code, scene setup and any code there. The models were taken from Unity's default assets and the rocks are free models in the unity store:!/content/19288

What is broken

This is an early prototype, some things are still a bit unstable and the light can do some weird things under certain circumstances.