Real-Time Rendering——Chapter 9Physically Based Shading基于物理的着色

“Let the form of an object be what it may,—light, shade, and perspective will always make it beautiful.”
—John Constable

“不管一个物体的形状是什么,光线、阴影和透视都会使它变得美丽。” —约翰·康斯太勃尔

In this chapter we cover the various aspects of physically based shading. We start with a description of the physics of light-matter interaction in Section 9.1, and in Sections 9.2 to 9.4 we show how these physics connect to the shading process. Sections 9.5 to 9.7 are dedicated to the building blocks used to construct physically based shading models, and the models themselves—covering a broad variety of material types—are discussed in Sections 9.8 to 9.12. Finally, in Section 9.13 we describe how materials are blended together, and we cover filtering methods for avoiding aliasing and preserving surface appearance.

在这一章中,我们将介绍基于物理的着色的各个方面。我们在第9.1节开始描述光与物质相互作用的物理过程,在第9.2节到9.4节我们将展示这些物理过程是如何与阴影过程相联系的。第9.5节到第9.7节专门讨论用于构建基于物理的着色模型的构件,而模型本身——涵盖了各种各样的材料类型——将在第9.8节到第9.12节中讨论。最后,在9.13节中,我们将描述材料是如何混合在一起的,我们还将介绍避免走样和保持表面外观的过滤方法。

9.1 Physics of Light

9.1光的物理学

The interactions of light and matter form the foundation of physically based shading.To understand these interactions, it helps to have a basic understanding of the nature of light.

光和物质的相互作用形成了基于物理的明暗处理的基础。为了理解这些相互作用,对光的本质有一个基本的理解是有帮助的。

In physical optics, light is modeled as an electromagnetic transverse wave, a wave that oscillates the electric and magnetic fields perpendicularly to the direction of its propagation. The oscillations of the two fields are coupled. The magnetic and electric field vectors are perpendicular to each other and the ratio of their lengths is fixed.This ratio is equal to the phase velocity, which we will discuss later.

在物理光学中,光被建模为电磁横波,这种波使电场和磁场垂直于其传播方向振荡。这两个场的振荡是耦合的。磁场和电场矢量彼此垂直,并且它们的长度比是固定的。这个比值等于相速度,我们将在后面讨论。

In Figure 9.1 we see a simple light wave. It is, in fact, the simplest possible—a perfect sine function. This wave has a single wavelength, denoted with the Greek letter λ (lambda). As we have seen in Section 8.1, the perceived color of light is strongly related to its wavelength. For this reason, light with a single wavelength is called monochromatic light, which means “single-colored.” However, most light waves encountered in practice are polychromatic, containing many different wavelengths.

在图9.1中,我们看到一个简单的光波。事实上,这是最简单的可能——一个完美的正弦函数。这种波只有一个波长,用希腊字母λ表示。正如我们在8.1节中所看到的,光的感知颜色与其波长密切相关。因此,单一波长的光被称为单色光,意思是“单色的”然而,实践中遇到的大多数光波是多色的,包含许多不同的波长。

 Figure 9.1. Light, an electromagnetic transverse wave. The electric and magnetic field vectors oscillate at 90◦ to each other and to the direction of propagation. The wave shown in the figure is the simplest possible light wave. It is both monochromatic (has a single wavelength λ) and linearly polarized (the electric and magnetic fields each oscillate along a single line).

图9.1。光,一种电磁横波。电场和磁场矢量相互之间以及与传播方向成90°振荡。图中所示的波是最简单的光波。它既是单色的(具有单一波长λ)又是线性偏振的(电场和磁场都沿着一条直线振荡)。

The light wave in Figure 9.1 is unusually simple in another respect. It is linearly polarized. This means that for a fixed point in space, the electric and magnetic fields each move back and forth along a line. In contrast, in this book we focus on unpolarized light, which is much more prevalent. In unpolarized light the field oscillations are spread equally over all directions perpendicular to the propagation axis. Despite their simplicity, it is useful to understand the behavior of monochromatic, linearly polarized waves, since any light wave can be factored into a combination of such waves.

图9.1中的光波在另一方面异常简单。它是线性偏振的。这意味着对于空间中的一个固定点,电场和磁场都沿着一条直线来回移动。相比之下,在本书中,我们关注的是非偏振光,这是更普遍的。在非偏振光中,场振荡在垂直于传播轴的所有方向上均匀传播。尽管很简单,但理解单色线偏振波的行为还是很有用的,因为任何光波都可以分解成这些波的组合。

If we track a point on the wave with a given phase (for example, an amplitude peak) over time, we will see it move through space at a constant speed, which is the wave’s phase velocity. For a light wave traveling through a vacuum, the phase velocity is c, commonly referred to as the speed of light, about 300,000 kilometers per second.

如果我们跟踪波上具有给定相位(例如,振幅峰值)的点,随着时间的推移,我们将看到它以恒定的速度在空间中移动,这就是波的相位速度。对于在真空中传播的光波,相速为c,通常称为光速,约为每秒30万公里。 

In Section 8.1.1 we discussed the fact that for visible light, the size of a single wavelength is in the range of approximately 400–700 nanometers. To give some intuition for this length, it is about a half to a third of the width of a single thread of spider silk, which is itself less than a fiftieth of the width of a human hair. See Figure 9.2. In optics it is often useful to talk about the size of features relative to light wavelength.In this case we would say that the width of a spider silk thread is about 2λ–3λ (2–3 light wavelengths), and the width of a hair is about 100λ–200λ.、

在第8.1.1节中,我们讨论了这样一个事实,即对于可见光来说,单一波长的大小大约在400-700纳米之间。给这个长度一个直观的解释,它大约是一根蜘蛛丝宽度的一半到三分之一,而蜘蛛丝本身还不到一根头发宽度的五十分之一。参见图9.2。在光学中,谈论特征的大小与光波长的关系通常是有用的。在这种情况下,我们可以说蜘蛛丝线的宽度约为2λ–3λ(2–3个光波长),而一根头发的宽度约为100λ–200λ。

Figure 9.2. On the left visible light wavelengths are shown relative to a single thread of spider silk,which is a bit over 1 micron in width. On the right a similar thread of spider silk is shown next to a human hair, to give some additional context. (Images courtesy of URnano/University of Rochester.) 

图9.2.左侧显示了相对于宽度略高于1微米的蜘蛛丝的可见光波长。在右边,一条类似的蜘蛛丝线显示在人的头发旁边,以提供一些额外的背景。(图片由乌尔纳诺/罗切斯特大学提供。)

Light waves carry energy. The density of energy flow is equal to the product of the magnitudes of the electric and magnetic fields, which is—since the magnitudes are proportional to each other—proportional to the squared magnitude of the electric field. We focus on the electric field since it affects matter much more strongly than the magnetic field. In rendering, we are concerned with the average energy flow over time, which is proportional to the squared wave amplitude. This average energy flow density is the irradiance, denoted with the letter E. Irradiance and its relation to other light quantities were discussed in Section 8.1.1.

光波携带能量。能量流的密度等于电场和磁场强度的乘积,因为强度是成比例的,所以与电场强度的平方成比例。我们专注于电场,因为它对物质的影响比磁场大得多。在渲染中,我们关心的是随时间变化的平均能量流,它与波振幅的平方成正比。这个平均能流密度就是辐照度,用字母e表示。辐照度及其与其他光量的关系在第8.1.1节中讨论。

Light waves combine linearly. The total wave is the sum of the component waves.However, since irradiance is proportional to the square of the amplitudes, this would seem to lead to a paradox. For example, would summing two equal waves not lead to a “1 + 1 = 4” situation for irradiance? And since irradiance measures energy flow,would this not violate conservation of energy? The answers to these two questions are “sometimes” and “no,” respectively.

光波线性组合。总波是各分量波的总和。然而,由于辐照度与振幅的平方成正比,这似乎会导致一个悖论。例如,将两个相等的波相加不会导致辐照度出现“1 + 1 = 4”的情况吗?因为辐照度测量能量流,这不会违反能量守恒吗?这两个问题的答案分别是“有时候”和“不”。

To illustrate, we will look at a simple case: the addition of n monochromatic waves, identical except for phase. The amplitude of each of the n waves is a. As mentioned earlier, the irradiance E1 of each wave is proportional to a平方, or in other words E1 = ka平方 for some constant k.

为了说明,我们来看一个简单的例子:n个单色波的相加,除了相位之外都是相同的。如前所述,每个波的辐照度E1与a平方成比例,或者换句话说,对于某个常数k,E1 = ka平方

Figure 9.3 shows three example scenarios for this case. On the left, the waves all line up with the same phase and reinforce each other. The combined wave irradiance is n平方 times that of a single wave, which is n times greater than the sum of the irradiance values of the individual waves. This situation is called constructive interference. In the center of the figure, each pair of waves is in opposing phase, canceling each other out. The combined wave has zero amplitude and zero irradiance. This scenario is destructive interference.

图9.3显示了这种情况下的三个示例场景。在左边,所有的波都以相同的相位排列并相互加强。组合波辐照度为n平方乘以单个波的辐照度值,大于单个波的辐照度值之和的n倍。这种情况叫做建设性干涉。在图的中心,每一对波的相位相反,相互抵消。组合波具有零振幅和零辐照度。这种情况是相消干涉。

Figure 9.3. Three scenarios where n monochromatic waves with the same frequency, polarization, and amplitude are added together. From left to right: constructive interference, destructive interference,and incoherent addition. In each case the amplitude and irradiance of the combined wave (bottom) is shown relative to the n original waves (top). 

图9.3。三个场景,其中具有相同频率、偏振和振幅的n个单色波被加在一起。从左到右:相长干涉、相消干涉、非相干相加。在每种情况下,组合波(底部)的振幅和辐照度相对于n个原始波(顶部)显示。

Constructive and destructive interference are two special cases of coherent addition,where the peaks and troughs of the waves line up in some consistent way. Depending on the relative phase relationships, coherent addition of n identical waves can result in a wave with irradiance anywhere between 0 and n2 times that of an individual wave.

构造干涉和破坏性干涉是相干加法的两种特殊情况,在这种情况下,波的峰和波谷以某种一致的方式排列。根据相对相位关系, n个相同波的相干相加可导致辐射率在单个波的0到n2倍之间的波。 

However, most often when waves are added up they are mutually incoherent, which means that their phases are relatively random. This is illustrated on the right in Figure 9.3. In this scenario, the amplitude of the combined wave is √n a, and the irradiance of the individual waves adds up linearly to n times the irradiance of one wave, as one would expect.

然而,大多数情况下,当波相加时,它们是互不相干的,这意味着它们的相位是相对随机的。这在图9.3的右侧进行了说明。在这种情况下,组合波的幅度为√n a,单个波的辐照度线性增加,达到一个波辐照度的n倍,这是意料之中的。

Figure 9.4. Monochromatic waves spreading out from two point sources, with the same frequency. The waves interfere constructively and destructively in different regions of space. 

图9.4。从两个点声源发出的频率相同的单色波。这些波在空间的不同区域会发生相长相消的干涉。

It would seem that destructive and constructive interference violate the conservation of energy. But Figure 9.3 does not show the full picture—it shows the wave interaction at only one location. As waves propagate through space, the phase relationship between them changes from one location to another, as shown in Figure 9.4.In some locations the waves interfere constructively, and the irradiance of the combined wave is greater than the sum of the irradiance values of the individual waves.In other locations they interfere destructively, causing the combined irradiance to be less than the sum of the individual wave irradiance values. This does not violate the law of conservation of energy, since the energy gained via constructive interference and the energy lost via destructive interference always cancel out.

破坏性的和建设性的干涉似乎违反了能量守恒。但是图9.3并没有显示全貌——它只显示了一个位置的波动相互作用。当波在空间传播时,它们之间的相位关系从一个位置变化到另一个位置,如图9.4所示。在某些位置,波相长干涉,组合波的辐照度大于单个波的辐照度之和。在其他位置,它们相消干涉,导致组合辐照度小于单个波辐照度值的总和。这并不违反能量守恒定律,因为通过相长干涉获得的能量和通过相消干涉损失的能量总是相互抵消。

Light waves are emitted when the electric charges in an object oscillate. Part of the energy that caused the oscillations—heat, electrical energy, chemical energy—is converted to light energy, which is radiated away from the object. In rendering, such objects are treated as light sources. We first discussed light sources in Section 5.2,and they will be described from a more physically based standpoint in Chapter 10.

当物体中的电荷振荡时,就会发出光波。引起振荡的部分能量——热能、电能、化学能——被转化为光能,并从物体辐射出去。在渲染中,此类对象被视为光源。我们首先在第5.2节讨论了光源,它们将在第10章从一个更加物理的角度来描述。

After light waves have been emitted, they travel through space until they encounter some bit of matter with which to interact. The core phenomenon underlying the majority of light-matter interactions is simple, and quite similar to the emission case discussed above. The oscillating electrical field pushes and pulls at the electrical charges in the matter, causing them to oscillate in turn. The oscillating charges emit new light waves, which redirect some of the energy of the incoming light wave in new directions. This reaction, called scattering, is the basis of a wide variety of optical phenomena.

光波发出后,会在空间中传播,直到遇到一些与之相互作用的物质。大多数光-物质相互作用背后的核心现象很简单,与上面讨论的发射情况非常相似。振荡电场推拉物质中的电荷,导致它们依次振荡。振荡电荷发出新的光波,将入射光波的部分能量重新导向新的方向。这种反应称为散射,是各种光学现象的基础。

A scattered light wave has the same frequency as the original wave. When, as is usually the case, the original wave contains multiple frequencies of light, each one interacts with matter separately. Incoming light energy at one frequency does not contribute to emitted light energy at a different frequency, except for specific—and relatively rare—cases such as fluorescence and phosphorescence, which we will not describe in this book.

散射光波的频率与原始波的频率相同。通常情况下,当原始波包含多种频率的光时,每一种频率的光都会分别与物质相互作用。一种频率的入射光能不会贡献给另一种频率的发射光能,除了特定的——相对罕见的——情况,如荧光和磷光,我们不会在本书中描述。

An isolated molecule scatters light in all directions, with some directional variation in intensity. More light is scattered in directions close to the original axis of propagation,both forward and backward. The molecule’s effectiveness as a scatterer—the chance that a light wave in its vicinity will be scattered at all—varies strongly by wavelength. Short-wavelength light is scattered much more effectively than longerwavelength light.

一个孤立的分子向四面八方散射光线,其强度会有一些方向性的变化。更多的光在接近原始传播轴的方向上散射,包括向前和向后。分子作为散射体的有效性——光波在其附近被散射的几率——随着波长的变化而变化。短波光比长波光散射得更有效。

In rendering we are concerned with collections of many molecules. Light interactions with such aggregates will not necessarily resemble interactions with isolated molecules. Waves scattered from nearby molecules are often mutually coherent, and thus exhibit interference, since they originate from the same incoming wave. The rest of this section is devoted to several important special cases of light scattering from multiple molecules.

在渲染中,我们关心许多分子的集合。光与这些聚集体的相互作用不一定与孤立分子的相互作用相似。从附近分子散射的波通常是相互相干的,因此表现出干涉,因为它们来自同一个入射波。这一节的其余部分将专门讨论多分子光散射的几个重要特例。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

椰子糖莫莫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值