I figured it out. Here is the solution:
Create two meshes with different materials. The first mesh should be the back and should have Cull set to Front. The second mesh should be the front and should have Cull set to Back, it should also have VisualInstance3D.sorting_offset set to a small positive value.
This causes the renderer to render all of the back mesh before all of the front mesh is rendered.