Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
dc4a2dbb
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,体验更适合开发者的 AI 搜索 >>
提交
dc4a2dbb
编写于
3月 20, 2017
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add MeshStandardMaterialSG
上级
d0af0b58
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
334 addition
and
33 deletion
+334
-33
src/materials/Materials.js
src/materials/Materials.js
+1
-0
src/materials/MeshStandardMaterialSG.js
src/materials/MeshStandardMaterialSG.js
+176
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+51
-16
src/renderers/shaders/ShaderChunk.js
src/renderers/shaders/ShaderChunk.js
+8
-0
src/renderers/shaders/ShaderChunk/glossinessmap_fragment.glsl
...renderers/shaders/ShaderChunk/glossinessmap_fragment.glsl
+10
-0
src/renderers/shaders/ShaderChunk/glossinessmap_pars_fragment.glsl
...rers/shaders/ShaderChunk/glossinessmap_pars_fragment.glsl
+5
-0
src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl
...nderers/shaders/ShaderChunk/lights_physical_fragment.glsl
+14
-7
src/renderers/shaders/ShaderChunk/specular2map_fragment.glsl
src/renderers/shaders/ShaderChunk/specular2map_fragment.glsl
+10
-0
src/renderers/shaders/ShaderChunk/specular2map_pars_fragment.glsl
...erers/shaders/ShaderChunk/specular2map_pars_fragment.glsl
+5
-0
src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl
src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl
+1
-1
src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl
src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl
+1
-1
src/renderers/shaders/ShaderChunk/uv_vertex.glsl
src/renderers/shaders/ShaderChunk/uv_vertex.glsl
+1
-1
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+4
-0
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
+27
-6
src/renderers/shaders/UniformsLib.js
src/renderers/shaders/UniformsLib.js
+12
-0
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+4
-0
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+4
-1
未找到文件。
src/materials/Materials.js
浏览文件 @
dc4a2dbb
...
...
@@ -5,6 +5,7 @@ export { ShaderMaterial } from './ShaderMaterial.js';
export
{
PointsMaterial
}
from
'
./PointsMaterial.js
'
;
export
{
MeshPhysicalMaterial
}
from
'
./MeshPhysicalMaterial.js
'
;
export
{
MeshStandardMaterial
}
from
'
./MeshStandardMaterial.js
'
;
export
{
MeshStandardMaterialSG
}
from
'
./MeshStandardMaterialSG.js
'
;
export
{
MeshPhongMaterial
}
from
'
./MeshPhongMaterial.js
'
;
export
{
MeshToonMaterial
}
from
'
./MeshToonMaterial.js
'
;
export
{
MeshNormalMaterial
}
from
'
./MeshNormalMaterial.js
'
;
...
...
src/materials/MeshStandardMaterialSG.js
0 → 100644
浏览文件 @
dc4a2dbb
import
{
Material
}
from
'
./Material
'
;
import
{
Vector2
}
from
'
../math/Vector2
'
;
import
{
Color
}
from
'
../math/Color
'
;
/**
* @author takahiro / http://github.com/takahirox
*
* parameters = {
* color: <hex>,
* glossiness: <float>,
* specular2: <hex>,
* opacity: <float>,
*
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
* lightMapIntensity: <float>
*
* aoMap: new THREE.Texture( <Image> ),
* aoMapIntensity: <float>
*
* emissive: <hex>,
* emissiveIntensity: <float>
* emissiveMap: new THREE.Texture( <Image> ),
*
* bumpMap: new THREE.Texture( <Image> ),
* bumpScale: <float>,
*
* normalMap: new THREE.Texture( <Image> ),
* normalScale: <Vector2>,
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>,
*
* glossinessMap: new THREE.Texture( <Image> ),
*
* specular2Map: new THREE.Texture( <Image> ),
*
* alphaMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
* envMapIntensity: <float>
*
* refractionRatio: <float>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
*
* skinning: <bool>,
* morphTargets: <bool>,
* morphNormals: <bool>
* }
*/
function
MeshStandardMaterialSG
(
parameters
)
{
Material
.
call
(
this
);
this
.
defines
=
{
'
STANDARD
'
:
''
,
'
STANDARD_SG
'
:
''
};
this
.
type
=
'
MeshStandardMaterialSG
'
;
this
.
color
=
new
Color
(
0xffffff
);
// diffuse
this
.
glossiness
=
0.5
;
this
.
specular2
=
new
Color
(
0x000000
);
this
.
map
=
null
;
this
.
lightMap
=
null
;
this
.
lightMapIntensity
=
1.0
;
this
.
aoMap
=
null
;
this
.
aoMapIntensity
=
1.0
;
this
.
emissive
=
new
Color
(
0x000000
);
this
.
emissiveIntensity
=
1.0
;
this
.
emissiveMap
=
null
;
this
.
bumpMap
=
null
;
this
.
bumpScale
=
1
;
this
.
normalMap
=
null
;
this
.
normalScale
=
new
Vector2
(
1
,
1
);
this
.
displacementMap
=
null
;
this
.
displacementScale
=
1
;
this
.
displacementBias
=
0
;
this
.
glossinessMap
=
null
;
this
.
specular2Map
=
null
;
this
.
alphaMap
=
null
;
this
.
envMap
=
null
;
this
.
envMapIntensity
=
1.0
;
this
.
refractionRatio
=
0.98
;
this
.
wireframe
=
false
;
this
.
wireframeLinewidth
=
1
;
this
.
wireframeLinecap
=
'
round
'
;
this
.
wireframeLinejoin
=
'
round
'
;
this
.
skinning
=
false
;
this
.
morphTargets
=
false
;
this
.
morphNormals
=
false
;
this
.
setValues
(
parameters
);
}
MeshStandardMaterialSG
.
prototype
=
Object
.
create
(
Material
.
prototype
);
MeshStandardMaterialSG
.
prototype
.
constructor
=
MeshStandardMaterialSG
;
MeshStandardMaterialSG
.
prototype
.
isMeshStandardMaterialSG
=
true
;
MeshStandardMaterialSG
.
prototype
.
copy
=
function
(
source
)
{
Material
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
defines
=
{
'
STANDARD
'
:
''
};
this
.
color
.
copy
(
source
.
color
);
this
.
glossiness
=
source
.
glossiness
;
this
.
speculars
.
copy
(
source
.
specular2
);
this
.
map
=
source
.
map
;
this
.
lightMap
=
source
.
lightMap
;
this
.
lightMapIntensity
=
source
.
lightMapIntensity
;
this
.
aoMap
=
source
.
aoMap
;
this
.
aoMapIntensity
=
source
.
aoMapIntensity
;
this
.
emissive
.
copy
(
source
.
emissive
);
this
.
emissiveMap
=
source
.
emissiveMap
;
this
.
emissiveIntensity
=
source
.
emissiveIntensity
;
this
.
bumpMap
=
source
.
bumpMap
;
this
.
bumpScale
=
source
.
bumpScale
;
this
.
normalMap
=
source
.
normalMap
;
this
.
normalScale
.
copy
(
source
.
normalScale
);
this
.
displacementMap
=
source
.
displacementMap
;
this
.
displacementScale
=
source
.
displacementScale
;
this
.
displacementBias
=
source
.
displacementBias
;
this
.
glossinessMap
=
source
.
glossinessMap
;
this
.
specular2Map
=
source
.
specular2Map
;
this
.
alphaMap
=
source
.
alphaMap
;
this
.
envMap
=
source
.
envMap
;
this
.
envMapIntensity
=
source
.
envMapIntensity
;
this
.
refractionRatio
=
source
.
refractionRatio
;
this
.
wireframe
=
source
.
wireframe
;
this
.
wireframeLinewidth
=
source
.
wireframeLinewidth
;
this
.
wireframeLinecap
=
source
.
wireframeLinecap
;
this
.
wireframeLinejoin
=
source
.
wireframeLinejoin
;
this
.
skinning
=
source
.
skinning
;
this
.
morphTargets
=
source
.
morphTargets
;
this
.
morphNormals
=
source
.
morphNormals
;
return
this
;
};
export
{
MeshStandardMaterialSG
};
src/renderers/WebGLRenderer.js
浏览文件 @
dc4a2dbb
...
...
@@ -622,6 +622,7 @@ function WebGLRenderer( parameters ) {
if
(
!
material
.
isMeshPhongMaterial
&&
!
material
.
isMeshStandardMaterial
&&
!
material
.
isMeshStandardMaterialSG
&&
!
material
.
isMeshNormalMaterial
&&
material
.
shading
===
FlatShading
)
{
...
...
@@ -1724,6 +1725,7 @@ function WebGLRenderer( parameters ) {
if
(
material
.
isShaderMaterial
||
material
.
isMeshPhongMaterial
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
envMap
)
{
var
uCamPos
=
p_uniforms
.
map
.
cameraPosition
;
...
...
@@ -1741,6 +1743,7 @@ function WebGLRenderer( parameters ) {
material
.
isMeshLambertMaterial
||
material
.
isMeshBasicMaterial
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
isShaderMaterial
||
material
.
skinning
)
{
...
...
@@ -1837,6 +1840,7 @@ function WebGLRenderer( parameters ) {
material
.
isMeshLambertMaterial
||
material
.
isMeshPhongMaterial
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
isMeshNormalMaterial
||
material
.
isMeshDepthMaterial
)
{
...
...
@@ -1879,6 +1883,10 @@ function WebGLRenderer( parameters ) {
refreshUniformsStandard
(
m_uniforms
,
material
);
}
else
if
(
material
.
isMeshStandardMaterialSG
)
{
refreshUniformsStandardSG
(
m_uniforms
,
material
);
}
else
if
(
material
.
isMeshDepthMaterial
)
{
if
(
material
.
displacementMap
)
{
...
...
@@ -2135,22 +2143,7 @@ function WebGLRenderer( parameters ) {
}
function
refreshUniformsStandard
(
uniforms
,
material
)
{
uniforms
.
roughness
.
value
=
material
.
roughness
;
uniforms
.
metalness
.
value
=
material
.
metalness
;
if
(
material
.
roughnessMap
)
{
uniforms
.
roughnessMap
.
value
=
material
.
roughnessMap
;
}
if
(
material
.
metalnessMap
)
{
uniforms
.
metalnessMap
.
value
=
material
.
metalnessMap
;
}
function
refreshUniformsStandardCommon
(
uniforms
,
material
)
{
if
(
material
.
emissiveMap
)
{
...
...
@@ -2189,6 +2182,48 @@ function WebGLRenderer( parameters ) {
}
function
refreshUniformsStandard
(
uniforms
,
material
)
{
uniforms
.
roughness
.
value
=
material
.
roughness
;
uniforms
.
metalness
.
value
=
material
.
metalness
;
if
(
material
.
roughnessMap
)
{
uniforms
.
roughnessMap
.
value
=
material
.
roughnessMap
;
}
if
(
material
.
metalnessMap
)
{
uniforms
.
metalnessMap
.
value
=
material
.
metalnessMap
;
}
refreshUniformsStandardCommon
(
uniforms
,
material
);
}
function
refreshUniformsStandardSG
(
uniforms
,
material
)
{
uniforms
.
glossiness
.
value
=
material
.
roughness
;
uniforms
.
specular2
.
value
.
copy
(
material
.
specular2
);
if
(
material
.
glossinessMap
)
{
uniforms
.
glossinessMap
.
value
=
material
.
glossinessMap
;
}
if
(
material
.
specular2Map
)
{
uniforms
.
specular2Map
.
value
=
material
.
specular2Map
;
}
refreshUniformsStandardCommon
(
uniforms
,
material
);
}
function
refreshUniformsPhysical
(
uniforms
,
material
)
{
uniforms
.
clearCoat
.
value
=
material
.
clearCoat
;
...
...
src/renderers/shaders/ShaderChunk.js
浏览文件 @
dc4a2dbb
...
...
@@ -32,6 +32,8 @@ import fog_vertex from './ShaderChunk/fog_vertex.glsl';
import
fog_pars_vertex
from
'
./ShaderChunk/fog_pars_vertex.glsl
'
;
import
fog_fragment
from
'
./ShaderChunk/fog_fragment.glsl
'
;
import
fog_pars_fragment
from
'
./ShaderChunk/fog_pars_fragment.glsl
'
;
import
glossinessmap_fragment
from
'
./ShaderChunk/glossinessmap_fragment.glsl
'
;
import
glossinessmap_pars_fragment
from
'
./ShaderChunk/glossinessmap_pars_fragment.glsl
'
;
import
gradientmap_pars_fragment
from
'
./ShaderChunk/gradientmap_pars_fragment.glsl
'
;
import
lightmap_fragment
from
'
./ShaderChunk/lightmap_fragment.glsl
'
;
import
lightmap_pars_fragment
from
'
./ShaderChunk/lightmap_pars_fragment.glsl
'
;
...
...
@@ -73,6 +75,8 @@ import skinning_vertex from './ShaderChunk/skinning_vertex.glsl';
import
skinnormal_vertex
from
'
./ShaderChunk/skinnormal_vertex.glsl
'
;
import
specularmap_fragment
from
'
./ShaderChunk/specularmap_fragment.glsl
'
;
import
specularmap_pars_fragment
from
'
./ShaderChunk/specularmap_pars_fragment.glsl
'
;
import
specular2map_fragment
from
'
./ShaderChunk/specular2map_fragment.glsl
'
;
import
specular2map_pars_fragment
from
'
./ShaderChunk/specular2map_pars_fragment.glsl
'
;
import
tonemapping_fragment
from
'
./ShaderChunk/tonemapping_fragment.glsl
'
;
import
tonemapping_pars_fragment
from
'
./ShaderChunk/tonemapping_pars_fragment.glsl
'
;
import
uv_pars_fragment
from
'
./ShaderChunk/uv_pars_fragment.glsl
'
;
...
...
@@ -143,6 +147,8 @@ export var ShaderChunk = {
fog_pars_vertex
:
fog_pars_vertex
,
fog_fragment
:
fog_fragment
,
fog_pars_fragment
:
fog_pars_fragment
,
glossinessmap_fragment
:
glossinessmap_fragment
,
glossinessmap_pars_fragment
:
glossinessmap_pars_fragment
,
gradientmap_pars_fragment
:
gradientmap_pars_fragment
,
lightmap_fragment
:
lightmap_fragment
,
lightmap_pars_fragment
:
lightmap_pars_fragment
,
...
...
@@ -184,6 +190,8 @@ export var ShaderChunk = {
skinnormal_vertex
:
skinnormal_vertex
,
specularmap_fragment
:
specularmap_fragment
,
specularmap_pars_fragment
:
specularmap_pars_fragment
,
specular2map_fragment
:
specular2map_fragment
,
specular2map_pars_fragment
:
specular2map_pars_fragment
,
tonemapping_fragment
:
tonemapping_fragment
,
tonemapping_pars_fragment
:
tonemapping_pars_fragment
,
uv_pars_fragment
:
uv_pars_fragment
,
...
...
src/renderers/shaders/ShaderChunk/glossinessmap_fragment.glsl
0 → 100644
浏览文件 @
dc4a2dbb
float
glossinessFactor
=
glossiness
;
#ifdef USE_GLOSSINESSMAP
vec4
texelGlossiness
=
texture2D
(
glossinessMap
,
vUv
);
// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture
glossinessFactor
*=
texelGlossiness
.
a
;
#endif
src/renderers/shaders/ShaderChunk/glossinessmap_pars_fragment.glsl
0 → 100644
浏览文件 @
dc4a2dbb
#ifdef USE_GLOSSINESSMAP
uniform
sampler2D
glossinessMap
;
#endif
\ No newline at end of file
src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl
浏览文件 @
dc4a2dbb
PhysicalMaterial
material
;
material
.
diffuseColor
=
diffuseColor
.
rgb
*
(
1
.
0
-
metalnessFactor
);
material
.
specularRoughness
=
clamp
(
roughnessFactor
,
0
.
04
,
1
.
0
);
#ifdef STANDARD
material
.
specularColor
=
mix
(
vec3
(
DEFAULT_SPECULAR_COEFFICIENT
),
diffuseColor
.
rgb
,
metalnessFactor
);
#ifdef STANDARD_SG
material
.
diffuseColor
=
diffuseColor
.
rgb
*
(
1
.
0
-
max
(
max
(
specular2Factor
.
r
,
specular2Factor
.
g
),
specular2Factor
.
b
)
);
material
.
specularRoughness
=
clamp
(
1
.
0
-
glossinessFactor
,
0
.
04
,
1
.
0
);
material
.
specularColor
=
specular2Factor
.
rgb
;
#else
material
.
specularColor
=
mix
(
vec3
(
MAXIMUM_SPECULAR_COEFFICIENT
*
pow2
(
reflectivity
)
),
diffuseColor
.
rgb
,
metalnessFactor
);
material
.
clearCoat
=
saturate
(
clearCoat
);
// Burley clearcoat model
material
.
clearCoatRoughness
=
clamp
(
clearCoatRoughness
,
0
.
04
,
1
.
0
);
material
.
diffuseColor
=
diffuseColor
.
rgb
*
(
1
.
0
-
metalnessFactor
);
material
.
specularRoughness
=
clamp
(
roughnessFactor
,
0
.
04
,
1
.
0
);
#ifdef STANDARD
material
.
specularColor
=
mix
(
vec3
(
DEFAULT_SPECULAR_COEFFICIENT
),
diffuseColor
.
rgb
,
metalnessFactor
);
#else
material
.
specularColor
=
mix
(
vec3
(
MAXIMUM_SPECULAR_COEFFICIENT
*
pow2
(
reflectivity
)
),
diffuseColor
.
rgb
,
metalnessFactor
);
material
.
clearCoat
=
saturate
(
clearCoat
);
// Burley clearcoat model
material
.
clearCoatRoughness
=
clamp
(
clearCoatRoughness
,
0
.
04
,
1
.
0
);
#endif
#endif
src/renderers/shaders/ShaderChunk/specular2map_fragment.glsl
0 → 100644
浏览文件 @
dc4a2dbb
vec3
specular2Factor
=
specular2
;
#ifdef USE_SPECULAR2MAP
vec4
texelSpecular2
=
texture2D
(
specular2Map
,
vUv
);
// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture
specular2Factor
*=
texelSpecular2
.
rgb
;
#endif
\ No newline at end of file
src/renderers/shaders/ShaderChunk/specular2map_pars_fragment.glsl
0 → 100644
浏览文件 @
dc4a2dbb
#ifdef USE_SPECULAR2MAP
uniform
sampler2D
specular2Map
;
#endif
\ No newline at end of file
src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl
浏览文件 @
dc4a2dbb
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
|| defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
varying
vec2
vUv
;
...
...
src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl
浏览文件 @
dc4a2dbb
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
|| defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
varying
vec2
vUv
;
uniform
vec4
offsetRepeat
;
...
...
src/renderers/shaders/ShaderChunk/uv_vertex.glsl
浏览文件 @
dc4a2dbb
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
|| defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
vUv
=
uv
*
offsetRepeat
.
zw
+
offsetRepeat
.
xy
;
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
dc4a2dbb
...
...
@@ -82,12 +82,16 @@ var ShaderLib = {
UniformsLib
.
displacementmap
,
UniformsLib
.
roughnessmap
,
UniformsLib
.
metalnessmap
,
UniformsLib
.
glossinessmap
,
UniformsLib
.
specular2map
,
UniformsLib
.
fog
,
UniformsLib
.
lights
,
{
emissive
:
{
value
:
new
Color
(
0x000000
)
},
roughness
:
{
value
:
0.5
},
metalness
:
{
value
:
0
},
glossiness
:
{
value
:
0.5
},
specular2
:
{
value
:
new
Color
(
0x000000
)
},
envMapIntensity
:
{
value
:
1
}
// temporary
}
]
),
...
...
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
浏览文件 @
dc4a2dbb
...
...
@@ -2,8 +2,15 @@
uniform
vec3
diffuse
;
uniform
vec3
emissive
;
uniform
float
roughness
;
uniform
float
metalness
;
#ifdef STANDARD_SG
uniform
float
glossiness
;
uniform
vec3
specular2
;
#else
uniform
float
roughness
;
uniform
float
metalness
;
#endif
uniform
float
opacity
;
#ifndef STANDARD
...
...
@@ -38,8 +45,15 @@ varying vec3 vViewPosition;
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#ifdef STANDARD_SG
#include <glossinessmap_pars_fragment>
#include <specular2map_pars_fragment>
#else
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#endif
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
...
...
@@ -57,8 +71,15 @@ void main() {
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#ifdef STANDARD_SG
#include <glossinessmap_fragment>
#include <specular2map_fragment>
#else
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#endif
#include <normal_flip>
#include <normal_fragment>
#include <emissivemap_fragment>
...
...
src/renderers/shaders/UniformsLib.js
浏览文件 @
dc4a2dbb
...
...
@@ -87,6 +87,18 @@ var UniformsLib = {
},
glossinessmap
:
{
glossinessMap
:
{
value
:
null
}
},
specular2map
:
{
specular2Map
:
{
value
:
null
}
},
fog
:
{
fogDensity
:
{
value
:
0.00025
},
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
dc4a2dbb
...
...
@@ -338,6 +338,8 @@ function WebGLProgram( renderer, code, material, parameters ) {
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
parameters
.
metalnessMap
?
'
#define USE_METALNESSMAP
'
:
''
,
parameters
.
glossinessMap
?
'
#define USE_GLOSSINESSMAP
'
:
''
,
parameters
.
specular2Map
?
'
#define USE_SPECULAR2MAP
'
:
''
,
parameters
.
alphaMap
?
'
#define USE_ALPHAMAP
'
:
''
,
parameters
.
vertexColors
?
'
#define USE_COLOR
'
:
''
,
...
...
@@ -445,6 +447,8 @@ function WebGLProgram( renderer, code, material, parameters ) {
parameters
.
specularMap
?
'
#define USE_SPECULARMAP
'
:
''
,
parameters
.
roughnessMap
?
'
#define USE_ROUGHNESSMAP
'
:
''
,
parameters
.
metalnessMap
?
'
#define USE_METALNESSMAP
'
:
''
,
parameters
.
glossinessMap
?
'
#define USE_GLOSSINESSMAP
'
:
''
,
parameters
.
specular2Map
?
'
#define USE_SPECULAR2MAP
'
:
''
,
parameters
.
alphaMap
?
'
#define USE_ALPHAMAP
'
:
''
,
parameters
.
vertexColors
?
'
#define USE_COLOR
'
:
''
,
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
dc4a2dbb
...
...
@@ -17,6 +17,7 @@ function WebGLPrograms( renderer, capabilities ) {
MeshPhongMaterial
:
'
phong
'
,
MeshToonMaterial
:
'
phong
'
,
MeshStandardMaterial
:
'
physical
'
,
MeshStandardMaterialSG
:
'
physical
'
,
MeshPhysicalMaterial
:
'
physical
'
,
LineBasicMaterial
:
'
basic
'
,
LineDashedMaterial
:
'
dashed
'
,
...
...
@@ -26,7 +27,7 @@ function WebGLPrograms( renderer, capabilities ) {
var
parameterNames
=
[
"
precision
"
,
"
supportsVertexTextures
"
,
"
map
"
,
"
mapEncoding
"
,
"
envMap
"
,
"
envMapMode
"
,
"
envMapEncoding
"
,
"
lightMap
"
,
"
aoMap
"
,
"
emissiveMap
"
,
"
emissiveMapEncoding
"
,
"
bumpMap
"
,
"
normalMap
"
,
"
displacementMap
"
,
"
specularMap
"
,
"
roughnessMap
"
,
"
metalnessMap
"
,
"
gradientMap
"
,
"
roughnessMap
"
,
"
metalnessMap
"
,
"
gradientMap
"
,
"
glossinessMap
"
,
"
specular2Map
"
,
"
alphaMap
"
,
"
combine
"
,
"
vertexColors
"
,
"
fog
"
,
"
useFog
"
,
"
fogExp
"
,
"
flatShading
"
,
"
sizeAttenuation
"
,
"
logarithmicDepthBuffer
"
,
"
skinning
"
,
"
maxBones
"
,
"
useVertexTexture
"
,
"
morphTargets
"
,
"
morphNormals
"
,
...
...
@@ -149,6 +150,8 @@ function WebGLPrograms( renderer, capabilities ) {
displacementMap
:
!!
material
.
displacementMap
,
roughnessMap
:
!!
material
.
roughnessMap
,
metalnessMap
:
!!
material
.
metalnessMap
,
glossinessMap
:
!!
material
.
glossinessMap
,
specular2Map
:
!!
material
.
specular2Map
,
specularMap
:
!!
material
.
specularMap
,
alphaMap
:
!!
material
.
alphaMap
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录