Synthesis, characterization and modelling of direct and inverse opals