# 各向异性过滤

**各向异性过滤**（Anisotropic filtering）是实时计算机图形学中的一种纹理过滤技术，它使滤波核适应屏幕像素投影到纹理空间后形成的拉长形状，从而减少各向同性滤波器在斜角观察的表面上产生的模糊和走样。图形 API 通过扩展和采样器参数提供该功能，例如 OpenGL 和 WebGL 中的 `EXT_texture_filter_anisotropic`、Direct3D 中的 `D3D11_FILTER_ANISOTROPIC`，以及 Vulkan 中的 `anisotropyEnable`。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup><sup> • </sup><sup>[2](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_sampler_desc)</sup><sup> • </sup><sup>[3](https://docs.vulkan.org/spec/latest/chapters/textures.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 所解决的问题 | MIP 贴图过滤假定像素在纹理空间中的滤波足迹是正方形（各向同性）；但实际上足迹可能细长，因此 MIP 贴图过滤会在斜向远离观察者的表面上严重模糊图像。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> |
| 各向异性的度量方式 | Direct3D 将其度量为一个屏幕像素逆映射到纹理空间后的伸长率，即长度除以宽度。<sup>[4](https://learn.microsoft.com/en-us/windows/uwp/graphics-concepts/anisotropic-texture-filtering)</sup> |
| 控制参数 | OpenGL 的 `TEXTURE_MAX_ANISOTROPY_EXT`（0x84FE）按纹理对象设置，合法值为大于或等于 1.0，初始值为 1.0（各向同性）。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> |
| 实现最低要求 | 实现必须至少支持 2 比 1 的各向异性，才能声称支持该扩展；查询到的限制为 `MAX_TEXTURE_MAX_ANISOTROPY_EXT`（0x84FF）。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> |
| Direct3D 11 范围 | 选择各向异性过滤器时，`D3D11_SAMPLER_DESC` 中的 `MaxAnisotropy` 是介于 1 和 16 之间的钳制值。<sup>[2](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_sampler_desc)</sup> |
| 典型方法 | 不在像素纹理足迹内取单个各向同性样本，而是沿各向异性线取 N 个各向同性样本并求平均。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup><sup> • </sup><sup>[3](https://docs.vulkan.org/spec/latest/chapters/textures.html)</sup> |
| 成本 | 各向异性过滤比双线性或三线性过滤昂贵得多，带宽需求也大得多。<sup>[5](https://developer.nvidia.com/docs/drive/drive-os/6.0.7/public/drive-os-linux-sdk/drive_os_v5l_sdk_dev_guide.pdf)</sup> |

## 问题：各向异性足迹

当渲染 3D 表面时，每个屏幕像素对应纹理的一块区域，该区域通过将像素逆映射到纹理空间得到。对于正对摄像机的表面，该区域大致为正方形；但对于掠射角下的表面，投影沿一个轴被压缩、沿另一个轴被拉伸；此时称该映射为各向异性的。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0097849399001594)</sup> 保罗·赫克伯特（Paul Heckbert）1986 年在卡内基梅隆大学（Carnegie Mellon University）机器人研究所（Robotics Institute）所做的综述，将[纹理映射](https://www.edgepedia.org/zh/texture-mapping)组织为几何映射和避免走样所需的过滤，并把过滤任务表述为：在考虑这种空间变化的缩小的同时，尽可能准确地将纹理图像重采样到投影后的场景。<sup>[7](https://publications.ri.cmu.edu/survey-of-texture-mapping)</sup><sup> • </sup><sup>[6](https://www.sciencedirect.com/science/article/pii/S0097849399001594)</sup>

在采用各向异性过滤之前，大多数实时硬件使用的滤波器基于 MIP 贴图纹理存储并结合双线性或三线性插值，它们假定足迹为正方形。这些滤波器以模糊图像为代价减少走样，而模糊在斜向远离观察者的表面上最明显，例如向远处延伸的地板和道路。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0097849399001594)</sup><sup> • </sup><sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> 点采样是最简单的替代方案，它在放大时产生块状图像，在缩小时产生走样伪影。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0097849399001594)</sup>

## 工作原理

硬件采用的实际方法是多重各向同性过滤：沿椭圆长轴执行若干次各向同性过滤操作（称为探测），以此近似像素的椭圆足迹。<sup>[8](https://www.sciencedirect.com/science/article/abs/pii/S1383762104001274)</sup> OpenGL 扩展规范描述了这样一种方案：根据纹理坐标的屏幕空间导数计算两个缩放因子，较大者与较小者之比决定样本数 N，并将其钳制到所请求的最大各向异性度；MIP 贴图细节层级则用较大的缩放因子除以 N 来选择。最终纹素值是沿像素足迹内各向异性线放置的 N 个样本的平均值。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup>

样本数由 \( N = \lceil \eta \rceil \) 得出，其中 \( \eta \) 是各向异性度；实现可以将 N 向上取整到所支持的采样率，例如取整到二的幂次采样率。<sup>[9](https://registry.khronos.org/vulkan/specs/latest-ratified/pdf/vkspec.pdf)</sup><sup> • </sup><sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> 当足迹退化为一个点时，\( \eta \) 按 1 处理，采样为各向同性；当足迹退化为一条线段时，\( \eta \) 按最大各向异性处理。<sup>[9](https://registry.khronos.org/vulkan/specs/latest-ratified/pdf/vkspec.pdf)</sup>

API 设计有意不规定具体方案。OpenGL 扩展提供了一种支持各向异性过滤的通用机制，而不指定特定公式；逐纹理的最大各向异性度与缩小、放大过滤器分开指定，实现可用这些过滤器来选择各向异性方案。追求最高质量的应用程序宜请求 `LINEAR_MIPMAP_LINEAR` 缩小过滤器、`LINEAR` 放大过滤器以及较大的最大各向异性度。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> Vulkan 规范同样指出，具体方案取决于实现，并警告说，由于历史原因，厂商实现在 `NEAREST` 过滤器或 `maxAnisotropy` 等于 1.0 等边界情形下对采样器参数的解释不同，因此应用程序不应指望这些情形下行为一致。<sup>[3](https://docs.vulkan.org/spec/latest/chapters/textures.html)</sup>

## API 提供方式

**OpenGL 与 WebGL。** `EXT_texture_filter_anisotropic` 扩展由英伟达（NVIDIA）于 1999 年持有版权，并针对 OpenGL 1.2 规范编写，它增加了两个标记：`TEXTURE_MAX_ANISOTROPY_EXT`（0x84FE），一个逐纹理参数，合法值为 1.0 或更大；以及 `MAX_TEXTURE_MAX_ANISOTROPY_EXT`（0x84FF），即实现限制，其最低支持值为 2.0。将该值设为 1.0 得到普通的各向同性过滤；大于 1.0 的值会启用各向异性过滤，上限取纹理值与实现限制中的较小者。报告的最大值很高，并不意味着纹理过滤性能或质量如何。<sup>[1](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)</sup> WebGL 版本即 WebGL 扩展 #11，其初始修订版于 2012 年 1 月发布，2013 年 5 月 15 日由 Khronos 促进者董事会（Khronos Board of Promoters）批准，并于 2025 年 3 月 20 日达到第 6 修订版；其中指出 WebGL 2 既在采样器入口点中支持该参数，也在纹理参数中支持它。<sup>[10](https://registry.khronos.org/webgl/extensions/EXT_texture_filter_anisotropic/)</sup> OpenGL 扩展注册表中还存在一个核心的 `ARB_texture_filter_anisotropic` 扩展。<sup>[11](https://registry.khronos.org/OpenGL/extensions/ARB/)</sup>

**Direct3D。** Direct3D 9 通过 `D3DTEXF_ANISOTROPIC` 过滤器类型暴露各向异性过滤，该类型用 `IDirect3DDevice9::SetSamplerState` 设置，同时设置 `D3DSAMP_MAXANISOTROPY` 各向异性度，其可能范围由 `D3DCAPS9` 能力结构的 `MaxAnisotropy` 成员给出；将各向异性度设为一会禁用该特性。<sup>[12](https://learn.microsoft.com/da-dk/windows/win32/direct3d9/anisotropic-texture-filtering)</sup> 在 Direct3D 11 中，采样器描述携带 `D3D11_FILTER_ANISOTROPIC` 的 `Filter` 和介于 1 与 16 之间的 `MaxAnisotropy` 钳制值，默认值为 1。<sup>[2](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_sampler_desc)</sup> 在 D3D 10 驱动级过滤器枚举中，各向异性过滤的 MIP 过滤器始终为线性，因此各向异性取值不会暴露单独的缩小、放大或 MIP 选择。<sup>[13](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/d3d10umddi/ne-d3d10umddi-d3d10_ddi_filter)</sup>

**Vulkan。** 各向异性过滤是一项可选的设备特性 `samplerAnisotropy`。采样器通过 `anisotropyEnable` 启用它，并通过 `maxAnisotropy` 对其进行钳制，后者必须介于 1.0 与物理设备限制 `maxSamplerAnisotropy` 之间；一次采样操作实际使用的各向异性度是采样器值与该限制中的较小者。如果该特性或 `anisotropyEnable` 为假，则有效最大值为 1。<sup>[3](https://docs.vulkan.org/spec/latest/chapters/textures.html)</sup><sup> • </sup><sup>[14](https://registry.khronos.org/vulkan/specs/latest/man/html/VkSamplerCreateInfo.html)</sup><sup> • </sup><sup>[15](https://docs.vulkan.org/spec/latest/chapters/limits.html)</sup>

## 成本与硬件实现

各向异性过滤比双线性或三线性过滤昂贵得多，带宽需求也大得多；后者每次采样分别最多获取四个和八个纹素，因此驱动程序和引擎的指导原则不是在所有地方自动启用它，而是判断哪些地方的质量收益值得付出成本。<sup>[5](https://developer.nvidia.com/docs/drive/drive-os/6.0.7/public/drive-os-linux-sdk/drive_os_v5l_sdk_dev_guide.pdf)</sup> 硬件只为给定像素实际使用的各向异性付出代价，因为样本数 N 随局部足迹形状而变化。<sup>[16](https://www.nvidia.com/docs/IO/8228/GDC2003_PipelinePerformance.pdf)</sup>

麦考马克（McCormack）及其同事在《计算机与图形学》（*Computers & Graphics*）2000 年发表的《实现各向异性纹理过滤器》中描述了一种详细硬件设计：一个低成本各向异性过滤单元，作为现有光栅化 ASIC 的扩展构建。MIP 贴图存储本身比原始纹理图多耗费最多三分之一的内存。他们的成本分析基于 0.5 μm ASIC 工艺，估计在现有三线性过滤硬件之上，定点实现约需 15,000 个门，浮点实现约需 45,000 至 50,000 个门，并得出结论：该过滤器仅以适度的硬件成本增加就产生了可见的改进结果。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0097849399001594)</sup> 后续工作继续缩小电路：西安邮电大学（Xi'an University of Posts and Telecommunications）2019 年的一项设计使用线性近似，以单个加法器和移位器计算足迹和对数，使推导出的 MIP 贴图层误差低于 7%，并在赛灵思 ZC706（Xilinx ZC706）板上得到验证。<sup>[17](https://www.jcad.cn/en/article/doi/10.3724/SP.J.1089.2019.16953)</sup>

## 实际使用

各向异性过滤与线性过滤或 MIP 贴图过滤配合使用，而不是取代它们；Direct3D 文档将其描述为与这些过滤器结合时改善渲染结果的一种方式。<sup>[4](https://learn.microsoft.com/en-us/windows/uwp/graphics-concepts/anisotropic-texture-filtering)</sup> 它适用于对与摄像机成掠射角的表面上的纹理进行采样，而不是一种后处理效果。在 Vulkan 教程中，推荐的设置是启用各向异性并将 `maxAnisotropy` 设为设备的 `maxSamplerAnisotropy` 限制以获得最高质量，较低的值则以质量换取性能。<sup>[18](https://docs.vulkan.org/tutorial/latest/06_Texture_mapping/01_Image_view_and_sampler.html)</sup> Direct3D 9 顶点纹理采样器忽略最大各向异性状态，不能使用各向异性过滤器。纹理图集可以使用各向异性过滤，但跨图集边界的 MIP 贴图过滤和各向异性采样可能采样到相邻区域并造成纹理渗色，需要填充或其他边界感知处理来缓解。<sup>[19](https://learn.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0)</sup><sup> • </sup><sup>[20](https://docs.vulkan.org/samples/latest/samples/extensions/descriptor_indexing/README.html)</sup><sup> • </sup><sup>[21](https://worldwind.arc.nasa.gov/autodocs/WorldWindJava/gov/nasa/worldwind/util/TextureAtlas.html)</sup>

## References

1. [EXT_texture_filter_anisotropic, OpenGL extension registry, Khronos Group](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt)
2. [D3D11_SAMPLER_DESC structure (d3d11.h), Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_sampler_desc)
3. [Texel Anisotropic Filtering, Vulkan specification, Sampling chapter, Khronos Group](https://docs.vulkan.org/spec/latest/chapters/textures.html)
4. [Anisotropic texture filtering, UWP applications, Microsoft Learn](https://learn.microsoft.com/en-us/windows/uwp/graphics-concepts/anisotropic-texture-filtering)
5. [NVIDIA DRIVE OS Linux SDK Developer Guide 6.0.7, Filter textures appropriately (T11)](https://developer.nvidia.com/docs/drive/drive-os/6.0.7/public/drive-os-linux-sdk/drive_os_v5l_sdk_dev_guide.pdf)
6. [McCormack, J. et al. (2000). Implementing an anisotropic texture filter. Computers & Graphics 24(2), ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0097849399001594)
7. [Paul Heckbert (1986). Survey of Texture Mapping, Robotics Institute, Carnegie Mellon University](https://publications.ri.cmu.edu/survey-of-texture-mapping)
8. [High-performance architecture for anisotropic filtering, ScienceDirect](https://www.sciencedirect.com/science/article/abs/pii/S1383762104001274)
9. [Vulkan 1.4 ratified specification PDF, Khronos Group](https://registry.khronos.org/vulkan/specs/latest-ratified/pdf/vkspec.pdf)
10. [WebGL EXT_texture_filter_anisotropic Khronos Ratified Extension Specification](https://registry.khronos.org/webgl/extensions/EXT_texture_filter_anisotropic/)
11. [Index of /OpenGL/extensions/ARB, Khronos Group](https://registry.khronos.org/OpenGL/extensions/ARB/)
12. [Anisotropic Texture Filtering (Direct3D 9), Microsoft Learn](https://learn.microsoft.com/da-dk/windows/win32/direct3d9/anisotropic-texture-filtering)
13. [D3D10_DDI_FILTER enumeration (d3d10umddi.h), Microsoft Learn](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/d3d10umddi/ne-d3d10umddi-d3d10_ddi_filter)
14. [VkSamplerCreateInfo(3), Vulkan Documentation Project](https://registry.khronos.org/vulkan/specs/latest/man/html/VkSamplerCreateInfo.html)
15. [Limits chapter, Vulkan specification, Khronos Group](https://docs.vulkan.org/spec/latest/chapters/limits.html)
16. [GDC 2003: Pipeline Performance, NVIDIA](https://www.nvidia.com/docs/IO/8228/GDC2003_PipelinePerformance.pdf)
17. [Xu Qichao, Du Huimin, Zeng Zecang, Wang Pengchao (2019). Hardware Implementation of an Anisotropic Texture Filter. Journal of Computer-Aided Design & Computer Graphics 31(1): 176-182](https://www.jcad.cn/en/article/doi/10.3724/SP.J.1089.2019.16953)
18. [Image view and sampler, Vulkan Tutorial, Vulkan Documentation Project](https://docs.vulkan.org/tutorial/latest/06_Texture_mapping/01_Image_view_and_sampler.html)
19. [Vertex Textures in vs_3_0 (DirectX HLSL), Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0)
20. [Descriptor indexing sample, Vulkan Documentation Project](https://docs.vulkan.org/samples/latest/samples/extensions/descriptor_indexing/README.html)
21. [TextureAtlas (NASA WorldWind)](https://worldwind.arc.nasa.gov/autodocs/WorldWindJava/gov/nasa/worldwind/util/TextureAtlas.html)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 计算机硬件 › 图形与GPU硬件 › 图形硬件概述

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/anisotropic-filtering

English original: https://www.edgepedia.org/anisotropic-filtering
