[WIP - UE4.25 Fork] Sakuga Rendering - Anime Cell Shading That Actually Works With Dynamic Lights

Sakuga Rendering UE4:

Been a big fan of UE4 for a while, but have always been bothered about the lack of proper ways to implement custom shading. Many methods involve feeding in a light vector into the material to determine if an area is lit or shaded and then feed that into the emissive input. 2 examples of games that do that are “Guilty Gear Xrd” and “My Hero One’s Justice”. The benefits of using this method is that it is cheap, but you loose the ability for the model to receive shadows from other objects in the scene or the model to shadow itself.

With this method, direct lights reference the base color(the lit color) and subsurface color(the shaded color) to determine the lighting, along with another custom pin value, that fudges if a surface is lit or not. This way, you have more control over the models color, without loosing access to dynamic shadows.

Currently there are two separate shading models, one determines the shaded color by multiplying the base color with the subsurface color and the other only uses the subsurface color itself.

Other lighting is handled normally(except sky-lighting is ignored), so if you need other lighting for the model, you merely use a separate lighting channel. After referencing several anime cell shading game, like “Ni No Kuni”, this seems to be the preferred method for non directional lighting.

I would appreciate some feedback, and will share the fork after cleaning some of the shader code up a bit. Most of the logic was determined from the Guilty Gear Xrd GDC talk which you can find here: GuiltyGearXrd's Art Style : The X Factor Between 2D and 3D - YouTube as well as referencing other games.

Other resources for making your own custom shading model :
https://blog.felixkate.net/2016/05/22/adding-a-custom-shading-model-1/
Unreal Engine 4 Rendering Part 6: Adding a new Shading Model | by Matt Hoffman | Medium

Thanks in advance for the feedback!