Theory of a two-layer hologram