Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
bcae10df
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,发现更多精彩内容 >>
提交
bcae10df
编写于
5月 27, 2014
作者:
N
Nima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed nagative f in pow warning in shaders
上级
c12ca877
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
16 deletion
+16
-16
src/renderers/shaders/ShaderChunk.js
src/renderers/shaders/ShaderChunk.js
+7
-7
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+9
-9
未找到文件。
src/renderers/shaders/ShaderChunk.js
浏览文件 @
bcae10df
/**
* Shader chunks for WebLG Shader library
*
*
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author mikael emtinger / http://gomo.se/
...
...
@@ -625,7 +625,7 @@ THREE.ShaderChunk = {
"
if ( spotEffect > spotLightAngleCos[ i ] ) {
"
,
"
spotEffect = max( pow(
spotEffect
, spotLightExponent[ i ] ), 0.0 );
"
,
"
spotEffect = max( pow(
max( spotEffect, 0.0 )
, spotLightExponent[ i ] ), 0.0 );
"
,
"
float lDistance = 1.0;
"
,
"
if ( spotLightDistance[ i ] > 0.0 )
"
,
...
...
@@ -880,7 +880,7 @@ THREE.ShaderChunk = {
"
if ( spotEffect > spotLightAngleCos[ i ] ) {
"
,
"
spotEffect = max( pow(
spotEffect
, spotLightExponent[ i ] ), 0.0 );
"
,
"
spotEffect = max( pow(
max( spotEffect, 0.0 )
, spotLightExponent[ i ] ), 0.0 );
"
,
// diffuse
...
...
@@ -1007,7 +1007,7 @@ THREE.ShaderChunk = {
"
vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );
"
,
"
float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;
"
,
"
float hemiSpecularWeightSky = specularStrength * max( pow(
hemiDotNormalHalfSky
, shininess ), 0.0 );
"
,
"
float hemiSpecularWeightSky = specularStrength * max( pow(
max( hemiDotNormalHalfSky, 0.0 )
, shininess ), 0.0 );
"
,
// specular (ground light)
...
...
@@ -1015,7 +1015,7 @@ THREE.ShaderChunk = {
"
vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );
"
,
"
float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;
"
,
"
float hemiSpecularWeightGround = specularStrength * max( pow(
hemiDotNormalHalfGround
, shininess ), 0.0 );
"
,
"
float hemiSpecularWeightGround = specularStrength * max( pow(
max( hemiDotNormalHalfGround, 0.0 )
, shininess ), 0.0 );
"
,
"
float dotProductGround = dot( normal, lVectorGround );
"
,
...
...
@@ -1541,7 +1541,7 @@ THREE.ShaderChunk = {
"
vec3 shadowZ = vec3( shadowCoord.z );
"
,
"
shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));
"
,
"
shadowKernel[0] *= vec3(0.25);
"
,
"
shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));
"
,
"
shadowKernel[1] *= vec3(0.25);
"
,
...
...
@@ -1664,7 +1664,7 @@ THREE.ShaderChunk = {
// http://outerra.blogspot.com/2012/11/maximizing-depth-buffer-range-and.html
// WebGL doesn't support gl_FragDepth out of the box, unless the EXT_frag_depth extension is available. On platforms
// without EXT_frag_depth, we have to fall back on linear z-buffer in the fragment shader, which means that some long
// without EXT_frag_depth, we have to fall back on linear z-buffer in the fragment shader, which means that some long
// faces close to the camera may have issues. This can be worked around by tesselating the model more finely when
// the camera is near the surface.
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
bcae10df
...
...
@@ -507,7 +507,7 @@ THREE.ShaderLib = {
"
uniform float mNear;
"
,
"
uniform float mFar;
"
,
"
uniform float opacity;
"
,
THREE
.
ShaderChunk
[
"
logdepthbuf_pars_fragment
"
],
"
void main() {
"
,
...
...
@@ -816,7 +816,7 @@ THREE.ShaderLib = {
"
float specularNormalization = ( shininess + 2.0 ) / 8.0;
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
1.0 - dot( pointVector, pointHalfVector
), 5.0 );
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
max( 1.0 - dot( pointVector, pointHalfVector ), 0.0
), 5.0 );
"
,
"
pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;
"
,
"
}
"
,
...
...
@@ -845,7 +845,7 @@ THREE.ShaderLib = {
"
if ( spotEffect > spotLightAngleCos[ i ] ) {
"
,
"
spotEffect = max( pow(
spotEffect
, spotLightExponent[ i ] ), 0.0 );
"
,
"
spotEffect = max( pow(
max( spotEffect, 0.0 )
, spotLightExponent[ i ] ), 0.0 );
"
,
// diffuse
...
...
@@ -872,7 +872,7 @@ THREE.ShaderLib = {
"
float specularNormalization = ( shininess + 2.0 ) / 8.0;
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
1.0 - dot( spotVector, spotHalfVector
), 5.0 );
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
max( 1.0 - dot( spotVector, spotHalfVector ), 0.0
), 5.0 );
"
,
"
spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;
"
,
"
}
"
,
...
...
@@ -918,7 +918,7 @@ THREE.ShaderLib = {
"
float specularNormalization = ( shininess + 2.0 ) / 8.0;
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
1.0 - dot( dirVector, dirHalfVector
), 5.0 );
"
,
"
vec3 schlick = specular + vec3( 1.0 - specular ) * pow(
max( 1.0 - dot( dirVector, dirHalfVector ), 0.0
), 5.0 );
"
,
"
dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;
"
,
"
}
"
,
...
...
@@ -951,7 +951,7 @@ THREE.ShaderLib = {
"
vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );
"
,
"
float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;
"
,
"
float hemiSpecularWeightSky = specularTex.r * max( pow(
hemiDotNormalHalfSky
, shininess ), 0.0 );
"
,
"
float hemiSpecularWeightSky = specularTex.r * max( pow(
max( hemiDotNormalHalfSky, 0.0 )
, shininess ), 0.0 );
"
,
// specular (ground light)
...
...
@@ -959,14 +959,14 @@ THREE.ShaderLib = {
"
vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );
"
,
"
float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;
"
,
"
float hemiSpecularWeightGround = specularTex.r * max( pow(
hemiDotNormalHalfGround
, shininess ), 0.0 );
"
,
"
float hemiSpecularWeightGround = specularTex.r * max( pow(
max( hemiDotNormalHalfGround, 0.0 )
, shininess ), 0.0 );
"
,
"
float dotProductGround = dot( normal, lVectorGround );
"
,
"
float specularNormalization = ( shininess + 2.0 ) / 8.0;
"
,
"
vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow(
1.0 - dot( lVector, hemiHalfVectorSky
), 5.0 );
"
,
"
vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow(
1.0 - dot( lVectorGround, hemiHalfVectorGround
), 5.0 );
"
,
"
vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow(
max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0
), 5.0 );
"
,
"
vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow(
max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0
), 5.0 );
"
,
"
hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );
"
,
"
}
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录