PBRT_V2 总结记录 <25> Reflection Models 和 The Shading Coordinate System

本文详细介绍了PBRT_V2中关于表面反射的模型,包括diffuse、glossy specular、perfect specular和retro-reflective四类,并探讨了各向同性和各向异性反射。此外,还解析了用于反射计算的坐标系统,说明了如何将世界坐标转换为反映坐标系统以及如何使用球坐标表示方向。同时,文章强调了BRDF和BTDF实现时需要注意的细节,如法线方向和入射光、出射光的方向处理。
摘要由CSDN通过智能技术生成

Reflection Models

1. 

This chapter defines a set of classes for describing the way that light scatters at surfaces.
Recall that in Section 5.6.1 we introduced the bidirectional reflectance distribution
function (BRDF) abstraction to describe light reflection at a surface, the BTDF to describe
transmission at a surface, and the BSDF to encompass both of these effects.
In this
chapter, we will start by defining a generic interface to these surface reflection and transmission
functions. Scattering from realistic surfaces is often best described as a mixture
of multiple BRDFs and BTDFs;

(BRDF 是描述 光在表面上是怎么放射的, BTDF 是描述光是在表面上怎么传输的,BSDF 就是 包含 这两种效果)

 

2. 

Before we define the relevant interfaces, a brief review of how they fit into the overall
system is in order. In the common case where the SamplerRenderer is used, the renderer
is first responsible for determining which surface is first visible along a ray. It then calls
the integrator classes, defined in Chapter 15, which call the surface shader that is bound
to the surface. The surface shader is a method in subclasses of the Material class and
is responsible for deciding what the BSDF is at a particular point on the surface (see
Chapter 9); it returns a BSDF object that holds BRDFs and BTDFs that it has allocated
and initialized for that point.
The integrator then uses the BSDF to compute the scattered
light at the point, based on the incoming illumination fromthe light sources in the scene.

(The process where the MetropolisRenderer is used rather than the SamplerRenderer is
similar, but without the use of separate Integrators.)

(以上是 BSDF在整个PBRT系统的作用,主要是 Integrator 使用 BSDF 来计算一个点的散射)

 

3. 

Reflection from surfaces can be split into four broad categories(大类): diffuse, glossy specular,
perfect specular, and retro-reflective (Figure 8.1).Most real surfaces exhibit(展示) reflection that
is a mixture of these four types.

Diffuse surfaces scatter light equally in all directions. Although a perfectly diffuse surface isn’t physically realizable, examples of near-diffuse surfaces include dull chalkboards(黑板) and matte paint(油漆).

Glossy specular surfaces such as plastic or high-gloss paint scatter light preferentially in a set of reflected directions—they
show blurry reflections of other objects.

Perfect specular surfaces scatter incident light in a single outgoing direction. Mirrors and glass are examples of perfect specular surfaces.


Finally, retro-reflective surfaces like velvet or the Earth’s moon scatter light primarily back along the incident direction. 

(反射模型的分类, diffuse,glossy specular,perfect specular retro-reflective)

 

4. 

Given a particular category of reflection, the reflectance distribution function may be
isotropic(各向同性) or anisotropic(各向异性). Most objects are isotropic: if you choose a point on the surface
and rotate it around its normal axis at that point, the amount of light reflected doesn’t change.

In contrast, anisotropic materials reflect different amounts of light as you rotate
them in this way. Examples of anisotropic surfaces include brushed metal, phonographic
records, and compact disks.

(什么是isotropic(各向同性) or anisotropic(各向异性).)

 

 

The Shading Coordinate System Or The Reflection Coordinate System

1. 

Reflection computations in pbrt are evaluated in a reflection coordinate system where
the two tangent vectors and the normal vector at the point being shaded are aligned with
the x, y, and z axes, respectively
(Figure 8.2). All direction vectors passed to and returned
from the BRDF and BTDF routines will be defined with respect to this coordinate system.

It is important to understand this coordinate system in order to understand the BRDF
and BTDF implementations in this chapter.

 

The shading coordinate system is defined by the
orthonormal basis vectors (s, t, n). We will orient these vectors such that they lie along the x, y, and
z axes in this coordinate system. Direction vectors ω in world space are transformed into the shading
coordinate system before any of the BRDF or BTDF methods are called.

(pbrt的反射的计算 是在 reflection coordinate system 空间下进行的,reflection coordinate system空间就由一个点的两条切线和一条法线构成的,传入 BRDF和BTDF 的 向量或者从 BRDF和BTDF 传出的 向量 都是 关于定义在 reflection coordinate system空间 上的,所以,一个世界坐标向量 w, 在传入 BRDF 或者 BTDF之前,需要先转换到 reflection coordinate system 空间上   )

 

2. 

The shading coordinate system also gives a frame for expressing directions in spherical
coordinates (θ , φ); the angle θ is measured from the given direction to the z axis, and φ
is the angle formed with the x axis after projection of the direction onto the xy plane.

Given a direction vector ω in this coordinate system, it is easy to compute quantities like
the cosine of the angle that it forms with the normal direction:

 

The value of sin θ can be found by computing the length of the dotted line, which is
the magnitude of the xy components of the vector. (Recall that the length of the vector ω is one.)
The sin φ and cos φ values can be computed using the circular coordinate equations x = r cos φ and
y = r sin φ, where r, the length of the dashed line, is equal to sin θ.

(这里就是用球坐标来表示一个向量w,

x = sin θ cos φ  =>   cos φ = x /  sin θ

y = sin θ sin φ  =>    sin φ = y /   sin θ

z = cos θ 

 

inline float CosTheta(const Vector &w) { return w.z; }

inline float AbsCosTheta(const Vector &w) { return fabsf(w.z); }

inline float SinTheta2(const Vector &w) {
    return max(0.f, 1.f - CosTheta(w)*CosTheta(w));
}

inline float SinTheta(const Vector &w) {
    return sqrtf(SinTheta2(w));
}

inline float CosPhi(const Vector &w) {    
    float sintheta = SinTheta(w);
    if (sintheta == 0.f) return 1.f;
    return Clamp(w.x / sintheta, -1.f, 1.f);
}

inline float SinPhi(const Vector &w) {
    float sintheta = SinTheta(w);
    if (sintheta == 0.f) return 0.f;
    return Clamp(w.y / sintheta, -1.f, 1.f);
}

 

3. 细节

Another convention we will follow is that the incident light direction ωi and the outgoing
viewing direction ωo will both be normalized and outward facing after being transformed
into the local coordinate system at the surface
. By convention, the surface normal n
always points to the “outside” of the object, which makes it easy to determine if light
is entering or exiting transmissive objects: if the incident light direction ωi is in the same
hemisphere as n, then light is entering; otherwise, it is exiting.

(wi 和 wo 都是要 normalized,并且 向外(outward facing),法线也是向外(outside))

 

Therefore, one detail to keep in mind is that the normal may be on the opposite side
of the surface than one or both of the ωi and ωo direction vectors.
Unlike many other
renderers, pbrt does not flip the normal to lie on the same side as ωo. Therefore, it is
important that BRDFs and BTDFs be implemented so that they don’t expect otherwise.

 

Furthermore, note that the local coordinate system used for shading may not be exactly
the same as the coordinate system returned by the Shape::Intersect() routines from
Chapter 3; they can be modified between intersection and shading to achieve effects like
bump mapping. See Chapter 9 for examples of this kind of modification.

 

One final detail to be aware of when reading this chapter is that BRDF and BTDF implementations
should not concern themselves with whether ωi and ωo lie in the same hemisphere.

For example, although a reflective BRDF should in principle detect if the incident
direction is above the surface and the outgoing direction is below and always return no
reflection in this case, here we will expect the reflection function to instead compute and
return the amount of light reflected using the appropriate formulas for their reflection
model, ignoring the detail that they are not in the same hemisphere. Higher-level code
in pbrt will ensure that only reflective or transmissive scattering routines are evaluated
as appropriate.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值