This week I am focusing on enhancing the cel-shading effect and I want to add a stroke effect to the model. This is because lines are an important effect in some of the classic cel-shading animation work. In this style of film, the stroke also provides a degree of additional detail.
Here I have taken some of the official UE stroke effects and used postprocessing to stroke the full screen.
This is the node for postprocessing materials. The basic principle is to get the depth information of the screen space to get the front-to-back relationship between objects or the objects themselves. This allows you to determine where to stroke the edges. An additional advantage of using depth information is that when the camera is far away, the stroke can be adapted and a better result can be achieved.
The custom depth in UE4 allows you to control the on/off of the object stroke effect.
In traditional celluloid animation, you can notice that some distant scenes are not stroked. In UE4, the SphereMask node can be used to make the stroke effect fade with distance based on the camera position.
Overall node for post-processing materials:
Comparison of final results.
It can be seen that the model with the stroke effect has more detail.