ok apparently I have to change the project settings in the Rendering > Optimization Category for it to use the masked materials efficiently. I switched the “Early Z-Pass” to “Opaque and masked meshes” and checked the box for “Mask material only in early Z-Pass”