Sheen从理论到实践
摘要:本文详解glTF光泽(Sheen)材质扩展的实现原理,涵盖光泽颜色/粗糙度的纹理映射与独立控制,重点解析基于Charlie分布的光泽BRDF模型及其微表面理论实现,适用于模拟天鹅绒类材质的背向散射效果。(79字)
本文为这篇文章的翻译与整理
光泽(Sheen)
属性
| 类型 | 描述 | 必需 |
|---|---|---|
sheenColorFactor |
线性空间中的光泽颜色。 | 否,默认值:[0.0, 0.0, 0.0] |
sheenColorTexture |
光泽颜色纹理(RGB,sRGB传输函数)。 | 否 |
sheenRoughnessFactor |
光泽粗糙度。 | 否,默认值:0.0 |
sheenRoughnessTexture |
光泽粗糙度alpha纹理。 | 否 |
光泽计算
颜色和粗糙度
if (sheenColorTexture) {
sheenColor = sheenColorFactor * sampleLinear(sheenColorTexture).rgb;
sheenRoughness = sheenRoughnessFactor * sample(sheenRoughnessTexture).a;
} else {
sheenColor = sheenColorFactor;
sheenRoughness = sheenRoughnessFactor;
}
-
光泽模拟天鹅绒类材质的背向散射。
-
主要沿表面法线定向的微纤维产生镜面响应。
-
sheenRoughness控制微纤维的发散:- 小粗糙度 → 锐利的掠射高光
- 大粗糙度 → 平滑的掠射高光
-
粗糙度映射为:
r = sheenRoughness^2
- 光泽粗糙度与基础材质粗糙度独立。
光泽BRDF
光泽BRDF基于微表面理论和Charlie分布(Conty & Kulla, 2017)。
光泽分布
alpha_g = sheenRoughness * sheenRoughness;
inv_r = 1 / alpha_g;
cos2h = NdotH * NdotH;
sin2h = 1 - cos2h;
sheen_distribution = (2 + inv_r) * pow(sin2h, inv_r * 0.5) / (2 * PI);
光泽可见性(Charlie)
float l(float x, float alpha_g) {
float one_minus_alpha_sq = (1.0 - alpha_g) * (1.0 - alpha_g);
float a = mix(21.5473, 25.3245, one_minus_alpha_sq);
float b = mix(3.82987, 3.32435, one_minus_alpha_sq);
float c = mix(0.19823, 0.16801, one_minus_alpha_sq);
float d = mix(-1.97760, -1.27393, one_minus_alpha_sq);
float e = mix(-4.32054, -4.85967, one_minus_alpha_sq);
return a / (1.0 + b * pow(x, c)) + d * x + e;
}
float lambda_sheen(float cos_theta, float alpha_g) {
return abs(cos_theta) < 0.5 ? exp(l(cos_theta, alpha_g)) : exp(2.0 * l(0.5, alpha_g) - l(1.0 - cos_theta, alpha_g));
}
sheen_visibility = 1.0 / ((1.0 + lambda_sheen(NdotV, alpha_g) + lambda_sheen(NdotL, alpha_g)) * (4.0 * NdotV * NdotL));
- 简化可见性(Ashikhmin & Premoze, 2007):
sheen_visibility = 1 / (4 * (NdotL + NdotV - NdotL * NdotV));
光泽分层
- 使用反照率缩放与基础材质结合(Conty & Kulla, 2017)。
float max3(vec3 v) { return max(max(v.x, v.y), v.z); }
sheen_albedo_scaling = min(1.0 - max3(sheenColor) * E(VdotN), 1.0 - max3(sheenColor) * E(LdotN));
sheen_material = sheenColor * sheen_brdf + material * sheen_albedo_scaling;
- 为了性能,可以跳过
E(LdotN):
sheen_albedo_scaling = 1.0 - max3(sheenColor) * E(VdotN);
- 缩放应用于直接和间接光照:
specular_direct *= sheen_albedo_scaling;
diffuse_direct *= sheen_albedo_scaling;
environment_irradiance_indirect *= sheen_albedo_scaling;
specular_environment_reflectance_indirect *= sheen_albedo_scaling;
参考文献
- Westin, S. H., Arvo, J. R., Torrance, K. E. (1992): 从复杂表面预测反射函数,SIGGRAPH
- Conty Estevez, A., Kulla, C. (2017): 生产友好的微表面光泽BRDF,SIGGRAPH
- Ashikhmin, M., Premoze, S. (2007): 基于分布的BRDF
- Filament材质模型 - 布料模型
- Filament的cmgen工具
- Neubelt, D., Pettineo, M. (2013): 为The Order: 1886打造次世代材质管线,SIGGRAPH
- 企业PBR着色模型 - 光泽
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 VanishingBlog!


