Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
99988a08
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,发现更多精彩内容 >>
提交
99988a08
编写于
10月 23, 2015
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use textureCubeLodEXT when it is available for best results.
上级
ecbe1f28
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
9 deletion
+27
-9
src/renderers/shaders/ShaderChunk/lights_pars.glsl
src/renderers/shaders/ShaderChunk/lights_pars.glsl
+27
-9
未找到文件。
src/renderers/shaders/ShaderChunk/lights_pars.glsl
浏览文件 @
99988a08
...
...
@@ -154,21 +154,28 @@ uniform vec3 ambientLightColor;
return
0
.
5
*
log2
(
delta_max_sqr
);
}
// this is not correct for cube maps.
float
getSamplerMIPLevel
(
const
in
int
maxMIPLevel
,
const
vec3
sampleDirection
)
{
float
envMapWidth
=
pow
(
2
.
0
,
float
(
maxMIPLevel
)
);
float
sampleMIPLevel
=
textureQueryLodCUBE
(
sampleDirection
*
(
envMapWidth
*
0
.
5
)
);
// only half because sampleDirection ranges of [-1,1]
// clamp to allowable LOD ranges.
return
clamp
(
sampleMIPLevel
,
0
.
0
,
float
(
maxMIPLevel
)
);
}
// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html
float
getSpecularMIP
Bias
(
const
in
float
blinnShininessExponent
,
const
in
int
maxMIPLevel
,
const
vec3
sampleDirection
)
{
float
getSpecularMIP
Level
(
const
in
float
blinnShininessExponent
,
const
in
int
maxMIPLevel
)
{
float
envMapWidth
=
pow
(
2
.
0
,
float
(
maxMIPLevel
)
);
//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );
float
desiredMIPLevel
=
float
(
maxMIPLevel
)
-
0
.
79248
-
0
.
5
*
log2
(
square
(
blinnShininessExponent
)
+
1
.
0
);
float
sampleMIPLevel
=
textureQueryLodCUBE
(
sampleDirection
*
(
envMapWidth
*
0
.
5
)
);
// only half because sampleDirection ranges of [-1,1]
// clamp to allowable LOD ranges.
sampleMIPLevel
=
clamp
(
sampleMIPLevel
,
0
.
0
,
float
(
maxMIPLevel
)
);
desiredMIPLevel
=
clamp
(
desiredMIPLevel
,
0
.
0
,
float
(
maxMIPLevel
)
);
// only go to lower LOD levels
return
max
(
desiredMIPLevel
-
sampleMIPLevel
,
0
.
0
);
return
clamp
(
desiredMIPLevel
,
0
.
0
,
float
(
maxMIPLevel
)
);
}
...
...
@@ -198,9 +205,20 @@ uniform vec3 ambientLightColor;
#ifdef ENVMAP_TYPE_CUBE
float
mipBias
=
getSpecularMIPBias
(
blinnShininessExponent
,
maxMIPLevel
,
reflectVec
);
float
specularMIPLevel
=
getSpecularMIPLevel
(
blinnShininessExponent
,
maxMIPLevel
);
#if defined( TEXTURE_CUBE_LOD_EXT )
vec4
envMapColor
=
textureCube
(
envMap
,
flipNormal
*
vec3
(
flipEnvMap
*
reflectVec
.
x
,
reflectVec
.
yz
),
mipBias
);
vec4
envMapColor
=
textureCubeLodEXT
(
envMap
,
flipNormal
*
vec3
(
flipEnvMap
*
reflectVec
.
x
,
reflectVec
.
yz
),
specularMIPLevel
);
#else
float
samplerMIPLevel
=
getSamplerMIPLevel
(
maxMIPLevel
,
reflectVec
);
vec4
envMapColor
=
textureCube
(
envMap
,
flipNormal
*
vec3
(
flipEnvMap
*
reflectVec
.
x
,
reflectVec
.
yz
),
max
(
specularMIPLevel
-
samplerMIPLevel
)
);
#endif
#elif defined( ENVMAP_TYPE_EQUIREC )
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录