Does it make sense to use own mipmap creation algorithm for OpenGL textures?

后端 未结 4 1219
清歌不尽
清歌不尽 2021-02-05 09:26

I was wondering if the quality of texture mipmaps would be better if I used my own algorithm for pre-generating them, instead of the built-in automatic one. I\'d probably use a

4条回答
  •  北海茫月
    2021-02-05 10:31

    As an addition to this question, I have found that some completely different mipmapping (rather than those simply trying to achieve best down-scaling quality, like Lanczos filtering) algorithms have good effects on certain textures.

    For instance, on some textures that are supposed to represent high-frequency information, I have tried using an algorithm that simply takes one random pixel of the four that are being considered for each iteration. The results depend much on the texture and what it is supposed to convey, but I have found that it gives great effect on some; not least for ground textures.

    Another one I've tried is taking the most deviating of the four pixels to preserve contrasts. It has even fewer uses, but they do exist.

    As such, I've implemented the option to choose mipmapping algorithm per texture.

    EDIT: I thought I might provide some examples of the differences in practice. Here's a piece of grass texture on the ground, the leftmost picture being with standard average mipmapping, and the rightmost being with randomized mipmapping:

    I hope the viewer can appreciate how much "apparent detail" is lost in the averaged mipmap, and how much flatter it looks for this kind of texture.

    Also for reference, here are the same samples with 4× anisotropic filtering turned on (the above being tri-linear):

    Anisotropic filtering makes the difference less pronounced, but it's still there.

提交回复
热议问题