XNA--Skeletal Animation

            When you need to animate a character (running, jumping, falling, and so on), the animation process becomes more complex. This is because you’ll need to modify the character’s mesh, called skinning. This chapter focuses on techniques for animating characters. Let’s begin by looking at the two main types of animation.

            There are two main types of animation: keyframed animation and skeletal animation. Each type of animation is used in different situations and has its advantages and disadvantages.

Keyframed Animation

         In the animation shown in Figure 12-1, you will need to add tweening between the first and second animation frames, to make the animation appear smooth. (Tweening refers to generating the intermediate frames between keyframes.) However, you don’t necessarily need to create all of the frames beforehand, because you can obtain them by interpolating between the first and second frames.

          One of the advantages of keyframed animation is that it’s fast, because all interpolation calculations have been done at startup. All the animation frames are stored in memory, and during the animation, you only need to change to the next mesh in the animation each frame. However, a disadvantage of this method is that it’s necessary to store all the model meshes in memory. If a model needs 100 animation frames, it’s necessary to store its mesh 100 times.

           The use of keyframed animated models with XNA is simple, because XNA already has the classes needed to handle static models. Therefore, you can treat a keyframed animation model in XNA as an array of static models using the Model class, where you store one Model object for each frame of the animation.

Skeletal Animation

           In this process, the entire model is structured on a skeleton, which is a combination of bones. The skeleton has one bone for each movable part of the model: one bone for a shoulder, one for an upper arm, one for a forearm, one for the hand plate, and then some more for the fingers.
           Each bone needs to know to which parent bone it connects and how it is connected there, which is defined by the rotation about the connection point.

           To build the model’s mesh, skeleton, and animations, you can use different modeling tools that support skeletal (or bone) animation, such as 3ds Max, Maya, Blender, and others. After you create the model, you also need to export it to a format that supports skeletal animation. Among the model formats that XNA supports natively, the X (DirectX) and FBX (Autodesk) formats support skeletal animation.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值