Search Unity

Puppet2D - An advanced skeletal animation tool

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

  1. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    I'd love to pick this up, but I'd like to know if anyone has tested it with the PSM version of Unity, specifically if it works on VITA? Thanks!
     
  2. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    If you send me your invoice number to puppet2d@gmail.com I'll send it right over :)
     
  3. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    I haven't specifically tried making a VITA build - but I don't see why there would be any problems. (If there are I'd be sure to fix it )
     
  4. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    Very cool, thanks for the quick response! I will be picking it up soon :)
     
  5. nluckett

    nluckett

    Joined:
    Jul 30, 2014
    Posts:
    14
    I haven't gone through this whole thread yet, so forgive me if it's answered in here already, but I have a question about the end of a chain. Is there a way with Puppet2D to make the end (a hand or foot) follow correctly? Right now I have it setup so the arm, with a sholder and arm bone, is a texture mesh and deforms as it bends. But I left the hand as just a piece on the end, so that it didnt get oddly deformed. But then it doesnt look connected. Any thoughts?

    Also, is there a way to do a whole hand? Fingers and all?
     

    Attached Files:

  6. nluckett

    nluckett

    Joined:
    Jul 30, 2014
    Posts:
    14
    Also, I love the squash and stretch feature... but is there a way to put constraints on it? It would be nice to be able to do it just a little bit.

    And is there a way to put limits on how far an elbow or other joint will bend?
     
  7. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    What you want to do is convert your hand to mesh as well, and then skin it to the hand & elbow bones. That way you can distribute the weights smoothly ass he bends the wrist.
    The same goes with the fingers, add the finger bones and skin the hand to them as well as the hand and elbow. (Make sure you delete the IK control first, and use "Create Bone Tool" to drawn in the finger bones).
     
  8. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Not currently,

    From an animating perspective I've never been big fan of constraining a rig myself - I like to have as much control as possible, even if that means allowing impossible poses.

    May I ask - are you wanting limits because you're planning on trying something procedural with the rig?
     
  9. nluckett

    nluckett

    Joined:
    Jul 30, 2014
    Posts:
    14
    Yep, I was hoping to make an IK arm that the user can control, and the hand grips things. So Im looking to play with this and figure out the limits and how to swap animations on the fly (so if it gets close to a button to press, the hand goes from open to pointing, then on click it would activate the button.
     
  10. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    Hi all,

    I've been getting right into puppet2d lately, it's been awesome, good job jamieniman!

    One thing I've been struggling to get working is root motion. As far as I can tell, root motion in Unity doesn't work with basic sprites or animation created directly in mecanim. I believe it needs a root bone, which is usually set up in the 3d software before importing.

    What I essentially want to do is animate for example a sprite / puppet2d character swinging a sword, I want to animate a little bit of forward motion so that it looks more natural (instead of swinging and staying in the same position). Currently the animation will snap back to the previous position when the animation state switches back to idle.

    Does anyone know of any techniques to get root motion working with 2d sprites or perhaps even puppet2d? Any advice would be highly welcome!

    Thanks
     
  11. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Its something I've started looking into - I'm not sure if its going to be easy to get it working - perhaps I could point you on my tracks and you could let me know if you manage to get it working -

    You need to run this, (perhaps in editor) to create the avatar-

    AvatarBuilder.BuildHumanAvatar

    Then you can change some of the settings of the the animator eg -

    Animator.hasRootMotion

    I haven't spent much time on it yet - please do let me know how you get on :)
     
  12. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    Brilliant, thanks for the info, I hadn't come across BuildHumanAvatar. I'll post back if I get it working.
     
  13. Rodlaiz

    Rodlaiz

    Joined:
    Jul 30, 2013
    Posts:
    38
    Hello,
    I'm thinking on buying this package instead of Esteoric Software's Spine (which is crazy expensive!)
    My question: if I buy it in the asset store I'll get the V2? or you'll update it later for people with a license?

    Thank you!
     
  14. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    All Puppet2D owners will be able to update for free when I release v2 :)
     
  15. Rodlaiz

    Rodlaiz

    Joined:
    Jul 30, 2013
    Posts:
    38
    Great, thanks for the quick answer, I've just bought the package ;) can you please tell me when are you planning to release v2? Thanks
     
  16. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Its basically ready - I'm just doing a little rebranding before I release it.

    I also keep finding myself adding features, recently added weight painting and pose saving :)
     
  17. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
    how close now? Very eager to see if this will work for my setup :)
     
  18. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    I'm aiming to get it released before the end of the year (hopefully sooner).
    Anyone who already owns Puppet2D will be able to upgrade for free :)

     
  19. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Update 2 looks amazing. Really awesome work.
     
  20. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    I'm also interested in the this workflow: Puppet2D -> Mecanim. Any success with the AvatarBuilder class?

    I wanna avoid more drastic measures such as exporting to obj, converting to fbx, importing back to Unity.
     
  21. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    I haven't had a chance to explore it yet - I'd be interested to hear your thoughts on the "drastic measure" - Is there a way to export the obj with all the gameobjects and their nesting? The only one I'm aware of only exports meshes
     
  22. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    Afraid I couldn't get it working. The documentation on it is pretty sparse. I kept getting an error to the effect of "Cannot find Transform of hip bone".

    I ended using an alternative solution by implementing a "root bone". I use something similar to what's discussed here: http://blog.wolfire.com/2011/08/Overgrowth-a143-video-changelog#comment-281076322
     
  23. Ylex

    Ylex

    Joined:
    Apr 9, 2012
    Posts:
    15
    Hi,
    I use quads and 2d textures as sprites rather than Unity's 2D workflow.
    Is Puppet2D a good tool for me?
     
  24. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    Yep, it would work fine I reckon.
     
  25. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    @aaronjbaptiste,
    Do you have a humanoid skeleton with a hip bone or generic skeleton? Are you passing the name of the root transform to AvatarBuilder.BuildGenericAvatar(GameObject go, string rootMotionTransformName)?

    @jamieniman, True, maybe obj won't do the trick. However, an fbx exporter shouldn't be hard to achieve. The format is documented and Autodesk provides a C++ class to export fbx (although a dll dependency might mean PRO-only feature?).

    Probably easier to write your own fbx exporter. Blender's exporter works well with Unity. It's written in phyton if I'm not mistaken. Also, fbx is fairly readable on text editor.. First go to Blender, export a single bone. Then two bones. Then bones + single animation, etc. and compare the output fbx. Then repeat it recursively.
     
  26. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    I didn't have a humanoid skeleton or a generic skeleton. I pretty much copy pasted this code: http://docs.unity3d.com/ScriptReference/HumanBone.html in an attempt to create a HumanBone object for the HumanDescription. However where that code references "Bip001 Spine2" for example, I was adding the GameObject name of a puppet 2d bone. I didn't have high hopes of that working.. The HumanDescription is therefore incorrect and is probably what causes the missing hip Transform error.

    I assume the only way to build a HumanBone at the moment is via imported 3d models?
     
  27. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Hmmm, I think I might try the other method before resorting to this - perhaps someone at Unity will be able to help us.
     
  28. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    We need to get the HumanDescription.skeleton right - thats as far as I've explored - I haven't tried too hard to get it to work yet, if I get to a dead end I'll try to contact Unity for a little help (sometimes theres some undocumented function out there that can help you out)
    http://docs.unity3d.com/ScriptReference/HumanDescription-skeleton.html
     
  29. Tor_Sprouted

    Tor_Sprouted

    Joined:
    Oct 7, 2014
    Posts:
    13
    I've got a couple of questions regarding baking animations.

    1) What is the performance improvement? I understand it's the removal of the bones and controls sprites, and the puppet2d script itself. Can anyone (or you Jamie) provide any percentage improvement or memory free statistics? i.e., the size of the scripts?
    2) If one has multiple characters using puppet2d, are the gains more or less when baking?
    3) Does baking still remove items in Mecanim not directly animated by bones? Are there any other watch outs?
    4) Is it ultimately worth it? Why bake if everything seems to be running fine without baking?
     
  30. Tor_Sprouted

    Tor_Sprouted

    Joined:
    Oct 7, 2014
    Posts:
    13
    Something I'm struggling with is having multiple characters move passed each other, either in front or behind, and not through each other.

    For example: I've got a "Character 1" sorting layer. The character is made up of 2d sprites for legs, arms, torsos, heads etc... and is animated with P2D as you'd expect. These body part sprites each have their own "Order in layer". The back leg would be 0, the front leg 1, the torso 2... etc, so that when they animate they move in front or behind another behind part believably.

    What happens if I have two of these characters move across each other is that one character's arms can appear through another characters torso, when what should happen is the whole character with all its sprites should be entirely behind (or in front) of another whole character. Right now it looks like some multi-limbed Indian god, with floating hair.

    Z-depth doesn't work, as order in layer and sorting layers override the z property of sprite.

    So how is this done? Does one have to dynamically adjust Order in layer for every single sprite that makes up a character for a character you know you want to have in front or behind another character on the same sort layer.
    Or does every character need it's own dynamically generated Sorting layer. What if you have other manual sorting layers... how to you interpose the 10 dynamic sorting layers for the 10 characters wandering about on screen between 2 "static" sorting layers?

    thanks in advance for any time.
     
  31. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    You need to create a script with the following logic and attach to your character(s):
    - public int CharacterSortingOrder = 1;
    - On Start or Awake iterate through all the children sprite renderers and add an offset on top of their sortingLayer value.
    - spriteRenderer.sortingLayer += this.CharacterSortingOrder * 100;

    Now you can control which character shows up in front of the other.. For instance, a character with sorting order 1 would essentially have sprites with order: 100, 101, 102.. 110 and a character with sorting order 2 would pass in front because its sprites would be 200, 201, 202 .. 210.

    Makes sense?
     
  32. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    112
    Here is the solution to flip in runtime (a rotation on the y axis):

    Code (CSharp):
    1.  
    2. void flip()
    3.     {
    4.         if(isTargetLeftOfMe() && !isFacingLeft)
    5.         {
    6.             isFacingLeft = true;
    7.             GblCtrl.transform.Rotate(new Vector3(0f,1f), 180f);
    8.         }
    9.         else if(!isTargetLeftOfMe() && isFacingLeft)//target is to the right of me
    10.         {
    11.             isFacingLeft = false;
    12.             GblCtrl.transform.Rotate(new Vector3(0f,1f), 180f);
    13.         }          
    14.     }
    15.  
     
    Last edited: Nov 22, 2014
  33. Tor_Sprouted

    Tor_Sprouted

    Joined:
    Oct 7, 2014
    Posts:
    13
    Thanks Manny. Will give that a bash. Is there any significant overhead in dynamically setting the sort order number for dozens of characters? And is there a limit to a sort order number?
     
  34. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Not too sure what the error you were getting was with the flipping at runtime (seems to work for me).
    The Puppet2d code already rotates 180 degrees in the Y to do the flipping (it also scales -1 in z to sort out the draw order).

    On a related note, there used to be a Unity bug with collders where they wouldn't work when you flipped the character - make sure you have Unity v4.5.5 patch 2
     
  35. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    No, it's cheap. Do it in Awake() or Start() and you will have no problems. The range of the values doesn't affect the speed of sorting either so you can use anything that fits into an integer.
     
    Tor_Sprouted likes this.
  36. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    What are the plans for unity5 and beyond?
    So far the asset looks a lot better than smoothmoves, specially considering the price.
    Also is there overhead when using puppet2d? specially considering mobile performance.
     
    Last edited: Nov 23, 2014
  37. steveR

    steveR

    Joined:
    Jul 14, 2013
    Posts:
    33
    Are there pre-made 2d animations available on the Asset Store that will work with Puppet2d. For example run, walk , jump , dance ext?
     
  38. zzdjk6

    zzdjk6

    Joined:
    Apr 20, 2014
    Posts:
    2
    hi,I have turned off "Bones Visibility" and "Controls Visibility",but I still can see bones in game window, I'm using Unity 4.6 RC3, the demo scene is work correctly, but my own get the wrong result.
     
  39. zzdjk6

    zzdjk6

    Joined:
    Apr 20, 2014
    Posts:
    2
    sorry, I made a mistake by myself, I should put everything under Global_Ctrl to let it work.
     
  40. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    I don't have any specific figures, but I can explain that baking removes the puppet2d control scripts and so optimises the CPU usage. On the other hand baking into bone keyframes increases the memory usage of the animations - so if memory is an issue it may be better not to bake.

    As above - it will improve CPU, and increase the memory. Currently there isn't much keyframe reduction - as this isn't expose for Unity animations. You can manually clean up they keyframes, but thats going to be a painful task.

    Currently sprite animation doesn't get copied over - but you can easily transfer this your self by copying and pasting the keyframes between the clips.
    Once you bake the global_control script will be turned off. If you still want to use the combine meshes feature and the flip, you should turn this back on and remove all the controls form it.

    If everything is running fine don't bother baking. Its for people who really need to optimise CPU, or want to handover their animations to someone who doesn't have Puppet2D
     
    Tor_Sprouted likes this.
  41. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Puppet2D v2.0 is compatible with Unity 5, I'll be updating to it soon.
    Puppet2D runs well on mobile, and has some performance optimising features like mesh combining and bone baking
     
  42. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    Its in my plans :)
     
  43. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    Btw i read a while back that it doesnt fully work with 2dtk sprites, like you ned to use unity sprtes for mesh/ffd, all the drama.
    Why is that? are there plans to change this and increase 2dtk compat.?
    Also could i use 2dtk to create an atlas and use the sprite dicing functios that optimizes them, then open it with the unity tools and animate with puppet2d?
    I've never tried opening 2dtk stuff with regular unity tools. I mostly just use 2dtk.

    Looking great so far, I have Spriter, and have checked out Spine a while back, but I realize now that a in-unity solution might be more optimal, so maybe i'll get puppet2d in the future.

    Thanks again.
     
  44. Tor_Sprouted

    Tor_Sprouted

    Joined:
    Oct 7, 2014
    Posts:
    13
    Thanks for the replies Jamie. Very much appreciated.
     
  45. Davi_J

    Davi_J

    Joined:
    May 18, 2014
    Posts:
    3
    I just picked this up because it's exactly the tool I've been looking for, and so far so good! Much better than I expected and has been really easy to use!

    This is probably an easy fix, but I haven't found a solution for it yet. When I try the "Covert Sprite to Mesh" the sprite is outlined accurately but the image for the sprite changes back to the entire sprite sheet. Any ideas how to fix this?

    Screen Shot 2014-11-29 at 11.18.57 AM.png
     
  46. Taurris

    Taurris

    Joined:
    Aug 13, 2012
    Posts:
    14
    [QUOTE="When I try the Covert Sprite to Mesh the sprite is outlined accurately but the image for the sprite changes back to the entire sprite sheet. Any ideas how to fix this?[/QUOTE]

    This happens when you have different than [1,1,1] scale on the sprite or any of it's parents. Just unparent it, set the scale to [1,1,1], then convert it to a mesh -> then reparent it back and change the scale to whatever you want.
    Atleast that's what was happening to me ;)
     
  47. Davi_J

    Davi_J

    Joined:
    May 18, 2014
    Posts:
    3
    Thanks for the quick response Taurris! I actually had it set to 1,1,1 but for some reason it wasn't working. Loaded up the demo scene and it was working so I was at a loss. Fired up my scene and it magically worked... I guess it was a turn it off and on again thing -.-
     
  48. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    987
    PUPPET 2D V2 IS OUT NOW!

    NEW FEATURES INCLUDE:

    • FFDS (FREE FORM DEFORMATION)
    • SPLINE CONTROLS FOR BENDY THINGS
    • POSE SAVING
    • WEIGHT PAINTING
    • NEW TABBED GUI
    • PNG SEQUENCE RENDERING

     
    Kiori and Manny Calavera like this.
  49. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    Can't wait to test this out. Thanks brah!
     
  50. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
    looking great! good job :)