Earlier today (20240620221253) I ran into the problem that ViewportTexture does not have mipmaps.
I realized that to solve this problem without generating mipmaps, we would need to:
determine the LOD to use
linearly interpolate between the current mipmap and the next mipmap (using mix)
average the colors from each of the pixels that would be in the mipmap at that LOD
When I was streaming earlier today, I got a little tripped up on determining what LOD to use, but apparently there’s a function to do just that called textureQueryLod. With that, we can skip figuring out what LOD to use and just let Godot do that for us:
This fixes the pixel shimmering and improves the image quality when zoomed out!