Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
bb985314
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
bb985314
编写于
6月 28, 2016
作者:
W
WestLangley
提交者:
Mr.doob
6月 27, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added clear coat energy conservation (#9238)
上级
6cec1104
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
3 deletion
+24
-3
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
...rs/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
+24
-3
未找到文件。
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
浏览文件 @
bb985314
...
@@ -14,6 +14,13 @@ struct PhysicalMaterial {
...
@@ -14,6 +14,13 @@ struct PhysicalMaterial {
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
// Clear coat directional hemishperical reflectance (this approximation should be improved)
float
clearCoatDHRApprox
(
const
in
float
roughness
,
const
in
float
dotNL
)
{
return
DEFAULT_SPECULAR_COEFFICIENT
+
(
1
.
0
-
DEFAULT_SPECULAR_COEFFICIENT
)
*
(
pow
(
1
.
0
-
dotNL
,
5
.
0
)
*
pow
(
1
.
0
-
roughness
,
2
.
0
)
);
}
void
RE_Direct_Physical
(
const
in
IncidentLight
directLight
,
const
in
GeometricContext
geometry
,
const
in
PhysicalMaterial
material
,
inout
ReflectedLight
reflectedLight
)
{
void
RE_Direct_Physical
(
const
in
IncidentLight
directLight
,
const
in
GeometricContext
geometry
,
const
in
PhysicalMaterial
material
,
inout
ReflectedLight
reflectedLight
)
{
float
dotNL
=
saturate
(
dot
(
geometry
.
normal
,
directLight
.
direction
)
);
float
dotNL
=
saturate
(
dot
(
geometry
.
normal
,
directLight
.
direction
)
);
...
@@ -26,8 +33,14 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
...
@@ -26,8 +33,14 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
#endif
#endif
reflectedLight
.
directSpecular
+=
irradiance
*
BRDF_Specular_GGX
(
directLight
,
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
#ifndef STANDARD
reflectedLight
.
directDiffuse
+=
irradiance
*
BRDF_Diffuse_Lambert
(
material
.
diffuseColor
);
float
clearCoatDHR
=
material
.
clearCoat
*
clearCoatDHRApprox
(
material
.
clearCoatRoughness
,
dotNL
);
#else
float
clearCoatDHR
=
0
.
0
;
#endif
reflectedLight
.
directSpecular
+=
(
1
.
0
-
clearCoatDHR
)
*
irradiance
*
BRDF_Specular_GGX
(
directLight
,
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
reflectedLight
.
directDiffuse
+=
(
1
.
0
-
clearCoatDHR
)
*
irradiance
*
BRDF_Diffuse_Lambert
(
material
.
diffuseColor
);
#ifndef STANDARD
#ifndef STANDARD
...
@@ -45,7 +58,15 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo
...
@@ -45,7 +58,15 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo
void
RE_IndirectSpecular_Physical
(
const
in
vec3
radiance
,
const
in
vec3
clearCoatRadiance
,
const
in
GeometricContext
geometry
,
const
in
PhysicalMaterial
material
,
inout
ReflectedLight
reflectedLight
)
{
void
RE_IndirectSpecular_Physical
(
const
in
vec3
radiance
,
const
in
vec3
clearCoatRadiance
,
const
in
GeometricContext
geometry
,
const
in
PhysicalMaterial
material
,
inout
ReflectedLight
reflectedLight
)
{
reflectedLight
.
indirectSpecular
+=
radiance
*
BRDF_Specular_GGX_Environment
(
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
#ifndef STANDARD
float
dotNV
=
saturate
(
dot
(
geometry
.
normal
,
geometry
.
viewDir
)
);
float
dotNL
=
dotNV
;
float
clearCoatDHR
=
material
.
clearCoat
*
clearCoatDHRApprox
(
material
.
clearCoatRoughness
,
dotNL
);
#else
float
clearCoatDHR
=
0
.
0
;
#endif
reflectedLight
.
indirectSpecular
+=
(
1
.
0
-
clearCoatDHR
)
*
radiance
*
BRDF_Specular_GGX_Environment
(
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
#ifndef STANDARD
#ifndef STANDARD
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录