For the extrapolation mode, the eighth bit (from right to left) of the stencil buffer needs to be marked to distinguish static objects (bit value: 0) from dynamic objects (bit value: 1), and you can set other seven bits by yourself. If the mark is incorrect or missing, serious blurring artifacts may occur on the edges of dynamic objects.
Symptom
In the demo, a serious blurring artifact occurs. For example, the head and body of a moving character are detached, and the head of the character tilts to the right.

Cause analysis
According to captured frames, it is found that the stencil value of the head area is 0 (binary value: 00000000) and the stencil value of the body area is 0x80 (binary value: 10000000). Both the head and body areas are target areas of a moving object and the eighth bit of their stencil values should be marked as 1. However, the stencil value of the head area is incorrectly set, resulting in head detachment from the body in generated frames.

Solution
The main cause of head-body detachment is that the stencil value of the motion area is not uniformly marked as 1xxx xxxx. Therefore, change the stencil value of the head area of the moving character to 0x80 (corresponding to 10000000 in binary, with the eighth bit marked as 1). Then, the head and body areas have the same stencil value and the head-body detachment disappears, as shown in the following figure.

Sample code
Check whether the stencil value in the dynamic object material shader is correctly set. The stencil value should be 0xxx xxxx for static objects and 1xxx xxxx for dynamic objects.
Shader "Standard_with_stencil"
{
Properties
{
/* ... */
_LightingStencilRef("Lighting Stencil Reference", Float) = 128 // Change the stencil value of the dynamic object material to 1xxx xxxx to eliminate head-body detachment.
[Enum(UnityEngine.Rendering.CompareFunction)] _LightingStencilComp("Lighting Stencil Comparison", Float) = 8
_StencilReadMask("Stencil Read Mask", Float) = 255
_StencilWriteMask("Stencil Write Mask", Float) = 255
}
SubShader
{
/* ... */
Pass
{
/* ... */
Stencil
{
Ref[_LightingStencilRef]
Comp[_LightingStencilComp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
Pass Replace
}
}
}
}
The passes for setting stencil values vary according to the shaders in different pipelines.
Universal Render Pipeline (URP) of Tuanjie Engine
Set stencil values in each pass with DepthOnly (that is, Tags {"LightMode" = "DepthOnly" }) or DepthNormals (that is, Tags {"LightMode" = "DepthNormals" }).
Built-in Render Pipeline of Tuanjie Engine
Set stencil values in each pass with ForwardBase (that is, Tags {"LightMode" = "ForwardBase" }) or ForwardAdd (that is, Tags {"LightMode" = "ForwardAdd" }).