Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
460ae33a
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
460ae33a
编写于
8月 31, 2021
作者:
W
WestLangley
提交者:
GitHub
8月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MeshPhysicalMaterial: Add sheen property (#22466)
上级
a430cd96
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
36 addition
and
6 deletion
+36
-6
docs/api/en/materials/MeshPhysicalMaterial.html
docs/api/en/materials/MeshPhysicalMaterial.html
+6
-1
src/loaders/MaterialLoader.js
src/loaders/MaterialLoader.js
+1
-0
src/materials/Material.js
src/materials/Material.js
+1
-0
src/materials/MeshPhysicalMaterial.js
src/materials/MeshPhysicalMaterial.js
+21
-0
src/renderers/shaders/ShaderLib.js
src/renderers/shaders/ShaderLib.js
+1
-0
src/renderers/webgl/WebGLMaterials.js
src/renderers/webgl/WebGLMaterials.js
+2
-2
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+2
-1
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+2
-2
未找到文件。
docs/api/en/materials/MeshPhysicalMaterial.html
浏览文件 @
460ae33a
...
...
@@ -133,6 +133,11 @@
This models the reflectivity of non-metallic materials. It has no effect when [page:MeshStandardMaterial.metalness metalness] is *1.0*
</p>
<h3>
[property:Float sheen]
</h3>
<p>
The intensity of the sheen layer, from *0.0* to *1.0*. Default is *0.0*.
</p>
</p>
<h3>
[property:Float sheenRoughness]
</h3>
<p>
Roughness of the sheen layer, from *0.0* to *1.0*. Default is *1.0*.
</p>
...
...
@@ -140,7 +145,7 @@
<h3>
[property:Color sheenTint]
</h3>
<p>
Used for rendering materials such as velvet. It has no effect when set to black (0x000000). Default is black
.
The sheen tint. Default is *0xffffff*, white
.
</p>
<h3>
[property:Float transmission]
</h3>
...
...
src/loaders/MaterialLoader.js
浏览文件 @
460ae33a
...
...
@@ -74,6 +74,7 @@ class MaterialLoader extends Loader {
if
(
json
.
color
!==
undefined
&&
material
.
color
!==
undefined
)
material
.
color
.
setHex
(
json
.
color
);
if
(
json
.
roughness
!==
undefined
)
material
.
roughness
=
json
.
roughness
;
if
(
json
.
metalness
!==
undefined
)
material
.
metalness
=
json
.
metalness
;
if
(
json
.
sheen
!==
undefined
)
material
.
sheen
=
json
.
sheen
;
if
(
json
.
sheenTint
!==
undefined
)
material
.
sheenTint
=
new
Color
().
setHex
(
json
.
sheenTint
);
if
(
json
.
sheenRoughness
!==
undefined
)
material
.
sheenRoughness
=
json
.
sheenRoughness
;
if
(
json
.
emissive
!==
undefined
&&
material
.
emissive
!==
undefined
)
material
.
emissive
.
setHex
(
json
.
emissive
);
...
...
src/materials/Material.js
浏览文件 @
460ae33a
...
...
@@ -189,6 +189,7 @@ class Material extends EventDispatcher {
if
(
this
.
roughness
!==
undefined
)
data
.
roughness
=
this
.
roughness
;
if
(
this
.
metalness
!==
undefined
)
data
.
metalness
=
this
.
metalness
;
if
(
this
.
sheen
!==
undefined
)
data
.
sheen
=
this
.
sheen
;
if
(
this
.
sheenTint
&&
this
.
sheenTint
.
isColor
)
data
.
sheenTint
=
this
.
sheenTint
.
getHex
();
if
(
this
.
sheenRoughness
!==
undefined
)
data
.
sheenRoughness
=
this
.
sheenRoughness
;
if
(
this
.
emissive
&&
this
.
emissive
.
isColor
)
data
.
emissive
=
this
.
emissive
.
getHex
();
...
...
src/materials/MeshPhysicalMaterial.js
浏览文件 @
460ae33a
...
...
@@ -15,6 +15,7 @@ import * as MathUtils from '../math/MathUtils.js';
* ior: <float>,
* reflectivity: <float>,
*
* sheen: <float>,
* sheenTint: <Color>,
* sheenRoughness: <float>,
*
...
...
@@ -84,6 +85,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
this
.
specularTint
=
new
Color
(
1
,
1
,
1
);
this
.
specularTintMap
=
null
;
this
.
_sheen
=
0.0
;
this
.
_clearcoat
=
0
;
this
.
_transmission
=
0
;
...
...
@@ -91,6 +93,24 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
}
get
sheen
()
{
return
this
.
_sheen
;
}
set
sheen
(
value
)
{
if
(
this
.
_sheen
>
0
!==
value
>
0
)
{
this
.
version
++
;
}
this
.
_sheen
=
value
;
}
get
clearcoat
()
{
return
this
.
_clearcoat
;
...
...
@@ -147,6 +167,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
this
.
ior
=
source
.
ior
;
this
.
sheen
=
source
.
sheen
;
this
.
sheenTint
.
copy
(
source
.
sheenTint
);
this
.
sheenRoughness
=
source
.
sheenRoughness
;
...
...
src/renderers/shaders/ShaderLib.js
浏览文件 @
460ae33a
...
...
@@ -296,6 +296,7 @@ ShaderLib.physical = {
clearcoatRoughnessMap
:
{
value
:
null
},
clearcoatNormalScale
:
{
value
:
new
Vector2
(
1
,
1
)
},
clearcoatNormalMap
:
{
value
:
null
},
sheen
:
{
value
:
0
},
sheenTint
:
{
value
:
new
Color
(
0x000000
)
},
sheenRoughness
:
{
value
:
0
},
transmission
:
{
value
:
0
},
...
...
src/renderers/webgl/WebGLMaterials.js
浏览文件 @
460ae33a
...
...
@@ -598,9 +598,9 @@ function WebGLMaterials( properties ) {
uniforms
.
ior
.
value
=
material
.
ior
;
// also part of uniforms common
if
(
material
.
sheen
Tint
&&
(
material
.
sheenTint
.
r
>
0
||
material
.
sheenTint
.
g
>
0
||
material
.
sheenTint
.
b
>
0
)
)
{
if
(
material
.
sheen
>
0
)
{
uniforms
.
sheenTint
.
value
.
copy
(
material
.
sheenTint
);
uniforms
.
sheenTint
.
value
.
copy
(
material
.
sheenTint
)
.
multiplyScalar
(
material
.
sheen
)
;
uniforms
.
sheenRoughness
.
value
=
material
.
sheenRoughness
;
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
460ae33a
...
...
@@ -631,7 +631,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
parameters
.
alphaMap
?
'
#define USE_ALPHAMAP
'
:
''
,
parameters
.
alphaTest
?
'
#define USE_ALPHATEST
'
:
''
,
parameters
.
sheenTint
?
'
#define USE_SHEEN
'
:
''
,
parameters
.
sheen
?
'
#define USE_SHEEN
'
:
''
,
parameters
.
transmission
?
'
#define USE_TRANSMISSION
'
:
''
,
parameters
.
transmissionMap
?
'
#define USE_TRANSMISSIONMAP
'
:
''
,
parameters
.
thicknessMap
?
'
#define USE_THICKNESSMAP
'
:
''
,
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
460ae33a
...
...
@@ -48,7 +48,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
'
numDirLightShadows
'
,
'
numPointLightShadows
'
,
'
numSpotLightShadows
'
,
'
shadowMapEnabled
'
,
'
shadowMapType
'
,
'
toneMapping
'
,
'
physicallyCorrectLights
'
,
'
doubleSided
'
,
'
flipSided
'
,
'
numClippingPlanes
'
,
'
numClipIntersection
'
,
'
depthPacking
'
,
'
dithering
'
,
'
format
'
,
'
sheen
Tint
'
,
'
transmission
'
,
'
transmissionMap
'
,
'
thicknessMap
'
'
sheen
'
,
'
transmission
'
,
'
transmissionMap
'
,
'
thicknessMap
'
];
function
getMaxBones
(
object
)
{
...
...
@@ -214,7 +214,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
gradientMap
:
!!
material
.
gradientMap
,
sheen
Tint
:
(
!!
material
.
sheenTint
&&
(
material
.
sheenTint
.
r
>
0
||
material
.
sheenTint
.
g
>
0
||
material
.
sheenTint
.
b
>
0
)
)
,
sheen
:
material
.
sheen
>
0
,
transmission
:
material
.
transmission
>
0
,
transmissionMap
:
!!
material
.
transmissionMap
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录