


And the cutoff results in a very sharp change from fully lit to fully shaded it’d look better with a very small falloff to prevent aliasing artefacts.

We could implement fresnel shading - which we’ll explore in the next tutorial. We could implement more cut-off points, which would give us more lighting “bands”. After all, we don’t even have specular lighting, and we might want more flexibility with the cut-off points. Hurray, we can all go home now, we’re done! …except I think we can do a little better. The resulting effect certainly reaches the cel-shading requirements. We’ll write our shader to only interact with Unity’s forward rendering pipeline.įloat diffuse = dot ( normal, lightDir ) // An additional line to implement two-tone shading: To build a lighting model, we supply a function with a name beginning Lighting - the exact semantics we must use can be found here. With our new lighting model, we won’t use that - instead we’ll use the more basic SurfaceOutput struct. Right now, we’re using the Standard lighting model, which includes the SurfaceOutputStandard struct to hold its parameters. However, we’ll need to write our own lighting model instead of using a built-in one. It’s currently the same as the finished DiffuseSurf shader we wrote in the last tutorial. Much of the power and utility of surface shaders comes from the fact they can be used to specify surface properties and leave the lighting to Unity, but since we’re going to be manipulating lighting directly, we’ll need to build our own lighting model. Before we get started, we’ll need to make a few modifications to the surface shader variant. The effect is characterised by hard shading with very little smoothing between lit and unlit sections of an object’s surface.įor this tutorial, we’ll be using the Diffuse shaders from the previous part as a base. You’re probably seen cel-shading in popular games such as Jet Set Radio and The Legend of Zelda: The Wind Waker, both of which are pioneers of the aesthetic, and recent titles like the Borderlands franchise. This results in a non-realistic look, commonly seen in cartoonish 3D games. This tutorial builds on what we learned in the Diffuse lighting tutorial and introduces thresholds on our lighting values to give our objects solid shading bands.
