Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d3606272
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
d3606272
编写于
3月 08, 2016
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adopt pow2, pow3, pow4
上级
c2ea1ff6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
11 deletion
+11
-11
src/renderers/shaders/ShaderChunk/bsdfs.glsl
src/renderers/shaders/ShaderChunk/bsdfs.glsl
+6
-6
src/renderers/shaders/ShaderChunk/common.glsl
src/renderers/shaders/ShaderChunk/common.glsl
+3
-3
src/renderers/shaders/ShaderChunk/lights_pars.glsl
src/renderers/shaders/ShaderChunk/lights_pars.glsl
+2
-2
未找到文件。
src/renderers/shaders/ShaderChunk/bsdfs.glsl
浏览文件 @
d3606272
...
...
@@ -58,9 +58,9 @@ float G_GGX_Smith( const in float alpha, const in float dotNL, const in float do
float
a2
=
alpha
*
alpha
;
float
gl
=
dotNL
+
pow
(
a2
+
(
1
.
0
-
a2
)
*
dotNL
*
dotNL
,
0
.
5
);
float
gl
=
dotNL
+
pow
(
a2
+
(
1
.
0
-
a2
)
*
pow2
(
dotNL
)
,
0
.
5
);
float
gv
=
dotNV
+
pow
(
a2
+
(
1
.
0
-
a2
)
*
dotNV
*
dotNV
,
0
.
5
);
float
gv
=
dotNV
+
pow
(
a2
+
(
1
.
0
-
a2
)
*
pow2
(
dotNV
)
,
0
.
5
);
return
1
.
0
/
(
gl
*
gv
);
...
...
@@ -72,11 +72,11 @@ float G_GGX_Smith( const in float alpha, const in float dotNL, const in float do
// alpha is "roughness squared" in Disney’s reparameterization
float
D_GGX
(
const
in
float
alpha
,
const
in
float
dotNH
)
{
float
a2
=
alpha
*
alpha
;
float
a2
=
pow2
(
alpha
)
;
float
denom
=
dotNH
*
dotNH
*
(
a2
-
1
.
0
)
+
1
.
0
;
// avoid alpha = 0 with dotNH = 1
float
denom
=
pow2
(
dotNH
)
*
(
a2
-
1
.
0
)
+
1
.
0
;
// avoid alpha = 0 with dotNH = 1
return
RECIPROCAL_PI
*
a2
/
(
denom
*
denom
);
return
RECIPROCAL_PI
*
a2
/
pow2
(
denom
);
}
...
...
@@ -158,7 +158,7 @@ vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in Ge
// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html
float
GGXRoughnessToBlinnExponent
(
const
in
float
ggxRoughness
)
{
return
(
2
.
0
/
square
(
ggxRoughness
+
0
.
0001
)
-
2
.
0
);
return
(
2
.
0
/
pow2
(
ggxRoughness
+
0
.
0001
)
-
2
.
0
);
}
float
BlinnExponentToGGXRoughness
(
const
in
float
blinnExponent
)
{
...
...
src/renderers/shaders/ShaderChunk/common.glsl
浏览文件 @
d3606272
...
...
@@ -8,9 +8,9 @@
#define saturate(a) clamp( a, 0.0, 1.0 )
#define whiteCompliment(a) ( 1.0 - saturate( a ) )
float
square
(
const
in
float
x
)
{
return
x
*
x
;
}
float
cube
(
const
in
float
x
)
{
return
x
*
x
*
x
;
}
float
pow4
(
const
in
float
x
)
{
return
x
*
x
*
x
*
x
;
}
float
pow2
(
const
in
float
x
)
{
return
x
*
x
;
}
float
pow3
(
const
in
float
x
)
{
return
x
*
x
*
x
;
}
float
pow4
(
const
in
float
x
)
{
float
x2
=
x
*
x
;
return
x2
*
x2
;
}
float
average
(
const
in
vec3
color
)
{
return
dot
(
color
,
vec3
(
0
.
3333
)
);
}
...
...
src/renderers/shaders/ShaderChunk/lights_pars.glsl
浏览文件 @
d3606272
...
...
@@ -210,10 +210,10 @@
float
getSpecularMIPLevel
(
const
in
float
blinnShininessExponent
,
const
in
int
maxMIPLevel
)
{
//float envMapWidth = pow( 2.0, maxMIPLevelScalar );
//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2(
square
( blinnShininessExponent ) + 1.0 );
//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2(
pow2
( blinnShininessExponent ) + 1.0 );
float
maxMIPLevelScalar
=
float
(
maxMIPLevel
);
float
desiredMIPLevel
=
maxMIPLevelScalar
-
0
.
79248
-
0
.
5
*
log2
(
square
(
blinnShininessExponent
)
+
1
.
0
);
float
desiredMIPLevel
=
maxMIPLevelScalar
-
0
.
79248
-
0
.
5
*
log2
(
pow2
(
blinnShininessExponent
)
+
1
.
0
);
// clamp to allowable LOD ranges.
return
clamp
(
desiredMIPLevel
,
0
.
0
,
maxMIPLevelScalar
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录