Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
22fce3b1
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,发现更多精彩内容 >>
提交
22fce3b1
编写于
8月 20, 2019
作者:
D
Daniel Sturk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed StandardNodeMaterial's sheen
上级
74e5482d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
61 addition
and
32 deletion
+61
-32
examples/jsm/nodes/materials/StandardNodeMaterial.js
examples/jsm/nodes/materials/StandardNodeMaterial.js
+1
-1
examples/jsm/nodes/materials/nodes/StandardNode.js
examples/jsm/nodes/materials/nodes/StandardNode.js
+9
-9
examples/webgl_materials_nodes.html
examples/webgl_materials_nodes.html
+0
-10
examples/webgl_materials_sheen.html
examples/webgl_materials_sheen.html
+50
-11
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
...shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
+1
-1
未找到文件。
examples/jsm/nodes/materials/StandardNodeMaterial.js
浏览文件 @
22fce3b1
...
...
@@ -36,7 +36,7 @@ NodeUtils.addShortcuts( StandardNodeMaterial.prototype, 'fragment', [
'
environment
'
,
'
mask
'
,
'
position
'
,
'
sheen
'
'
sheen
Color
'
]
);
export
{
StandardNodeMaterial
};
examples/jsm/nodes/materials/nodes/StandardNode.js
浏览文件 @
22fce3b1
...
...
@@ -32,7 +32,7 @@ StandardNode.prototype.build = function ( builder ) {
var
code
;
builder
.
define
(
this
.
clearCoat
||
this
.
clearCoatRoughness
||
this
.
sheen
?
'
PHYSICAL
'
:
'
STANDARD
'
);
builder
.
define
(
this
.
clearCoat
||
this
.
clearCoatRoughness
?
'
PHYSICAL
'
:
'
STANDARD
'
);
if
(
this
.
energyPreservation
)
builder
.
define
(
'
ENERGY_PRESERVATION
'
);
...
...
@@ -162,17 +162,17 @@ StandardNode.prototype.build = function ( builder ) {
// isolate environment from others inputs ( see TextureNode, CubeTextureNode )
// environment.analyze will detect if there is a need of calculate irradiance
this
.
environment
.
analyze
(
builder
,
{
cache
:
'
radiance
'
,
context
:
contextEnvironment
,
slot
:
'
radiance
'
}
);
this
.
environment
.
analyze
(
builder
,
{
cache
:
'
radiance
'
,
context
:
contextEnvironment
,
slot
:
'
radiance
'
}
);
if
(
builder
.
requires
.
irradiance
)
{
this
.
environment
.
analyze
(
builder
,
{
cache
:
'
irradiance
'
,
context
:
contextEnvironment
,
slot
:
'
irradiance
'
}
);
this
.
environment
.
analyze
(
builder
,
{
cache
:
'
irradiance
'
,
context
:
contextEnvironment
,
slot
:
'
irradiance
'
}
);
}
}
if
(
this
.
sheen
)
this
.
sheen
.
analyze
(
builder
);
if
(
this
.
sheen
Color
)
this
.
sheenColor
.
analyze
(
builder
);
// build code
...
...
@@ -216,7 +216,7 @@ StandardNode.prototype.build = function ( builder ) {
var
clearCoatEnv
=
useClearCoat
&&
environment
?
this
.
environment
.
flow
(
builder
,
'
c
'
,
{
cache
:
'
clearCoat
'
,
context
:
contextEnvironment
,
slot
:
'
environment
'
}
)
:
undefined
;
var
sheen
=
!
builder
.
isDefined
(
'
STANDARD
'
)
&&
this
.
sheen
?
this
.
sheen
.
flow
(
builder
,
'
f
'
)
:
undefined
;
var
sheen
Color
=
this
.
sheenColor
?
this
.
sheenColor
.
flow
(
builder
,
'
c
'
)
:
undefined
;
builder
.
requires
.
transparent
=
alpha
!==
undefined
;
...
...
@@ -328,9 +328,9 @@ StandardNode.prototype.build = function ( builder ) {
}
if
(
sheen
)
{
if
(
sheen
Color
)
{
output
.
push
(
'
material.sheen
=
'
+
sheen
.
result
+
'
;
'
);
output
.
push
(
'
material.sheen
Color =
'
+
sheenColor
.
result
+
'
;
'
);
}
...
...
@@ -506,7 +506,7 @@ StandardNode.prototype.copy = function ( source ) {
if
(
source
.
environment
)
this
.
environment
=
source
.
environment
;
if
(
source
.
sheen
)
this
.
sheen
=
source
.
sheen
;
if
(
source
.
sheen
Color
)
this
.
sheenColor
=
source
.
sheenColor
;
return
this
;
...
...
@@ -551,7 +551,7 @@ StandardNode.prototype.toJSON = function ( meta ) {
if
(
this
.
environment
)
data
.
environment
=
this
.
environment
.
toJSON
(
meta
).
uuid
;
if
(
this
.
sheen
)
data
.
sheen
=
this
.
sheen
.
toJSON
(
meta
).
uuid
;
if
(
this
.
sheen
Color
)
data
.
sheenColor
=
this
.
sheenColor
.
toJSON
(
meta
).
uuid
;
}
...
...
examples/webgl_materials_nodes.html
浏览文件 @
22fce3b1
...
...
@@ -800,8 +800,6 @@
Nodes
.
OperatorNode
.
MUL
);
var
sheen
=
new
Nodes
.
FloatNode
(.
5
);
mtl
.
color
=
new
Nodes
.
ColorNode
(
0xEEEEEE
);
mtl
.
roughness
=
roughness
;
mtl
.
metalness
=
metalness
;
...
...
@@ -812,8 +810,6 @@
mtl
.
normal
=
new
Nodes
.
NormalMapNode
(
new
Nodes
.
TextureNode
(
getTexture
(
"
grassNormal
"
)
)
);
mtl
.
normal
.
scale
=
normalMask
;
mtl
.
sheen
=
sheen
;
// GUI
addGui
(
'
color
'
,
mtl
.
color
.
value
.
getHex
(),
function
(
val
)
{
...
...
@@ -870,12 +866,6 @@
},
false
,
0
,
1
);
addGui
(
'
sheen
'
,
sheen
.
value
,
function
(
val
)
{
sheen
.
value
=
val
;
},
false
,
0
,
1
);
break
;
case
'
wave
'
:
...
...
examples/webgl_materials_sheen.html
浏览文件 @
22fce3b1
...
...
@@ -20,6 +20,8 @@
import
*
as
THREE
from
'
../build/three.module.js
'
;
import
*
as
Nodes
from
'
./jsm/nodes/Nodes.js
'
;
import
Stats
from
'
./jsm/libs/stats.module.js
'
;
import
{
GUI
}
from
'
./jsm/libs/dat.gui.module.js
'
;
...
...
@@ -28,10 +30,12 @@
import
{
FBXLoader
}
from
'
./jsm/loaders/FBXLoader.js
'
;
// Graphics variables
var
camera
,
controls
,
scene
,
renderer
,
mesh
,
stats
;
var
camera
,
controls
,
scene
,
renderer
,
stats
;
var
directionalLight
;
var
mesh
,
sphere
,
material
,
nodeMaterial
;
var
params
=
{
nodeMaterial
:
true
,
color
:
new
THREE
.
Color
(
255
,
0
,
127
),
sheenBRDF
:
true
,
sheenColor
:
new
THREE
.
Color
(
10
,
10
,
10
),
// corresponds to .04 reflectance
...
...
@@ -55,15 +59,28 @@
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0xbfd1e5
);
mesh
.
material
=
new
THREE
.
MeshPhysicalMaterial
();
mesh
.
material
.
side
=
THREE
.
DoubleSide
;
mesh
.
material
.
metalness
=
0
;
mesh
.
scale
.
multiplyScalar
(
.
5
);
scene
.
add
(
mesh
);
var
sphere
=
new
THREE
.
Mesh
(
//
material
=
new
THREE
.
MeshPhysicalMaterial
();
material
.
side
=
THREE
.
DoubleSide
;
material
.
metalness
=
0
;
//
nodeMaterial
=
new
Nodes
.
StandardNodeMaterial
();
nodeMaterial
.
side
=
THREE
.
DoubleSide
;
nodeMaterial
.
metalness
=
new
Nodes
.
FloatNode
(
0
);
nodeMaterial
.
roughness
=
new
Nodes
.
FloatNode
();
nodeMaterial
.
color
=
new
Nodes
.
ColorNode
(
params
.
color
.
clone
()
);
//
sphere
=
new
THREE
.
Mesh
(
new
THREE
.
SphereBufferGeometry
(
1
,
100
,
100
),
m
esh
.
m
aterial
material
);
scene
.
add
(
sphere
);
...
...
@@ -101,6 +118,7 @@
var
gui
=
new
GUI
();
gui
.
add
(
params
,
'
nodeMaterial
'
);
gui
.
addColor
(
params
,
'
color
'
);
gui
.
add
(
params
,
'
sheenBRDF
'
);
gui
.
addColor
(
params
,
'
sheenColor
'
);
...
...
@@ -132,15 +150,36 @@
function
render
()
{
mesh
.
material
.
sheenColor
=
params
.
sheenBRDF
mesh
.
material
=
sphere
.
material
=
params
.
nodeMaterial
?
nodeMaterial
:
material
;
//
material
.
sheenColor
=
params
.
sheenBRDF
?
new
THREE
.
Color
().
copy
(
params
.
sheenColor
).
multiplyScalar
(
1
/
255
)
:
null
;
mesh
.
material
.
color
.
copy
(
params
.
color
).
multiplyScalar
(
1
/
255
);
mesh
.
material
.
roughness
=
params
.
roughness
;
renderer
.
toneMappingExposure
=
params
.
exposure
;
mesh
.
material
.
needsUpdate
=
true
;
material
.
color
.
copy
(
params
.
color
).
multiplyScalar
(
1
/
255
);
material
.
roughness
=
params
.
roughness
;
material
.
needsUpdate
=
true
;
//
nodeMaterial
.
sheenColor
=
params
.
sheenBRDF
?
new
Nodes
.
ColorNode
(
material
.
sheenColor
)
:
undefined
;
nodeMaterial
.
color
.
value
.
copy
(
material
.
color
);
nodeMaterial
.
roughness
.
value
=
params
.
roughness
;
nodeMaterial
.
needsCompile
=
true
;
//
renderer
.
toneMappingExposure
=
params
.
exposure
;
renderer
.
render
(
scene
,
camera
);
}
...
...
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
浏览文件 @
22fce3b1
...
...
@@ -107,7 +107,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
material.specularRoughness,
directLight.direction,
geometry,
sheenColor
material.
sheenColor
);
#else
reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录