I wanted Object No. 3 to be obscured by Object No. 2 and Object No. 3 to penetrate object No. 1 and be displayed. I managed to achieve this in viewport by using custom depth stencil value and custom depth stencil write mask.
but it was not stable. It would cause the mask result to change according to the distance.
Moreover, this way of obtaining the depth of the custom depth stencil value is still based on the screen, which doesn’t feel like the method I want.
Is there any way to obtain a complete custom mask selection in Unreal Engine?