Game Developer Hibikai, whose pixel-style WIP game with a cute cat exploring the countryside we've featured recently, showcased how they create cavities that are not supposed to be visible, as in the demo above.
The developer achieved such an effect with a custom fade material created with Unreal Engine 5. Hibikai explained that the effect can be created by calculating Scene Depth and Pixel Depth in UE5. However, as the developer noted, the Depth Fade node simplifies the process significantly.
Check out sneak peeks at Hibikai's game about the cat's adventures: