阿諾德渲染器中的物理學(xué)原理

原文: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.

雖然我們在設(shè)計(jì)材質(zhì)時(shí)不一定要完全還原現(xiàn)實(shí)藕咏,也不一定要百分百符合材質(zhì)的物理特性,但是基于物理定律設(shè)計(jì)材質(zhì)可以呈現(xiàn)更真實(shí)的光照和陰影秽五。通過理解和應(yīng)用一些物理學(xué)原則創(chuàng)建材質(zhì)孽查,可以使渲染出的圖像更真實(shí),并且能夠創(chuàng)建在不同照明設(shè)置下輕松預(yù)見其表現(xiàn)的材質(zhì)坦喘。

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.

在現(xiàn)代渲染器中盲再,基于物理的渲染通常是指——能量守恒、物理上合理的散射瓣铣、材料和線性色彩空間中的層次等概念答朋。阿諾德雖然是基于物理規(guī)則的渲染器,但是如果需要棠笑,它也允許打破規(guī)則梦碗,創(chuàng)建不符合物理定律的材質(zhì)和燈光。在本文中,我們將解釋阿諾德渲染的基本原理洪规,以及如何設(shè)置著色器來遵循這些法則印屁。

? 阿諾德支持各種第三方程序,如: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.

在渲染時(shí)斩例,我們模擬光子從光源發(fā)出库车,經(jīng)過空氣傳播,在表面和體積中彈起樱拴,最終落在攝像機(jī)傳感器上柠衍。數(shù)以百萬計(jì)的光子在攝影機(jī)傳感器上組合在一起,就形成了渲染圖像晶乔。

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.

從物理學(xué)角度來看的話珍坊,曲面著色器描述了曲面如何與光子相互作用。擊中物體的光子可能會被吸收正罢、在曲面發(fā)生反射阵漏、透過曲面發(fā)生折射,或者在物體內(nèi)部四處散射翻具。這些組件組合在一起履怯,就產(chǎn)生了種類眾多的材質(zhì)。

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.

除非物體是發(fā)射光子的光源裆泳,否則它返回的能量不能多于入射光所貢獻(xiàn)的能量叹洲。材質(zhì)要做到能量守恒,離開表面的光子數(shù)量就要小于或等于入射光子的數(shù)量工禾。如果材質(zhì)不是能量守恒运提,材質(zhì)將會顯得過亮并且會增加渲染時(shí)的噪點(diǎn),尤其是在使用全局光照時(shí)闻葵。

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.

為了保證材質(zhì)的能量守恒民泵,材質(zhì)組件的權(quán)重和顏色值絕不能超過1。此外槽畔,我們必須小心確保所有組件的組合都是能量守恒的栈妆,稍后會詳細(xì)解釋。

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.

在微觀層面上厢钧,物體表面的細(xì)節(jié)是錯(cuò)綜復(fù)雜的鳞尔。對于渲染,我們不使用幾何體來表現(xiàn)所有這些細(xì)節(jié)坏快,而是使用統(tǒng)計(jì)模型铅檩,這類模型具有更易于理解的參數(shù)。

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.

阿諾德的標(biāo)準(zhǔn)曲面著色器在為物體建模時(shí)會建立一個(gè)或兩個(gè)鏡面反射層莽鸿,以及一個(gè)漫反射或透明內(nèi)部。這種模型可以表現(xiàn)各種各樣的材質(zhì)。我們來看一下各個(gè)組件的具體介紹:

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.

首先來看漫反射內(nèi)部祥得。入射光子進(jìn)入物體兔沃,在內(nèi)部四處散射,然后被吸收或在另一位置離開物體级及。

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.

如果光子散射很多次乒疏,并且由于光子在不同的位置和方向離開曲面,我們就會得到一個(gè)漫反射外觀饮焦。對于像皮膚這樣的材質(zhì)怕吴,光子可以在曲面下散射的相對較遠(yuǎn),呈現(xiàn)出一個(gè)非常柔軟的外觀县踢,我們使用次表面散射進(jìn)行渲染转绷;對于像原木材料,光子不會散射的非常遠(yuǎn)硼啤,因此呈現(xiàn)出更堅(jiān)硬的外觀议经,這種效果使用漫反射進(jìn)行渲染;對于像葉子這樣的纖薄物體谴返,光子可以一直散射到另一面煞肾,這種效果以漫反射 SSS(啟用 thin_wall)形式進(jìn)行渲染。

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.

請注意嗓袱,盡管我們在著色器中為所有這些類型的材質(zhì)提供了單獨(dú)的控制選項(xiàng)籍救,但是所有這些材質(zhì)背后都具有相同的物理機(jī)制。

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.

漫反射內(nèi)部通常對材質(zhì)的整體顏色影響最大渠抹。 每個(gè)光子都有一個(gè)關(guān)聯(lián)的波長钧忽, 并且根據(jù)材料的特性,某些波長的光子比其他光子更有可能被吸收逼肯。反過來就意味著耸黑,某些波長的光子更容易離開曲面,從而使曲面呈現(xiàn)彩色外觀篮幢。

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.

單個(gè)光子只能參與漫反射缺菌、次表面散射或背面照明這幾個(gè)組件中的一個(gè),為了實(shí)現(xiàn)物理上的正確性搜锰,我們不希望離開表面的光子比進(jìn)入的光子多伴郁。對于標(biāo)準(zhǔn)曲面,會自動確保這些組件的總和不高于 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.

鏡面反射層使用微面分布進(jìn)行建模焊傅。我們假設(shè)曲面是由許多沿隨機(jī)方向排列的微小的面構(gòu)成剂陡。粗糙度低的曲面(如鏡面)上各個(gè)微面之間幾乎沒有變化,因此呈現(xiàn)清晰銳利的反射狐胎。粗糙度高的曲面存在很多變化鸭栖,因此呈現(xiàn)更柔和、富有光澤的反射握巢。

A strong Specular highlight is visible on the apple. Note the table's specular reflection which is broad and dull (high Specular Roughness value). 蘋果上可見強(qiáng)烈的鏡面反射高光晕鹊。注意,桌子的鏡面反射寬泛而暗淡(因?yàn)殓R面反射粗糙度值較高)暴浦。
Rough reflections caused by scattered light rays 散射光線引起的粗糙反射
Glossy surface. The angle of incidence and reflection are equal. 光澤曲面:入射角和反射角相等溅话。
Diffuse surface. Ray direction varies randomly. 漫反射曲面:光線方向隨機(jī)變化。
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.

要查看曲面高光的變化歌焦,應(yīng)將貼圖連接到鏡面反射的“粗糙度”(Roughness)飞几。這不僅會影響高光的亮度,還會影響其大小和環(huán)境反射的清晰度同规。

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).

光子不僅可以在曲面上發(fā)生反射循狰,還可以透過曲面發(fā)生折射。光子將穿過鏡面反射層券勺,通常在離開該層的另一面時(shí)改變方向绪钥,具體取決于折射率 (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.

如果曲面的內(nèi)部是透明的(如透明玻璃內(nèi)部)关炼,光子將可以穿過物體并從另一面射出程腹。如果為漫反射內(nèi)部,光子可以在物體內(nèi)部散射儒拂,然后被吸收或再次離開物體寸潦。鏡面反射層的折射率越高,下面的漫反射內(nèi)部越清晰可見社痛。對于金屬這樣的材質(zhì)见转,穿過鏡面反射層發(fā)生折射的光子往往會立即被吸收,因此我們看不到漫反射內(nèi)部蒜哀。

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.

鏡面反射層反射或折射的光子的百分比與視角有關(guān)斩箫。從正面觀察曲面時(shí),大多數(shù)光會發(fā)生折射撵儿;以一定掠射角觀察曲面時(shí)乘客,大多數(shù)光會發(fā)生反射。這種現(xiàn)象稱為“菲涅爾效應(yīng)”淀歇。折射率控制著此效應(yīng)具體如何隨視角發(fā)生變化易核。

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.

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

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

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

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.

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

葉片不透明度:禁用 / 葉片不透明度:啟用 / 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.

透射深度與此類似,但它控制的不是表面掸哑,而是物體內(nèi)部的密度约急。體積密度越高,在光子通過內(nèi)部時(shí)吸收的光子越多苗分,從而使物體越厚的地方亮度越暗厌蔽。

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

轉(zhuǎn)載請私信。
禁止私自轉(zhuǎn)載摔癣!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末奴饮,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子择浊,更是在濱河造成了極大的恐慌戴卜,老刑警劉巖,帶你破解...
    沈念sama閱讀 206,378評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件琢岩,死亡現(xiàn)場離奇詭異投剥,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)担孔,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,356評論 2 382
  • 文/潘曉璐 我一進(jìn)店門江锨,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人糕篇,你說我怎么就攤上這事啄育。” “怎么了拌消?”我有些...
    開封第一講書人閱讀 152,702評論 0 342
  • 文/不壞的土叔 我叫張陵挑豌,是天一觀的道長。 經(jīng)常有香客問我拼坎,道長浮毯,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,259評論 1 279
  • 正文 為了忘掉前任泰鸡,我火速辦了婚禮债蓝,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘盛龄。我一直安慰自己饰迹,他們只是感情好芳誓,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,263評論 5 371
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著啊鸭,像睡著了一般锹淌。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上赠制,一...
    開封第一講書人閱讀 49,036評論 1 285
  • 那天赂摆,我揣著相機(jī)與錄音,去河邊找鬼钟些。 笑死烟号,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的政恍。 我是一名探鬼主播汪拥,決...
    沈念sama閱讀 38,349評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼篙耗!你這毒婦竟也來了迫筑?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 36,979評論 0 259
  • 序言:老撾萬榮一對情侶失蹤宗弯,失蹤者是張志新(化名)和其女友劉穎脯燃,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體罕伯,經(jīng)...
    沈念sama閱讀 43,469評論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡曲伊,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,938評論 2 323
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了追他。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片坟募。...
    茶點(diǎn)故事閱讀 38,059評論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖邑狸,靈堂內(nèi)的尸體忽然破棺而出懈糯,到底是詐尸還是另有隱情,我是刑警寧澤单雾,帶...
    沈念sama閱讀 33,703評論 4 323
  • 正文 年R本政府宣布赚哗,位于F島的核電站,受9級特大地震影響硅堆,放射性物質(zhì)發(fā)生泄漏屿储。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,257評論 3 307
  • 文/蒙蒙 一渐逃、第九天 我趴在偏房一處隱蔽的房頂上張望够掠。 院中可真熱鬧,春花似錦茄菊、人聲如沸疯潭。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,262評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽竖哩。三九已至哭廉,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間相叁,已是汗流浹背遵绰。 一陣腳步聲響...
    開封第一講書人閱讀 31,485評論 1 262
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留钝荡,地道東北人街立。 一個(gè)月前我還...
    沈念sama閱讀 45,501評論 2 354
  • 正文 我出身青樓舶衬,卻偏偏與公主長得像埠通,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子逛犹,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,792評論 2 345

推薦閱讀更多精彩內(nèi)容

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