In this talk I will illustrate how quantum-mechanical modeling of materials at the atomic scale plays an important role in solar energy research, and how it can be used to design and realize entirely new materials. After an introduction to solar photovoltaics, I will discuss the emergence of perovskite solar cells during the past few years, and explain why this family of materials has attracted so much interest in the scientific community. One of the outstanding challenges in perovskite research is to find new lead-free materials with optoelectronic properties comparable to lead-based halide perovskites. In this context I will discuss several approaches to the computational design of potential new perovskites and double perovskites, including concepts like cation substitution, band structure engineering, and combinatorial screening based on geometric descriptors. I will demonstrate that, when integrated with experimental synthesis and characterization, these approaches can deliver new materials with high potential for applications in solar energy harvesting and in energy-efficient lighting technology [1-3]. Furthermore I will show that we currently know only a small subset of all possible perovskites , and much more work is still needed to discover new materials of this family and to explore their uses in renewable energy technology.