Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
9d174a1d
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,发现更多精彩内容 >>
提交
9d174a1d
编写于
1月 31, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
3b54f69c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
29 deletion
+21
-29
build/three.js
build/three.js
+2
-10
build/three.min.js
build/three.min.js
+19
-19
未找到文件。
build/three.js
浏览文件 @
9d174a1d
...
...
@@ -23409,7 +23409,7 @@ THREE.ShaderChunk[ 'color_vertex' ] = "#ifdef USE_COLOR\n vColor.xyz = color.xyz
// File:src/renderers/shaders/ShaderChunk/common.glsl
THREE.ShaderChunk[ 'common' ] = "#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nvec3 inputToLinear( in vec3 a ) {\n #ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n #else\n return a;\n #endif\n}\nvec3 linearToOutput( in vec3 a ) {\n #ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n #else\n return a;\n #endif\n}\n";
THREE.ShaderChunk[ 'common' ] = "#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n
#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float angleCos;\n float exponent;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n#endif\n
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nvec3 inputToLinear( in vec3 a ) {\n #ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n #else\n return a;\n #endif\n}\nvec3 linearToOutput( in vec3 a ) {\n #ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n #else\n return a;\n #endif\n}\n";
// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl
...
...
@@ -23469,7 +23469,7 @@ THREE.ShaderChunk[ 'lights_lambert_vertex' ] = "vec3 diffuse = vec3( 1.0 );\nGeo
// File:src/renderers/shaders/ShaderChunk/lights_pars.glsl
THREE.ShaderChunk[ 'lights_pars' ] = "#if NUM_DIR_LIGHTS > 0\n
struct DirectionalLight {\n vec3 direction;\n vec3 color;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n IncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n return directLight;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n IncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n directLight.color = pointLight.color;\n directLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n return directLight;\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float angleCos;\n float exponent;\n bool shadowEnabled;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n mat4 shadowMatrix;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n IncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float spotEffect = dot( directLight.direction, spotLight.direction );\n if ( spotEffect > spotLight.angleCos ) {\n float spotEffect = dot( spotLight.direction, directLight.direction );\n spotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n directLight.color = spotLight.color;\n directLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n } else {\n directLight.color = vec3( 0.0 );\n }\n return directLight;\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n return PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n #else\n vec3 envMapColor = vec3( 0.0 );\n #endif\n envMapColor.rgb = inputToLinear( envMapColor.rgb );\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n #endif\n envMapColor.rgb = inputToLinear( envMapColor.rgb );\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n";
THREE.ShaderChunk[ 'lights_pars' ] = "#if NUM_DIR_LIGHTS > 0\n
IncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n return directLight;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n IncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n directLight.color = pointLight.color;\n directLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n return directLight;\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n IncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float spotEffect = dot( directLight.direction, spotLight.direction );\n if ( spotEffect > spotLight.angleCos ) {\n float spotEffect = dot( spotLight.direction, directLight.direction );\n spotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n directLight.color = spotLight.color;\n directLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n } else {\n directLight.color = vec3( 0.0 );\n }\n return directLight;\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0
\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n return PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n #else\n vec3 envMapColor = vec3( 0.0 );\n #endif\n envMapColor.rgb = inputToLinear( envMapColor.rgb );\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n #endif\n envMapColor.rgb = inputToLinear( envMapColor.rgb );\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n";
// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl
...
...
@@ -23902,8 +23902,6 @@ THREE.ShaderLib = {
THREE.ShaderChunk[ "uv_pars_vertex" ],
THREE.ShaderChunk[ "uv2_pars_vertex" ],
THREE.ShaderChunk[ "envmap_pars_vertex" ],
THREE.ShaderChunk[ "bsdfs" ],
THREE.ShaderChunk[ "lights_pars" ],
THREE.ShaderChunk[ "color_pars_vertex" ],
THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
THREE.ShaderChunk[ "skinning_pars_vertex" ],
...
...
@@ -24189,8 +24187,6 @@ THREE.ShaderLib = {
THREE.ShaderChunk[ "uv2_pars_vertex" ],
THREE.ShaderChunk[ "displacementmap_pars_vertex" ],
THREE.ShaderChunk[ "envmap_pars_vertex" ],
THREE.ShaderChunk[ "bsdfs" ],
THREE.ShaderChunk[ "lights_pars" ],
THREE.ShaderChunk[ "lights_phong_pars_vertex" ],
THREE.ShaderChunk[ "color_pars_vertex" ],
THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
...
...
@@ -24345,8 +24341,6 @@ THREE.ShaderLib = {
THREE.ShaderChunk[ "uv2_pars_vertex" ],
THREE.ShaderChunk[ "displacementmap_pars_vertex" ],
THREE.ShaderChunk[ "envmap_pars_vertex" ],
THREE.ShaderChunk[ "bsdfs" ],
THREE.ShaderChunk[ "lights_pars" ],
THREE.ShaderChunk[ "color_pars_vertex" ],
THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
THREE.ShaderChunk[ "skinning_pars_vertex" ],
...
...
@@ -24484,8 +24478,6 @@ THREE.ShaderLib = {
"uniform float scale;",
THREE.ShaderChunk[ "common" ],
THREE.ShaderChunk[ "bsdfs" ],
THREE.ShaderChunk[ "lights_pars" ],
THREE.ShaderChunk[ "color_pars_vertex" ],
THREE.ShaderChunk[ "shadowmap_pars_vertex" ],
THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ],
...
...
build/three.min.js
浏览文件 @
9d174a1d
...
...
@@ -519,7 +519,7 @@ THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.dens
THREE
.
ShaderChunk
.
ambient_pars
=
"
uniform vec3 ambientLightColor;
\n
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
\n\t
return PI * ambientLightColor;
\n
}
\n
"
;
THREE
.
ShaderChunk
.
aomap_fragment
=
"
#ifdef USE_AOMAP
\n\t
reflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
aomap_pars_fragment
=
"
#ifdef USE_AOMAP
\n\t
uniform sampler2D aoMap;
\n\t
uniform float aoMapIntensity;
\n
#endif
"
;
THREE
.
ShaderChunk
.
begin_vertex
=
"
\n
vec3 transformed = vec3( position );
\n
"
;
THREE
.
ShaderChunk
.
beginnormal_vertex
=
"
\n
vec3 objectNormal = vec3( normal );
\n
"
;
THREE
.
ShaderChunk
.
bsdfs
=
"
float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
\n\t
if ( decayExponent > 0.0 ) {
\n\t
return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
\n\t
}
\n\t
return 1.0;
\n
}
\n
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
\n\t
return RECIPROCAL_PI * diffuseColor;
\n
}
\n
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
\n\t
float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
\n\t
return ( 1.0 - specularColor ) * fresnel + specularColor;
\n
}
\n
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
\n\t
float a2 = alpha * alpha;
\n\t
float gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );
\n\t
float gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );
\n\t
return 1.0 / ( gl * gv );
\n
}
\n
float D_GGX( const in float alpha, const in float dotNH ) {
\n\t
float a2 = alpha * alpha;
\n\t
float denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0;
\n\t
return RECIPROCAL_PI * a2 / ( denom * denom );
\n
}
\n
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
\n\t
float alpha = roughness * roughness;
\n\t
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
\n\t
float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );
\n\t
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
\n\t
float dotNH = saturate( dot( geometry.normal, halfDir ) );
\n\t
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
\n\t
vec3 F = F_Schlick( specularColor, dotLH );
\n\t
float G = G_GGX_Smith( alpha, dotNL, dotNV );
\n\t
float D = D_GGX( alpha, dotNH );
\n\t
return F * ( G * D );
\n
}
\n
vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
\n\t
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
\n\t
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
\n\t
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
\n\t
vec4 r = roughness * c0 + c1;
\n\t
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
\n\t
vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
\n\t
return specularColor * AB.x + AB.y;
\n
}
\n
float G_BlinnPhong_Implicit( ) {
\n\t
return 0.25;
\n
}
\n
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
\n\t
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
\n
}
\n
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
\n\t
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
\n\t
float dotNH = saturate( dot( geometry.normal, halfDir ) );
\n\t
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
\n\t
vec3 F = F_Schlick( specularColor, dotLH );
\n\t
float G = G_BlinnPhong_Implicit( );
\n\t
float D = D_BlinnPhong( shininess, dotNH );
\n\t
return F * ( G * D );
\n
}
\n
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
\n\t
return ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );
\n
}
"
;
THREE
.
ShaderChunk
.
bumpmap_pars_fragment
=
"
#ifdef USE_BUMPMAP
\n\t
uniform sampler2D bumpMap;
\n\t
uniform float bumpScale;
\n\t
vec2 dHdxy_fwd() {
\n\t\t
vec2 dSTdx = dFdx( vUv );
\n\t\t
vec2 dSTdy = dFdy( vUv );
\n\t\t
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
\n\t\t
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
\n\t\t
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
\n\t\t
return vec2( dBx, dBy );
\n\t
}
\n\t
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
\n\t\t
vec3 vSigmaX = dFdx( surf_pos );
\n\t\t
vec3 vSigmaY = dFdy( surf_pos );
\n\t\t
vec3 vN = surf_norm;
\n\t\t
vec3 R1 = cross( vSigmaY, vN );
\n\t\t
vec3 R2 = cross( vN, vSigmaX );
\n\t\t
float fDet = dot( vSigmaX, R1 );
\n\t\t
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
\n\t\t
return normalize( abs( fDet ) * surf_norm - vGrad );
\n\t
}
\n
#endif
\n
"
;
THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif";THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n";THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif";THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif";THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nvec3 inputToLinear( in vec3 a ) {\n\t#ifdef GAMMA_INPUT\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n";
THREE
.
ShaderChunk
.
color_fragment
=
"
#ifdef USE_COLOR
\n\t
diffuseColor.rgb *= vColor;
\n
#endif
"
;
THREE
.
ShaderChunk
.
color_pars_fragment
=
"
#ifdef USE_COLOR
\n\t
varying vec3 vColor;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
color_pars_vertex
=
"
#ifdef USE_COLOR
\n\t
varying vec3 vColor;
\n
#endif
"
;
THREE
.
ShaderChunk
.
color_vertex
=
"
#ifdef USE_COLOR
\n\t
vColor.xyz = color.xyz;
\n
#endif
"
;
THREE
.
ShaderChunk
.
common
=
"
#define PI 3.14159
\n
#define PI2 6.28318
\n
#define RECIPROCAL_PI 0.31830988618
\n
#define RECIPROCAL_PI2 0.15915494
\n
#define LOG2 1.442695
\n
#define EPSILON 1e-6
\n
#define saturate(a) clamp( a, 0.0, 1.0 )
\n
#define whiteCompliment(a) ( 1.0 - saturate( a ) )
\n
float square( const in float x ) { return x*x; }
\n
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
\n
struct IncidentLight {
\n\t
vec3 color;
\n\t
vec3 direction;
\n
};
\n
struct ReflectedLight {
\n\t
vec3 directDiffuse;
\n\t
vec3 directSpecular;
\n\t
vec3 indirectDiffuse;
\n\t
vec3 indirectSpecular;
\n
};
\n
struct GeometricContext {
\n\t
vec3 position;
\n\t
vec3 normal;
\n\t
vec3 viewDir;
\n
};
\n
#if NUM_DIR_LIGHTS > 0
\n\t
struct DirectionalLight {
\n\t\t
vec3 direction;
\n\t\t
vec3 color;
\n\t\t
bool shadowEnabled;
\n\t\t
float shadowBias;
\n\t\t
float shadowRadius;
\n\t\t
vec2 shadowMapSize;
\n\t\t
mat4 shadowMatrix;
\n\t
};
\n\t
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
\n
#endif
\n
#if NUM_SPOT_LIGHTS > 0
\n\t
struct SpotLight {
\n\t\t
vec3 position;
\n\t\t
vec3 direction;
\n\t\t
vec3 color;
\n\t\t
float distance;
\n\t\t
float decay;
\n\t\t
float angleCos;
\n\t\t
float exponent;
\n\t\t
bool shadowEnabled;
\n\t\t
float shadowBias;
\n\t\t
float shadowRadius;
\n\t\t
vec2 shadowMapSize;
\n\t\t
mat4 shadowMatrix;
\n\t
};
\n\t
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
\n
#endif
\n
#if NUM_POINT_LIGHTS > 0
\n\t
struct PointLight {
\n\t\t
vec3 position;
\n\t\t
vec3 color;
\n\t\t
float distance;
\n\t\t
float decay;
\n\t\t
bool shadowEnabled;
\n\t\t
float shadowBias;
\n\t\t
float shadowRadius;
\n\t\t
vec2 shadowMapSize;
\n\t\t
mat4 shadowMatrix;
\n\t
};
\n\t
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
\n
#endif
\n
#if NUM_HEMI_LIGHTS > 0
\n\t
struct HemisphereLight {
\n\t\t
vec3 direction;
\n\t\t
vec3 skyColor;
\n\t\t
vec3 groundColor;
\n\t
};
\n\t
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
\n
#endif
\n
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
\n\t
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
\n
}
\n
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
\n\t
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
\n
}
\n
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
\n\t
float distance = dot( planeNormal, point - pointOnPlane );
\n\t
return - distance * planeNormal + point;
\n
}
\n
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
\n\t
return sign( dot( point - pointOnPlane, planeNormal ) );
\n
}
\n
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
\n\t
return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
\n
}
\n
vec3 inputToLinear( in vec3 a ) {
\n\t
#ifdef GAMMA_INPUT
\n\t\t
return pow( a, vec3( float( GAMMA_FACTOR ) ) );
\n\t
#else
\n\t\t
return a;
\n\t
#endif
\n
}
\n
vec3 linearToOutput( in vec3 a ) {
\n\t
#ifdef GAMMA_OUTPUT
\n\t\t
return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );
\n\t
#else
\n\t\t
return a;
\n\t
#endif
\n
}
\n
"
;
THREE
.
ShaderChunk
.
defaultnormal_vertex
=
"
#ifdef FLIP_SIDED
\n\t
objectNormal = -objectNormal;
\n
#endif
\n
vec3 transformedNormal = normalMatrix * objectNormal;
\n
"
;
THREE
.
ShaderChunk
.
displacementmap_vertex
=
"
#ifdef USE_DISPLACEMENTMAP
\n\t
transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
displacementmap_pars_vertex
=
"
#ifdef USE_DISPLACEMENTMAP
\n\t
uniform sampler2D displacementMap;
\n\t
uniform float displacementScale;
\n\t
uniform float displacementBias;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
emissivemap_fragment
=
"
#ifdef USE_EMISSIVEMAP
\n\t
vec4 emissiveColor = texture2D( emissiveMap, vUv );
\n\t
emissiveColor.rgb = inputToLinear( emissiveColor.rgb );
\n\t
totalEmissiveLight *= emissiveColor.rgb;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
emissivemap_pars_fragment
=
"
#ifdef USE_EMISSIVEMAP
\n\t
uniform sampler2D emissiveMap;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
envmap_fragment
=
"
#ifdef USE_ENVMAP
\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
\n\t\t
vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
\n\t\t
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
\n\t\t
#ifdef ENVMAP_MODE_REFLECTION
\n\t\t\t
vec3 reflectVec = reflect( cameraToVertex, worldNormal );
\n\t\t
#else
\n\t\t\t
vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
\n\t\t
#endif
\n\t
#else
\n\t\t
vec3 reflectVec = vReflect;
\n\t
#endif
\n\t
#ifdef DOUBLE_SIDED
\n\t\t
float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
\n\t
#else
\n\t\t
float flipNormal = 1.0;
\n\t
#endif
\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
\n\t
#elif defined( ENVMAP_TYPE_EQUIREC )
\n\t\t
vec2 sampleUV;
\n\t\t
sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
\n\t\t
sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
\n\t\t
vec4 envColor = texture2D( envMap, sampleUV );
\n\t
#elif defined( ENVMAP_TYPE_SPHERE )
\n\t\t
vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
\n\t\t
vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
\n\t
#endif
\n\t
envColor.xyz = inputToLinear( envColor.xyz );
\n\t
#ifdef ENVMAP_BLENDING_MULTIPLY
\n\t\t
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
\n\t
#elif defined( ENVMAP_BLENDING_MIX )
\n\t\t
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
\n\t
#elif defined( ENVMAP_BLENDING_ADD )
\n\t\t
outgoingLight += envColor.xyz * specularStrength * reflectivity;
\n\t
#endif
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
envmap_pars_fragment
=
"
#if defined( USE_ENVMAP ) || defined( STANDARD )
\n\t
uniform float reflectivity;
\n\t
uniform float envMapIntenstiy;
\n
#endif
\n
#ifdef USE_ENVMAP
\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
uniform samplerCube envMap;
\n\t
#else
\n\t\t
uniform sampler2D envMap;
\n\t
#endif
\n\t
uniform float flipEnvMap;
\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )
\n\t\t
uniform float refractionRatio;
\n\t
#else
\n\t\t
varying vec3 vReflect;
\n\t
#endif
\n
#endif
\n
"
;
...
...
@@ -527,7 +527,7 @@ THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( US
THREE
.
ShaderChunk
.
fog_fragment
=
"
#ifdef USE_FOG
\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\t\t
float depth = gl_FragDepthEXT / gl_FragCoord.w;
\n\t
#else
\n\t\t
float depth = gl_FragCoord.z / gl_FragCoord.w;
\n\t
#endif
\n\t
#ifdef FOG_EXP2
\n\t\t
float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );
\n\t
#else
\n\t\t
float fogFactor = smoothstep( fogNear, fogFar, depth );
\n\t
#endif
\n\t\n\t
outgoingLight = mix( outgoingLight, fogColor, fogFactor );
\n
#endif
"
;
THREE
.
ShaderChunk
.
fog_pars_fragment
=
"
#ifdef USE_FOG
\n\t
uniform vec3 fogColor;
\n\t
#ifdef FOG_EXP2
\n\t\t
uniform float fogDensity;
\n\t
#else
\n\t\t
uniform float fogNear;
\n\t\t
uniform float fogFar;
\n\t
#endif
\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_fragment
=
"
#ifdef USE_LIGHTMAP
\n\t
reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lightmap_pars_fragment
=
"
#ifdef USE_LIGHTMAP
\n\t
uniform sampler2D lightMap;
\n\t
uniform float lightMapIntensity;
\n
#endif
"
;
THREE
.
ShaderChunk
.
lights_lambert_vertex
=
"
vec3 diffuse = vec3( 1.0 );
\n
GeometricContext geometry;
\n
geometry.position = mvPosition.xyz;
\n
geometry.normal = normalize( transformedNormal );
\n
geometry.viewDir = normalize( -mvPosition.xyz );
\n
GeometricContext backGeometry;
\n
backGeometry.position = geometry.position;
\n
backGeometry.normal = -geometry.normal;
\n
backGeometry.viewDir = geometry.viewDir;
\n
vLightFront = vec3( 0.0 );
\n
#ifdef DOUBLE_SIDED
\n\t
vLightBack = vec3( 0.0 );
\n
#endif
\n
IncidentLight directLight;
\n
float dotNL;
\n
vec3 directLightColor_Diffuse;
\n
#if NUM_POINT_LIGHTS > 0
\n\t
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
\n\t\t
directLight = getPointDirectLight( pointLights[ i ], geometry );
\n\t\t
dotNL = dot( geometry.normal, directLight.direction );
\n\t\t
directLightColor_Diffuse = PI * directLight.color;
\n\t\t
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
\n\t\t
#endif
\n\t
}
\n
#endif
\n
#if NUM_SPOT_LIGHTS > 0
\n\t
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
\n\t\t
directLight = getSpotDirectLight( spotLights[ i ], geometry );
\n\t\t
dotNL = dot( geometry.normal, directLight.direction );
\n\t\t
directLightColor_Diffuse = PI * directLight.color;
\n\t\t
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
\n\t\t
#endif
\n\t
}
\n
#endif
\n
#if NUM_DIR_LIGHTS > 0
\n\t
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
\n\t\t
directLight = getDirectionalDirectLight( directionalLights[ i ], geometry );
\n\t\t
dotNL = dot( geometry.normal, directLight.direction );
\n\t\t
directLightColor_Diffuse = PI * directLight.color;
\n\t\t
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
\n\t\t
#endif
\n\t
}
\n
#endif
\n
#if NUM_HEMI_LIGHTS > 0
\n\t
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
\n\t\t
vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
\n\t\t
#endif
\n\t
}
\n
#endif
\n
"
;
THREE.ShaderChunk.lights_pars="#if NUM_DIR_LIGHTS > 0\n\t
struct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tbool shadowEnabled;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tmat4 shadowMatrix;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tIncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tbool shadowEnabled;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tmat4 shadowMatrix;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tIncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat angleCos;\n\t\tfloat exponent;\n\t\tbool shadowEnabled;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tmat4 shadowMatrix;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tIncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat spotEffect = dot( directLight.direction, spotLight.direction );\n\t\tif ( spotEffect > spotLight.angleCos ) {\n\t\t\tfloat spotEffect = dot( spotLight.direction, directLight.direction );\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t}\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\treturn PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t#else\n\t\t\tvec3 envMapColor = vec3( 0.0 );\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n";
THREE
.
ShaderChunk
.
lights_pars
=
"
#if NUM_DIR_LIGHTS > 0
\n\t
IncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {
\n\t\t
IncidentLight directLight;
\n\t\t
directLight.color = directionalLight.color;
\n\t\t
directLight.direction = directionalLight.direction;
\n\t\t
return directLight;
\n\t
}
\n
#endif
\n
#if NUM_POINT_LIGHTS > 0
\n\t
IncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {
\n\t\t
IncidentLight directLight;
\n\t\t
vec3 lVector = pointLight.position - geometry.position;
\n\t\t
directLight.direction = normalize( lVector );
\n\t\t
directLight.color = pointLight.color;
\n\t\t
directLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );
\n\t\t
return directLight;
\n\t
}
\n
#endif
\n
#if NUM_SPOT_LIGHTS > 0
\n\t
IncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {
\n\t\t
IncidentLight directLight;
\n\t\t
vec3 lVector = spotLight.position - geometry.position;
\n\t\t
directLight.direction = normalize( lVector );
\n\t\t
float spotEffect = dot( directLight.direction, spotLight.direction );
\n\t\t
if ( spotEffect > spotLight.angleCos ) {
\n\t\t\t
float spotEffect = dot( spotLight.direction, directLight.direction );
\n\t\t\t
spotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );
\n\t\t\t
directLight.color = spotLight.color;
\n\t\t\t
directLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );
\n\t\t
} else {
\n\t\t\t
directLight.color = vec3( 0.0 );
\n\t\t
}
\n\t\t
return directLight;
\n\t
}
\n
#endif
\n
#if NUM_HEMI_LIGHTS > 0
\n\t
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
\n\t\t
float dotNL = dot( geometry.normal, hemiLight.direction );
\n\t\t
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
\n\t\t
return PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
\n\t
}
\n
#endif
\n
#if defined( USE_ENVMAP ) && defined( STANDARD )
\n\t
vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
\n\t\t
#else
\n\t\t\t
float flipNormal = 1.0;
\n\t\t
#endif
\n\t\t
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
\n\t\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t\t
vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
\n\t\t\t
#ifdef TEXTURE_LOD_EXT
\n\t\t\t\t
vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
\n\t\t\t
#else
\n\t\t\t\t
vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
\n\t\t\t
#endif
\n\t\t
#else
\n\t\t\t
vec3 envMapColor = vec3( 0.0 );
\n\t\t
#endif
\n\t\t
envMapColor.rgb = inputToLinear( envMapColor.rgb );
\n\t\t
return PI * envMapColor.rgb * envMapIntensity;
\n\t
}
\n\t
float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {
\n\t\t
float maxMIPLevelScalar = float( maxMIPLevel );
\n\t\t
float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );
\n\t\t
return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
\n\t
}
\n\t
vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {
\n\t\t
#ifdef ENVMAP_MODE_REFLECTION
\n\t\t\t
vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );
\n\t\t
#else
\n\t\t\t
vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );
\n\t\t
#endif
\n\t\t
#ifdef DOUBLE_SIDED
\n\t\t\t
float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
\n\t\t
#else
\n\t\t\t
float flipNormal = 1.0;
\n\t\t
#endif
\n\t\t
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
\n\t\t
float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );
\n\t\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t\t
vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
\n\t\t\t
#ifdef TEXTURE_LOD_EXT
\n\t\t\t\t
vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
\n\t\t\t
#else
\n\t\t\t\t
vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
\n\t\t\t
#endif
\n\t\t
#elif defined( ENVMAP_TYPE_EQUIREC )
\n\t\t\t
vec2 sampleUV;
\n\t\t\t
sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
\n\t\t\t
sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
\n\t\t\t
#ifdef TEXTURE_LOD_EXT
\n\t\t\t\t
vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
\n\t\t\t
#else
\n\t\t\t\t
vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
\n\t\t\t
#endif
\n\t\t
#elif defined( ENVMAP_TYPE_SPHERE )
\n\t\t\t
vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
\n\t\t\t
#ifdef TEXTURE_LOD_EXT
\n\t\t\t\t
vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
\n\t\t\t
#else
\n\t\t\t\t
vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
\n\t\t\t
#endif
\n\t\t
#endif
\n\t\t
envMapColor.rgb = inputToLinear( envMapColor.rgb );
\n\t\t
return envMapColor.rgb * envMapIntensity;
\n\t
}
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_fragment
=
"
BlinnPhongMaterial material;
\n
material.diffuseColor = diffuseColor.rgb;
\n
material.specularColor = specular;
\n
material.specularShininess = shininess;
\n
material.specularStrength = specularStrength;
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_fragment
=
"
#ifdef USE_ENVMAP
\n\t
varying vec3 vWorldPosition;
\n
#endif
\n
varying vec3 vViewPosition;
\n
#ifndef FLAT_SHADED
\n\t
varying vec3 vNormal;
\n
#endif
\n
struct BlinnPhongMaterial {
\n\t
vec3
\t
diffuseColor;
\n\t
vec3
\t
specularColor;
\n\t
float
\t
specularShininess;
\n\t
float
\t
specularStrength;
\n
};
\n
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
\n\t
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
\n\t
vec3 irradiance = dotNL * PI * directLight.color;
\n\t
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
\n\t
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
\n
}
\n
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
\n\t
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
\n
}
\n
#define RE_Direct
\t\t\t\t
RE_Direct_BlinnPhong
\n
#define RE_IndirectDiffuse
\t\t
RE_IndirectDiffuse_BlinnPhong
\n
#define Material_LightProbeLOD( material )
\t
(0)
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_vertex
=
"
#ifdef USE_ENVMAP
\n\t
varying vec3 vWorldPosition;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_vertex
=
"
#ifdef USE_ENVMAP
\n\t
vWorldPosition = worldPosition.xyz;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_standard_fragment
=
"
StandardMaterial material;
\n
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
\n
material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
\n
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
\n
"
;
THREE
.
ShaderChunk
.
lights_standard_pars_fragment
=
"
struct StandardMaterial {
\n\t
vec3
\t
diffuseColor;
\n\t
float
\t
specularRoughness;
\n\t
vec3
\t
specularColor;
\n
};
\n
void RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {
\n\t
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
\n\t
vec3 irradiance = dotNL * PI * directLight.color;
\n\t
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
\n\t
reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );
\n
}
\n
void RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {
\n\t
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
\n
}
\n
void RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {
\n\t
reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );
\n
}
\n
#define RE_Direct
\t\t\t\t
RE_Direct_Standard
\n
#define RE_IndirectDiffuse
\t\t
RE_IndirectDiffuse_Standard
\n
#define RE_IndirectSpecular
\t\t
RE_IndirectSpecular_Standard
\n
#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )
\n
"
;
...
...
@@ -553,10 +553,10 @@ value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type
value
:
1
},
fogFar
:{
type
:
"
f
"
,
value
:
2
E3
},
fogColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
16777215
)}},
ambient
:{
ambientLightColor
:{
type
:
"
fv
"
,
value
:[]}},
lights
:{
directionalLights
:{
type
:
"
sa
"
,
value
:[],
properties
:{
direction
:{
type
:
"
v3
"
},
color
:{
type
:
"
c
"
},
shadowEnabled
:{
type
:
"
i
"
},
shadowBias
:{
type
:
"
f
"
},
shadowRadius
:{
type
:
"
f
"
},
shadowMapSize
:{
type
:
"
v2
"
},
shadowMatrix
:{
type
:
"
m4
"
}}},
directionalLightsShadowMap
:{
type
:
"
tv
"
,
value
:[]},
spotLights
:{
type
:
"
sa
"
,
value
:[],
properties
:{
color
:{
type
:
"
c
"
},
position
:{
type
:
"
v3
"
},
direction
:{
type
:
"
v3
"
},
distance
:{
type
:
"
f
"
},
angleCos
:{
type
:
"
f
"
},
exponent
:{
type
:
"
f
"
},
decay
:{
type
:
"
f
"
},
shadowEnabled
:{
type
:
"
i
"
},
shadowBias
:{
type
:
"
f
"
},
shadowRadius
:{
type
:
"
f
"
},
shadowMapSize
:{
type
:
"
v2
"
},
shadowMatrix
:{
type
:
"
m4
"
}}},
spotLightsShadowMap
:{
type
:
"
tv
"
,
value
:[]},
pointLights
:{
type
:
"
sa
"
,
value
:[],
properties
:{
color
:{
type
:
"
c
"
},
position
:{
type
:
"
v3
"
},
decay
:{
type
:
"
f
"
},
distance
:{
type
:
"
f
"
},
shadowEnabled
:{
type
:
"
i
"
},
shadowBias
:{
type
:
"
f
"
},
shadowRadius
:{
type
:
"
f
"
},
shadowMapSize
:{
type
:
"
v2
"
},
shadowMatrix
:{
type
:
"
m4
"
}}},
pointLightsShadowMap
:{
type
:
"
tv
"
,
value
:[]},
hemisphereLights
:{
type
:
"
sa
"
,
value
:[],
properties
:{
direction
:{
type
:
"
v3
"
},
skyColor
:{
type
:
"
c
"
},
groundColor
:{
type
:
"
c
"
}}}},
points
:{
diffuse
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
opacity
:{
type
:
"
f
"
,
value
:
1
},
size
:{
type
:
"
f
"
,
value
:
1
},
scale
:{
type
:
"
f
"
,
value
:
1
},
map
:{
type
:
"
t
"
,
value
:
null
},
offsetRepeat
:{
type
:
"
v4
"
,
value
:
new
THREE
.
Vector4
(
0
,
0
,
1
,
1
)}}};
THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.fog]),vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.uv_pars_vertex,THREE.ShaderChunk.uv2_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.
bsdfs,THREE.ShaderChunk.lights_pars,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars
_vertex,
"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos
_vertex,
THREE.ShaderChunk.
envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.uv_pars_fragment,THREE.ShaderChunk.uv2_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.aomap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog
_pars_fragment,
THREE.ShaderChunk.s
hadowmap_pars_fragment,THREE.ShaderChunk.s
pecularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );",
THREE
.
ShaderLib
=
{
basic
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
aomap
,
THREE
.
UniformsLib
.
fog
]),
vertexShader
:[
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
uv_pars_vertex
,
THREE
.
ShaderChunk
.
uv2_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
uv
_vertex
,
THREE
.
ShaderChunk
.
uv2_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
THREE
.
ShaderChunk
.
skinbase_vertex
,
"
\t
#ifdef USE_ENVMAP
"
,
THREE
.
ShaderChunk
.
beginnormal_vertex
,
THREE
.
ShaderChunk
.
morphnormal_vertex
,
THREE
.
ShaderChunk
.
skinnormal_vertex
,
THREE
.
ShaderChunk
.
defaultnormal_vertex
,
"
\t
#endif
"
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
THREE
.
ShaderChunk
.
envmap
_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
uniform vec3 diffuse;
\n
uniform float opacity;
\n
#ifndef FLAT_SHADED
\n\t
varying vec3 vNormal;
\n
#endif
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
uv_pars_fragment
,
THREE
.
ShaderChunk
.
uv2_pars_fragment
,
THREE
.
ShaderChunk
.
map_pars_fragment
,
THREE
.
ShaderChunk
.
alphamap_pars_fragment
,
THREE
.
ShaderChunk
.
aomap_pars_fragment
,
THREE
.
ShaderChunk
.
envmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap
_pars_fragment
,
THREE
.
ShaderChunk
.
specularmap_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
\n\t
vec4 diffuseColor = vec4( diffuse, opacity );
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
alphamap_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
specularmap_fragment
,
"
\t
ReflectedLight reflectedLight;
\n\t
reflectedLight.directDiffuse = vec3( 0.0 );
\n\t
reflectedLight.directSpecular = vec3( 0.0 );
\n\t
reflectedLight.indirectDiffuse = diffuseColor.rgb;
\n\t
reflectedLight.indirectSpecular = vec3( 0.0 );
"
,
THREE
.
ShaderChunk
.
aomap_fragment
,
"
vec3 outgoingLight = reflectedLight.indirectDiffuse;
"
,
THREE
.
ShaderChunk
.
envmap_fragment
,
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
lambert
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
aomap
,
THREE
.
UniformsLib
.
lightmap
,
THREE
.
UniformsLib
.
emissivemap
,
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
ambient
,
THREE
.
UniformsLib
.
lights
,{
emissive
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0
)}}]),
vertexShader
:[
"
#define LAMBERT
\n
varying vec3 vLightFront;
\n
#ifdef DOUBLE_SIDED
\n\t
varying vec3 vLightBack;
\n
#endif
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
uv_pars_vertex
,
THREE
.
ShaderChunk
.
uv2_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
bsdfs
,
THREE
.
ShaderChunk
.
lights_pars
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
uv_vertex
,
THREE
.
ShaderChunk
.
uv2_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
THREE
.
ShaderChunk
.
beginnormal_vertex
,
THREE
.
ShaderChunk
.
morphnormal_vertex
,
THREE
.
ShaderChunk
.
skinbase_vertex
,
THREE
.
ShaderChunk
.
skinnormal_vertex
,
THREE
.
ShaderChunk
.
defaultnormal_vertex
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
...
...
@@ -565,22 +565,22 @@ THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.emissivemap_pars_frag
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
alphamap_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
specularmap_fragment
,
THREE
.
ShaderChunk
.
emissivemap_fragment
,
"
\t
reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
"
,
THREE
.
ShaderChunk
.
lightmap_fragment
,
"
\t
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
\n\t
#ifdef DOUBLE_SIDED
\n\t\t
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
\n\t
#else
\n\t\t
reflectedLight.directDiffuse = vLightFront;
\n\t
#endif
\n\t
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
"
,
THREE
.
ShaderChunk
.
aomap_fragment
,
"
\t
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;
"
,
THREE
.
ShaderChunk
.
envmap_fragment
,
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
phong
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
aomap
,
THREE
.
UniformsLib
.
lightmap
,
THREE
.
UniformsLib
.
emissivemap
,
THREE
.
UniformsLib
.
bumpmap
,
THREE
.
UniformsLib
.
normalmap
,
THREE
.
UniformsLib
.
displacementmap
,
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
ambient
,
THREE
.
UniformsLib
.
lights
,{
emissive
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0
)},
specular
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
shininess
:{
type
:
"
f
"
,
value
:
30
}}]),
vertexShader
:[
"
#define PHONG
\n
varying vec3 vViewPosition;
\n
#ifndef FLAT_SHADED
\n\t
varying vec3 vNormal;
\n
#endif
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
uv_pars_vertex
,
THREE
.
ShaderChunk
.
uv2_pars_vertex
,
THREE
.
ShaderChunk
.
displacementmap_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE.ShaderChunk.
bsdfs,THREE.ShaderChunk.lights_pars,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase
_vertex,
THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.displacementmap_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex
,
THREE.ShaderChunk.
shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.uv_pars_fragment,THREE.ShaderChunk.uv2_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.aomap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.emissivemap
_pars_fragment,
THREE.ShaderChunk.
envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.bsdfs,THREE.ShaderChunk.ambient_pars,THREE.ShaderChunk.lights_pars,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;"
,
THREE.ShaderChunk.
logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.normal_fragment,THREE.ShaderChunk.emissivemap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lights_template,THREE.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;"
,
THREE.ShaderChunk.
envmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},standard:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.bumpmap,THREE.UniformsLib.normalmap,THREE.UniformsLib.displacementmap,THREE.UniformsLib.roughnessmap,THREE.UniformsLib.metalnessmap,THREE.UniformsLib.fog
,
THREE.UniformsLib.ambient,THREE.UniformsLib.lights,{emissive:{type:"c",value:new THREE.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.uv_pars_vertex,THREE.ShaderChunk.uv2_pars_vertex,THREE.ShaderChunk.displacementmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.bsdfs
,
THREE.ShaderChunk.
lights_pars,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal
_vertex,
THREE.ShaderChunk.d
efaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.d
isplacementmap_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",
THREE
.
ShaderChunk
.
lights_phong_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
uv_vertex
,
THREE
.
ShaderChunk
.
uv2_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
THREE
.
ShaderChunk
.
beginnormal_vertex
,
THREE
.
ShaderChunk
.
morphnormal_vertex
,
THREE
.
ShaderChunk
.
skinbase_vertex
,
THREE
.
ShaderChunk
.
skinnormal_vertex
,
THREE
.
ShaderChunk
.
defaultnormal
_vertex
,
"
#ifndef FLAT_SHADED
\n\t
vNormal = normalize( transformedNormal );
\n
#endif
"
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
displacementmap_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
"
\t
vViewPosition = - mvPosition.xyz;
"
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
lights_phong_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
#define PHONG
\n
uniform vec3 diffuse;
\n
uniform vec3 emissive;
\n
uniform vec3 specular;
\n
uniform float shininess;
\n
uniform float opacity;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
uv_pars_fragment
,
THREE
.
ShaderChunk
.
uv2_pars_fragment
,
THREE
.
ShaderChunk
.
map_pars_fragment
,
THREE
.
ShaderChunk
.
alphamap_pars_fragment
,
THREE
.
ShaderChunk
.
aomap_pars_fragment
,
THREE
.
ShaderChunk
.
lightmap_pars_fragment
,
THREE
.
ShaderChunk
.
emissivemap_pars_fragment
,
THREE
.
ShaderChunk
.
envmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
bsdfs
,
THREE
.
ShaderChunk
.
ambient_pars
,
THREE
.
ShaderChunk
.
lights_pars
,
THREE
.
ShaderChunk
.
lights_phong
_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
THREE
.
ShaderChunk
.
bumpmap_pars_fragment
,
THREE
.
ShaderChunk
.
normalmap_pars_fragment
,
THREE
.
ShaderChunk
.
specularmap_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
\n\t
vec4 diffuseColor = vec4( diffuse, opacity );
\n\t
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
\n\t
vec3 totalEmissiveLight = emissive;
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
alphamap_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
specularmap_fragment
,
THREE
.
ShaderChunk
.
normal_fragment
,
THREE
.
ShaderChunk
.
emissivemap_fragment
,
THREE
.
ShaderChunk
.
lights_phong_fragment
,
THREE
.
ShaderChunk
.
lights_template
,
THREE
.
ShaderChunk
.
aomap_fragment
,
"
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;
"
,
THREE
.
ShaderChunk
.
envmap_fragment
,
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
standard
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
aomap
,
THREE
.
UniformsLib
.
lightmap
,
THREE
.
UniformsLib
.
emissivemap
,
THREE
.
UniformsLib
.
bumpmap
,
THREE
.
UniformsLib
.
normalmap
,
THREE
.
UniformsLib
.
displacementmap
,
THREE
.
UniformsLib
.
roughnessmap
,
THREE
.
UniformsLib
.
metalnessmap
,
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
ambient
,
THREE
.
UniformsLib
.
lights
,{
emissive
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0
)}
,
roughness
:{
type
:
"
f
"
,
value
:.
5
},
metalness
:{
type
:
"
f
"
,
value
:
0
},
envMapIntensity
:{
type
:
"
f
"
,
value
:
1
}}]),
vertexShader
:[
"
#define STANDARD
\n
varying vec3 vViewPosition;
\n
#ifndef FLAT_SHADED
\n\t
varying vec3 vNormal;
\n
#endif
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
uv_pars_vertex
,
THREE
.
ShaderChunk
.
uv2_pars_vertex
,
THREE
.
ShaderChunk
.
displacementmap_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
THREE
.
ShaderChunk
.
specularmap_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
uv_vertex
,
THREE
.
ShaderChunk
.
uv2_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
THREE
.
ShaderChunk
.
beginnormal_vertex
,
THREE
.
ShaderChunk
.
morphnormal_vertex
,
THREE
.
ShaderChunk
.
skinbase_vertex
,
THREE
.
ShaderChunk
.
skinnormal_vertex
,
THREE
.
ShaderChunk
.
defaultnormal_vertex
,
"
#ifndef FLAT_SHADED
\n\t
vNormal = normalize( transformedNormal );
\n
#endif
"
,
THREE
.
ShaderChunk
.
begin
_vertex
,
THREE
.
ShaderChunk
.
displacementmap_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
"
\t
vViewPosition = - mvPosition.xyz;
"
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
#define STANDARD
\n
uniform vec3 diffuse;
\n
uniform vec3 emissive;
\n
uniform float roughness;
\n
uniform float metalness;
\n
uniform float opacity;
\n
uniform float envMapIntensity;
\n
varying vec3 vViewPosition;
\n
#ifndef FLAT_SHADED
\n\t
varying vec3 vNormal;
\n
#endif
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
uv_pars_fragment
,
THREE
.
ShaderChunk
.
uv2_pars_fragment
,
THREE
.
ShaderChunk
.
map_pars_fragment
,
THREE
.
ShaderChunk
.
alphamap_pars_fragment
,
THREE
.
ShaderChunk
.
aomap_pars_fragment
,
THREE
.
ShaderChunk
.
lightmap_pars_fragment
,
THREE
.
ShaderChunk
.
emissivemap_pars_fragment
,
THREE
.
ShaderChunk
.
envmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
bsdfs
,
THREE
.
ShaderChunk
.
ambient_pars
,
THREE
.
ShaderChunk
.
lights_pars
,
THREE
.
ShaderChunk
.
lights_standard_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
THREE
.
ShaderChunk
.
bumpmap_pars_fragment
,
THREE
.
ShaderChunk
.
normalmap_pars_fragment
,
THREE
.
ShaderChunk
.
roughnessmap_pars_fragment
,
THREE
.
ShaderChunk
.
metalnessmap_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
\n\t
vec4 diffuseColor = vec4( diffuse, opacity );
\n\t
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
\n\t
vec3 totalEmissiveLight = emissive;
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
alphamap_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
specularmap_fragment
,
THREE
.
ShaderChunk
.
roughnessmap_fragment
,
THREE
.
ShaderChunk
.
metalnessmap_fragment
,
THREE
.
ShaderChunk
.
normal_fragment
,
THREE
.
ShaderChunk
.
emissivemap_fragment
,
THREE
.
ShaderChunk
.
lights_standard_fragment
,
THREE
.
ShaderChunk
.
lights_template
,
THREE
.
ShaderChunk
.
aomap_fragment
,
"
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;
"
,
THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.points,THREE.UniformsLib.fog]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.common,THREE.ShaderChunk.
bsdfs,THREE.ShaderChunk.lights_pars,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"
,
THREE.ShaderChunk.
color_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.project_vertex,"\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle
_pars_fragment,
THREE.ShaderChunk.
fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}
,
dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,
THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
points
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
points
,
THREE
.
UniformsLib
.
fog
]),
vertexShader
:[
"
uniform float size;
\n
uniform float scale;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
color_vertex
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
"
\t
#ifdef USE_SIZEATTENUATION
\n\t\t
gl_PointSize = size * ( scale / - mvPosition.z );
\n\t
#else
\n\t\t
gl_PointSize = size;
\n\t
#endif
"
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
uniform vec3 diffuse;
\n
uniform float opacity;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
map_particle_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap
_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
\n\t
vec3 outgoingLight = vec3( 0.0 );
\n\t
vec4 diffuseColor = vec4( diffuse, opacity );
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
map_particle_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
"
\t
outgoingLight = diffuseColor.rgb;
"
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
dashed
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
fog
,{
scale
:{
type
:
"
f
"
,
value
:
1
},
dashSize
:{
type
:
"
f
"
,
value
:
1
},
totalSize
:{
type
:
"
f
"
,
value
:
2
}}]),
vertexShader
:[
"
uniform float scale;
\n
attribute float lineDistance;
\n
varying float vLineDistance;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
color_vertex
,
"
\t
vLineDistance = scale * lineDistance;
\n\t
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n\t
gl_Position = projectionMatrix * mvPosition;
"
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
uniform vec3 diffuse;
\n
uniform float opacity;
\n
uniform float dashSize;
\n
uniform float totalSize;
\n
varying float vLineDistance;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
\n\t
if ( mod( vLineDistance, totalSize ) > dashSize ) {
\n\t\t
discard;
\n\t
}
\n\t
vec3 outgoingLight = vec3( 0.0 );
\n\t
vec4 diffuseColor = vec4( diffuse, opacity );
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
"
\t
outgoingLight = diffuseColor.rgb;
"
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
\t
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
\n
}
"
].
join
(
"
\n
"
)},
depth
:{
uniforms
:{
mNear
:{
type
:
"
f
"
,
value
:
1
},
mFar
:{
type
:
"
f
"
,
value
:
2
E3
},
opacity
:{
type
:
"
f
"
,
value
:
1
}},
vertexShader
:[
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
logdepthbuf_vertex
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
uniform float mNear;
\n
uniform float mFar;
\n
uniform float opacity;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
logdepthbuf_pars_fragment
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
logdepthbuf_fragment
,
"
\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\t\t
float depth = gl_FragDepthEXT / gl_FragCoord.w;
\n\t
#else
\n\t\t
float depth = gl_FragCoord.z / gl_FragCoord.w;
\n\t
#endif
\n\t
float color = 1.0 - smoothstep( mNear, mFar, depth );
\n\t
gl_FragColor = vec4( vec3( color ), opacity );
\n
}
"
].
join
(
"
\n
"
)},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录