I am following a paper on computationally modeling optical phenomena within a lens. (https://resources.mpi-inf.mpg.de/lensflareRendering/) At some point they use the Fourier power spectrum of an aperture image to generate an image of the refractive phenomenon known as a "starburst". From the paper:
Assuming a uniform incident distribution of parallel (collimated) light (at wave- length λ) and a real-valued amplitude transmission function T (x, y), the Fraunhofer pattern T 0 (x0 , y 0 ) in an observation plane at distance z0 from the aperture is given by the Fourier power spectrum of T.
I am rendering my polygonal aperture as a pixel image and using an FFT of it for the starburst. I quickly found out that I have to pad my aperture image with a lot of zeroes for an acceptable result to avoid artifacts from the assumption of a periodic input signal for an FFT. Currently I am making my image roughly four times as large as the aperture:
But I am still getting artifacts that look like mirror images of the "rays" on the edges of my power spectrum:
I suspect that I will always get those in some way, no matter how much padding I add. Both more padding and scaling down the aperture further will sooner or later get impractical due to constraints on either memory and computing time or achievable quality.
Is there some alternative transform or approach I can use, that avoid these artifacts or at least the memory overhead of padding the aperture image with a massive amount of zeroes?
I am using Python and Numpy, big plus for a solution using those tools only. I do not mind cutting off some of the rays at the border of the spectrum, but I cannot have their "reflections" in the result.