Refine Cel-Shader and Outlines

I have managed to implement my Distance Fade effect in engine. This time I’m dividing the distance from camera by the size of the object with the options to customize the fade distance and scale factor for each instance. You can see how small creatures become silhouettes much more quickly than large ones.

You may have noticed that the outline is also no longer creating those ugly black zones on the character. This is because I’m now implementing the outline via a post-process effect, which also means that the performance cost is essentially fixed no matter how many outlines the renderer has to draw.

However, the same logic that the post-process outline uses to minimize the black areas at grazing angles can probably be used on the material outline as well. And the post-process approach has some drawbacks:

  1. Although the performance cost is fixed, it is steeper in general, and only becomes a savings when there are many creatures on screen at once.
  2. The distance scaling is not automatic, and I’m not totally happy with it even after extensive experimentation with the various parameters.
  3. The outline parameters are fixed for all entities that are flagged for post-process. I can’t customize for each instance.
  4. At the max draw distance, the outline tends to disappear suddenly causing a noticeable popping.
  5. Post-process effects work on a pixel-basis. Since it doesn’t think in terms of whole objects, I may not be able to apply the same logic I used to influence the distance fade by the size of the object.

I’m still undecided which approach to use, or whether I can use a hybrid approach, relying on material outlines until a certain threshold is reached in terms of performance or number of on-screen cel-shaded entities, and then start unloading the outline material from distant creatures to rely on post-processing instead.