Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
a3190d0d
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a3190d0d
编写于
8月 29, 2021
作者:
W
WestLangley
提交者:
GitHub
8月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22455 from WestLangley/shaders_sheen
Shaders: Refactored sheen BRDF
上级
41fe3d8e
fa21f2c3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
13 deletion
+16
-13
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js
+15
-12
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
...shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
+1
-1
未找到文件。
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js
浏览文件 @
a3190d0d
...
...
@@ -217,35 +217,38 @@ vec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricCo
#if defined( USE_SHEEN )
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
#L94
float D_Charlie( float roughness, float
No
H ) {
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
float D_Charlie( float roughness, float
dotN
H ) {
// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
float invAlpha = 1.0 / roughness;
float cos2h =
NoH * No
H;
float cos2h =
dotNH * dotN
H;
float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
#L136
float V_Neubelt( float
NoV, float No
L ) {
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
float V_Neubelt( float
dotNV, float dotN
L ) {
// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
return saturate( 1.0 / ( 4.0 * (
NoL + NoV - NoL * No
V ) ) );
return saturate( 1.0 / ( 4.0 * (
dotNL + dotNV - dotNL * dotN
V ) ) );
}
vec3 BRDF_Sheen( const in
float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor
) {
vec3 BRDF_Sheen( const in
vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenTint, const in float sheenRoughness
) {
vec3 N = geometry.normal;
vec3 V = geometry.viewDir;
vec3 halfDir = normalize( lightDir + viewDir );
vec3 H = normalize( V + L );
float dotNH = saturate( dot( N, H ) );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return s
pecularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L)
);
return s
heenTint * ( D * V
);
}
...
...
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
浏览文件 @
a3190d0d
...
...
@@ -132,7 +132,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
#ifdef USE_SHEEN
reflectedLight.directSpecular += irradiance * BRDF_Sheen(
material.roughness, directLight.direction, geometry, material.sheenTint
);
reflectedLight.directSpecular += irradiance * BRDF_Sheen(
directLight.direction, geometry.viewDir, geometry.normal, material.sheenTint, material.roughness
);
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录