3dfx Archive
http://www.falconfly.de/cgi-bin/yabb2/YaBB.pl
This & That >> This & That >> Anisotropic filtering
http://www.falconfly.de/cgi-bin/yabb2/YaBB.pl?num=1087702561

Message started by DenisF on 20.06.04 at 05:36:01

Title: Anisotropic filtering
Post by DenisF on 20.06.04 at 05:36:01
Hi,

I'm doing a little *research* about what features GFX cards do and how they do them.
I already have almost everything i need answered, except this one thing;

Is anisotropic filtering done on pre or post-render basis?
[ie applied to textures before the scene is rendered, or applied to the whole scene after the rendering]

Right now, out of everyone i asked this, 50% think it's pre, and the other 50% think it's post. couldn't get a straight answer and it's driving me nuts.

If someone could please solve this riddle for me, id'e appriciate it.

Thanks
/DenisF

Title: Re: Anisotropic filtering
Post by FalconFly on 20.06.04 at 09:35:32
It should work "pre-render".

It is done basically 'on the fly', right within the normal rendering Process.

Aniso Filtering just takes more Texture Samples before mapping the (final processed) Texture onto the Scene.
It takes place within the process of Bilinear/Trilinear Filtering cycle to generate the Textures according to their MipMap LOD needed for the Objects.

The actual Texture Mapping process should not be affected by it, as it's just a higher Quality Texture being generated in the overall Texture Filtering process so to speak.

Title: Re: Anisotropic filtering
Post by DenisF on 20.06.04 at 11:37:31
mucho gracias, falconfly  :)

Title: Re: Anisotropic filtering
Post by grunw on 16.07.04 at 10:01:39
It's "MUCHAS gracias" not "mucho gracias"  :P

Title: Re: Anisotropic filtering
Post by dborca on 16.07.04 at 15:30:46
*it's "MACHO gracias", not "mucho gracias"  ;D*

Anisotropic filtering cannot work pre-render, unless you know exactly how and where the texture will be applied. The aniso filtering is done in the rasterization stage (during the texel lookup phase).

I don't know how current IHVs do implement it, but here's a story...

Here beginneth FakeAniso Cheap Hack (tm):
For simplicity, we'll take nearest sampling mipmapped textures. The mipmaps are build so that each level is obtained by halving the previous level, using a 2x2 average box. The TMU will automagically determine the LOD, based on distance: 0 - 1 - 2 - 3 - 4 ... (those are LOD #s).

Let's take a distance which falls in LOD#1. It is simply an averaged version of the LOD#0. Moreover, it is uniformly averaged in all planar directions -- a circular filter, approximated by a square.

This is okay in particular conditions, but if the texture is being seen under a certain angle (ie: floor texture) it's not enough. It must be an elliptical filter, approximated by a rectangle. This means you can't use a 2x2 box. You'll be needing an WxH box.

So, what is to be done? First of all, you can't extract the original pixels from the averaged pixel. So we FORCE the first LOD as far as we can: 0 - 0 - 0 - 1 - 2 .... Okay, we got our pixels, but we still need to have them averaged, using our WxH box.

The hardware cannot do that automatically, so we have to do it ourselves. How? Multipass rendering. We render the texture with original values, then jitter the texture, by jittering the vertex positions/texture coordinates in the correct direction. This step should be overlayed with alpha blending. The process can be repeated several times, by increasing the jittering while decreasing the alpha blending factor.

Caveats:
  • interferes with GL_EXT_texture_lod
  • interferes with other built-in multipass capabilities of certain renderers (such as MesaFX)
  • might be affected by bi-/tri-linear filtering
  • interferes with alpha blending
  • induces slowness, inherent to multipass techniques
VSA100 users: the native jittering capability of the Napalm could do the trick, at least to some extent. But you'll loose FSAA. And it's beyond the scope of this file, since it's fragment jittering, not vertex jittering. Too many approximations already... And probably Voodoo2 users would find aniso neat, on their hardware, too.  ;D
Here endeth FakeAniso Cheap Hack (tm):


The compulsory credits:
Marc Olano, Shrijeet Mukherjee, Angus Dorbie for the wonderful "Vertex based anisoptropic Texturing"

Koolsmoky & big H.(S) for pointing me to the aforementioned doc and the fruitful discussions we've had while I was trying to understand the algorithm. I also remember that Syed Aqueel Hamdani gave me a link to that file too...

So I hope I didn't forget anyone!

<memo to myself> now copy the damn thing somewhere for your own reference, otherwise you might forget how it's done...  :o

*ave, Commodus, morituri te salutant*

Title: Re: Anisotropic filtering
Post by FalconFly on 16.07.04 at 17:21:15
Well, in my book that is "within the Rendering process", maybe the term "Pre-render" might be a tad misleading ;)

Title: Re: Anisotropic filtering
Post by Lecram25 on 16.07.04 at 18:47:08

Quote:
I also remember that Syed Aqueel Hamdani gave me a link to that file too...


hehe
So do you plan on completing this ICD?


3dfx Archive » Powered by YaBB 2.4!
YaBB © 2000-2009. All Rights Reserved.