Real-Time Rendering——9.3 The BRDF

Ultimately, physically based rendering comes down to computing the radiance entering the camera along some set of view rays. Using the notation for incoming radiance introduced in Section 8.1.1, for a given view ray the quantity we need to compute is Li(c,−v), where c is the camera position and −v is the direction along the view ray. We use −v due to two notation conventions. First, the direction vector in Li() always points away from the given point, which in this case is the camera location. Second, the view vector v always points toward the camera.

最终,基于物理的渲染归结为计算沿着一些视线进入相机的辐射。使用第8.1.1节中介绍的入射辐射符号,对于给定的视线,我们需要计算的量是Li(c,-v ),其中c是摄像机位置,-v是沿视线的方向。我们使用-v是因为有两个符号约定。首先,Li()中的方向向量总是指向远离给定点的方向,在本例中,给定点就是摄像机的位置。第二,视图向量v总是指向相机。

In rendering, scenes are typically modeled as collections of objects with media in between them (the word “media” actually comes from the Latin word for “in the middle” or “in between”). Often the medium in question is a moderate amount of relatively clean air, which does not noticeably affect the ray’s radiance and can thus be ignored for rendering purposes. Sometimes the ray may travel through a medium that does affect its radiance appreciably via absorption or scattering. Such media are called participating media since they participate in the light’s transport through the scene. Participating media will be covered in detail in Chapter 14. In this chapter we assume that there are no participating media present, so the radiance entering the camera is equal to the radiance leaving the closest object surface in the direction of the camera:

在渲染中,场景通常被建模为中间有媒体的对象的集合(单词“媒体”实际上来自拉丁语“在中间”或“在中间”)。通常,所讨论的介质是适量的相对干净的空气,它不会明显影响光线的辐射,因此可以忽略不计。有时射线可能穿过一种介质,这种介质通过吸收或散射对其辐射亮度有明显的影响。这种介质被称为参与介质,因为它们参与光在场景中的传输。参与媒体将在第14章中详细介绍。在本章中,我们假设不存在参与介质,因此进入相机的辐射等于离开相机方向上最近的物体表面的辐射:

where p is the intersection of the view ray with the closest object surface. 

其中p是视线与最近物体表面的交点。

Following Equation 9.2, our new goal is to calculate Lo(p, v). This calculation is a physically based version of the shading model evaluation discussed in Section 5.1.Sometimes radiance is directly emitted by the surface. More often, radiance leaving the surface originated from elsewhere and is reflected by the surface into the view ray, via the physical interactions described in Section 9.1. In this chapter we leave aside the cases of transparency (Section 5.5 and Section 14.5.2) and global subsurface scattering(Section 14.6). In other words, we focus on local reflectance phenomena, which redirect light hitting the currently shaded point back outward. These phenomena include surface reflection as well as local subsurface scattering, and depend on only the incoming light direction l and the outgoing view direction v. Local reflectance is quantified by the bidirectional reflectance distribution function (BRDF), denoted as f(l, v).

根据等式9.2,我们的新目标是计算Lo(p,v)。这种计算是第5.1节中讨论的基于物理的着色模型评估。有时辐射直接由表面发出。更常见的情况是,离开表面的辐射来自其他地方,并通过9.1节中描述的物理相互作用被表面反射到视线中。在本章中,我们将透明度(5.5节和14.5.2节)和全球次表面散射(14.6节)的情况放在一边。换句话说,我们关注的是局部反射现象,这种现象将射到当前阴影点的光重新导向外面。这些现象包括表面反射以及局部次表面散射,并且仅取决于入射光方向l和出射观察方向v。局部反射由双向反射分布函数(BRDF)量化,表示为f(l,v)

In its original derivation [1277] the BRDF was defined for uniform surfaces. That is, the BRDF was assumed to be the same over the surface. However, objects in the real world (and in rendered scenes) rarely have uniform material properties over their surface. Even an object that is composed of a single material, e.g., a statue made of silver, will have scratches, tarnished spots, stains, and other variations that cause its visual properties to change from one surface point to the next. Technically, a function that captures BRDF variation based on spatial location is called a spatially varying BRDF (SVBRDF) or spatial BRDF (SBRDF). However, this case is so prevalent in practice that the shorter term BRDF is often used and implicitly assumed to depend on surface location.

在其最初的推导[1277]中,BRDF是为均匀表面定义的。也就是说,假设BRDF在表面上是相同的。然而,真实世界中(以及渲染场景中)的对象很少在其表面上具有统一的材质属性。即使是由单一材料构成的物体,例如由银制成的雕像,也会有划痕、失泽点、污点和其它变化,这些变化导致其视觉特性从一个表面点到下一个表面点发生变化。从技术上讲,基于空间位置捕捉BRDF变化的函数称为空间变化BRDF (SVBRDF)或空间BRDF (SBRDF)。然而,这种情况在实践中非常普遍,以至于经常使用更短的术语BRDF,并隐含地假设它取决于表面位置。

The incoming and outgoing directions each have two degrees of freedom. A frequently used parameterization involves two angles: elevation θ relative to the surface normal n and azimuth (horizontal rotation) φ about n. In the general case, the BRDF is a function of four scalar variables. Isotropic BRDFs are an important special case. Such BRDFs remain the same when the incoming and outgoing directions are rotated around the surface normal, keeping the same relative angles between them.Figure 9.17 shows the variables used in both cases. Isotropic BRDFs are functions of three scalar variables, since only a single angle φ between the light’s and camera’s rotation is needed. What this means is that if a uniform isotropic material is placed on a turntable and rotated, it will appear the same for all rotation angles, given a fixed light and camera.

输入和输出方向各有两个自由度。经常使用的参数化涉及两个角度:相对于表面法线n的仰角θ和关于n的方位角(水平旋转)φ。在一般情况下,BRDF是四个标量变量的函数。各向同性BRDFs是一个重要的特例。当传入和传出方向围绕曲面法线旋转时,这种BRDFs保持不变,保持它们之间的相对角度不变。图9.17显示了两种情况下使用的变量。各向同性BRDFs是三个标量变量的函数,因为只需要光和相机旋转之间的单一角度φ。这意味着,如果将一种均匀的各向同性材料放在转盘上并旋转,在给定固定的灯光和相机的情况下,它对于所有旋转角度都是相同的。

Figure 9.17. The BRDF. Azimuth angles φi and φo are given with respect to a given tangent vector t. The relative azimuth angle φ, used for isotropic BRDFs instead of φi and φo, does not require a reference tangent vector. 
图9.17。BRDF。方位角φi和φo是相对于给定的切向量t给出的。相对方位角φ用于各向同性BRDFs,而不是φi和φo,不需要参考切向量。

Since we ignore phenomena such as fluorescence and phosphorescence, we can assume that incoming light of a given wavelength is reflected at the same wavelength.The amount of light reflected can vary based on the wavelength, which can be modeled in one of two ways. Either the wavelength is treated as an additional input variable to the BRDF, or the BRDF is treated as returning a spectrally distributed value.While the first approach is sometimes used in offline rendering [660], in real-time rendering the second approach is always used. Since real-time renderers represent spectral distributions as RGB triples, this simply means that the BRDF returns an RGB value.

因为我们忽略了荧光和磷光等现象,所以我们可以假设给定波长的入射光以相同的波长反射。反射的光量可以根据波长而变化,波长可以用两种方法之一建模。要么将波长视为BRDF的附加输入变量,要么将BRDF视为返回光谱分布值。虽然第一种方法有时用于离线渲染[660],但在实时渲染中总是使用第二种方法。由于实时渲染器将光谱分布表示为RGB三元组,这仅仅意味着BRDF返回RGB值。

To compute Lo(p, v), we incorporate the BRDF into the reflectance equation:

为了计算Lo(p,v ),我们将BRDF纳入反射率方程:

The  subscript on the integral sign means that integration is performed over l vectors that lie in the unit hemisphere above the surface (centered on the surface normal n). Note that l is swept continuously over the hemisphere of incoming directions— it is not a specific “light source direction.” The idea is that any incoming direction can (and usually will) have some radiance associated with it. We use dl to denote the differential solid angle around l (solid angles are discussed in Section 8.1.1). 

积分符号上的下标表示对位于曲面上方单位半球中的l个向量进行积分(以曲面法线n为中心)。请注意,l在入射方向的半球上连续扫描,它不是特定的“光源方向”这个想法是,任何入射方向都可以(并且通常会)有一些与之相关的辐射。我们用dl表示围绕l的微分立体角(立体角在8.1.1节中讨论)。

In summary, the reflectance equation shows that outgoing radiance equals the integral (over l in oumiga) of incoming radiance times the BRDF times the dot product between n and l. 

总之,反射率方程表明,出射辐射等于入射辐射的积分(以oumiga为单位,超过l)乘以BRDF,再乘以n与l之间的点积。

For brevity, for the rest of the chapter we will omit the surface point p from Li(),Lo(), and the reflectance equation:

为简洁起见,在本章的其余部分,我们将省略Li()、Lo()和反射率方程中的表面点p:

When computing the reflectance equation, the hemisphere is often parameterized using spherical coordinates φ and θ. For this parameterization, the differential solid angle dl is equal to sin θi dθi dφi. Using this parameterization, a double-integral form of Equation 9.4 can be derived, which uses spherical coordinates (recall that (n · l) = cos θi): 

当计算反射率方程时,半球通常使用球面坐标φ和θ来参数化。对于这个参数化,微分立体角dl等于sin θi dθi dφi .使用这个参数化,可以导出方程9.4的二重积分形式,它使用球坐标(回想一下(n · l) = cos θi):

The angles θi, φi, θo, and φo are shown in Figure 9.17. 

角度θi,φi,θo和φo如图9.17所示。

In some cases it is convenient to use a slightly different parameterization, with the cosines of the elevation angles μi = cos θi and μo = cos θo as variables rather than the angles θi and θo themselves. For this parameterization, the differential solid angle dl is equal to dμi dφi. Using the (μ, φ) parameterization yields the following integral form:

在某些情况下,使用稍微不同的参数化是方便的,仰角μi = cos θi和μo = cos θo的余弦作为变量,而不是角度θi和θo本身。对于该参数化,微分固体角dl等于dμi dφi。使用(μ, φ)参数化生成以下积分形式: 

The BRDF is defined only in cases where both the light and view directions are above the surface. The case where the light direction is under the surface can be avoided by either multiplying the BRDF by zero or not evaluating the BRDF for such directions in the first place. But what about view directions under the surface, in other words where the dot product n · v is negative? Theoretically this case should never occur. The surface would be facing away from the camera and would thus be invisible. However, interpolated vertex normals and normal mapping, both common in real-time applications, can create such situations in practice. Evaluation of the BRDF for view directions under the surface can be avoided by clamping n · v to 0 or using its absolute value, but both approaches can result in artifacts. The Frostbite engine uses the absolute value of n · v plus a small number (0.00001) to avoid divides by zero [960]. Another possible approach is a “soft clamp,” which gradually goes to zero as the angle between n and v increases past 90◦. 

BRDF仅在光线和观察方向都在表面上方的情况下定义。通过将BRDF乘以零或者首先不评估这些方向的BRDF,可以避免光方向在表面下的情况。但是表面下的视角方向呢,换句话说,点积n v是负的?理论上这种情况不应该发生。该表面将背向照相机,因此是不可见的。然而,在实时应用中常见的插值顶点法线和法线贴图在实践中会产生这种情况。通过将n v箝位至0或使用其绝对值,可以避免评估表面下观察方向的BRDF,但这两种方法都可能导致伪像。Frostbite引擎使用n v的绝对值加上一个小数字(0.00001)来避免除以零[960]。另一种可能的方法是“软箝位”,当n和v之间的角度超过90°时,它会逐渐变为零。

The laws of physics impose two constraints on any BRDF. The first constraint is Helmholtz reciprocity, which means that the input and output angles can be switched and the function value will be the same:

物理定律对任何BRDF施加了两个限制。第一个约束是Helmholtz互易性,这意味着输入和输出角度可以切换,并且函数值将相同: 

In practice, BRDFs used in rendering often violate Helmholtz reciprocity without noticeable artifacts, except for offline rendering algorithms that specifically require reciprocity, such as bidirectional path tracing. However, it is a useful tool to use when determining if a BRDF is physically plausible. 

在实践中,渲染中使用的BRDFs经常违反亥姆霍兹互易性,而没有明显的伪像,除非离线渲染算法特别需要互易性,如双向路径跟踪。然而,当确定BRDF在物理上是否合理时,它是一个有用的工具。

The second constraint is conservation of energy—the outgoing energy cannot be greater than the incoming energy (not counting glowing surfaces that emit light, which are handled as a special case). Offline rendering algorithms such as path tracing require energy conservation to ensure convergence. For real-time rendering, exact energy conservation is not necessary, but approximate energy conservation is important. A surface rendered with a BRDF that significantly violates energy conservation would be too bright, and so may look unrealistic.

第二个限制是能量守恒——输出的能量不能大于输入的能量(不包括发光的发光表面,这是一个特例)。路径追踪等离线渲染算法需要能量守恒来保证收敛。对于实时渲染,精确的能量守恒不是必须的,近似的能量守恒很重要。使用明显违反能量守恒的BRDF渲染的表面会太亮,因此可能看起来不真实。

The directional-hemispherical reflectance R(l) is a function related to the BRDF.It can be used to measure to what degree a BRDF is energy conserving. Despite its somewhat daunting name, the directional-hemispherical reflectance is a simple concept.It measures the amount of light coming from a given direction that is reflected at all, into any outgoing direction in the hemisphere around the surface normal. Essentially, it measures energy loss for a given incoming direction. The input to this function is the incoming direction vector l, and its definition is presented here:

方向半球反射率R(l)是与BRDF相关的函数。它可以用来测量BRDF节能的程度。尽管它的名字有些令人生畏,定向半球反射率是一个简单的概念。它测量从给定方向反射到曲面法线周围半球的任何出射方向的光量。本质上,它测量给定输入方向的能量损失。该函数的输入是输入方向向量l,其定义如下:

Note that here v, like l in the reflectance equation, is swept over the entire hemisphere and does not represent a singular viewing direction. 

注意,这里的v和反射率方程中的l一样,扫过整个半球,并不代表单一的观察方向。

A similar but in some sense opposite function, hemispherical-directional reflectance R(v) can be similarly defined:

类似但在某种意义上相反的函数,半球方向反射率R(v)可以类似地定义为:

If the BRDF is reciprocal, then the hemispherical-directional reflectance and the directional-hemispherical reflectance are equal and the same function can be used to compute either one. Directional albedo can be used as a blanket term for both reflectances in cases where they are used interchangeably. 

如果BRDF是倒数,那么半球方向反射率和方向半球反射率是相等的,并且可以使用相同的函数来计算任何一个。当两种反射率互换使用时,方向反照率可以作为一个总括术语。

The value of the directional-hemispherical reflectance R(l) must always be in the range [0, 1], as a result of energy conservation. A reflectance value of 0 represents a case where all the incoming light is absorbed or otherwise lost. If all the light is reflected, the reflectance will be 1. In most cases it will be somewhere between these two values. Like the BRDF, the values of R(l) vary with wavelength, so it is represented as an RGB vector for rendering purposes. Since each component (red, green, and blue) is restricted to the range [0, 1], a value of R(l) can be thought of as a simple color. Note that this restriction does not apply to the values of the BRDF. As a distribution function, the BRDF can have arbitrarily high values in certain directions (such as the center of a highlight) if the distribution it describes is highly nonuniform. The requirement for a BRDF to be energy conserving is that R(l) be no greater than one for all possible values of l.

作为能量守恒的结果,定向半球反射率R(l)的值必须总是在范围[0,1]内。反射率值为0表示所有入射光被吸收或以其他方式损失的情况。如果所有的光都被反射,反射率将为1。在大多数情况下,它会介于这两个值之间。与BRDF一样,R(l)的值随波长而变化,因此出于渲染目的,它被表示为RGB向量。由于每个分量(红色、绿色和蓝色)被限制在范围[0,1]内,R(l)的值可以被认为是一种简单的颜色。请注意,此限制不适用于BRDF的值。作为分布函数,如果BRDF描述的分布高度不均匀,则它在某些方向(例如高光的中心)可以具有任意高的值。对BRDF节能的要求是,对于所有可能的l值,R(l)不大于1。

The simplest possible BRDF is Lambertian, which corresponds to the Lambertian shading model briefly discussed in Section 5.2. The Lambertian BRDF has a constant value. The well-known (n · l) factor that distinguishes Lambertian shading is not part of the BRDF but rather part of Equation 9.4. Despite its simplicity, the Lambertian BRDF is often used in real-time rendering to represent local subsurface scattering (though it is being supplanted by more accurate models, as discussed in Section 9.9).The directional-hemispherical reflectance of a Lambertian surface is also a constant.Evaluating Equation 9.8 for a constant value of f(l, v) yields the following value for the directional-hemispherical reflectance as a function of the BRDF:

最简单的可能的BRDF是朗伯模型,它对应于5.2节中简要讨论的朗伯阴影模型。朗伯BRDF具有恒定值。区别朗伯阴影的众所周知的(n l)因子不是BRDF的一部分,而是等式9.4的一部分。尽管简单,朗伯BRDF经常在实时渲染中用于表示局部地下散射(尽管它正被更精确的模型所取代,如9.9节所述)。朗伯表面的方向半球反射率也是一个常数。对于f(l,v)的常数值,评估方程9.8得出作为BRDF函数的方向半球反射率的以下值:

The constant reflectance value of a Lambertian BRDF is typically referred to as the diffuse color cdiff or the albedo ρ. In this chapter, to emphasize the connection with subsurface scattering, we will refer to this quantity as the subsurface albedo ρss. The subsurface albedo is discussed in detail in Section 9.9.1. The BRDF from Equation 9.10 gives the following result: 

朗伯BRDF的恒定反射率值通常被称为漫反射颜色cdiff或反照率ρ。在本章中,为了强调与地下散射的联系,我们将把这个量称为地下反照率ρss。第9.9.1节详细讨论了地下反照率。等式9.10中的BRDF给出了以下结果:

The 1/π factor is caused by the fact that integrating a cosine factor over the hemisphere yields a value of π. Such factors are often seen in BRDFs. 

1/π因子是由在半球上对余弦因子进行积分得到π值这一事实引起的。这种因素在BRDFs中很常见。

One way to understand a BRDF is to visualize it with the input direction held constant. See Figure 9.18. For a given direction of incoming light, the BRDF’s values are displayed for all outgoing directions. The spherical part around the point of intersection is the diffuse component, since outgoing radiance has an equal chance of reflecting in any direction. The ellipsoidal piece is the specular lobe. Naturally, such lobes are in the reflection direction from the incoming light, with the thickness of the lobe corresponding to the fuzziness of the reflection. By the principle of reciprocity,these same visualizations can also be thought of as how much each different incoming light direction contributes to a single outgoing direction.

理解BRDF的一种方法是在输入方向保持不变的情况下将其可视化。参见图9.18。对于给定方向的入射光,显示所有出射方向的BRDF值。交叉点周围的球形部分是漫射部分,因为向外的辐射在任何方向反射的机会都是相等的。椭圆体部分是镜面波瓣。自然地,这种波瓣位于入射光的反射方向,波瓣的厚度对应于反射的模糊度。根据互易原理,这些相同的可视化也可以被认为是每个不同的入射光方向对单个出射方向的贡献。

Figure 9.18. Example BRDFs. The solid green line coming from the right of each figure is the incoming light direction, and the dashed green and white line is the ideal reflection direction. In the top row, the left figure shows a Lambertian BRDF (a simple hemisphere). The middle figure shows Blinn-Phong highlighting added to the Lambertian term. The right figure shows the Cook-Torrance BRDF [285, 1779]. Note how the specular highlight is not strongest in the reflection direction. In the bottom row, the left figure shows a close-up of Ward’s anisotropic model. In this case, the effect is to tilt the specular lobe. The middle figure shows the Hapke/Lommel-Seeliger “lunar surface” BRDF [664], which has strong retroreflection. The right figure shows Lommel-Seeliger scattering, in which dusty surfaces scatter light toward grazing angles. (Images courtesy of Szymon Rusinkiewicz, from his “bv” BRDF browser.) 

图9.18。示例BRDFs。来自每个图右侧的绿色实线是入射光方向,绿色和白色虚线是理想的反射方向。在最上面一行,左图显示了朗伯BRDF(一个简单的半球)。中间的图显示了添加到朗伯项的Blinn-Phong突出显示。右图显示了库克-托兰斯BRDF [285,1779]。请注意镜面高光在反射方向不是最强的。在最下面一行,左图显示了沃德各向异性模型的特写。在这种情况下,效果是倾斜镜面波瓣。中间的图是Hapke/Lommel-Seeliger“月球表面”BRDF [664],它有很强的后向反射。右图显示了Lommel-Seeliger散射,其中灰尘表面以掠射角散射光线。(图片由Szymon Rusinkiewicz提供,来自他的“bv”BRDF浏览器。)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

椰子糖莫莫

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

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

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

打赏作者

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

抵扣说明:

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

余额充值