Cel Shader

From C4 Engine Wiki

Jump to: navigation, search

A simple cel shader can be created by using the output of the Diffuse Reflection process as the input texture coordinates for a cel texture as shown in the following shader graph (light pass).


Image:Celgraph.png


The cel texture is basically a one-dimensional look-up table for reflection intensities and can be divided into as many bands as you want. The following image shows an example cel texture that is 64×1 pixels in size.


Image:Celtexture.png


For best results, the cel texture should have the following properties:

  • The leftmost pixel should be 100% black, and it should be only one pixel wide.
  • The rightmost band should be 100% white.
  • The wrap modes should both be set to Clamp.
  • Mipmap generation should be turned off.

Using a texture map simplifies the shader and allows the transitions between intensities to be smoothed out by the filtering hardware. Using a larger (wider) texture map will make the transitions sharper.

Here is an example application of the cel shader described in this article:


Image:Celchar.png

Personal tools