创建FBX骨骼外观
# 创建FBX骨骼外观

下左图是 FBX文件导入 3dsMax 之后自动创建的Bone 效果,右图是插件创建骨骼外观之后的效果。
这样处理之后有利于渲染 骨骼动画。




G:\Git_NDTools\Dev_Channel\美术研发部通用技术研发_资源库_批量预览图预览视频\SVN资源中心-批量渲染\骨骼渲染显示-v5.ms
1
方式也是非常暴力,直接根据骨骼节点父子关系 创建 BOX,然后蒙皮设置权重。
fn _createProxy pBone targetObjOrPos isTerminal finalWidth =
(
local p1 = pBone.pos
local p2 = if isTerminal then targetObjOrPos else targetObjOrPos.pos
local dist = distance p1 p2
if dist > 0.001 do
(
-- Create Mesh
local meshColor = this._getBoneColor pBone.name
local geo = Box width:finalWidth length:finalWidth height:dist \
widthsegs:1 lengthsegs:1 heightsegs:this.segments \
wirecolor:meshColor name:(pBone.name + this.proxySuffix)
-- Align
geo.transform = this._getMatrixFromZAxis p1 p2
-- Skinning
--resetScale geo
addModifier geo (Skin())
local skinMod = geo.modifiers[#Skin]
-- SkinOps requires selection and modify mode
select geo
max modify mode
if isTerminal then
(
-- Terminal/Head: 100% weight to parent only
skinOps.addBone skinMod pBone 1
)
else
(
-- Chain: Gradient weight
skinOps.addBone skinMod pBone 1
skinOps.addBone skinMod targetObjOrPos 1
local vertCount = skinOps.GetNumberVertices skinMod
for v = 1 to vertCount do
(
local vPos = getVert geo.mesh v
local ratio = vPos.z / dist
if ratio < 0 do ratio = 0
if ratio > 1 do ratio = 1
skinOps.ReplaceVertexWeights skinMod v #(1, 2) #((1.0 - ratio), ratio)
)
)
pBone.renderable = not this.is_hide_bone
return geo
)
return undefined
),
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
