Fabricating opals to control the flow of light