Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b538cb29
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,发现更多精彩内容 >>
提交
b538cb29
编写于
12月 30, 2015
作者:
S
SUNAG
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sss to skin and translucent example
上级
cd80a94c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
88 addition
and
28 deletion
+88
-28
examples/webgl_materials_nodes.html
examples/webgl_materials_nodes.html
+88
-28
未找到文件。
examples/webgl_materials_nodes.html
浏览文件 @
b538cb29
...
...
@@ -206,6 +206,7 @@
'
adv / soft-body
'
:
'
soft-body
'
,
'
adv / wave
'
:
'
wave
'
,
'
adv / sss
'
:
'
sss
'
,
'
adv / translucent
'
:
'
translucent
'
,
'
misc / smoke
'
:
'
smoke
'
,
'
misc / firefly
'
:
'
firefly
'
}
).
onFinishChange
(
function
()
{
...
...
@@ -262,6 +263,20 @@
if
(
mesh
.
material
)
mesh
.
material
.
dispose
();
if
(
rtTexture
)
{
rtTexture
.
dispose
();
rtTexture
=
null
;
}
if
(
rtMaterial
)
{
rtMaterial
.
dispose
();
rtMaterial
=
null
;
}
var
name
=
param
.
example
;
var
mtl
;
...
...
@@ -1611,6 +1626,7 @@
break
;
case
'
sss
'
:
case
'
translucent
'
:
// DISTANCE FORMULA
...
...
@@ -1669,53 +1685,93 @@
THREE
.
OperatorNode
.
SUB
);
difference
=
new
THREE
.
Math3Node
(
var
sss
=
new
THREE
.
Math3Node
(
new
THREE
.
FloatNode
(
-
.
1
),
new
THREE
.
FloatNode
(
.
5
),
difference
,
THREE
.
Math3Node
.
SMOOTHSTEP
);
var
internalColor
=
new
THREE
.
ColorNode
(
0x1a0e14
);
var
surfaceColor
=
new
THREE
.
ColorNode
(
0xd04327
);
var
sssAlpha
=
new
THREE
.
Math1Node
(
sss
,
THREE
.
Math1Node
.
SAT
);
var
color
=
new
THREE
.
Math3Node
(
surfaceColor
,
internalColor
,
new
THREE
.
Math1Node
(
difference
,
THREE
.
Math1Node
.
SAT
),
THREE
.
Math3Node
.
MIX
);
var
frontColor
,
backColor
;
var
light
=
new
THREE
.
OperatorNode
(
new
THREE
.
LightNode
(),
color
,
THREE
.
OperatorNode
.
ADD
);
if
(
name
==
'
sss
'
)
{
mtl
.
color
=
new
THREE
.
ColorNode
(
0xffffff
);
mtl
.
roughness
=
new
THREE
.
FloatNode
(
.
1
);
mtl
.
metalness
=
new
THREE
.
FloatNode
(
.
5
);
var
sssOut
=
new
THREE
.
Math2Node
(
objectDepth
,
sssAlpha
,
THREE
.
Math2Node
.
MIN
);
mtl
.
light
=
light
;
mtl
.
environment
=
color
;
frontColor
=
new
THREE
.
ColorNode
(
0xd4cfbb
);
backColor
=
new
THREE
.
ColorNode
(
0xd04327
);
var
color
=
new
THREE
.
Math3Node
(
backColor
,
frontColor
,
sssOut
,
THREE
.
Math3Node
.
MIX
);
var
light
=
new
THREE
.
OperatorNode
(
new
THREE
.
LightNode
(),
color
,
THREE
.
OperatorNode
.
ADD
);
mtl
.
color
=
frontColor
;
mtl
.
roughness
=
new
THREE
.
FloatNode
(
.
1
);
mtl
.
metalness
=
new
THREE
.
FloatNode
(
.
5
);
mtl
.
light
=
light
;
mtl
.
environment
=
color
;
}
else
{
frontColor
=
new
THREE
.
ColorNode
(
0xd04327
);
backColor
=
new
THREE
.
ColorNode
(
0x1a0e14
);
var
color
=
new
THREE
.
Math3Node
(
frontColor
,
backColor
,
sssAlpha
,
THREE
.
Math3Node
.
MIX
);
var
light
=
new
THREE
.
OperatorNode
(
new
THREE
.
LightNode
(),
color
,
THREE
.
OperatorNode
.
ADD
);
mtl
.
color
=
new
THREE
.
ColorNode
(
0xffffff
);
mtl
.
roughness
=
new
THREE
.
FloatNode
(
.
1
);
mtl
.
metalness
=
new
THREE
.
FloatNode
(
.
5
);
mtl
.
light
=
light
;
mtl
.
environment
=
color
;
}
// GUI
addGui
(
'
internalColor
'
,
internal
Color
.
value
.
getHex
(),
function
(
val
)
{
addGui
(
'
frontColor
'
,
front
Color
.
value
.
getHex
(),
function
(
val
)
{
internal
Color
.
value
.
setHex
(
val
);
front
Color
.
value
.
setHex
(
val
);
},
true
);
addGui
(
'
surfaceColor
'
,
surface
Color
.
value
.
getHex
(),
function
(
val
)
{
addGui
(
'
backColor
'
,
back
Color
.
value
.
getHex
(),
function
(
val
)
{
surface
Color
.
value
.
setHex
(
val
);
back
Color
.
value
.
setHex
(
val
);
},
true
);
addGui
(
'
area
'
,
difference
.
b
.
number
,
function
(
val
)
{
addGui
(
'
area
'
,
sss
.
b
.
number
,
function
(
val
)
{
difference
.
b
.
number
=
val
;
sss
.
b
.
number
=
val
;
},
false
,
0
,
1
);
...
...
@@ -1732,10 +1788,14 @@
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
var
width
=
window
.
innerWidth
,
height
=
window
.
innerHeight
;
camera
.
aspect
=
width
/
height
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
width
,
height
);
if
(
rtTexture
)
rtTexture
.
setSize
(
width
,
height
);
}
...
...
@@ -1762,7 +1822,7 @@
// update material animation and/or gpu calcs (pre-renderer)
mesh
.
material
.
updateAnimation
(
delta
);
// render to texture for
SSS
material only
// render to texture for
sss/translucent
material only
if
(
rtTexture
)
{
scene
.
overrideMaterial
=
rtMaterial
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录