游戏开发论坛

 找回密码
 立即注册
搜索
楼主: bluefire9213

怎么让骨骼运动更平滑?

[复制链接]

59

主题

1104

帖子

1199

积分

金牌会员

Rank: 6Rank: 6

积分
1199
发表于 2005-2-26 14:04:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

DEMO归DEMO,游戏归游戏,DEMO不是游戏。

96

主题

529

帖子

539

积分

高级会员

Rank: 4

积分
539
 楼主| 发表于 2005-2-26 16:19:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

你很爱钻牛角尖啊,算了,不说了。再说这个也没意义,跟我发贴的目的不符。我发的这个贴子不是“论什么是骨骼”、“论什么是DEMO”的概念论文。

59

主题

1104

帖子

1199

积分

金牌会员

Rank: 6Rank: 6

积分
1199
发表于 2005-2-26 16:42:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

虚心使人进步,我也不愿意多讲了,意思到了,自己去琢磨吧。

132

主题

1341

帖子

1341

积分

金牌会员

Rank: 6Rank: 6

积分
1341
发表于 2005-3-3 18:12:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

rotate矩阵计算的并不准确,如东西不在源点时,rotate出来的结果会不如人意,所以最原始的骨骼应都是在源点附近,然后执行rotate,在执行translate,这只是个人见解。

8

主题

111

帖子

163

积分

注册会员

Rank: 2

积分
163
发表于 2005-3-3 20:37:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

基本上Max导出的Node的Transform Matrix可以用max sdk的decomp_affine(...)分拆成若干个部分,然后再对这些部分分别插值后,再合并成一个matrix,这样可以实现transform matrix的平滑过渡.如果Transform里不包括那种off axis scaling的话(可能就是楼上说的不在原点的rotate/scale吧),可以用Max的DecomposeMatrix(...)或者D3DX的D3DXMatrixDecompose(...)来拆矩阵.
一般可以要求美术提供没有复杂的Transform的动画(就是只包括Rotate,Scale,Translate),不过通用起见,我觉得还是用decomp_affine(...)比较合适,当然会有点慢.
以下引自max sdk的帮助,介绍decomp_affine(...)这个函数的:


Description:

This structure and the associated functions provide a way to decompose an arbitrary Matrix3 into its translation, rotation, and scale components.

To use these APIs put the following statement in your source file:

#include "decomp.h"

For a full discussion of this decomposition see Graphics Gems IV - Polar Matrix Decomposition by Ken Shoemake. ISBN 0-12-336155-9.

T F R U K U'

T - translation matrix

F - either an identity matrix or negative identity matrix

R - rotation defined by Quat q.

U - rotates you into the coordinates system where the scaling or stretching is done

K - scaling matrix

U' - inverse of u.

Structure:

typedef struct {

Point3 t;

The translation components.

Quat q;

The essential rotation.

Quat u;

The stretch rotation. This is the axis system of the scaling application.

Point3 k;

The stretch factors. These are the scale factors for x, y and z.

float f;

Sign of the determinant.

} AffineParts;

Functions:

Prototype:

void decomp_affine(Matrix3 A, AffineParts *parts);

Remarks:

This will decompose a matrix into the translation, rotation and scale components and store the results in the AffineParts structure passed. This will return correct results for off axis scale. This is a fairly computationally intensive iterative solution operation.

Parameters:

Matrix3 A

The input matrix to decompose.

AffineParts *parts

The result. See above.

Sample Code:

Note: If you want to rebuild a Matrix3 from the decomposed parts you get back from decomp_affine()the important thing is the order the parts are combined.

Consider the following matrices constructed from the various affine parts:

ptm = position component (t)

rtm = "essential" rotation (q)

srtm = "stretch" rotation (u)

stm = scale component (k)

ftm = the flip tm -> ScaleMatrix(Point3(ap.f,ap.f,ap.f));

Here's the correct way of reassembling the decomposed matrix:

Matrix3 srtm, rtm, ptm, stm, ftm;

ptm.IdentityMatrix();

ptm.SetTrans(ap.t);

ap.q.MakeMatrix(rtm);

ap.u.MakeMatrix(srtm);

stm = ScaleMatrix(ap.k);

mat = Inverse(srtm) * stm * srtm * rtm * ftm * ptm;

1

主题

11

帖子

11

积分

新手上路

Rank: 1

积分
11
发表于 2005-3-4 10:30:00 | 显示全部楼层

Re:怎么让骨骼运动更平滑?

tarkey和bluefire9213说得应该都对,骨骼信息包不包含translate都可以。对于碰撞检测,不包含translate的骨骼在碰到障碍物时,仍然可以摆胳膊晃腿只是停止在原地不在前行;包含translate的骨骼在碰到障碍物时,则身体一动不动呆在原地。不包含translate的骨骼可以对物体运动速度有很好的控制,加速减速都很方便。不知我的理解对不对,请各位指教下哈。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-25 10:10

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表