An artificial opal is a compact arrangement of transparent spheres, and is an archetype of a three-dimensional photonic crystal. Here, we describe the optics of an opal using a flexible model based upon a stratified medium whose (effective) index is governed by the opal density in a small planar slice of the opal. We take into account the effect of the substrate and assume a well- controlled number of layers, as it occurs for an opal fabricated by Langmuir-Blodgett deposition. The calculations are performed with transfer matrices, and an absorptive component in the effective index is introduced to account for the light scattering. This one-dimensional formalism allows quantitative predictions for reflection and transmission, notably as a function of the ratio between the irradiation wavelength and the sphere diameter, or as a function of the incidence angle or of the polarization. It can be used for an irradiation from the substrate side or from the vacuum side and can account for defect layers. The interface region between the opal and the substrate (or vacuum) is shown to have a strong influence, regardless of the exact opal structure. This break in the periodicity at the interface is a general, but often ignored feature, of any external coupling to a photonic crystal. Our calculations provide also the main features of the Bragg peak for reflection, including its width and strength. Comparisons of this versatile model with experiments show that despite its simplicity, it is powerful enough to explain numerous observations.