首先简单回顾一下典型的纯金属与绝缘体的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,基本能量守恒