A method to fabricate a multi-dimensional target waveguide or volume grating; wherein a common waveguide Bragg grating or volume grating is used as a seed grating, wherein the wave-vector of the seed grating is K ⇀ 0 r ⇀, the wave-vector of the light is k ⇀ and the wave-vector difference between light and the seed grating is Δ k ⇀ which can be expressed as Δ k ⇀ = k ⇀ − K ⇀ 0 r ⇀, wherein Δ ⁢ n r ⇀ is the refractive index modulation depth of the seed grating, and - wherein the grating period of the seed grating is uniform and varies from 50 nm to 1000 nm; modulating the seed grating with a sampling structure, S r ⇀, to form a sampled grating, wherein the refractive index modulation of the sampled grating with arbitrary sampling structure and uniform seed grating can be expressed as Δ n s r ⇀ = S r ⇀ ⋅ Δ ⁢ n r ⇀, wherein r ⇀ denotes the space vector;; wherein, based on the Fourier analysis, equation can be further expressed as, Δ n s r ⇀ = ∑ n = − ∞ n = + ∞ C n r → exp j ∫ G ⇀ sn r • d r ⇀ Δ ⁢ n ⁢ exp j ∫ K ⇀ 0 r ⇀ • d r ⇀ = 1 2 ∑ n = − ∞ n = + ∞ C n r ⇀ Δ ⁢ n ⁢ exp j ∫ K ⇀ n r ⇀ • d r ⇀ where j denotes an imaginary number, G ⇀ sn r → is the wave-vector of the n th order Fourier component of the sampling structure; K ⇀ 0 r ⇀ is the wave-vector of the seed grating and it can be further expressed as K ⇀ 0 r ⇀ = 2 ⁢ π Λ r ⇀ e ⇀ 0; Λ r ⇀ is the period of the seed grating and e ⇀ 0 denotes the direction of the seed grating; C n r ⇀ is the Fourier coefficient, n denotes the n th Fourier order and describes all the Fourier components of the sampled grating, wherein each of the Fourier components of the sampled grating is a ghost grating or a sub-grating with wave-vector K ⇀ n r ⇀; where, according to Eq., there is a series of ghost gratings or sub-gratins in the sampled grating, and wherein all of these ghost gratings or sub-gratings can be changed with the sampling structure S r ⇀; and wherein the n th order wave-vector of the ghost grating K ⇀ n r ⇀ corresponds to the summation of the wave-vectors of the seed grating K ⇀ 0 and of the n th order sampling structure's Fourier sub-grating G ⇀ sn r →; wherein, among the multiple ghost gratings or sub-gratings in the sampled grating structure, one is selected as the target equivalent grating and, according to Eq., the wave-vector of the target equivalent grating K ⇀ N r ⇀ is expressed as K ⇀ N r ⇀ = G ⇀ sN r ⇀ + K ⇀ 0 r ⇀, with K ⇀ 0 r ⇀ being the wave-vector of the seed grating, G → sN r ⇀ being the wave-vector of the target sampling structure's Fourier sub-grating, determining that the wave-vector of the target equivalent grating, K ⇀ N r ⇀, equals to the wave-vector of the target grating, K ⇀ d r ⇀, that is, K ⇀ N r ⇀ = K ⇀ d r ⇀;, changing the sampling structure by changing the periodic distribution of the sampling structure, S r ⇀, wherein the wave-vector G → sN r ⇀ is changed accordingly to equivalently realize the target grating; such that, when the wave-vector of the seed grating K ⇀ 0 r ⇀ mismatches the wave-vector of the required target grating, one of the Fourier sub-gratings in the sampling structure, i.e. the wave-vector of the target sampling structure's Fourier sub-grating G → sN r ⇀, is used to compensate this mismatch; wherein an additional target sampling structure's Fourier sub-grating is employed to keep the phase difference equal to zero during the optical transmission process, and the following phase match is also satisfied: K ⇀ d − K ⇀ 0 r ⇀ − G ⇀ sN r ⇀ = 0, wherein, according to Eq., the phase of the sample grating is also a function of space; wherein, in particular, the phase of the uniform ghost grating can be expressed as exp j G ⇀ sn • r ⇀ exp j K ⇀ 0 • r ⇀, wherein if there is a phase shift in the sampling structure, and the shift value is Δ r ⇀ ′, a phase shift also exists in the sampling structure's Fourier sub-grating; and wherein the corresponding phase of the ghost grating can be described as exp j G ⇀ sn • r ⇀ + Δ r ⇀ ′ exp j K ⇀ 0 • r ⇀ = exp j G ⇀ sn • r ⇀ exp j K ⇀ 0 • r ⇀ exp j G ⇀ sn • Δ r ⇀ ′ and the corresponding phase shift of the ghost-grating has a magnitude of exp j G ⇀ sn • Δ r ′; wherein, for a uniform seed grating, G → sn • Δ r → ′ = φ; such that a phase shift φ is introduced in the n th order ghost grating of the sample grating; wherein, in particular, the refractive-index modulation, which corresponds to the Fourier coefficient C n r ⇀, is also changed with the pattern or shape in one sampling period, such as the duty cycle; wherein, in the 2D case, the refractive-index modulation can also be equivalently changed; wherein the suitable shape in one sampling period to get the largest refractive-index modulation intensity can be obtained from the Fourier analysis.