Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Puppet2D - An advanced skeletal animation tool

Discussion in 'Assets and Asset Store' started by jamieniman, Dec 31, 2013.

  1. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    Thanks for the detailed bug report, ill have a look into it...
     
  2. stormwaver

    stormwaver

    Joined:
    Jul 10, 2014
    Posts:
    2
    we have tried out this plugin a while and found some issues:

    1. Integrated with NGUI
    as far as now, we realize that Puppet2D Global_CTRL can not placed under any SCALED parents, it causes:
    - the 'edit node circle' scaled extremely big.
    - Combine Meshes's result is incorrect.
    So, we let artist do animation job outside the UIRoot, and placed the result Global_CTRL under UIRoot, change to suitable scale, it looks fine. (after we adapted the issue3 method.)

    2. Directory Path
    - the default path to save MESH,MATERIAL is "Assets/Puppet2D/Models/", "Assets/Puppet2D/Models/Materials/"
    but we want to keep the clarity in the plugin directory. is it possible to assign save directory by user?
    - the Puppet2D plugin MUST placed in Assets/Puppet2D, is it possible placed in other directory? (keep dependency)

    3. Combine Meshes issue

    we tested performance by cloning many instances, and found errors and incorrect under the UIRoot(issue 1).

    after surfing source code, we modify CombineAllMeshes() , and it works fine for us now.

    void CombineAllMeshes()
    {
    //mod
    //we clone from a "Combined Meshes gameobject", so no need to do again.
    if (gameObject.GetComponent<SkinnedMeshRenderer>() != null)
    return;
    //mod.

    Vector3 originalScale = transform.localScale;
    Quaternion originalRot = transform.rotation;
    Vector3 originalPos = transform.position;
    //mod
    Transform originalParent = transform.parent;
    transform.parent = null;
    //mod.
    transform.localScale = Vector3.one;
    transform.rotation = Quaternion.identity;
    transform.position = Vector3.zero;

    ........

    //mod
    transform.parent = originalParent;
    //mod.
    transform.localScale =originalScale;
    transform.rotation = originalRot;
    transform.position =originalPos;

    4. Performance issue
    we are not sure the performance of this plugin is suitable for us yet, the main factor should be the bone number * object num, right? is any suggestion for the performance issue?

    thanks for your reading.
     
  3. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    thanks for the feedback,

    Some advice on performance:

    - you can try baking your animations onto the bones to remove running puppet2D scripts.

    - Sprites perform better than skinned meshes, so if you can get away with them do.

    - Try to keep the number bones attached to each vert to be 2 or less.

    - You can also place all your characters into a single global_Ctrl and use the combine mesh checkbox only on that to combine multiple characters that share the same texture together.
     
  4. Tannon

    Tannon

    Joined:
    Apr 24, 2014
    Posts:
    9
    Just want to say that the Puppet2D creator directly addressed my support issue and sent a fix.

    If you're reading this and on the fence about picking up Puppet2D, grab it! Excellent tool and developer.
     
  5. stormwaver

    stormwaver

    Joined:
    Jul 10, 2014
    Posts:
    2
    thanks for reply and performance suggestions, really helpful.:)

    after baking animation, we found some data was missing:
    1. Sprites (which have no bones)
    2. GameObject.IsActive


    before baking:


    after baking
     
    Last edited: Jul 14, 2014
  6. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    Yes, at the moment it only bakes the bone transforms.

    This is certainly on my list to improve.
     
  7. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    i made skinned a character but i didnt start on the 0,0,0 world position and ended up having the Global_Ctrl at 0,0,0 and everything else far away. Is there a way to bring everything to that position ?

    Edit : Actually had to remake the bone anyway so i replaced all and also saw yours answer in page 8 :p
     
    Last edited: Jul 19, 2014
  8. ahmed_decoy

    ahmed_decoy

    Joined:
    May 19, 2013
    Posts:
    58
    Hi jamieniman,

    I noticed when I create a transition from one animation to another, the preview in the transition inspector window only shows my controls animating, not my actual sprite. Only happens in this particular preview window for me. Not sure if it was something I'm doing wrong or possibly an issue.

    Keep up the good work, this is a really awesome tool and easy to get up and going!

    P.S. In the example below, I dropped the Global_CTRL gameObject in to the transition preview window. I hit play, and only the control indicators are animating. I also have not baked the animation yet, not sure if that will make a difference.

    upload_2014-7-20_7-35-36.png
     
  9. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    The preview window doesn't update any running scripts so unfortunately you wont be able to see control animations work there.

    It will work when you bake it to bones - but you will also notice that the way the animations transition between each other will behave differently. This is because blending between rotations looks different to blending between control translations.
     
  10. Vinous

    Vinous

    Joined:
    Jun 27, 2014
    Posts:
    10
    I ran into a problem: if I make an animation with Controls it is working fine until I Bake it. After Baking the Animation, the Sprite just get to the last position of the Animation and when I play the Animation, only the Controls move alone.

    Has anybody the same problem? Do I miss something during creating animation?
     
  11. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    I think the issue might be that you still have both animations on the animator controller (both the baked and unbaked one).
    In order for the baked animation to work you have to remove the control animations.

    Let me know if that helps :)
     
  12. Vinous

    Vinous

    Joined:
    Jun 27, 2014
    Posts:
    10
    I tried it, but it still doesn't work, the Baked Animation is already broken without opening a Controller.
     
  13. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    You need a controller to bake the animations (it bakes all the animations in the controller)
    Also make sure the bones are parented to the global control.

    If its not any of that, could you package it up and send it to me so I could have a look?
     
  14. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    I replied to your email directly, but for the benefit others:

    After you bake the animations, they will appear in the Puppet2D>Animation>Baked folder with the same name with _baked after it.

    You will then need to drag the animation onto the animator controller (in the animator window) and delete the old unbaked animation from the animator controller. (You can't use both unbaked and baked animations together)
     
  15. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    I am trying to oriented the feet on the ground but i have a problem when the character is fliped :

    perso01.jpg

    perso03.jpg

    but when it's fliped :

    perso02.jpg


    The code i am using is like this :
    Code (csharp):
    1.  
    2. Quaternion q=Quaternion.FromToRotation(Vector3.right, new Vector3(dir.x,dir.y,0));
    3. footLeftCtrl.transform.rotation = new Quaternion(footLeftCtrl.transform.rotation.x, footLeftCtrl.transform.rotation.y, q.z, footLeftCtrl.transform.rotation.w);
    4.  
    the vector dir is the direction of the slope, i tried several ways to make it work when it's fliped, even if it was breaking the normal side. Just fiding what was wrong, and i always end up with the foot etheir not rotating or rotate completly wrong. I think it has to do with the way you flip the character, i'm not blaming just if you have any idea how i should consider you fliping code to correct mine ? I already check your code where you flip the character but still could find a fix :/
     
  16. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    I think what you want to do is call your code from the place where the flip code happens on the global_ctrl. This is likely because you want your code to be executed after the Puppet2D flip code
     
  17. BrandStone

    BrandStone

    Joined:
    Jul 21, 2014
    Posts:
    79
    A newbie question: while using this plugin will I be able to change the character's meshes through coding? I want to offer full character customization: hair color, eyes, clothing, etc. Thanks!
     
  18. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    Apologies for the late reply (I was on paternity)
    Most likely you should use sprites parented to bones, so that you can use the following to switch the sprites:

    Code (CSharp):
    1. Sprite newSprite;
    2. character.GetComponent<SpriteRenderer>().sprite = newSprite;
    Otherwise for skinned meshes you will want to have all your meshes skinned to the bones, and then you can switch enabled of the skinnedMeshRenderer
     
  19. Tommassino

    Tommassino

    Joined:
    May 25, 2014
    Posts:
    7
    HI, I bought Puppet2d a couple of hours ago and i found it really great, but i am having problem with mesh deforminng (for example leg bending.
    When i move leg IK controller of my character it just keep rotatating the leg but doesnt deform it. Attached image should be more explanatory.
    Do I need to set something or edit my sprites ?
    I used "Parent Oject to bones" skinning method.
     

    Attached Files:

  20. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    As a brief explanation:

    There are two ways the bones can move the character - skinning or parenting. You can always do one or another or both as in the example.

    1. Parenting means only 1 bone can influence each sprite or gameobject. Its more optimised that using skinning. Doing it this way would mean you would need to split the leg into two sprites, one for the thigh and one for the lower leg.

    2. Skinning on the otherhand means you can have multiple bones influence the same object. This can be useful to get it to deform as u bend the limbs or spine . To do this you need to convert the sprite into a mesh, and then "skin" it to the the bones. It doesnt need to be parented to the bones at all.

    Hope that explains things a bit.
     
  21. Tommassino

    Tommassino

    Joined:
    May 25, 2014
    Posts:
    7
    Thx, i should have more carefully read documentation :). Maybe hangover is not the best ttime to study new things :).
    I inderstand that now .

    I tried skinning, which worked as it should, bud i came across another problem. I have my legs as extra sprites, but i would like to lock top of the legs (bottom :) ) from moving, when i move the IK control. . I attached my leg image to this post. I would like the the waist to stay calm While i move tho leg. I tried set zero weights, but it didnt help. Is there any way ho to do it ?
     

    Attached Files:

  22. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    You need to have an extra waist bone, as the top bone of the ik is for the thigh.
     
  23. Tommassino

    Tommassino

    Joined:
    May 25, 2014
    Posts:
    7
    Thank you, i wll try that :)
     
  24. Headworker

    Headworker

    Joined:
    Sep 6, 2012
    Posts:
    28
    Hello Jamie,

    first id like to say that from what I saw so far : your Toolkit looks aweseome. I want to buy it in a few hours.
    A quick question: Can the IK function used by a script? Like Moving the hands into a direction (for topdown gun targeting) and the arms (ill use 2 bones here, parenting, no skinning) will follow smoothly? Think procedural animation.

    Thanks for your time, if this has been answered before, I apologize, but I couldnt find it with google + unity forum search.
     
  25. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    The controls and bones are gameObjects so you can do what you want with them at runtime

    for example if you attach the following script to the Ik control it will aim the arm at the mouse:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. publicclass MoveArmToMouse : MonoBehaviour {
    5.  
    6. //Updateiscalledonceper frame
    7. void Update (){
    8.  
    9. Vector3 mousePos =Camera.main.ScreenToWorldPoint(Input.mousePosition);
    10. transform.position =new Vector3(mousePos.x, mousePos.y,0);
    11. }
    12. }
     
  26. Headworker

    Headworker

    Joined:
    Sep 6, 2012
    Posts:
    28
    Thanks jamie, you be ll some bucks richer in a second :)
     
  27. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    perfect, thanks Jamie
     
  28. Headworker

    Headworker

    Joined:
    Sep 6, 2012
    Posts:
    28
    Hey Jamie, another quick question, are there global setting which need to be set in order to animate a top-down character? The tool behaves like it should, but I'm having a hard time animating that walk cycle :)

    Thanks in advance!

    Clarify Edit: The tool is awesome, I just moved on to animate a squid with many arms :) Works like a charm, I am just asking, if I should change the values for y rotation or something else for a top-down human walkcycle (basically just moving feet, sometimes showing a knee)

    And another question: Ive all animations for the squid up and running. How do I need to organize the hierarchy to sucessfully bake the animation? A picture of my current hierarchy :
    [/URL][/IMG]
     
    Last edited: Aug 6, 2014
  29. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    So, just in case anyone else finds certain sprites on their 2d rig disappearing throughout the animation...Make sure your camera depth (far clipping plane) is set to something far, like 1000, not 30, as Jamie's IK controls tweak the z-values (transform.position.z) and can push certain bones(ultimately, sprites) just past the camera's far point if the clipping planes have been cropped to include only up to the 2d plane.
     
    Last edited: Aug 12, 2014
  30. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Hi @jamieniman,

    How much of AfterEffects+DuIK can it do?

     
  31. kacyesp

    kacyesp

    Joined:
    Jul 3, 2014
    Posts:
    4
    After binding the rig to a character, will any animations I've made require all the bone/control objects when the game is actually being played?
    It seems like a lot of overhead if it does. I'm worried about using this instead of a sprite sheet because of performance. Especially if I have a lot of sprites, I feel like if those bones and controls are still being used indirectly in the game for the animations, then the frames per second will surely dip.
     
  32. Boomer

    Boomer

    Joined:
    Feb 25, 2014
    Posts:
    1
    Hi. I've recently purchased your software and it seems to have one major flaw (at least for me) which makes it basically unusable. I can rig everything properly and set up all of the bones to meshes, etc. etc. However, when I try to edit skin weights in order to make the puppet look smoother during motion (avoiding distorting, unwanted stretching, and so on) the yellow circles that are supposed to represent the vertices are HUGE. They are beyond huge. They are so large, in fact, that they completely give my sprite a solid, yellow background. This disallows me from being able to adjust the skin weights in order to fine-tune animation. Is there a fix for this? If not, then I'll have to find another way to animate.
     
  33. mhope

    mhope

    Joined:
    Aug 14, 2013
    Posts:
    13
    Hey Boomer. Under the "Skinning" portion of the Puppet2D_Editor tab, there's a slider at the very bottom. If you adjust that slider, I believe you can adjust the size of the skin weight handles.

    Screen Shot 2014-08-12 at 17.47.42.png

    The models I am working on right now don't have a meshes, so I can't confirm for sure.
    But in my previous prototypes I had some mesh animations and if I remember correctly this slider did the trick.

    Cheers.
     
  34. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    There are three aspects to the overhead of using puppet2d:
    1. Control scripts
    These are always being updated at runtime - but the good news is you can remove this overhead by baking the animation onto the bones using the bake animation button
    2. Skinning
    The most optimised use of puppet2d is by parenting sprites to the bones. There's a lot of you can get away with doing it this way.
    Skinning is for when you want multiple bones affecting the vertices. You can optimise it by using 1 bone skinning as well.
    3. Bone Gameobjects
    There is hardly any overhead in having multiple gameobjects themselves. However more keyframes will affect performance a bit

    Puppet2D is much better for you texture memory usage however, as you will only need one set of sprites for all your characters animation
     
    Last edited: Aug 12, 2014
  35. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    Most of the main things - eg the IK, skinning, stretchy IK, you can zero the values to bind pose etc.
    Theres soon to be some cool new features such as spline controls and FFDs.

    (You can't create custom sliders yet, but its on my features to do)

    If there's any particular features you would like please let me know
     
    Manny Calavera likes this.
  36. kacyesp

    kacyesp

    Joined:
    Jul 3, 2014
    Posts:
    4
    First off, thank you very much for the quick reply, and all the tips to improve performance.

    Unfortunately, I can't break up certain limbs into a separate sprite or else they don't move around seamlessly with the rest of the character. It can get a little choppy.

    Do you know if there's a way to turn the animation into a sprite sheet?
    I feel like an awesome workflow would be to draw up my characters, apply rigs and controls in puppet2d, animate it using unity, and then convert that animation to a sprite sheet.
    I think memory usage wouldn't go up too much just because unity has to store the information for the rig and key frames if I didn't use a sprite sheet for the animations. And performance would likely increase.
     
  37. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
  38. kacyesp

    kacyesp

    Joined:
    Jul 3, 2014
    Posts:
    4
  39. kacyesp

    kacyesp

    Joined:
    Jul 3, 2014
    Posts:
    4
    Maybe this is already possible (and if it is please let me know how it's done), but one feature I think you could add is layering of different parts within a mesh. For example, say it's not possible to break up an arm and the chest into 2 different sprites because moving the arm around creates a seam between the arm and chest. Therefore you must use a mesh. But now let's say I want to move the arm in front of the chest in one part of an animation, and then in back of the chest in another part of a different or even the same animation. I don't believe there's a way of accomplishing this with the current version of puppet2D. You could probably accomplish this by adding a little more data to the skin weights and use the "Order in Layer" feature provided by Unity.
     
  40. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    You can use the z value of the arm control to bring it behind and in front of the body :)
     
  41. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Great work on this excellent asset.

    Was wondering if there's a planned update coming soon and info of the features on the road map.

    Cheers.
     
  42. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    The next version will be v2.0 and comes with spline controls and FFDs!
    It'll likely be in a month or so, ive just implemented the features, but still needs a lot of bug testing.
    You can see more here:
    https://trello.com/b/JHI4ybs4/puppet2d-feature-bug-list
     
  43. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
  44. Priabudiman

    Priabudiman

    Joined:
    Dec 22, 2012
    Posts:
    6
    @jamieniman

    Awesome thing with the side rig for the walkcycle. But how to set up rig for Front / Back Walkcycle?

    Any example anyone?
     
  45. iKonrad

    iKonrad

    Joined:
    Jun 23, 2013
    Posts:
    179
    Hello,
    Any chance of getting Adventure Creator support in a future? I can't stress it enough how helpful that would be.
     
  46. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Does anyone know if it's possible how to convert Spine bone animation data that's in Json into a format that can drive a puppet2D bone hierarchy?
     
  47. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    I don't have an example to hand -

    Its not as straight forward to do forward and back animations as there is difficulty using a puppet method to get foreshortening on the arms and legs.
    Have the knees and elbows bend inwards, and try scaling the controls to fake the foreshortening.
    The new FFD feature in v2.0 will allow you to deform the arms and legs to do this better - but thats not out for a month or so. ;-)
     
  48. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    What kind of issues are there? (I dont have a copy) Perhaps theres something I can help you out with it?

    By the way - the original question you had about chaning the plane - u can do this now by rotating the global control to the axis you want - it should all work in the current version.

    The spline control is coming quite soon - in a month or so ( v 2.0). This version is pretty massive one - it introduces FFDs, Spline controls and rendering Png sequences :)
     
  49. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    985
    I imagine that is quite a niche question :p
     
  50. iKonrad

    iKonrad

    Joined:
    Jun 23, 2013
    Posts:
    179

    Thanks!

    Actually I made it working with Adventure Creator by applying some fixes in AC.

    There's one thing that I still bother to fix, though: Animation flipping.

    So both systems (puppet2D and AC) have such option, but none of these are working correctly (or I screwed something up).

    So when I use puppet's "Flip" option, some parts of the character disappear (see hands and foots):

    Screen Shot 2014-08-21 at 17.28.44.png


    But when I use AC's mirroring, animations are messed up (hands/trunk/head bending in wrong way, foots behave abnormally):
    Screen Shot 2014-08-21 at 17.27.12.png



    So not sure where's the issue now. Any idea?