首先簡單回顧一下典型的純金屬與絕緣體的PBR屬性:
- 純金屬:
- Albedo(diff): 0
- F0(spec): >0.3 (or 0.5, epic/allegorithmic etc.)
- Metallic: 1
- 絕緣體:
- Albedo(diff):可為0-1
- F0(spec):0-0.08 (allegorithmic etc.), 典型值0.04
- Metallic: 0
已知某材質的BaseColor、Metallic、SpecularScale(預設值0.5),欲求其diff(albedo)與spec(F0),可用如下公式:
half DielectricSpecular = 0.08 * SpecularScale; half3 DiffuseColor = BaseColor * (1 - Metallic); half3 SpecularColor = DielectricSpecular * (1 - Metallic) + BaseColor * Metallic;
可以看出:
- 對於純金屬而言: Metallic=1
- DiffuseColor=0
- SpecularColor = BaseColor
- 對於絕緣體而言: Metallic=0
- DiffuseColor = BaseColor
- SpecularColor = DielectricSpecular = 0.08 * SpecularScale(預設0.5)= 0.04(預設)
- 對於介於兩者之間的半導體而言: Metallic=(0,1)
- DiffuseColor = BaseColor * (1 - Metallic)
- SpecularColor = DielectricSpecular * (1 - Metallic) + BaseColor * Metallic = 0.08 * SpecularScale * (1 - Metallic) + BaseColor * Metallic
由此可見:
- 對於一張貼圖而言,因為SpecularScale是統一指定的,所以對於其貼圖中的絕緣體而言,其F0是統一的
- 對於一般的半導體metallic情況,其spec為DielectricSpecular、BaseColor二者的lerp,但注意,其實F0位於0.08-0.3(or 0.5)之間的情況很少;而其diff則可用basecolor與(1-metallic)簡單計算出來
- 考慮一般的半導體metallic情況,DiffuseColor + SpecularColor=(BaseColor + DielectricSpecular) * (1 - Metallic) + BaseColor * Metallic,其中DielectricSpecular的最大值為0.08,而BaseColor、Metallic均位於(0,1),但BaseColor=1、DielectricSpecular=0.08且Metallic=0時,整個式子最大值為1.08,基本能量守恆