Sign in to follow this  
antber

OpenGL how the filtering between mip levels

Recommended Posts

I dont quite understand whats happening when we are trying to interpolate between miplevels only using glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR);

there is paragraph 3.8.9 in OpenGL 2.1 specs that says:

[quote]Finally, there is the choice of c, the minification vs. magnification switchover point. If the magnification filter is given by LINEAR and the minification filter is given by NEAREST_MIPMAP_NEAREST or NEAREST_MIPMAP_LINEAR, then c = 0.5. This is done to ensure that a minified texture does not appear “sharper” than a magnified texture. Otherwise c = 0.[/quote]

The simple test which draws 8x1 texture quad into 7x1 viewport with min filter set as above shows that results really depends from the GL_TEXTURE_MAG_FILTER setting as well.
I dont also understand how the texture might get "sharper" neither I can calculate manually the results of the interpolation.
With switching point set to 0.5 the magnification takes place when LOD < 0.5 where LOD calculated as lg of the scale factor.
So that LOD for the test = lg(8/7) = 0.19, which is less than 0.5, so that magnification takes place instead of minification (wtf?)
Shouldnt we get base level values (without any interpolation) in the framebuffer as the magnification always takes reference values from the base level?

Share this post


Link to post
Share on other sites
[quote]The simple test which draws 8x1 texture quad into 7x1 viewport with min filter set as above shows that results really depends from the GL_TEXTURE_MAG_FILTER setting as well.[/quote]
FYI, that is magnification, your image is bigger than the viewport, so it is zoomed in or magnified.

[quote]This is done to ensure that a minified texture does not appear “sharper” than a magnified texture. Otherwise c = 0.[/quote]
Minified means it is rendered smaller, or in 3d further away. Since the texture is downsampled, the pixels average down over and over, so you will end up with more blurry images.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this