A method for realizing a grating structure including the steps of providing a layered structure having a substrate, a grating layer, a first masking layer of polysilicon, a dielectric layer and a second masking layer. Additionally, a resist layer is deposited on the second masking layer; the resist layer is exposed according to a selected pattern to an electron beam; the resist layer is developed according to the pattern; the second masking layer is etched using the developed resist layer as a mask to form a patterned second masking layer; the dielectric layer is etched using the patterned second masking layer as a hard mask to form a patterned dielectric layer; the first masking layer is etched using the patterned dielectric layer as a hard mask to form a patterned first masking layer; and the grating layer is etched using the patterned first masking layer as a hard mask to form the grating structure.