anisotropy ?

If I generate all mipmap levels and enable anisotropy through GL_TEXTURE_MAX_ANISOTROPY_EXT and GL_LINEAR_MIPMAP_LINEAR param, can I assume my fragment will automatically sample using the appropriate trilinear anisotropy level when I do this ?
vec4 color=texture2D(source, gl_TexCoord[0].xy);

Also, is there a way to know what mipmap level the fragment shader chose to use ?

can I assume my fragment will automatically sample using the appropriate trilinear anisotropy level when I do this ?

Yes.

Also, is there a way to know what mipmap level the fragment shader chose to use ?

You could do the math in the shader. But mipmap blending will mean that it’s sampling from 2 mipmaps. And anisotropic filtering is implementation-dependent. For the ATI 5xxx line, ATI implemented viewpoint-independent anisotropic, so there’s pretty much no way to tell for sure which mipmaps it accesses.

Depending on who and why you must know, you can use the trick of making a special texture with a different uniform color for each mipmap level and either look visually or analyze in your shader the resulting color.

The cost is an additional texture lookup.

The color by mipmap-level trick may give different results as some implementations detect such artificial cases (used by visual benchmarks) and run different optimizations to make the benchmark look better.

GLSL 4.0 (OpenGL 4.0) introduced function textureQueryLod(). Maybe it returns some reasonable value for aniso filtering as well.

With aniso. the things are more complicated. It samples the mipmap level(s) many times and does some filtering. My advice: Do not try to know the level.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.