Detailed understanding of the structural and photophysical properties of polymeric carbon nitride (PCN) materials is of critical importance to derive future material optimization strategies towards more desirable optical properties and more photocatalytically active materials. However, the wide range of structural motifs found in synthesized PCNs complicates atomistic simulations that rely on well defined models. Performing hybrid DFT studies, we systematically investigate formation energy trends and optical properties of PCNs as a function of dimensionality, going from molecular oligomers over periodic sheet models to stacked crystals. Thermochemical calculations that take into account vibrational enthalpy and entropy contributions predict that a mixture of structural motifs including the melon string structure, poly(heptazine imide), and g-C3N4 motifs is stable under typical synthetic conditions. The degree of lateral condensation as well as stacking can reduce the bandgap while out-of-plane corrugation of the material increases both stability and the optical gap. The key result of this work is that already small domains of strongly condensed PCN are calculated to give rise to favorable optical properties. This result reconciles conflicting literature reports indicating that the thermodynamically favorable melon motif has a too large bandgap compared to experiments, while the g-C3N4 structure, for which bandgap calculations are in better agreement with experiments, does not agree with measured chemical compositions of PCNs. Finally, we postulate a new computational model for carbon nitride materials that encompasses the most important structural motifs and shows a bandgap of ca. 2.9 eV