how nebulae are formed