When 2D Projections Become Unviable
Why your texture might look bad
Last week we talked about how to create a double-process rendering pipeline to create a distortion lens effect. But we still had a glaring problem: the quality is terrible!
Particularly in the texture! Choosing one with lots of straight lines really highlighted the problem—downsampled straight line patterns have a tendency to create moiré patterns, consistent with those typically alleviated by applying Nyquist Sampling Theorem. The theorem boils down simply: to accurately capture a signal, sample at 2x the highest frequency.
The "frequency" here is spatial—how fast details change across the screen. The position on the screen per the view angle is determined by tan(θ):
As the angle increases, the rate at which the position on the 2D projection changes would be the derivative of tan(θ)—sec²(θ). Plug that into the calculator with, for example, 80°—you’ll find that the rate of change is ~33—in other words, one degree of change at 80° spreads across 33x the pixels. At 2x according to Nyquist, you’d need 66x the pixels!
Of course, it gets worse. Considering we’re doing a fisheye lens, we’re going to want to approach a field of view near 180°—and in the graph for sec²(θ), you can see that as you approach π/2 (90° for half the total FOV), we approach infinity:
And good luck getting enough samples for infinity, twice!
It’s clear that in order to sample for our fisheye lens properly we’re going to need a different projection for our first pass. What’ll we do instead? (You’ll find out next week!)




