- Home /
Weighted Pose Animations without Blending
I have a facial model exported from a 3D modelling package with several animation poses (smile, open, pucker, blink, etc.). I need to be able to combine these poses with weights and without any Unity blending from frame to frame. The weights don't have to add to one. For example, I might have a weight of .5 for 'open' and .75 for 'blink'. Each pose animation consists of 5 identical frames with bones rotated and/or translated to give that pose. I need to be able to change the weights on a frame by frame basis without Unity "helping" smooth things out. I've tried using layers, but with a fixed set of weights, I still get
Failing an easy way to do this, is there a way to get at the guts of an animation (bone rotations, translations, etc.) and create a new animation on the fly with my own calculated values?
Thanks for any insight you can provide!
Okay, after a lot more reading and searching it looks like what is needed is to make each pose animation a two frame animation with the neutral pose as the first frame and the pose itself as the second frame. Then, each pose is placed in its own layer and the blend$$anonymous$$ode of the animation is set to Additive. Then, the normalizedTime is set to 1.0, the wrap$$anonymous$$ode is set to ClampForever. Then, using the weight for each layer as the weight of the pose, you get nice additive poses. I have some sliders that I use to adjust the weights to play with combining the poses. Also, you need to enable the neutral pose each Update as well.
You should answer your own question, as the approach in you comment is correct (except perhaps the bit about enabling the neutral pose every Update, that shouldn't be necessary), and works for you.
@Warwick Allison: Well, if all animations are additive you need at least one "absolute" animation. Otherwise the relative change will add up each frame and will result in strange motions.
@JimG: Your approach is how you can do it, just some hints:
Animation.Play does only reset the animation-time to 0 and set enabled to true.
Crossfade does the same, but moves the weight from 0 to 1 (slowly).
You can control all those properties on your own .enables, .time, .weight, .speed, ...
You can sample an animation state at any time you like by calling Animation.Sample().
Additive animations are not affected by layers. Only when it comes to Play or Crossfade since they stop all animations an the same layer. You can put all additive animations on one extra layer.
Could you check this question http://answers.unity3d.com/questions/1206428/how-weights-of-2d-blending-are-calculated.html
@Bunny83: Thanks for the info. I changed it to all be in the same layer without any problems. There should be a better example of using Additive somewhere. The leaning one from Unity leaves a lot to be desired.
@Warwick Allison: Yeah, very interesting effect if you don't set the neutral pose each frame. Face just explodes as Additive animations keep accumulating.
Answer by Dreamora · Jul 02, 2011 at 04:42 AM
Bones are just transforms in the hierarchy you can modify however you want.
Its also possible to change the weights, the Mesh class as well as other relevant aspects on the renderer give you full access to whatever you need to use it. Generally unity does not smooth things out, it interpolates stuff over its define amount of time. So if something is too smooth / long I would check the timing
The thing is that I want the time to be just a single frame, so that the image is static unless the weights change. I was able to figure it out, though.
Your answer
Follow this Question
Related Questions
Making characters strike poses when hit? 2 Answers
How can i make vertex influences works the same as in maya? 0 Answers
Changing AnimationState weights does screw up Crossfading.. 1 Answer
Creating keyframes from poses in the scene view (with pictures for clarity) -1 Answers
Is it possible to blend Animations in a way similar to Blendshapes? 1 Answer