阿諾德渲染器中的物理學原理

原文:Understanding Physically Based Rendering in Arnold

Designing materials based on physical laws can tremendously simplify shading and lighting, even when we do not necessarily strive for realism or physical accuracy. By understanding and applying a few principles, we can make images that are more believable, and create materials that behave more predictably in different lighting setups.

雖然我們在設計材質時不一定要完全還原現實,也不一定要百分百符合材質的物理特性,但是基于物理定律設計材質可以呈現更真實的光照和陰影。通過理解和應用一些物理學原則創建材質,可以使渲染出的圖像更真實,并且能夠創建在不同照明設置下輕松預見其表現的材質。

In modern renderers, physically based rendering refers to concepts like energy conservation, physically plausible scattering and layering in materials and linear color spaces. Arnold is a physically based renderer, but it also lets you break the rules and create materials and lights that do not obey the laws of physics if you wish. In this document, we'll explain the underlying theory and how to set up your shaders to follow these principles.

在現代渲染器中,基于物理的渲染通常是指——能量守恒、物理上合理的散射、材料和線性色彩空間中的層次等概念。阿諾德雖然是基于物理規則的渲染器,但是如果需要,它也允許打破規則,創建不符合物理定律的材質和燈光。在本文中,我們將解釋阿諾德渲染的基本原理,以及如何設置著色器來遵循這些法則。

? 阿諾德支持各種第三方程序,如:Substance Painter

Photons and Scattering(光子和散射)

In rendering we simulate photons emitted from lights, traveling through the air and bouncing off surfaces and through volumes, eventually ending up on a camera sensor. The combination of millions of photons on the camera sensor then forms the rendered image.

在渲染時,我們模擬光子從光源發出,經過空氣傳播,在表面和體積中彈起,最終落在攝像機傳感器上。數以百萬計的光子在攝影機傳感器上組合在一起,就形成了渲染圖像。

This means that from a physics point of view, surface shaders describe how the surface interacts with photons. Photons hitting an object can be absorbed, reflect off the surface, refract through the surface, or scatter around inside the object. The combination of these components results in a wide variety of materials.

從物理學角度來看的話,曲面著色器描述了曲面如何與光子相互作用。擊中物體的光子可能會被吸收、在曲面發生反射、透過曲面發生折射,或者在物體內部四處散射。這些組件組合在一起,就產生了種類眾多的材質。

Energy Conservation(能量守恒)

Unless an object is a light source that emits photons, it can't return more energy than is being contributed by the incoming light. For a material to be energy conserving the number of photons leaving the surface should be smaller or equal to the number of incoming photons. If a material is not energy conserving, materials will appear overly bright and render with increased noise, especially when using global illumination.

除非物體是發射光子的光源,否則它返回的能量不能多于入射光所貢獻的能量。材質要做到能量守恒,離開表面的光子數量就要小于或等于入射光子的數量。如果材質不是能量守恒,材質將會顯得過亮并且會增加渲染時的噪點,尤其是在使用全局光照時。

To keep materials energy conserving, the weight and color of material components should never exceed 1. Further, we must be careful to ensure that the combination of all components is energy conserving, which we'll explain in detail later.

為了保證材質的能量守恒,材質組件的權重和顏色值絕不能超過1。此外,我們必須小心確保所有組件的組合都是能量守恒的,稍后會詳細解釋。

Materials(材料)

At the microscopic level, object surfaces are intricately detailed. For rendering, we do not use geometry to represent all of this detail, but rather use statistical models than having easy to understand parameters.

在微觀層面上,物體表面的細節是錯綜復雜的。對于渲染,我們不使用幾何體來表現所有這些細節,而是使用統計模型,這類模型具有更易于理解的參數。

Arnold's Standard Surface shader model objects with one or two specular layers, and a diffuse or transparent interior. This model can represent a wide variety of materials. Let's look at the individual components.

阿諾德的標準曲面著色器在為物體建模時會建立一個或兩個鏡面反射層,以及一個漫反射或透明內部。這種模型可以表現各種各樣的材質。我們來看一下各個組件的具體介紹:

Diffuse and Subsurface Scattering(漫反射和次表面散射)

First, consider the diffuse interior. Incoming photons will enter the object, scatter around inside and either get absorbed or leave the object at another location.

首先來看漫反射內部。入射光子進入物體,在內部四處散射,然后被吸收或在另一位置離開物體。

If photons scatter many times, we get a diffuse appearance, due to photons leaving the surface in many different locations and directions. For materials like skin, photons can scatter relatively far under the surface giving a very soft appearance, which we render with subsurface scattering. For materials like unfinished wood, photons do not scatter very far which gives a harder appearance, and we render these as diffuse. For thin objects like leaves, the photons can scatter all the way to the other side of the object, which we render as diffuse SSS with thin_wall enabled.

如果光子散射很多次,并且由于光子在不同的位置和方向離開曲面,我們就會得到一個漫反射外觀。對于像皮膚這樣的材質,光子可以在曲面下散射的相對較遠,呈現出一個非常柔軟的外觀,我們使用次表面散射進行渲染;對于像原木材料,光子不會散射的非常遠,因此呈現出更堅硬的外觀,這種效果使用漫反射進行渲染;對于像葉子這樣的纖薄物體,光子可以一直散射到另一面,這種效果以漫反射 SSS(啟用 thin_wall)形式進行渲染。

Note that fundamentally all of these types of materials have the same underlying physical mechanism, even though we provide separate controls for them in the shader.

請注意,盡管我們在著色器中為所有這些類型的材質提供了單獨的控制選項,但是所有這些材質背后都具有相同的物理機制。

The diffuse interior also typically has the biggest influence on the overall color of the material. Each photon has an associated wavelength, and depending on the properties of the material some photons with some wavelengths are more likely to be absorbed than others. This, in turn, means that photons with some wavelengths are more likely to leave the surface, which will give it a colored appearance.

漫反射內部通常對材質的整體顏色影響最大。 每個光子都有一個關聯的波長, 并且根據材料的特性,某些波長的光子比其他光子更有可能被吸收。反過來就意味著,某些波長的光子更容易離開曲面,從而使曲面呈現彩色外觀。

The skin of a red apple mostly reflects red light. Only the red wavelengths are scattered back outside the apple skin, and the others are absorbed by it. 紅蘋果的表皮主要反射紅色光線,只有紅色波長的光才會散射在蘋果皮外面,其它的光則被吸收。
Energy Conservation(能量守恒)

A single photon can only participate in one of the diffuse, subsurface scattering and backlighting components, for physical correctness we do not want more photons leaving the surface than entering. For Standard Surface, it is automatically ensured that the sum of these components is not higher than 1.

單個光子只能參與漫反射、次表面散射或背面照明這幾個組件中的一個,為了實現物理上的正確性,我們不希望離開表面的光子比進入的光子多。對于標準曲面,會自動確保這些組件的總和不高于 1。

Specular Scattering(鏡面散射)
Specular Roughness 0 to 1 粗糙度從0到1
Roughness(粗糙度)

The specular layer is modeled using a microfacet distribution. We assume that the surface consists of microscopic faces oriented in random directions. A surface with low roughness such as a mirror will have little variation between the faces, resulting in sharp reflections. With high roughness, there will be a lot of variation resulting in softer, glossy reflections.

鏡面反射層使用微面分布進行建模。我們假設曲面是由許多沿隨機方向排列的微小的面構成。粗糙度低的曲面(如鏡面)上各個微面之間幾乎沒有變化,因此呈現清晰銳利的反射。粗糙度高的曲面存在很多變化,因此呈現更柔和、富有光澤的反射。

A strong Specular highlight is visible on the apple. Note the table's specular reflection which is broad and dull (high Specular Roughness value). 蘋果上可見強烈的鏡面反射高光。注意,桌子的鏡面反射寬泛而暗淡(因為鏡面反射粗糙度值較高)。
Rough reflections caused by scattered light rays 散射光線引起的粗糙反射
Glossy surface. The angle of incidence and reflection are equal. 光澤曲面:入射角和反射角相等。
Diffuse surface. Ray direction varies randomly. 漫反射曲面:光線方向隨機變化。
Roughness Map(粗糙度貼圖)

To get variation in the highlights of the surface, a map should be connected to the Specular Roughness. This will influence not only the brightness of the highlight but also its size and the sharpness of the environmental reflection.

要查看曲面高光的變化,應將貼圖連接到鏡面反射的“粗糙度”(Roughness)。這不僅會影響高光的亮度,還會影響其大小和環境反射的清晰度。

Low Specular Roughness & High Specular Roughness ('Scratches' texture connected to Specular Roughness) 低鏡面反射粗糙度 / 高鏡面反射粗糙度(“劃痕”(Scratches)紋理連接到鏡面反射的“粗糙度”(Roughness))
Transmission(透射)

Photons can not only be reflected off the surface but can refract through it as well. Photons will pass through the specular layer, typically changing direction when exiting on the other side of the layer, controlled by the index of refraction (IOR).

光子不僅可以在曲面上發生反射,還可以透過曲面發生折射。光子將穿過鏡面反射層,通常在離開該層的另一面時改變方向,具體取決于折射率 (IOR)。

If the interior of the surface is transparent, such as for clear glass, then photons can pass through the object and exit on the other side. If there is a diffuse interior, the photon can scatter inside the object and get absorbed or exit the object again. The more refractive the specular layer, the more the underlying diffuse interior will be visible. For materials like metals, photons refracting through the specular are often immediately absorbed, and so the diffuse interior is not visible.

如果曲面的內部是透明的(如透明玻璃內部),光子將可以穿過物體并從另一面射出。如果為漫反射內部,光子可以在物體內部散射,然后被吸收或再次離開物體。鏡面反射層的折射率越高,下面的漫反射內部越清晰可見。對于金屬這樣的材質,穿過鏡面反射層發生折射的光子往往會立即被吸收,因此我們看不到漫反射內部。

Fresnel(菲涅爾)

The percentage of photons reflected or refracted by the specular layer is view dependent. When looking at surfaces head on, most light is refracted, while at grazing angles most light is reflected. This is called the Fresnel effect. The index of refraction controls exactly how this effect varies with the viewing angle.

鏡面反射層反射或折射的光子的百分比與視角有關。從正面觀察曲面時,大多數光會發生折射;以一定掠射角觀察曲面時,大多數光會發生反射。這種現象稱為“菲涅爾效應”。折射率控制著此效應具體如何隨視角發生變化。

Opacity and Transmission(不透明度和透射)

Opacity is best understood as a way to model surface geometry using textures. It does not affect how photons interact with the surface, but rather indicates where the surface's geometry is absent and the photons can pass straight through.

不透明度最好的理解是:不透明度是一種使用紋理為曲面幾何體建模的方法。它不影響光子與曲面的相互作用,而是指示哪個位置不存在曲面幾何體、光子可以直接通過。

Ramp texture connected to the opacity 漸變紋理連接到不透明度

Variation of a Specular BRDF with respect to the view direction 鏡面反射 BRDF 相對于視角方向發生的變化

A typical use for opacity would be a sprite type of effect, such as cutting out the shape of a leaf from a polygon card or making the tips of hair strands transparent. Be warned however that scenes containing many opacity sprites (for example tree leaves) can slow down rendering considerably.

不透明度的一個典型用途是創建精靈類型的效果,比如使用一張多邊形卡片裁切出樹葉形狀,或者使發股末端變得透明。但需要注意的是,包含許多不透明度精靈(例如樹葉)的場景可能會使渲染速度顯著下降。

葉片不透明度:禁用 / 葉片不透明度:啟用 / Alpha貼圖鏈接到“不透明度”(Opacity)

Transmission depth is similar, but rather than the surface it controls the density of the object interior. Denser volumes will absorb more photons as they pass through the interior, making the object darker where it is thicker.

透射深度與此類似,但它控制的不是表面,而是物體內部的密度。體積密度越高,在光子通過內部時吸收的光子越多,從而使物體越厚的地方亮度越暗。

透射顏色:白色 / 投射顏色:淺藍色
Pepe model by Daniel M. Lara (Pepeland) 由 Daniel M. Lara 制作的 Pepe 模型 (Pepeland)

轉載請私信。
禁止私自轉載!

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,941評論 0 23
  • 隨著年齡的增長,煩心事越來越多,負能量像得到充分灌溉的小樹苗一樣滋潤壯大起來。慢慢摧毀你的意志,蠶食掉那個樂觀,那...
    淺色葉子閱讀 185評論 0 0