GAMES101-现代计算机图形学入门-闫令琪——Lecture 15 Ray Tracing 3 学习笔记

Lecture 15 Ray Tracing 3

(一)、Radiometry

Measurement system and units for illumination

Accurately measure the spatial properties of light

–New terms: Radiant flux, intensity, irradiance, radiance

Perform lighting calculations in a physically correct manner

1、Radiant Energy and Flux (Power)

Radiant energy

Definition: Radiant energy is the energy of electromagnetic radiation. It is measured in units of joules, and denoted by the symbol.

image-20210124094446021

类似于功的概念,可以理解为总的能量

Radiant flux

Definition: Radiant flux (power) is the energy emitted, reflected, transmitted or received, per unit time

image-20210124094505071

类似于功率的概念,可以理解为单位时间的能量

同时功率的单位还可以是lm(流明),可以理解为表示的是光的亮度。

Flux – #photons flowing through a sensor in unit time

image-20210124100526354

同这个概念还可以这样理解:如上图,假设前面有一个感光的平面,那么某一时刻通过这个平面的光子数量,即为Radiant flux。

2、Important Light Measurements of Interest
image-20210124100717624
(1)、Radiant Intensity

Definition: The radiant (luminous) intensity is the power per unit solid angle (立体角) emitted by a point light source.

一个光源会向各个方向辐射能量,在这里定义Radiant Intensity,表示沿某个立体角方向上辐射的能量(单位立体角上光辐射的能量)。

image-20210124100803366 image-20210124100813878

那么什么是立体角?

Angles and Solid Angles

Angle: ratio of subtended arc length on circle to radius

image-20210124101050941
  • θ= l r \frac{l}{r} rl
  • Circle has 2π radians

在二维上来讲,用弧度来定义一个角,弧度=弧长/半径,整个圆的弧度是2π

Solid angle: ratio of subtended area on sphere to radius squared

image-20210124101204436
  • Ω= A r 2 \frac{A}{r^2} r2A
  • Sphere has 4π steradians

在三维上,用立体角来定义和二维中弧度类似的概念(相当于是用弧度表示角度的概念在三维中的延伸)。在三维空间中,从球心出发,向球的表面,形成某个锥,这个锥会打到球面上,形成某一块面积,立体角=面积/半径的平方。

整个球面的立体角也可以类似去积分,是4π

Differential Solid Angles(单位立体角)

image-20210124101757964

如果把这个球看成一个经纬球,那么用θ表示经度方向的角度,用φ表示纬度方向的角度,那么就可以定义球上唯一一点的位置。

那么通过微积分就可以求出单位立体角:

先将单位面积积分出来:

image-20210124102323885

再通过立体角的定义求出单位立体角:

image-20210124102346098

我们还可以求出整个球的单位立体角:

image-20210124102425592

ω as a direction vector

image-20210124102515086

Will use ω to denote a direction vector (unit length)

我们可以用单位立体角去表示单位长度(单位球)上的任意一个方向。

Isotropic Point Source

image-20210124102747840

知道了什么是立体角,回到刚刚的Radiant Intensity问题上来,我们定义一个点光源,那么Radiant Intensity其实就是任意一个光源在任何一个方向上的亮度:

image-20210124103028485

把所有单位立体角上的Intensity积分起来同样还可以得到flux(power)

image-20210124102955648
(2)、Irradiance

Definition: The irradiance is the power per unit area incident on a surface point.

image-20210124204735960 image-20210124204747556

各个方向的光照射到一小块面积上的能量(单位面积上接收到的各个方向的光辐射的能量)。

这里的Irradiance必须是垂直于光线的面积,或者说投影到垂直方向上的面积。

所以以前的一些问题就可以得到解决:

Lambert’s Cosine Law

Irradiance at surface is proportional to cosine of angle between light direction and surface normal

image-20210124205034301

Correction: Irradiance Falloff

image-20210124205325200
(3)、Radiance

Radiance is the fundamental field quantity that describes the distribution of light in an environment

  • Radiance is the quantity associated with a ray
  • Rendering is all about computing radiance
image-20210124205439344

用来描述光线的属性。

Definition: The radiance (luminance) is the power emitted, reflected, transmitted or received by a surface, per unit solid angle, per projected unit area.

image-20210124205501432 image-20210124205514563

刚刚提到了Intensity是沿某个立体角方向上辐射的能量,Irradiance是各个方向的光照射到一小块面积上的能量,那么把两者结合起来理解,即为光在某个单位面积上,朝某个方向辐射出来的能量。

比如一小块面积dA,他可能辐射的方向朝着四面八方

再比如确定了一个立体角dω,但是如果面积A本身比较大,那么辐射的东西就多,如果A本身比较小,那么辐射的东西就少

所以我们两者结合,定义了某一个确定的微小的面dA,和某一个确定的方向。这个确定的区域会往某一个确定的方向(立体角dω)去辐射能量。

Recall

  • Irradiance: power per projected unit area
  • Intensity: power per solid angle

So

  • Radiance: Irradiance per solid angle
  • Radiance: Intensity per projected unit area

我们发现Radiance和前面两个量Irradiance和Intensity都有关系,因此我们从以下两个方向去理解:

①、Incident Radiance

Incident radiance is the irradiance per unit solid angle arriving at the surface.

image-20210124211928329

i.e. it is the light arriving at the surface along a given ray (point on surface and incident direction).

这里理解成某一个确定微小面积上受到的所有能量(E),在一个方向ω上的分量。

②、Exiting Radiance

Exiting surface radiance is the intensity per unit projected area leaving the surface.

image-20210124212225951

e.g. for an area light it is the light emitted along a given ray (point on surface and exit direction).

这里理解成一个确定的方向上辐射出来的所有能量(I),在一个微小面积上的分量。

(4)、Irradiance vs. Radiance

Irradiance: total power received by area dA

Radiance: power received by area dA from “direction” dω

将Irradiance和Radiance比较。

Irradiance表示某一个确定微小面积上受到的所有能量,

Radiance表示某一个确定微小面积上受到的所有能量,在一个方向ω上的分量,

Radiance无非就是在Irradiance的基础上增加了一个方向性。把这个式子写出来如下所示:

image-20210124212502966

Unit Hemisphere: H2

image-20210124212524940

(二)、Bidirectional Reflectance Distribution Function (BRDF)

Reflection at a Point

Radiance from direction ωi turns into the power E that dA receives Then power E will become the radiance to any other direction ω0

image-20210124213002845

从对反射的理解层面,BRDF可以理解为某一个方向的光,在打到某个微小面积后,反射到各个方向,那么各个方向的能量分配,就是BRDF做的事情。

从另一方面理解,一个方向的光打到一个微小的平面被吸收了,吸收后再从这个微小平面被发出去。那么就可以用Irradiance和Radiance去解释反射。

Differential irradiance incoming:image-20210124213039844

对于某一个微小面积,他所接受到的能量Irradiance(dE(ωi))(单考虑从某一个方向进来的能量)就是从某一个方向的立体角(dωi)的Radiance(L(ωi)cosθi

Irradiance会被转化成Radiance再出去,也就是

Differential radiance exiting(due to dE(ωi)):dLrr)

现在的问题是,对于一个微小的面积,我们知道他在某个方向上接收到的某些能量,我们也知道他要把能量辐射到四面八方去,但我不知道他往某个方向上辐射的能量有多少。于是我们定义一个函数来专门描述这个概念:

BRDF

The Bidirectional Reflectance Distribution Function (BRDF) represents how much light is reflected into each outgoing direction ωrfrom each incoming direction

image-20210124215532311 image-20210124215538733

微小面积dA,从某一个微小立体角dωi,接收到的Irradiance,会如何被分配到各个不同的立体角上去,算的是一个比例。

对于任何一个出射方向,算出其Radiance,除以一个微小面积接收到的Irradiance,这就是BRDF的定义。

正是因为这个概念,影响了反射,决定了物体表面不同的材质。

The Reflection Equation

image-20210124220020848 image-20210124221357248

那么如果此时,我盯着某一个反射出去的方向,然后我认为某一个着色点可以接收来自四面八方不同的光照,那么对于每一个入射方向,都会对应一个“入射方向→着色点→出射方向”这样的一个BRDF,那么我们就可以把每一个方向上dω的入射光的强度Radiance乘以cosθ乘以BRDF,然后把每一个入射方向上对出射方向的贡献都加起来,就得到了从反射方向看过去这个点的样子了。

Challenge: Recursive Equation

image-20210124221214324 image-20210124221227808

But incoming radiance depends on reflected radiance (at another point in the scene)

但是这里的问题是,入射光线不只是来源于光源,还有一部分来自于其他物体的反射光线。

The Rendering Equation

Re-write the reflection equation:

image-20210124221643757

by adding an Emission term to make it general!

如果这个物体自己会发光,那么应该把自发光这一项加上(Le)。

The Rendering Equation

image-20210124221728114

这里考虑的是一个通用情况,第一项是自发光Le,第二项表示的是所有方向入射来的光,是个半球面,而且此处把cosθ写成了法线n点乘入射方向ω

Note: now, we assume that all directions are pointing outwards!(依然假设所有方向都向外)

(三)、Understanding the rendering equation

Reflection Equation

image-20210124222139733 image-20210124222149555

上图是一个点光源的情况,那么假设有很多点光源该怎么办?

image-20210124222304376 image-20210124222315804

Sum over all light sources

那么此处,有很多点光源,我们就考虑把每一个点光源照亮这个点x,然后反射到观测方向上的值全部加起来即可。(把每个点光源的贡献加起来)

如果有面光源又该怎么办?

image-20210124222447023 image-20210124222514970

面光源本身就是一些点光源的集合,既然上一步我们可以把每个点光源的贡献加起来,那么对于一个面光源,我们就把面光源上每个点的贡献积分起来,积分这个面光源所占据的立体角,然后考虑所有覆盖的方向,从每一个方向来的Radiance,经过BRDF反射过去应该是什么样的Radiance出去,把之前的求和变成了积分。

但是照亮到一个点的Radiance可不一定就是来自于光源,也有可能是其他物体反射来的,这时候又该怎么办?

image-20210124222757894 image-20210124222810026

Rendering Equation as Integral Equation

这时,我们不知道反射光的Radiance是多少,同时也不知道从其他物体反射过来在此处的入射光的Radiance是多少,其他项我们都知道(自发光和BRDF(材质)我们都可以定义好)。那么对于这个式子来讲不知道的只有各个物体反射的(反射过来和反射出去的)Radiance是多少。

image-20210124223613055

下面我们来简化这个式子

Is a Fredholm Integral Equation of second kind [extensively studied numerically] with canonical form

image-20210124223743770

对于这一个式子,我们可以进一步把BRDF简写成某种操作符(算子)

image-20210124223809191

Can be discretized to a simple matrix equation [or system of simultaneous linear equations] (L, E are vectors, K is the light transport matrix)

对于所有物体辐射出来的所有能量将其写成所有光源辐射出来的能量加上辐射出来的能量被反射之后的能量。

这样写(忽略了很多中间步骤)的目的是最终为了解出L。

Ray Tracing and extensions

  • General class numerical Monte Carlo methods
  • Approximate set of all paths of light in scene
image-20210124224019634

L是一个递归定义的,通过数学变换将L移到一边,得到L=(1-K)-1E。

在这里算子(1-K)-1虽然是矩阵,但是同样也具有类似于泰勒展开的性质,因此可以通过泰勒展开展出来。

Ray Tracing

image-20210124224548262

这时候就可以把L分解成

E:直接看到光源会看到什么(光源)
+
KE:光源辐射出的能量经过一次反射后会看到什么(直接光照)
+
K2E:光源辐射出的能量经过两次反射后会看到什么(间接光照)
+
K3E:光源辐射出的能量经过三次反射后会看到什么(间接光照)
+

这就是对于光线弹射次数的一个分解。如果光线一次都不弹射直接打到人的眼睛里,那么看到的就是光源E;如果光线弹射一次后打到人的眼睛里,看到的就是直接光照KE(包括阴影);如果弹射两次,看到的就是间接光照;弹射三次就是…弹射越多就是更多的间接光照。光线弹射两次中间就包括了反射(比如光从眼睛出发,打到镜子弹射一次,再打到物体又弹射一次。),反射本身就是一种间接光照。

全部光照弹射的次数加起来就叫全局光照(直接和间接光照的集合)

从另一个角度来理解:光栅化可以干什么?

image-20210124225252177

光栅化能够告诉我们光线传播的内容只有0次(E)和一次(KE)的弹射,也就是只包括光源自己和直接光照部分,后面的部分就是光栅化比较难做的部分。这也就是为什么要用光线追踪的方法来解决光线传播问题的一个理由。

下面用直观的例子来理解光线追踪的式子:

image-20210124225509624

直接光照(p点是黑的,没有光)

image-20210124225538348

一次间接光照:将光弹射两次的部分引起的间接光照加入直接光照之后(p点亮了)

image-20210124225743245

两次间接光照:光线在场景中弹射三次。考虑的是光线在场景中弹射一次、两次和三次的总共全局光照效果

image-20210124225855060

四次间接光照:光线在场景中弹射五次。场景更亮了(p点清晰可见)。这里有个细节,在上一幅图(光线在场景中弹射三次)中,图片顶部的灯是暗的,而到了这一幅图,图片顶部的灯可以透过光线了(亮了)。这里的这个灯是玻璃的,如果光线在场景中弹射三次,只够光在摄像机进入灯里,出不来,经过若干次弹射才能出来。(灯的玻璃可能是双层的,经过两次弹射才能进去,再经过两次弹射才能出来)

image-20210124230253639 image-20210124230303140

不断增加弹射次数可以发现,整个画面的亮度变化不大了。假设真的能做无限次的光的弹射,那么最后会收敛到某一个亮度,之后就不会再出现剧烈的变化,会基本保持在某个亮度。(能量守恒和单位时间问题)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值