Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
94894c12
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,体验更适合开发者的 AI 搜索 >>
提交
94894c12
编写于
10月 09, 2019
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MeshPhysicalMaterial: Initialise sheen by default and only use when is not black.
上级
b67fb442
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
33 deletion
+25
-33
examples/webgl_materials_physical_sheen.html
examples/webgl_materials_physical_sheen.html
+17
-26
src/materials/Material.js
src/materials/Material.js
+3
-1
src/materials/MeshPhysicalMaterial.d.ts
src/materials/MeshPhysicalMaterial.d.ts
+1
-1
src/materials/MeshPhysicalMaterial.js
src/materials/MeshPhysicalMaterial.js
+2
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+1
-1
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+1
-1
未找到文件。
examples/webgl_materials_physical_sheen.html
浏览文件 @
94894c12
...
...
@@ -37,7 +37,6 @@
var
params
=
{
nodeMaterial
:
true
,
color
:
new
THREE
.
Color
(
255
,
0
,
127
),
sheenBRDF
:
true
,
sheen
:
new
THREE
.
Color
(
10
,
10
,
10
),
// corresponds to .04 reflectance
roughness
:
.
9
,
exposure
:
2
,
...
...
@@ -46,7 +45,7 @@
// model
new
FBXLoader
().
load
(
'
models/fbx/cloth.fbx
'
,
function
(
loadedModel
)
{
mesh
=
loadedModel
.
children
[
0
];
mesh
=
loadedModel
.
children
[
0
];
init
();
...
...
@@ -75,6 +74,7 @@
nodeMaterial
.
metalness
=
new
Nodes
.
FloatNode
(
0
);
nodeMaterial
.
roughness
=
new
Nodes
.
FloatNode
();
nodeMaterial
.
color
=
new
Nodes
.
ColorNode
(
params
.
color
.
clone
()
);
nodeMaterial
.
sheen
=
new
Nodes
.
ColorNode
(
params
.
sheen
.
clone
()
);
//
...
...
@@ -82,7 +82,7 @@
new
THREE
.
SphereBufferGeometry
(
1
,
100
,
100
),
material
);
scene
.
add
(
sphere
);
scene
.
add
(
sphere
);
camera
.
position
.
set
(
-
12
,
7
,
4
);
...
...
@@ -120,28 +120,27 @@
function
onUpdate
()
{
mesh
.
material
=
sphere
.
material
=
params
.
nodeMaterial
?
nodeMaterial
:
material
;
mesh
.
material
=
sphere
.
material
=
params
.
nodeMaterial
?
nodeMaterial
:
material
;
material
.
sheen
=
params
.
sheenBRDF
?
new
THREE
.
Color
()
:
null
;
}
function
onSheenUpdate
()
{
var
newSheenEnabled
=
params
.
color
.
r
>
0
||
params
.
color
.
g
>
0
||
params
.
color
.
b
>
0
;
var
oldSheenEnabled
=
material
.
sheen
.
r
>
0
||
material
.
sheen
.
g
>
0
||
material
.
sheen
.
b
>
0
;
material
.
needsUpdate
=
true
;
if
(
newSheenEnabled
!==
oldSheenEnabled
)
{
nodeMaterial
.
sheen
=
params
.
sheenBRDF
?
new
Nodes
.
ColorNode
(
material
.
sheen
)
:
undefined
;
material
.
needsUpdate
=
true
;
nodeMaterial
.
needsCompile
=
true
;
nodeMaterial
.
needsCompile
=
true
;
}
}
gui
.
add
(
params
,
'
nodeMaterial
'
).
onChange
(
onUpdate
);
gui
.
addColor
(
params
,
'
color
'
);
gui
.
add
(
params
,
'
sheenBRDF
'
).
onChange
(
onUpdate
);
gui
.
addColor
(
params
,
'
sheen
'
);
gui
.
addColor
(
params
,
'
sheen
'
).
onChange
(
onSheenUpdate
);
gui
.
add
(
params
,
'
roughness
'
,
0
,
1
);
gui
.
add
(
params
,
'
exposure
'
,
0
,
3
);
gui
.
open
();
...
...
@@ -172,26 +171,18 @@
function
render
()
{
//
material
.
color
.
copy
(
params
.
color
).
multiplyScalar
(
1
/
255
);
material
.
sheen
.
copy
(
params
.
sheen
).
multiplyScalar
(
1
/
255
);
material
.
roughness
=
params
.
roughness
;
//
nodeMaterial
.
color
.
value
.
copy
(
material
.
color
);
nodeMaterial
.
sheen
.
value
.
copy
(
params
.
sheen
).
multiplyScalar
(
1
/
255
);
nodeMaterial
.
roughness
.
value
=
params
.
roughness
;
//
if
(
params
.
sheenBRDF
)
{
material
.
sheen
.
copy
(
params
.
sheen
).
multiplyScalar
(
1
/
255
);
}
//
renderer
.
toneMappingExposure
=
params
.
exposure
;
renderer
.
render
(
scene
,
camera
);
...
...
src/materials/Material.js
浏览文件 @
94894c12
...
...
@@ -169,12 +169,12 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if
(
this
.
roughness
!==
undefined
)
data
.
roughness
=
this
.
roughness
;
if
(
this
.
metalness
!==
undefined
)
data
.
metalness
=
this
.
metalness
;
if
(
this
.
sheen
&&
this
.
sheen
.
isColor
)
data
.
sheen
=
this
.
sheen
.
getHex
();
if
(
this
.
emissive
&&
this
.
emissive
.
isColor
)
data
.
emissive
=
this
.
emissive
.
getHex
();
if
(
this
.
emissiveIntensity
&&
this
.
emissiveIntensity
!==
1
)
data
.
emissiveIntensity
=
this
.
emissiveIntensity
;
if
(
this
.
specular
&&
this
.
specular
.
isColor
)
data
.
specular
=
this
.
specular
.
getHex
();
if
(
this
.
shininess
!==
undefined
)
data
.
shininess
=
this
.
shininess
;
if
(
this
.
clearcoat
!==
undefined
)
data
.
clearcoat
=
this
.
clearcoat
;
if
(
this
.
clearcoatRoughness
!==
undefined
)
data
.
clearcoatRoughness
=
this
.
clearcoatRoughness
;
...
...
@@ -185,6 +185,8 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
}
if
(
this
.
sheen
&&
this
.
sheen
.
isColor
)
data
.
sheen
=
this
.
sheen
.
getHex
();
if
(
this
.
map
&&
this
.
map
.
isTexture
)
data
.
map
=
this
.
map
.
toJSON
(
meta
).
uuid
;
if
(
this
.
matcap
&&
this
.
matcap
.
isTexture
)
data
.
matcap
=
this
.
matcap
.
toJSON
(
meta
).
uuid
;
if
(
this
.
alphaMap
&&
this
.
alphaMap
.
isTexture
)
data
.
alphaMap
=
this
.
alphaMap
.
toJSON
(
meta
).
uuid
;
...
...
src/materials/MeshPhysicalMaterial.d.ts
浏览文件 @
94894c12
...
...
@@ -27,7 +27,7 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial {
clearcoat
:
number
;
clearcoatRoughness
:
number
;
sheen
:
Color
|
null
;
sheen
:
Color
;
clearcoatNormalScale
:
Vector2
;
clearcoatNormalMap
:
Texture
|
null
;
...
...
src/materials/MeshPhysicalMaterial.js
浏览文件 @
94894c12
...
...
@@ -35,7 +35,7 @@ function MeshPhysicalMaterial( parameters ) {
this
.
clearcoat
=
0.0
;
this
.
clearcoatRoughness
=
0.0
;
this
.
sheen
=
n
ull
;
// null will disable sheen bsdf
this
.
sheen
=
n
ew
Color
(
0x000000
);
this
.
clearcoatNormalScale
=
new
Vector2
(
1
,
1
);
this
.
clearcoatNormalMap
=
null
;
...
...
@@ -67,8 +67,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
this
.
clearcoat
=
source
.
clearcoat
;
this
.
clearcoatRoughness
=
source
.
clearcoatRoughness
;
if
(
source
.
sheen
)
this
.
sheen
=
(
this
.
sheen
||
new
Color
()
).
copy
(
source
.
sheen
);
else
this
.
sheen
=
null
;
this
.
sheen
.
copy
(
source
.
sheen
);
this
.
clearcoatNormalMap
=
source
.
clearcoatNormalMap
;
this
.
clearcoatNormalScale
.
copy
(
source
.
clearcoatNormalScale
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
94894c12
...
...
@@ -2385,7 +2385,7 @@ function WebGLRenderer( parameters ) {
uniforms
.
clearcoat
.
value
=
material
.
clearcoat
;
uniforms
.
clearcoatRoughness
.
value
=
material
.
clearcoatRoughness
;
if
(
material
.
sheen
)
uniforms
.
sheen
.
value
.
copy
(
material
.
sheen
);
uniforms
.
sheen
.
value
.
copy
(
material
.
sheen
);
if
(
material
.
clearcoatNormalMap
)
{
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
94894c12
...
...
@@ -179,7 +179,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
gradientMap
:
!!
material
.
gradientMap
,
sheen
:
!!
material
.
sheen
,
sheen
:
material
.
sheen
&&
(
material
.
sheen
.
r
>
0
||
material
.
sheen
.
g
>
0
||
material
.
sheen
.
b
>
0
)
,
combine
:
material
.
combine
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录