Real-Time Rendering——6.2.2 Minification纹理缩小(最近邻、mipmapping,SAT、Unconstrained Anisotropic Filtering)

When a texture is minimized, several texels may cover a pixel’s cell, as shown in Figure 6.13. To get a correct color value for each pixel, you should integrate the effect of the texels influencing the pixel. However, it is difficult to determine precisely the exact influence of all texels near a particular pixel, and it is effectively impossible to do so perfectly in real time.

当一个纹理被最小化时,几个纹理元素可能会覆盖一个像素单元,如图6.13所示。要获得每个像素的正确颜色值,您应该综合影响像素的纹理元素的效果。然而,精确地确定特定像素附近的所有纹理元素的确切影响是困难的,并且实际上不可能实时完美地做到这一点。

Figure 6.13. Minification: A view of a checkerboard-textured square through a row of pixel cells,showing roughly how a number of texels affect each pixel. 

图6.13。缩小:透过一排像素单元的棋盘纹理正方形视图,粗略显示了多个纹理元素如何影响每个像素。

Because of this limitation, several different methods are used on GPUs. One method is to use the nearest neighbor, which works exactly as the corresponding magnification filter does, i.e., it selects the texel that is visible at the center of the pixel’s cell. This filter may cause severe aliasing problems. In Figure 6.14, nearest neighbor is used in the top figure. Toward the horizon, artifacts appear because only one of the many texels influencing a pixel is chosen to represent the surface. Such artifacts are even more noticeable as the surface moves with respect to the viewer,and are one manifestation of what is called temporal aliasing.

由于这一限制,在GPU上使用了几种不同的方法。一种方法是使用最近邻,它的工作方式与相应的放大过滤器完全相同,即它选择在像素单元中心可见的纹理元素。该滤波器可能会导致严重的锯齿问题。在图6.14中,上图使用了最近邻法。朝向地平线,由于影响像素的许多纹理元素中只有一个被选择来表示表面,因此会出现伪像。当表面相对于观察者移动时,这种伪像甚至更加明显,并且是所谓的时间锯齿的一种表现。

Figure 6.14. The top image was rendered with point sampling (nearest neighbor), the center with mipmapping, and the bottom with summed area tables. 

图6.14。顶部图像使用点采样(最近邻)进行渲染,中间图像使用mipmapping贴图进行渲染,底部图像使用总面积表进行渲染。

Another filter often available is bilinear interpolation, again working exactly as in the magnification filter. This filter is only slightly better than the nearest neighbor approach for minification. It blends four texels instead of using just one, but when a pixel is influenced by more than four texels, the filter soon fails and produces aliasing.

另一种常用的滤波器是双线性插值,其工作原理与放大滤波器完全相同。对于缩小,该滤波器仅比最近邻方法稍好。它混合了四个纹理元素,而不是只使用一个,但是当一个像素受到四个以上纹理元素的影响时,过滤器很快就会失败并产生混叠。

Better solutions are possible. As discussed in Section 5.4.1, the problem of aliasing can be addressed by sampling and filtering techniques. The signal frequency of a texture depends upon how closely spaced its texels are on the screen. Due to the Nyquist limit, we need to make sure that the texture’s signal frequency is no greater than half the sample frequency. For example, say an image is composed of alternating black and white lines, a texel apart. The wavelength is then two texels wide (from black line to black line), so the frequency is 1/2 . To properly display this texture on a screen, the frequency must then be at least 2× 1/2 , i.e., at least one pixel per texel. So,for textures in general, there should be at most one texel per pixel to avoid aliasing.

更好的解决方案是可能的。如第5.4.1节所述,锯齿问题可以通过采样和滤波技术解决。纹理的信号频率取决于它的纹理元素在屏幕上的间隔有多近。由于奈奎斯特极限,我们需要确保纹理的信号频率不大于采样频率的一半。例如,假设一幅图像是由黑白相间的线条组成的,相隔一个纹理元素。波长是两个纹理像素宽(从黑线到黑线),所以频率是1/2。为了在屏幕上正确显示这个纹理,频率必须至少为2× 1/2,即每个纹理元素至少一个像素。因此,对于一般的纹理,每个像素应该最多有一个纹理元素来避免走样。

To achieve this goal, either the pixel’s sampling frequency has to increase or the texture frequency has to decrease. The antialiasing methods discussed in the previous chapter give ways to increase the pixel sampling rate. However, these give only a limited increase in sampling frequency. To more fully address this problem, various texture minification algorithms have been developed.

为了实现这个目标,要么提高像素的采样频率,要么降低纹理频率。上一章讨论的抗锯齿方法给出了提高像素采样速率的方法。然而,这些仅有限地增加了采样频率。为了更充分地解决这个问题,已经开发了各种纹理缩小算法。

The basic idea behind all texture antialiasing algorithms is the same: to preprocess the texture and create data structures that will help compute a quick approximation of the effect of a set of texels on a pixel. For real-time work, these algorithms have the characteristic of using a fixed amount of time and resources for execution. In this way,a fixed number of samples are taken per pixel and combined to compute the effect of a (potentially huge) number of texels.

所有纹理抗锯齿算法背后的基本思想是相同的:预处理纹理并创建数据结构,这将有助于计算一组纹理元素对一个像素的影响的快速近似值。对于实时工作,这些算法具有使用固定数量的时间和资源来执行的特征。通过这种方式,每个像素获取固定数量的样本,并将其组合以计算(潜在大量的)纹理元素的效果。

Mipmapping 多级渐远纹理

The most popular method of antialiasing for textures is called mipmapping. It is implemented in some form on all graphics accelerators now produced. “Mip” stands for multum in parvo, Latin for “many things in a small place”—a good name for a process in which the original texture is filtered down repeatedly into smaller images.

纹理抗锯齿最流行的方法叫做小中见大贴图。它以某种形式在现在生产的所有图形加速器上实现。“Mip”代表parvo中的multum,拉丁语是“小地方的许多东西”——这是一个很好的名字,指的是原始纹理被反复过滤成较小图像的过程。

When the mipmapping minimization filter is used, the original texture is augmented with a set of smaller versions of the texture before the actual rendering takes place. The texture (at level zero) is downsampled to a quarter of the original area,with each new texel value often computed as the average of four neighbor texels in the original texture. The new, level-one texture is sometimes called a subtexture of the original texture. The reduction is performed recursively until one or both of the dimensions of the texture equals one texel. This process is illustrated in Figure 6.15.The set of images as a whole is often called a mipmap chain.

当使用小中见大贴图最小化过滤器时,在实际渲染发生之前,原始纹理用一组较小版本的纹理来增强。纹理(零级)被下采样到原始区域的四分之一,每个新的纹理元素值通常被计算为原始纹理中四个相邻纹理元素的平均值。新的一级纹理有时被称为原始纹理的子纹理。递归地执行减少,直到纹理的一个或两个维度等于一个纹理元素。这一过程如图6.15所示。作为一个整体的图像集通常被称为mipmap链。

Figure 6.15. A mipmap is formed by taking the original image (level 0), at the base of the pyramid, and averaging each 2 × 2 area into a texel value on the next level up. The vertical axis is the third texture coordinate, d. In this figure, d is not linear; it is a measure of which two texture levels a sample uses for interpolation. 

图6.15。通过在金字塔的底部获取原始图像(级别0 ),并将每个2 × 2区域平均为上一级别的纹理像素值,来形成mipmap。纵轴是第三个纹理坐标,d,在这个图中,d不是线性的;它是对样本用于插值的两个纹理级别的度量。

Two important elements in forming high-quality mipmaps are good filtering and gamma correction. The common way to form a mipmap level is to take each 2×2 set of texels and average them to get the mip texel value. The filter used is then a box filter, one of the worst filters possible. This can result in poor quality, as it has the effect of blurring low frequencies unnecessarily, while keeping some high frequencies that cause aliasing. It is better to use a Gaussian, Lanczos, Kaiser, or similar filter; fast, free source code exists for the task, and some APIs support better filtering on the GPU itself. Near the edges of textures, care must be taken during filtering as to whether the texture repeats or is a single copy.

形成高质量mipmaps的两个重要因素是良好的过滤和伽马校正。形成mip贴图级别的常用方法是获取每组2×2的纹理元素,并对其进行平均,以获得MIP纹理元素值。所用的滤波器是箱式滤波器,可能是最差的滤波器之一。这会导致低质量,因为它会不必要地模糊低频,同时保留一些导致锯齿的高频。最好使用高斯、Lanczos、Kaiser或类似的滤波器;该任务有快速、免费的源代码,一些API支持在GPU本身上进行更好的过滤。在纹理的边缘附近,在过滤期间必须注意纹理是重复的还是单一的副本。

For textures encoded in a nonlinear space (such as most color textures), ignoring gamma correction when filtering will modify the perceived brightness of the mipmap levels. As you get farther away from the object and the uncorrected mipmaps get used, the object can look darker overall, and contrast and details can also be affected. For this reason, it is important to convert such textures from sRGB to linear space (Section 5.6), perform all mipmap filtering in that space, and convert the final results back into sRGB color space for storage. Most APIs have support for sRGB textures, and so will generate mipmaps correctly in linear space and store the results in sRGB. When sRGB textures are accessed, their values are first converted to linear space so that magnification and minification are performed properly.

对于在非线性空间中编码的纹理(如大多数颜色纹理),在过滤时忽略伽马校正将修改小中见大贴图级别的感知亮度。当你离物体越来越远,并且使用了未校正的小中见大贴图时,物体整体上会看起来更暗,对比度和细节也会受到影响。由于这个原因,将这样的纹理从sRGB转换到线性空间(5.6节),在那个空间中执行所有的小中见大贴图过滤,并且将最终结果转换回sRGB颜色空间用于存储是很重要的。大多数API都支持sRGB纹理,因此可以在线性空间中正确地生成小中见大贴图,并将结果存储在sRGB中。当访问sRGB纹理时,它们的值首先被转换到线性空间,以便正确地执行放大和缩小。

As mentioned earlier, some textures have a fundamentally nonlinear relationship to the final shaded color. Although this poses a problem for filtering in general, mipmap generation is particularly sensitive to this issue, since many hundred or thousands of pixels are being filtered. Specialized mipmap generation methods are often needed for the best results. Such methods are detailed in Section 9.13.

如前所述,一些纹理与最终的着色颜色有着本质上的非线性关系。尽管这通常会给过滤带来问题,但小中见大贴图的生成对这个问题特别敏感,因为要过滤成百上千的像素。为了获得最佳结果,通常需要专门的mipmap生成方法。第9.13节详细介绍了这些方法。

The basic process of accessing this structure while texturing is straightforward. A screen pixel encloses an area on the texture itself. When the pixel’s area is projected onto the texture (Figure 6.16), it includes one or more texels. Using the pixel’s cell boundaries is not strictly correct, but is used here to simplify the presentation.Texels outside of the cell can influence the pixel’s color; see Section 5.4.1. The goal is to determine roughly how much of the texture influences the pixel. There are two common measures used to compute d (which OpenGL calls λ, and which is also known as the texture level of detail). One is to use the longer edge of the quadrilateral formed by the pixel’s cell to approximate the pixel’s coverage [1889]; another is to use as a measure the largest absolute value of the four differentials ∂u/∂x, ∂v/∂x, ∂u/∂y, and ∂v/∂y [901, 1411]. Each differential is a measure of the amount of change in the texture coordinate with respect to a screen axis. For example, ∂u/∂x is the amount of change in the u texture value along the x-screen-axis for one pixel. See Williams’s original article [1889] or the articles by Flavell [473] or Pharr [1411] for more about these equations. McCormack et al. [1160] discuss the introduction of aliasing by the largest absolute value method, and they present an alternate formula. Ewins et al. [454] analyze the hardware costs of several algorithms of comparable quality.

纹理化时访问这个结构的基本过程很简单。屏幕像素包围了纹理本身的一个区域。当像素区域投影到纹理上时(图6.16),它包括一个或多个纹理元素。使用像素的单元格边界并不严格正确,但在这里是为了简化演示。单元外的纹理元素会影响像素的颜色;参见第5.4.1节。目标是大致确定纹理对像素的影响程度。有两种常用的方法来计算OpenGL称之为λ,也称为纹理细节层次)。一种是用像素单元形成的四边形的较长边来近似像素的覆盖范围[1889];另一种方法是用∂u/∂x、∂v/∂x、∂u/∂y和∂v/∂y四个变量的最大绝对值来衡量[901,1411]。每个差异是纹理坐标相对于屏幕轴的变化量的度量。例如,∂u/∂x是一个像素沿x屏幕轴的u纹理值的变化量。参见Williams的原始文章[1889]或Flavell的文章[473]或Pharr的文章[1411]了解关于这些方程的更多信息。McCormack等人[1160]讨论了通过最大绝对值法引入混叠,他们提出了一个替代公式。Ewins等人[454]分析了质量相当的几种算法的硬件成本。

Figure 6.16. On the left is a square pixel cell and its view of a texture.On the right is the projection of the pixel cell onto the texture itself. 

图6.16。左边是一个正方形像素单元及其纹理视图。右边是像素单元在纹理本身上的投影。

These gradient values are available to pixel shader programs using Shader Model 3.0 or newer. Since they are based on the differences between values in adjacent pixels,they are not accessible in sections of the pixel shader affected by dynamic flow control (Section 3.8). For texture reads to be performed in such a section (e.g., inside a loop),the derivatives must be computed earlier. Note that since vertex shaders cannot access gradient information, the gradients or the level of detail need to be computed in the vertex shader itself and supplied to the GPU when using vertex texturing.

这些渐变值可用于使用着色器模型3.0或更新版本的像素着色器程序。由于它们是基于相邻像素中的值之间的差异,因此它们在受动态流控制影响的像素着色器部分中是不可访问的(第3.8节)。对于要在这样的部分(例如,在循环内)中执行的纹理读取,导数必须较早计算。请注意,由于顶点着色器无法访问梯度信息,因此在使用顶点纹理时,需要在顶点着色器本身中计算梯度或细节级别,并将其提供给GPU。

The intent of computing the coordinate d is to determine where to sample along the mipmap’s pyramid axis. See Figure 6.15. The goal is a pixel-to-texel ratio of at least 1 : 1 to achieve the Nyquist rate. The important principle here is that as the pixel cell comes to include more texels and d increases, a smaller, blurrier version of the texture is accessed. The (u, v, d) triplet is used to access the mipmap. The value d is analogous to a texture level, but instead of an integer value, d has the fractional value of the distance between levels. The texture level above and the level below the d location is sampled. The (u, v) location is used to retrieve a bilinearly interpolated sample from each of these two texture levels. The resulting sample is then linearly interpolated, depending on the distance from each texture level to d. This entire process is called trilinear interpolation and is performed per pixel.

计算坐标d的目的是确定沿着小中见大贴图的棱锥轴在哪里采样。参见图6.15。目标是像素与纹理元素的比率至少为1 : 1,以达到奈奎斯特速率。这里的重要原则是,随着像素单元包含更多的纹理元素和d值的增加,纹理会变得更小、更模糊。(u,v,d)三元组用于访问mipmap。值d类似于纹理级别,但d不是整数值,而是级别之间距离的分数值。对d位置之上和之下的纹理级别进行采样。(u,v)位置用于从这两个纹理级别的每一个中检索双线性插值样本。然后,根据从每个纹理级别到d的距离,对产生的样本进行线性插值。整个过程称为三线性插值,对每个像素执行。

One user control on the d-coordinate is the level of detail bias (LOD bias). This is a value added to d, and so it affects the relative perceived sharpness of a texture. If we move further up the pyramid to start (increasing d), the texture will look blurrier.A good LOD bias for any given texture will vary with the image type and with the way it is used. For example, images that are somewhat blurry to begin with could use a negative bias, while poorly filtered (aliased) synthetic images used for texturing could use a positive bias. The bias can be specified for the texture as a whole, or per-pixel in the pixel shader. For finer control, the d-coordinate or the derivatives used to compute it can be supplied by the user.

d坐标上的一个用户控件是细节层次偏差(LOD偏差)。这是添加到d中的一个值,因此它会影响纹理的相对感知清晰度。如果我们进一步向上移动金字塔开始(增加d),纹理将看起来更模糊。对于任何给定的纹理,一个好的LOD偏差会随着图像类型和使用方式的不同而不同。例如,开始时有些模糊的图像可以使用负偏置,而用于纹理的过滤不良(混叠)的合成图像可以使用正偏置。可以为整个纹理指定偏移,也可以在像素着色器中为每个像素指定偏移。为了更好地控制,用户可以提供用于计算的d坐标或导数。

The benefit of mipmapping is that, instead of trying to sum all the texels that affect a pixel individually, precombined sets of texels are accessed and interpolated.This process takes a fixed amount of time, no matter what the amount of minification.However, mipmapping has several flaws. A major one is overblurring. Imagine a pixel cell that covers a large number of texels in the u-direction and only a few in the v-direction. This case commonly occurs when a viewer looks along a textured surface nearly edge-on. In fact, it is possible to need minification along one axis of the texture and magnification along the other. The effect of accessing the mipmap is that square areas on the texture are retrieved; retrieving rectangular areas is not possible. To avoid aliasing, we choose the largest measure of the approximate coverage of the pixel cell on the texture. This results in the retrieved sample often being relatively blurry.This effect can be seen in the mipmap image in Figure 6.14. The lines moving into the distance on the right show overblurring.

小中见大贴图的好处在于,不是试图对单独影响一个像素的所有纹理元素求和,而是访问和内插预先组合的纹理元素集。这个过程需要固定的时间,不管缩小多少。然而,mipmapping有几个缺陷。一个主要问题是过度模糊。想象一个像素单元在u方向上覆盖大量纹理元素,而在v方向上仅覆盖少量纹理元素。这种情况通常发生在观察者沿着纹理表面几乎侧着看的时候。事实上,可能需要沿着纹理的一个轴缩小,而沿着另一个轴放大。访问小中见大贴图的效果是检索纹理上的正方形区域;不可能检索矩形区域。为了避免混叠,我们选择纹理上像素单元的近似覆盖的最大度量。这导致取回的样本通常相对模糊。这种效果可以在图6.14中的mipmap图像中看到。右边向远处移动的线条显示了过度模糊。

Summed-Area Table总面积表

Another method to avoid overblurring is the summed-area table (SAT) . To use this method, one first creates an array that is the size of the texture but contains more bits of precision for the color stored (e.g., 16 bits or more for each of red, green, and blue). At each location in this array, one must compute and store the sum of all the corresponding texture’s texels in the rectangle formed by this location and texel (0, 0)(the origin). During texturing, the pixel cell’s projection onto the texture is bound by a rectangle. The summed-area table is then accessed to determine the average color of this rectangle, which is passed back as the texture’s color for the pixel. The average is computed using the texture coordinates of the rectangle shown in Figure 6.17. This is done using the formula given in Equation 6.3:

另一种避免过度模糊的方法是总面积表(SAT)。要使用这种方法,首先创建一个数组,该数组的大小与纹理的大小相同,但包含更多的存储颜色精度位(例如,红色、绿色和蓝色各16位或更多)。在该数组的每个位置,必须计算并存储由该位置和纹理元素(0,0)(原点)形成的矩形中所有相应纹理元素的总和。在纹理化过程中,像素单元在纹理上的投影由一个矩形限定。然后访问总面积表来确定这个矩形的平均颜色,该颜色作为像素的纹理颜色被传递回来。平均值是用图6.17所示矩形的纹理坐标计算出来的。这是使用等式6.3中给出的公式完成的:

 Figure 6.17. The pixel cell is back-projected onto the texture, bound by a rectangle; the four corners of the rectangle are used to access the summed-area table.

图6.17。像素单元被反投影到纹理上,由矩形界定;矩形的四个角用于访问总面积表。

Here, x and y are the texel coordinates of the rectangle and s[x, y] is the summed-area value for that texel. This equation works by taking the sum of the entire area from the upper right corner to the origin, then subtracting off areas A and B by subtracting the neighboring corners’ contributions. Area C has been subtracted twice, so it is added back in by the lower left corner. Note that (xll, yll) is the upper right corner of area C, i.e., (xll + 1, yll + 1) is the lower left corner of the bounding box.

 这里,x和y是矩形的纹理元素坐标,s[x,y]是该纹理元素的总面积值。这个等式的工作原理是从右上角到原点取整个面积的总和,然后通过减去相邻角的贡献来减去面积A和B。区域C已经被减去了两次,所以它被左下角加了回来。注意(xll,yll)是区域C的右上角,即(xll + 1,yll + 1)是边界框的左下角。

The results of using a summed-area table are shown in Figure 6.14. The lines going to the horizon are sharper near the right edge, but the diagonally crossing lines in the middle are still overblurred. The problem is that when a texture is viewed along its diagonal, a large rectangle is generated, with many of the texels situated nowhere near the pixel being computed. For example, imagine a long, thin rectangle representing the pixel cell’s back-projection lying diagonally across the entire texture in Figure 6.17. The whole texture rectangle’s average will be returned, rather than just the average within the pixel cell.

使用总面积表的结果如图6.14所示。走向地平线的线条在右边缘附近更清晰,但中间对角交叉的线条仍然模糊过度。问题是,当沿着纹理的对角线查看纹理时,会生成一个大矩形,其中许多纹理元素都不在被计算的像素附近。例如,想象一个长而细的矩形,代表图6.17中整个纹理对角线上的像素单元的反投影。将返回整个纹理矩形的平均值,而不仅仅是像素单元内的平均值。

The summed-area table is an example of what are called anisotropic filtering algorithms. Such algorithms retrieve texel values over areas that are not square.However, SAT is able to do this most effectively in primarily horizontal and vertical directions.Note also that summed-area tables take at least two times as much memory for textures of size 16 × 16 or less, with more precision needed for larger textures.

总面积表是所谓的各向异性过滤算法的一个例子。这种算法检索非正方形区域上的纹理像素值。然而,SAT能够在主要水平和垂直方向上最有效地做到这一点。还要注意,对于大小为16 × 16或更小的纹理,总面积表至少占用两倍的内存,对于更大的纹理,需要更高的精度。

Summed area tables, which give higher quality at a reasonable overall memory cost, can be implemented on modern GPUs [585]. Improved filtering can be critical to the quality of advanced rendering techniques. For example, Hensley et al. [718, 719] provide an efficient implementation and show how summed area sampling improves glossy reflections. Other algorithms in which area sampling is used can be improved by SAT, such as depth of field [585, 719], shadow maps [988], and blurry reflections [718].

总面积表,以合理的总内存成本提供更高的质量,可以在现代GPU上实现[585]。改进的过滤对高级渲染技术的质量至关重要。例如,Hensley等人[718,719]提供了一种有效的实现方式,并展示了总面积采样如何改善光泽反射。SAT可以改进使用区域采样的其他算法,如景深[585,719]、阴影贴图[988]和模糊反射[718]。

Unconstrained Anisotropic Filtering无约束各向异性滤波

For current graphics hardware, the most common method to further improve texture filtering is to reuse existing mipmap hardware. The basic idea is that the pixel cell is back-projected, this quadrilateral (quad) on the texture is then sampled several times, and the samples are combined. As outlined above, each mipmap sample has a location and a squarish area associated with it. Instead of using a single mipmap sample to approximate this quad’s coverage, the algorithm uses several squares to cover the quad. The shorter side of the quad can be used to determine d (unlike in mipmapping, where the longer side is often used); this makes the averaged area smaller (and so less blurred) for each mipmap sample. The quad’s longer side is used to create a line of anisotropy parallel to the longer side and through the middle of the quad. When the amount of anisotropy is between 1 : 1 and 2 : 1, two samples are taken along this line (see Figure 6.18). At higher ratios of anisotropy, more samples are taken along the axis.

对于当前的图形硬件,进一步改进纹理过滤的最常见方法是重用现有的mipmap硬件。基本思想是像素单元被反向投影,然后纹理上的这个四边形(四边形)被采样几次,并且样本被组合。如上所述,每个mipmap样本都有一个位置和与之相关联的方形区域。该算法使用几个正方形来覆盖该四边形,而不是使用单个小中见大贴图样本来近似该四边形的覆盖范围。四边形的较短边可用于确定d(不像在mipmapping中,通常使用较长边);这使得每个mipmap样本的平均面积更小(因此更不模糊)。四边形的长边用于创建一条平行于长边并穿过四边形中间的各向异性线。当各向异性的量在1 : 1和2 : 1之间时,沿着这条线取两个样本(见图6.18)。在较高的各向异性比率下,沿轴采集更多的样本。

Figure 6.18. Anisotropic filtering. The back-projection of the pixel cell creates a quadrilateral. A line of anisotropy is formed between the longer sides. 

图6.18。各向异性过滤。像素单元的反向投影创建了一个四边形。在长边之间形成一条各向异性线。

This scheme allows the line of anisotropy to run in any direction, and so does not have the limitations of summed-area tables. It also requires no more texture memory than mipmaps do, since it uses the mipmap algorithm to do its sampling. An example of anisotropic filtering is shown in Figure 6.19.

这种方案允许各向异性线向任何方向延伸,因此没有总面积表的限制。它也不需要比小中见大贴图更多的纹理内存,因为它使用小中见大贴图算法进行采样。各向异性滤波的一个例子如图6.19所示。

Figure 6.19. Mipmap versus anisotropic filtering. Trilinear mipmapping has been done on the left, and 16 : 1 anisotropic filtering on the right. Toward the horizon, anisotropic filtering provides a sharper result,with minimal aliasing. (Image from three.js example webgl materials texture anisotropy.) 

图6.19。Mipmap与各向异性过滤。左边是三线性MIP贴图,右边是16 : 1各向异性过滤。朝向地平线,各向异性滤波提供了更清晰的结果,具有最小的混叠。(图片来自three.js示例webgl材质纹理各向异性。)

This idea of sampling along an axis was first introduced by Schilling et al. with their Texram dynamic memory device [1564]. Barkans describes the algorithm’s use in the Talisman system [103]. A similar system called Feline is presented by McCormack et al. [1161]. Texram’s original formulation has the samples along the anisotropic axis (also known as probes) given equal weights. Talisman gives half weight to the two probes at opposite ends of the axis. Feline uses a Gaussian filter kernel to weight the set of probes. These algorithms approach the high quality of software sampling algorithms such as the Elliptical Weighted Average (EWA) filter, which transforms the pixel’s area of influence into an ellipse on the texture and weights the texels inside the ellipse by a filter kernel [691]. Mavridis and Papaioannou present several methods to implement EWA filtering with shader code on the GPU [1143].

Schilling等人通过他们的Texram动态存储设备[1564]首次提出了沿轴采样的想法。Barkans描述了该算法在Talisman系统中的应用[103]。McCormack等人[1161]提出了一种类似的称为猫科动物的系统。Texram的原始公式中,沿各向异性轴(也称为探针)的样本具有相同的权重。Talisman赋予轴两端的两个探头一半的权重。猫使用高斯滤波器核来加权该组探针。这些算法接近软件采样算法的高质量,如椭圆加权平均(EWA)滤波器,它将像素的影响区域转换为纹理上的椭圆,并通过滤波器内核对椭圆内的纹理像素进行加权[691]。马夫里迪斯和帕帕约安努提出了几种在GPU上用着色器代码实现EWA滤波的方法[1143]。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

椰子糖莫莫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值