A sample with several lattice layers can be modelled as a 2d lattice with a 3d particle basis.
In this example, the sample consists of two hexagonal close packed layers of spheres.
Real-space model
Scattering intensity