GAMES202 1&2 Overview & Recap of CG Basis
Lecture 1&2 Overview & Recap of CG BasisContents
Shadows
Global Illum
Physically-based Shading
Real-time Ray Tracing
Graphics Pipeline 渲染管线 复习OpenGL:
一系列通过CPU调用GPU的API
语言不重要
跨平台
替代品:DirectX,Vulkan
缺点:
版本比较碎片化
C style, 使用不是很简单
(之前)不好Debug
如何理解:
和101里面的光栅化一一对应
放置/摆放物体,视图变换啥的,GL有矩阵相乘的API
VBO 存储模型的向量、坐标、纹理坐标
之前的obj文件
使用一个画架easel(GL里面的framebuffer)可以渲染多张图
还有一种是直接渲染到屏幕(垂直同步),但是容易造成画面撕裂。使用双/三重缓冲避免
目前只需要用到vertex shader和fragment shader
大致渲染过程,每一次pass
指定物体、相机、MVP等等
指定framebuffe ...
GAMES101 19,20,21,22 (完结)
19 Cameras, Lenses and Light Fields 相机棱镜和光场Camera Structure
shutter 快门
sensor 传感器,感知Irradiance
针孔相机 Pinhole Image Formation没有模糊
Feild of view (FOV) 视场取决于Lens和Sensor(宽度是h)的距离(f)。 $Fov=2 arctan(\frac{h}{2f})$
Exposure 曝光
$ H=T\times E$
exposure=time*irradiance
Aperture size 光圈(E)f数(F-Number F-STop)直径分之一,越大光圈越小。光圈大远景模糊,浅景深(景深是光像清晰的一段范围)
Shutter speed 快门曝光时间(T)Motion Blur 运动模糊
ISO Gain 感光度。太大放大噪声
F-Stop和Shutter时间要Trade off
Gauss Ray Tracing Construction / Thin lens equation$\fr ...
GAMES101 18 Advanced Topics in Rendering
18 Advanced Topics in RenderingAdvanced Light TransportUnbiased light transport methodsBidirectional Path Tracing (BDPT)生成两个子路径,分别从光源和摄像机出发光线,并将两者断电连接起来。
Metropolis Light Transport (MLT)
用马尔可夫链生成样本,给一条路径,生成一系列相似的路径。被积函数和pdf形状一致的时候variance最小。(马尔可夫链可以用任何函数生成样本)
适用于局部取样、复杂光路、焦散、SDS(Specular-Diffuse-Specular)
缺点是收敛速度问题不清楚、有些像素收敛快,有的慢
Biased light transport methodPhoton Mapping
caustics(焦散),
Step 1 Photon Tracing 光子一直跑,知道遇到diffuse的地方
Step 2 photon collecting 从视角跑,直到遇到diffuse的地方
Step 3 Calculation - ...
GAMES101 17 Material and Appearance
17 Material and AppearanceMaterial = BRDF
Diffuse / Lambertain Material
albedo (color): $f_r=\rho/\pi,albedo\ is\ \rho $
Glossy MaterialIdeal Reflective / Refractive Material 反射和折射材料Snell’s Law
Law of Refraction 斯涅尔定律(折射定律)
Snell’s Circle (水中的全反射,一个锥形)
Fresnel Reflection / Term 菲涅尔项
Reflectance depends on incident angle (and polarization of light)
不同角度反射和折射的量不同。也取决于光的偏振方向。但是太不好算了
菲涅尔项的approximation: schlick’s approximation
Microfacet Theory 微表面模型 基于物理
对于细节很多的材质。远 ...
GAMES101 16 Ray Tracing 4 Path Tracing
Ray Tracing 4 Path TracingMonte Carlo Integration
Definite intergral: $\int_{a}^{b}{f(x)dx}$
Random variable: $X_i\sim pdf(x)$ , pdf is the Probability Distribution Function
Monte Carlo estimator: $F_N=\frac{1}{N}\sum_{i=1}^{N}{\frac{f(x_i)}{pdf(x_i)}}$
我自己证明一下:中心极限定理,当 $ N\rightarrow \infty $
$\frac{1}{N}\sum_{i=1}^{N}{\frac{f(x_i)}{pdf(x_i)}}\rightarrow E(\frac{f(x_i)}{pdf(x_i)})$
$= \int_{a}^{b}{pdf(x_i)\times \frac{f(x_i)}{pdf(x_i)}}dx$
$=\int_{a}^{b}{f(x_i)}dx$
$& ...
GAMES101 15 Ray Tracing 3 BRDF
15 Ray Tracing 3 BRDFBasic Radiometry 辐射度量学基础Irradiance
Definition: Power pur unit area.
$ E(x) \equiv \frac{d\Phi_{\perp}(x)}{dA}=\frac{\Phi}{A}cos\theta $
单位面积上接收到的能量
Radiance
Definition: Power pur unit solid angle pur unit area
$L(p,\omega)\equiv \frac{d^2\Phi(p,\omega)}{d\omega dAcos\theta}$
单位立体角单位面积上接收到的能量
Radiance 对单位立体角积分,就是Irradiance:
$E_i(\omega_i)=L_i(\omega_i)cos\theta_i d\omega_i$
Bidirectional Reflectance Distribution Function (BRDF)Reflection at a Point 光在一个点的反射
可以理解成, ...
GAMES101 14 Ray Tracing 2 Accelerate
14 Ray Tracing 2 AccelerateAcceleration: Bounding Volumes
Ray-Intersection With a Box
Understanding : box is the intersection of 3 pairs of slabs.
Axis-Aligned Bounding Box: AABB 轴对齐包围盒
光线进入所有包围面,进入盒子。出去其中一个包围面,出去包围盒。
$t_{enter}=max{t_{min}}, t_{exit}=min{t_{max}}$
If $t_{enter}<t_{exit}$, ray stay a while in the box.
$t_{enter}<t_{exit} and t_{exit}>=0$, ray and AABB intersection.
Grid Solution: 在bounding box 里面再弄一堆格子
Spatial Partitioning Examples
Oct-Tree
KD-Tree
BSP- ...
GAMES101 13 Ray Tracing 1 Whitted-Style
13 Ray Tracing 1 Whitted-StyleShadow Mapping before we move onTBD
Whitted-Style Ray TracingTBD
Why Ray Tracing?
Rasterization couldn’t handle global effects well
Soft shadow
Light bounces more than once
Ray Tracing is accurate, but is very slow
Rasterization: real-time, ray tracing: offline
~10k CPU core hours to render one frame in production.
Definition:
Light Rays:
Light travels in straight lines 直线传播
Light rays do not collide with each other if they cross 不相互影响
Light rays travel from th ...
GAMES101 12 Geometry 3 Mesh Operation
Geometry 3 Mesh Operationby @SankHyan24
Mesh Subdivision:
Loop Subdivision:(used only on triangle)
Add the number of triangle
Assign new vertex positions according to weight
New/old vertices updated differently
For new vertices: Updated to $\frac{3}{8}(A+B)+\frac{1}{8}(C+D)$
For old vertices: Updated to
$(1-nu)\times original position + u neighbor position sum$
$n: vertex degree$
$u:\frac{3}{16} if n=3, \frac{3}{8n} otherwise $
Catmull-Clark Subdivision (General Mesh)
Definitio ...
GAMES101 11 Geometry 2 Curves and Surface
11 Geometry 2 Curves and Surface 曲线和表面
Explicit Representations
Curves
Bezier Curves
De Casteljau’s Algorithm
B-splines, etc.
Surfaces
Bezier surfaces
Triangles & quads
Subdivision, simplification, regulation
Explicit Representations
Point Cloud (Explicit)
Easiest representation: list of points(x,y,z)
只要点足够密,表示任何面
经常被转化成多边形面
Polygon Mesh (Explicit)
Store vertices & polygons(一般是三角形/四边形)
更复杂的数据结构,更普遍的表达形式
The Wavefront Object File (.obj) Format
Curves
Bezier Curves 贝塞尔曲线
D ...