Cube
images ignore the wrap modes specified in the sampler. Instead, if
VK_FILTER_NEAREST
is used within a miplevel then
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
is used, and if
VK_FILTER_LINEAR
is used within a miplevel then sampling at the edges
is performed as described earlier in the
Cube map edge handling section.
The first integer texel coordinate i is transformed based on the
addressModeU
parameter of the sampler.
where:
$j$
(for 2D and Cube image) and
$k$
(for 3D image)
are similarly transformed based on the addressModeV
and
addressModeW
parameters of the sampler, respectively.
SPIR-V instructions with Gather
in the name return a vector derived
from a 2x2 rectangular region of texels in the base level of the image view.
The rules for the VK_FILTER_LINEAR
minification filter are applied to identify the
four selected texels. Each texel is then converted to an RGBA value according
to conversion to RGBA and then
swizzled. A four-component vector is then
assembled by taking the component indicated by the Component
value in
the instruction from the swizzled color value of the four texels:
where:
If
$\lambda$
is less than or equal to zero, the texture is said
to be magnified, and the filter mode within a mip level is selected by the
magFilter
in the sampler. If
$\lambda$
is greater than
zero, the texture is said to be minified, and the filter mode within a mip
level is selected by the minFilter
in the sampler.
Within a miplevel, VK_FILTER_NEAREST
filtering selects a single value using the
$(i,j,k)$
texel coordinates, with all texels taken from layer l.
Within a miplevel, VK_FILTER_LINEAR
filtering computes a weighted average of 8
(for 3D), 4 (for 2D or Cube), or 2 (for 1D) texel values, using the weights
computed earlier:
Finally, mipmap filtering either selects a value from one miplevel or computes a weighted average between neighboring miplevels:
Anisotropic filtering is enabled by the anisotropyEnable
in the
sampler. When enabled, the image filtering scheme accounts for a degree of
anisotropy.
The particular scheme for anisotropic texture filtering is implementation
dependent. Implementations should consider the magFilter
,
minFilter
and mipmapMode
of the sampler to control the specifics
of the anisotropic filtering scheme used. In addition, implementations
should consider minLod
and maxLod
of the sampler.
The following describes one particular approach to implementing anisotropic filtering for the 2D Image case, implementations may choose other methods:
Given a magFilter
, minFilter
of VK_FILTER_LINEAR
and a
mipmapMode
of VK_SAMPLER_MIPMAP_MODE_NEAREST
:
Instead of a single isotropic sample, N isotropic samples are be sampled within the image footprint of the image level $d$ to approximate an anisotropic filter. The sum $\tau_{2Daniso}$ is defined using the single isotropic $\tau_{2D}$ (u,v) at level $d$ .
![]() | editing-note |
---|---|
(Bill) EXT_texture_filter_anisotropic has not been updated since 2000, except for ES extension number (2007) and a minor speeling (sic) correction (2014), neither of which are functional changes. It is showing its age. In particular, there is an open issue about 3D textures. There are no interactions with ARB_texture_cube_map (approved 1999, promoted to core OpenGL 1.3 in 2001), let alone interactions with ARB_seamless_cube_map (approved and promoted to core OpenGL 3.2 in 2009). There are no interactions with texture offsets or texture gather. |