
Pseudo-bandlimited pixel art filtering in 3D: A mathematical derivation - ingve
http://themaister.net/blog/2018/08/25/pseudo-bandlimited-pixel-art-filtering-in-3d-a-mathematical-derivation/
======
enriquto
Very beautiful article!

I'm always infuriated by texture aliasing, and this is a very refreshing read
of the basics. Notice that in this article the anisotropy is linearized, and
near the horizon of the sampled plane this linearization breaks down. It is
actually very difficult to render an infinite plane without aliasing nor blur
near the horizon!

~~~
Retric
I don't think their is a 3rd option.

Picture zooming out from a repeating image. Eventually an entire picture takes
a single pixel then multiple images per pixel. You can pick one pixel from a
full image but that's going to get aliasing effects, or you can use multiple
but that just means blur.

~~~
enriquto
It is certainly possible. If your texture is defined by a simple formula
(e.g., an infinite checkerboard), then you can compute explicitly the correct
rendering without aliasing nor blur.

~~~
Retric
Suppose you have zoomed out enough so their are a grid of ~10^100 x ~10^100
black and white checkerboards under each pixel. Now, you could use some small
set of random samples to pick black or white, but for any given screen and set
of random points their is a way to lay that checkerboard so every sample is
white.

Increase the # of samples to any finite number, and you get the same problem
at a higher zoom level.

~~~
enriquto
For the case of the checkerboard, the color of pixels near the horizon has to
be gray. This does not mean that there is blur, it is just a realistic
rendering model.

The problem is that it is very difficult to filter a generic texture so that
it looks perfect near the horizon. For a particular simple texture such as the
checkerboard you can compute the exact rendering explicitly. But I know of no
method to do it in general.

~~~
Retric
Ok, I would call that blur, but I don't want to argue semantics. Anyway, that
makes my original point moot as I misunderstood what you where looking for.

------
grenoire
This is absolutely amazing! I've been looking for a filter like this for such
a long time, that can display scaled pixel graphics as if it were anti-aliased
quads. Great work and maths!

------
dahart
> sin might be rather expensive on your GPU targets

Definitely depends on hardware, but I learned recently that on my NVIDIA GPU,
the transcendentals are actually in a separate pipeline, so they are free as
long as you don't do too many of them! The 3 term sin approximation in the
article might be slower than calling sin(), on my GPU it'd crowd the
arithmetic pipe.

> This is very similar to a smoothstep, which explains why smoothstep
> techniques for this kind of filtering works so well.

Seems like most of the filtering I see in ShaderToy uses smoothstep(). I sort-
of assumed it was a hack of convenience and availability, but it's nice to see
there's some justification for using smoothstep! I'm tempted to try this
pseudo-bandlimited filtering on ShaderToy.

------
kowdermeister
Too bad he doesn't show examples of with and without his method applied.

~~~
dahart
What are you looking at? I see examples with and without: the first 6 pictures
in the article. Are you referring to the anisotropic examples at the end of
the article?

~~~
kowdermeister
Maybe I'm struggling with reading comprehension but it's not clear which is
the one he made.

Also the anisotropic pictures would be really nice to see with and without the
algo applied.

~~~
dahart
He didn’t call it out clearly; you have a good point. I think it did take me a
second to realize the 3rd example was the new better method. The main clue is
the text, where the first two are negative (“aliasing from hell” and “blurry
mess”) and the third one is positive (“smooth and sharp”). It certainly could
have used a description that says “here’s my new method”.

It wouldn’t hurt to show the anisotropic pics against the other two, but FWIW,
the story is more complicated since he mixed in mip-mapping for that example.
He’d have to mix mip-mapping with nearest neighbor and bilinear as well, which
would look sorta weird, take extra work, and possibly confuse his main point a
little rather than clarify. It wouldn’t be much more illustrative than the
first set of examples either. So, I’m just guessing, but I can see reasons why
he might have chosen to skip the comparison.

------
izzydata
We need more games like Octopath Traveler.

