Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ecd9515c
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,发现更多精彩内容 >>
提交
ecd9515c
编写于
4月 09, 2017
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Make MeshStandardMaterialCommon"
This reverts commit
225dabda
.
上级
f9190b50
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
259 addition
and
183 deletion
+259
-183
src/materials/Materials.js
src/materials/Materials.js
+0
-1
src/materials/MeshStandardMaterial.js
src/materials/MeshStandardMaterial.js
+122
-6
src/materials/MeshStandardMaterialCommon.js
src/materials/MeshStandardMaterialCommon.js
+0
-159
src/materials/MeshStandardMaterialSG.js
src/materials/MeshStandardMaterialSG.js
+122
-6
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+8
-4
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
...rs/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
+5
-5
src/renderers/shaders/ShaderChunk/lights_template.glsl
src/renderers/shaders/ShaderChunk/lights_template.glsl
+1
-1
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
+1
-1
未找到文件。
src/materials/Materials.js
浏览文件 @
ecd9515c
...
...
@@ -4,7 +4,6 @@ export { RawShaderMaterial } from './RawShaderMaterial.js';
export
{
ShaderMaterial
}
from
'
./ShaderMaterial.js
'
;
export
{
PointsMaterial
}
from
'
./PointsMaterial.js
'
;
export
{
MeshPhysicalMaterial
}
from
'
./MeshPhysicalMaterial.js
'
;
export
{
MeshStandardMaterialCommon
}
from
'
./MeshStandardMaterialCommon.js
'
;
export
{
MeshStandardMaterial
}
from
'
./MeshStandardMaterial.js
'
;
export
{
MeshStandardMaterialSG
}
from
'
./MeshStandardMaterialSG.js
'
;
export
{
MeshPhongMaterial
}
from
'
./MeshPhongMaterial.js
'
;
...
...
src/materials/MeshStandardMaterial.js
浏览文件 @
ecd9515c
import
{
M
eshStandardMaterialCommon
}
from
'
./MeshStandardMaterialCommon
'
;
import
{
M
aterial
}
from
'
./Material
'
;
import
{
Vector2
}
from
'
../math/Vector2
'
;
import
{
Color
}
from
'
../math/Color
'
;
...
...
@@ -6,52 +6,168 @@ import { Color } from '../math/Color';
* @author WestLangley / http://github.com/WestLangley
*
* parameters = {
* color: <hex>,
* roughness: <float>,
* metalness: <float>,
* 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>,
*
* roughnessMap: new THREE.Texture( <Image> ),
*
* metalnessMap: 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
MeshStandardMaterial
(
parameters
)
{
M
eshStandardMaterialCommon
.
call
(
this
);
M
aterial
.
call
(
this
);
this
.
defines
[
'
STANDARD
'
]
=
''
;
this
.
defines
=
{
'
STANDARD
'
:
''
}
;
this
.
type
=
'
MeshStandardMaterial
'
;
this
.
color
=
new
Color
(
0xffffff
);
// diffuse
this
.
roughness
=
0.5
;
this
.
metalness
=
0.5
;
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
.
roughnessMap
=
null
;
this
.
metalnessMap
=
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
);
}
MeshStandardMaterial
.
prototype
=
Object
.
create
(
M
eshStandardMaterialCommon
.
prototype
);
MeshStandardMaterial
.
prototype
=
Object
.
create
(
M
aterial
.
prototype
);
MeshStandardMaterial
.
prototype
.
constructor
=
MeshStandardMaterial
;
MeshStandardMaterial
.
prototype
.
isMeshStandardMaterial
=
true
;
MeshStandardMaterial
.
prototype
.
copy
=
function
(
source
)
{
M
eshStandardMaterialCommon
.
prototype
.
copy
.
call
(
this
,
source
);
M
aterial
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
defines
[
'
STANDARD
'
]
=
''
;
this
.
defines
=
{
'
STANDARD
'
:
''
}
;
this
.
color
.
copy
(
source
.
color
);
this
.
roughness
=
source
.
roughness
;
this
.
metalness
=
source
.
metalness
;
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
.
roughnessMap
=
source
.
roughnessMap
;
this
.
metalnessMap
=
source
.
metalnessMap
;
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
;
};
...
...
src/materials/MeshStandardMaterialCommon.js
已删除
100644 → 0
浏览文件 @
f9190b50
import
{
Material
}
from
'
./Material
'
;
import
{
Vector2
}
from
'
../math/Vector2
'
;
import
{
Color
}
from
'
../math/Color
'
;
/**
* @author WestLangley / http://github.com/WestLangley
* @author takahiro / http://github.com/takahirox
*
* parameters = {
* color: <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>,
*
* 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
MeshStandardMaterialCommon
(
parameters
)
{
Material
.
call
(
this
);
this
.
defines
=
{
'
STANDARD_COMMON
'
:
''
};
this
.
type
=
'
MeshStandardMaterialCommon
'
;
this
.
color
=
new
Color
(
0xffffff
);
// diffuse
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
.
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
);
}
MeshStandardMaterialCommon
.
prototype
=
Object
.
create
(
Material
.
prototype
);
MeshStandardMaterialCommon
.
prototype
.
constructor
=
MeshStandardMaterialCommon
;
MeshStandardMaterialCommon
.
prototype
.
isMeshStandardMaterialCommon
=
true
;
MeshStandardMaterialCommon
.
prototype
.
copy
=
function
(
source
)
{
Material
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
defines
=
{
'
STANDARD_COMMON
'
:
''
};
this
.
color
.
copy
(
source
.
color
);
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
.
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
{
MeshStandardMaterialCommon
};
src/materials/MeshStandardMaterialSG.js
浏览文件 @
ecd9515c
import
{
M
eshStandardMaterialCommon
}
from
'
./MeshStandardMaterialCommon
'
;
import
{
M
aterial
}
from
'
./Material
'
;
import
{
Vector2
}
from
'
../math/Vector2
'
;
import
{
Color
}
from
'
../math/Color
'
;
...
...
@@ -6,52 +6,168 @@ 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
)
{
M
eshStandardMaterialCommon
.
call
(
this
);
M
aterial
.
call
(
this
);
this
.
defines
[
'
STANDARD_SG
'
]
=
''
;
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
(
M
eshStandardMaterialCommon
.
prototype
);
MeshStandardMaterialSG
.
prototype
=
Object
.
create
(
M
aterial
.
prototype
);
MeshStandardMaterialSG
.
prototype
.
constructor
=
MeshStandardMaterialSG
;
MeshStandardMaterialSG
.
prototype
.
isMeshStandardMaterialSG
=
true
;
MeshStandardMaterialSG
.
prototype
.
copy
=
function
(
source
)
{
M
eshStandardMaterialCommon
.
prototype
.
copy
.
call
(
this
,
source
);
M
aterial
.
prototype
.
copy
.
call
(
this
,
source
);
this
.
defines
[
'
STANDARD_SG
'
]
=
''
;
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
;
};
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
ecd9515c
...
...
@@ -622,7 +622,8 @@ function WebGLRenderer( parameters ) {
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
buffers
.
normal
);
if
(
!
material
.
isMeshPhongMaterial
&&
!
material
.
isMeshStandardMaterialCommon
&&
!
material
.
isMeshStandardMaterial
&&
!
material
.
isMeshStandardMaterialSG
&&
!
material
.
isMeshNormalMaterial
&&
material
.
shading
===
FlatShading
)
{
...
...
@@ -1722,7 +1723,8 @@ function WebGLRenderer( parameters ) {
if
(
material
.
isShaderMaterial
||
material
.
isMeshPhongMaterial
||
material
.
isMeshStandardMaterialCommon
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
envMap
)
{
var
uCamPos
=
p_uniforms
.
map
.
cameraPosition
;
...
...
@@ -1739,7 +1741,8 @@ function WebGLRenderer( parameters ) {
if
(
material
.
isMeshPhongMaterial
||
material
.
isMeshLambertMaterial
||
material
.
isMeshBasicMaterial
||
material
.
isMeshStandardMaterialCommon
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
isShaderMaterial
||
material
.
skinning
)
{
...
...
@@ -1835,7 +1838,8 @@ function WebGLRenderer( parameters ) {
if
(
material
.
isMeshBasicMaterial
||
material
.
isMeshLambertMaterial
||
material
.
isMeshPhongMaterial
||
material
.
isMeshStandardMaterialCommon
||
material
.
isMeshStandardMaterial
||
material
.
isMeshStandardMaterialSG
||
material
.
isMeshNormalMaterial
||
material
.
isMeshDepthMaterial
)
{
...
...
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl
浏览文件 @
ecd9515c
...
...
@@ -4,7 +4,7 @@ struct PhysicalMaterial {
float
specularRoughness
;
vec3
specularColor
;
#ifndef STANDARD
_COMMON
#ifndef STANDARD
float
clearCoat
;
float
clearCoatRoughness
;
#endif
...
...
@@ -56,7 +56,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
#endif
#ifndef STANDARD
_COMMON
#ifndef STANDARD
float
clearCoatDHR
=
material
.
clearCoat
*
clearCoatDHRApprox
(
material
.
clearCoatRoughness
,
dotNL
);
#else
float
clearCoatDHR
=
0
.
0
;
...
...
@@ -65,7 +65,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
reflectedLight
.
directSpecular
+=
(
1
.
0
-
clearCoatDHR
)
*
irradiance
*
BRDF_Specular_GGX
(
directLight
,
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
reflectedLight
.
directDiffuse
+=
(
1
.
0
-
clearCoatDHR
)
*
irradiance
*
BRDF_Diffuse_Lambert
(
material
.
diffuseColor
);
#ifndef STANDARD
_COMMON
#ifndef STANDARD
reflectedLight
.
directSpecular
+=
irradiance
*
material
.
clearCoat
*
BRDF_Specular_GGX
(
directLight
,
geometry
,
vec3
(
DEFAULT_SPECULAR_COEFFICIENT
),
material
.
clearCoatRoughness
);
...
...
@@ -81,7 +81,7 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo
void
RE_IndirectSpecular_Physical
(
const
in
vec3
radiance
,
const
in
vec3
clearCoatRadiance
,
const
in
GeometricContext
geometry
,
const
in
PhysicalMaterial
material
,
inout
ReflectedLight
reflectedLight
)
{
#ifndef STANDARD
_COMMON
#ifndef STANDARD
float
dotNV
=
saturate
(
dot
(
geometry
.
normal
,
geometry
.
viewDir
)
);
float
dotNL
=
dotNV
;
float
clearCoatDHR
=
material
.
clearCoat
*
clearCoatDHRApprox
(
material
.
clearCoatRoughness
,
dotNL
);
...
...
@@ -91,7 +91,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCo
reflectedLight
.
indirectSpecular
+=
(
1
.
0
-
clearCoatDHR
)
*
radiance
*
BRDF_Specular_GGX_Environment
(
geometry
,
material
.
specularColor
,
material
.
specularRoughness
);
#ifndef STANDARD
_COMMON
#ifndef STANDARD
reflectedLight
.
indirectSpecular
+=
clearCoatRadiance
*
material
.
clearCoat
*
BRDF_Specular_GGX_Environment
(
geometry
,
vec3
(
DEFAULT_SPECULAR_COEFFICIENT
),
material
.
clearCoatRoughness
);
...
...
src/renderers/shaders/ShaderChunk/lights_template.glsl
浏览文件 @
ecd9515c
...
...
@@ -138,7 +138,7 @@ IncidentLight directLight;
// TODO, replace 8 with the real maxMIPLevel
vec3
radiance
=
getLightProbeIndirectRadiance
(
/*specularLightProbe,*/
geometry
,
Material_BlinnShininessExponent
(
material
),
8
);
#ifndef STANDARD
_COMMON
#ifndef STANDARD
vec3
clearCoatRadiance
=
getLightProbeIndirectRadiance
(
/*specularLightProbe,*/
geometry
,
Material_ClearCoat_BlinnShininessExponent
(
material
),
8
);
#else
vec3
clearCoatRadiance
=
vec3
(
0
.
0
);
...
...
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl
浏览文件 @
ecd9515c
...
...
@@ -13,7 +13,7 @@ uniform vec3 emissive;
uniform
float
opacity
;
#ifndef STANDARD
_COMMON
#ifndef STANDARD
uniform
float
clearCoat
;
uniform
float
clearCoatRoughness
;
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录