The method of invariant imbedding has been applied to the problem of penetration of gamma rays through two-layer slabs and turned out to be accurate and less time-consuming than the Monte Carlo method. A series of calculations was made for two-layer slabs of water, iron, and lead for plane oblique sources. An approximate formula for synthesizing the buildup factor of a composite slab from those of elementary layers is derived from numerical solutions by modifying the formula originally proposed by Kalos.