We develop a dynamic general equilibrium model for the positive and normative analysis of macroprudential policies. Optimizing financial intermediaries allocate their scarce net worth together with funds raised from saving households across two lending activities, mortgage and corporate lending. For all borrowers (households, firms, and banks) external financing takes the form of debt which is subject to default risk. This "3D model" shows the interplay between three interconnected net worth channels that cause financial amplification and the distortions due to deposit insurance. We apply it to the analysis of capital regulation.