The essential function of the lung, gas exchange, is dependent on adequate matching of ventilation and perfusion, where air and blood are delivered through complex branching systems exposed to regionally varying transpulmonary and transmural pressures. Structure and function in the lung are intimately related, yet computational models in pulmonary physiology usually simplify or neglect structure. The geometries of the airway and vascular systems and their interaction with parenchymal tissue have an important bearing on regional distributions of air and blood, and therefore on whole lung gas exchange, but this has not yet been addressed by modelling studies. Models for gas exchange have typically incorporated considerable detail at the level of chemical reactions, with little thought for the influence of structure. To date, relatively little attention has been paid to modelling at the cellular or subcellular level in the lung, or to linking information from the protein structure/interaction and cellular levels to the operation of the whole lung. We review previous work in developing anatomically based models of the lung, airways, parenchyma and pulmonary vasculature, and some functional studies in which these models have been used. Models for gas exchange at several spatial scales are briefly reviewed, and the challenges and benefits from modelling cellular function in the lung are discussed.