I've talked about Bilinear vs. Bicubic filtering before in the context of 2D images, but bilinear filtering is a key ingredient in 3D graphics, too. When a texture is applied to a polygon, the texture may be scaled up or down to fit, depending on your screen resolution. This is done via bilinear filtering.
A full discussion of 3D graphics is way outside the scope of this post-- plus I don't want to bore you to death with concepts like trilinear filtering and mip-mapping. But I do want to highlight one particular peculiarity of bitmap scaling in 3D graphics. As you rotate a texture-mapped polygon away from the viewer, simple bilinear filtering and mip-mapping cause the texture to lose detail as the angle increases:
Now, some detail loss with distance is intentional. That's essentially what mip-mapping is. if we didn't mip-map into the distance, the image would look extremely noisy:
| No mip-mapping | Mip-mapping |
The problem with simple mip-mapping and bilinear filtering is that they're too simple. Much more detail should be retained into the distance. And that's what anisotropic filtering does:
Because you're typically viewing most of the polygons in the world at an angle at any given time, anisotropic filtering has a profound impact on image quality. Here are some screenshots I took from the PC game FlatOut which illustrate the dramatic difference between standard filtering and anisotropic filtering:
| Standard filtering | 16x Anisotropic filtering |
These are detail elements cropped from the full-size 1024x768 screenshots: standard, anisotropic.
Proper anisotropic filtering is computationally expensive, even on dedicated 3D hardware. And the performance penalty increases with resolution. ATI was the first 3d hardware vendor to introduce some anisotropic filtering optimizations-- some would say shortcuts-- in their cards which allowed much higher performance. There is one small caveat, however: at some angles, textures don't get fully filtered. ATI effectively optimized for common angles you'd see in 3D level geometry (floor, walls, ceiling) at the cost of the others.
For better or worse, these optimizations are now relatively standard now even on nVidia cards. I think it's a reasonable tradeoff for the increased image quality and performance.
In my opinion, anisotropic filtering is the most important single image quality setting available on today's 3D hardware. It's like Freedom Rock: make sure you've turned it up, man!
Thats nice, but where is the ajax code for mip-mapping? :P
Very nice reading, brings back memories of 3d programming. I wish I had invested more time on that field. Actually suprises me that you dont see more directx .net example/source/stuff around in vb.net/c#. Yes C++ will still be the language of choise for programming 3d games, but since the hardware do so much these days and vb.net/c# is the language of choise for so many, I would expect more 3d reletated releases for the .net platform.
/P
Peter Palludan on January 9, 2006 5:37 AMme that you dont see more directx .net example/source/stuff around in vb.net/c#
Well, MS has managed wrappers for DirectX at the developer center:
http://msdn.microsoft.com/directx/
They've been through a few revs of the managed wrappers now, and I think they have any performance issues ironed out. There's at least one shipping 3D game on the market written in .NET 1.1:
http://blogs.msdn.com/tmiller/archive/2004/10/14/242443.aspx
Those FlatOut screenshots are not a correct comparison. There are differences other than the addition of anisotropic filtering.
The shot on the left shows lower resolution textures than the one on the right. (You can see the big chunky texels in the area over the rear wheel.) The right hand one also looks under-filtered to me, which shows more detail but also more aliasing. The white details on the car roof exhibit nasty stair step/rope type artifacts for example.
Brian on April 15, 2006 12:49 PMThose FlatOut screenshots are not a correct comparison. There are differences other than the addition of anisotropic filtering.
Nope-- that is the only difference between the shots.
Jeff Atwood on April 17, 2006 2:08 AMNope-- that is the only difference between the shots.
Then anisotropic filtering is also a great way of getting rid of unwanted traffic cones...?
Well, the car position is slightly different in the shots. The car start positions are randomized in FlatOut (eg you all start on the same line in a random left to right order) -- so I got it as close as I could.
The only RENDERING difference in the two shots is that one has minimum aniso and one has maximum aniso.
All the things Brian is complaining about are, in fact, due to the differences in anisotropic filtering. Textures at an angle will look "lower resolution", etc.
Jeff Atwood on April 17, 2006 2:27 AMThe comments to this entry are closed.
|
|
Traffic Stats |