"Fake Stop Motion". 3d animation without blending between frames?

There’s a solution that uses step tangent, mentioned on this post:

But when setting the curves to Constant, the animation gets messed up (on its left leg):2296247--154485--wm.gif

This should not be a difficult troubleshooting process between you anim package and Unity.
Is the image above from Unity or animation package?
Seems the animation needs to have an extra keyframe to control the rotation direction.

1 Like

Why not simply pause animating by setting time/speed to 0 for 10 frames then simulating for 1 frame? where “10” is the number of frames skipped.

60fps / 10 = 10fps animation.

This results in the stop motion look afaik… might need some messing about though.

2 Likes

I’ve tried the different methods for the stop-motion like behavior and the best one is using the simple script when you set the speed for 0 for particular amount of the time like hippocoder said. Using the constant curves isn’t ideal, because if you want to speed up the animation, the stop motion would break.

2 Likes

Hum… interesting… I’ve made a quick test:
timet += Time.deltaTime;
if (timet > frameTime) {
timet = 0;
animator.speed = frameSpeed;
} else {
animator.speed = 0;
}

It works! I will need to fine-tune some other details on the animation, but looks great!

2 Likes

Zimbres, I am very interested in your findings.
I have also been looking forward to create stop motion like animation for a while now. I was stuck just the same with the curve/interpolation flaw on the rotations.
However I am no coding expert… Am I right to assume that the “frameTime” is the number of frames the animation pauses? Similarly “frameSpeed” is the actual playback speed (1 being default speed?), right?

Thanks a lot in advance for your help!

Animation window > select keyframes > right click > Both Tangents > Constant.

1 Like

@enhawk I’ve found that Unity still blends / tweens between two constant frames, on some plays of the animation. From what I can tell it is not deterministic. I recall early versions of Unity, pre 5, respecting the constant setting.

Has anyone else found this? I came here looking for a way to force the animator / animation to respect constant. I need it when flipping arms and such in attack animations. Currently, on some plays of the animation you can see the intermediate frame (although there is no frame visible in the timeline) of the flip between say y = 1 and y = -1.

FWIW, I’ve resorted to disabling the element I want to flip, flipping it, then reenabling it.

Example…

Frame 10, disable shoulder
Frame 11, flip shoulder.scale.y
Frame 12, enable shoulder

… this feels like a hack, has anyone found a better way?

I’ve tried setting the timeline to greater than sample = 60 (in an attempt to see the “hidden” frames) but the max appears to be 60.

Seems like this is a known issue, Unity blends the Keys regardless of the Constant curve setting.

You’ll have to fake it for now in your 3D software and export the animation already faked.

The best way to bring this to Unity’s attention is a bug report with an example scene detailing the issue.

2 Likes

My solution, as sugested, is this code:

Animator animator;
    // Use this for initialization
    void Awake () {
        animator = GetComponent<Animator>();
    }

    bool skipani = true;
    float timet = 0;
    public float frameTime = 0.125f;
    public float frameSpeed = 2;
    internal void updateAni() {
      
    }
    void Update () {
        if (skipani) {
            //frameTime = 1 / 6f;
            //frameSpeed = 8;
            timet += Time.deltaTime;
            if (timet > frameTime) {
                timet -= frameTime;
                animator.speed = frameSpeed;
            } else {
                animator.speed = 0;
            }
        }
    }

I’ve used this for a while, to focus on other things… but my solution is not perfect. I have to guess the frame interval, the frame speed skip, and I’m not feeling safe about this. The frames that shows are not always the keyframes I want to show.

Maybe… I can fix this, changing the animator.speed with a correct speed fix, based on delta time and all. I will try some things.

Thanks a lot for the update Zimbres. I think this will be a great starting point for me.

It is ok to ressurrect this thread from the dead? Someone knows if this “fake stop motion” is really possible now?

Nothing new, no. Unity’s animation curves are, like most game engines, baked out at a fixed time step and compressed meaning all animations will tween a little bit.

You might be able to get around this by having the framerate for your animation clip to something like 2x (or more) of your intended game framerate, and disable compression if you’re importing from an external file.

1 Like

Interesting. I will take a look, thanks!

There’s another thought though, you can bake the current state of an animated mesh. You don’t need to render this mesh. Instead it’s used to calculate the final mesh with Unity - Scripting API: SkinnedMeshRenderer.BakeMesh

So at intervals, you would call bakemesh which is the reference on the playable mesh (ie not a skinned mesh). This is guaranteed to work, at a slightly sub optimal performance, depending on what you’re doing. For the player and important creatures you shouldn’t see much perf hit. For crowds it might be a perf gain with instancing :smile:

2 Likes