跳转至

Textures

Texture Mapping

  • apply a spatial variation to the surface of an object

  • Every 3D surface point also has a place where it goes in the 2D image and in the 2D texture

  • every triangle copies a piece of texture image back to the surface
  • 纹理复用:对重复场景很好用

Texture Coordinate Generation

  1. 参数化曲面:将参数面坐标直接作为纹理坐标

  2. planar projection

  3. spherical projection

  4. complex surfaces: project parts to parametric surfaces

image-20241129205320515
  1. logic: cut -> flatten -> pack

    • 怎么切,怎么摊平:保距、保角

Texture Mapping is Sampling

事实上是一个重采样

  • for each rasterized screen sample (x,y):

​ (u,v)= evaluate texcoord value at (x,y);

​ float3 texcolor =texture.sample(u,v); ​ set sample's color to texcolor;

  • Mathematically, to draw a texture sample at \((u,v)\):
  • Start with discrete, sampled 2D function \(f(x,y)\). This function is only non-zero at sampled locations
  • Reconstruct a continuous 2D function, \(f_{cont}(x,y)=f(x,y)*k(x,y)\) by convolution with a reconstruction filter \(k(x,y)\)
  • Draw the desired sample at \((u,v)\) from the continuous 2Dsignal by function evaluation: \(f_{cont}(u,v)\)
  • 屏幕采样率vs纹理采样率
  • At optimal viewing size:
  • 1:1 mapping between pixel sampling rate and texel sampling rate
  • Dependent on texture resolution! e.g.512x512
  • When larger(magnification), Multiple pixel samples per texel samples, upsampling
  • When smaller(minification), One pixel sample per multiple texel samples, downsampling

  • screen pixel footprint in texture 即屏幕空间里一个pixel对应纹理空间的大小

  • 雅克比矩阵

    image-20241129210642314

Texture Filtering

  • 采样率不匹配可能导致锯齿、闪烁等问题

  • idea: 低通滤波

  • 放大: essentially image interpolation 如双线性插值

image-20241129211059335
  • 缩小:更复杂的情况

  • 挑战

    • 很多的texel对应一个pixel footprint
    • pixel footprint的形状可能很复杂
  • idea

    • low-pass filter and 降采样
    • 使用匹配屏幕采样率的分辨率
  • mipmap: 储存不同距离对应的不同的采样率

    image-20241129212514920

  • determine mip level D: estimate texture footprint using texture coordinates of neighboring screen samples

    image-20241129212746766

  • 让图像更加连续:比如一个点位于level D和D+1之间,这时候先得到D和D+1时的结果,再将这两个结果进行插值,即三线性插值 trilinear filtering

  • miplap的局限性:overblur

    image-20241129213855656

  • Elliptical weighted average filtering 各向异性的filter

Advanced Texturing

  1. Environment Map 把环境光映射到镜面反射物体上 a function from sphere to colors
image-20241129214110725

Cube Map: 把一个球分成六个正方形映射到立方体上

  1. Displacement Mapping

  2. Bump Mapping

  3. 3D Procedural Texture

  4. Precomputed Shading 预计算一个可能的阴影图,不考虑光照方向等信息

  5. Bidirectional Texture Function

    • Lighting- and view-dependent textures(6D)
    • represent appearance of various materials

评论