当前位置: 代码迷 >> 综合 >> GAMES101-06光栅化2(反走样和深度缓冲)
  详细解决方案

GAMES101-06光栅化2(反走样和深度缓冲)

热度:50   发布时间:2024-01-05 10:33:20.0

06Rasterization 2 (Antialiasing and Z-Buffering

  • 一、Rasterization 1 (Antialiasing and Z-Buffering)


一、Rasterization 1 (Antialiasing and Z-Buffering)

Recap: Testing in/out△at pixels’ centers
如何解决锯齿(学名走样aliasing)是本节课的主要内容
照片就是采样的过程,采样可以发生在不同的时间。

Sampling Artifacts/瑕疵
(Errors / Mistakes / Inaccuracies) in Computer Graphics

Moire Patterns in lmaging摩尔纹
拿手机拍显示器的屏幕也会出现同类情况

Wagon heel illusion (False Motion)
有时看到高速行驶的汽车轮胎倒转

Artifacts due to sampling - "Aliasing"
Jaggies - sampling in space
Moire - undersampling images
Wagon wheel effect - sampling in time

Antialiasing ldea: Blurring (Pre-Filtering) Before
Sampling(在采样之前做一个模糊,即滤波)
中间加一个过程
若先采样再模糊叫Blurred Aliasing,实际还是走样了
??采样速度跟不上信号变化速度就会走样
频率知识:
Frequency Domain 频域
Fourier Transform 傅里叶变换
傅里叶级数展开可以将函数图像转换成正弦余弦变换。

相同采样方法采样不同函数,采样结果一样。
走样
Filtering 滤波= Getting rid of certain frequency contents去掉特定频率
傅里叶变化
逆傅里叶变化1
高通滤波:只让高频信息留下,只留下图片边界
边界(颜色的突变)——高频

逆傅里叶变化2
低通滤波:只让低频信息留下,模糊边界
逆傅里叶变化3
Filtering = Convolution卷积(= Averaging平均)
卷积定理
空间域中的卷积等于频域中的乘法,反之亦然
实域的卷积等于频域的乘积。
ex.
Box Filter
九分之一是为了保持图像颜色亮度不改变(归一化)
滤波器

小盒子

大盒子
盒子变大了,反映在频率上反而变小了。

Sampiing = Repeating Frequency Contents
Aliasing = Mixed Frequency Contents
解决方法:
Option 1: lncrease sampling rate

  • Essentially increasing the distance between replicas in the Fourier domain
  • Higher resolution displays, sensors, frame buffers…
  • But: costly & may need very high resolution
    Option 2: Antialiasing
  • Making Fourier contents “narrower” before
  • repeating i.e.Filtering out high frequencies before sampling

Solution:

  • Convolve f(,y) by a 1-pixel box-blur
  • Then sample at every pixel’s center

MSAA多重采样反走样
将一个像素分解为多个小格,然后平均采样
抗锯齿

并未实际改变分辨率,只是近似覆盖
What’s the cost of MSAA? 增大计算量
其他抗锯齿方法:

  • FXAA(Fast Approximate AA)
  • TAA (Temporal AA)

Super resolution / super sampling

  • From low resolution to high resolution
  • Essentially still “not enough samples” problem
  • DLSS (Deep Learning Super Sampling)