Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Mesh Animator - Highly efficient animated crowds, fully animated GPU instancing, and more!

Discussion in 'Assets and Asset Store' started by jschieck, Dec 7, 2014.

  1. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Does the model use multiple materials or sub-meshes? Mesh Animator currently doesn't support sub meshes in all cases so that might be what the issue is. If you want, send me the model and textures and I'll take a look at it and see if I can get a fix for you.
     
  2. blackanub1s

    blackanub1s

    Joined:
    Dec 12, 2013
    Posts:
    21
    My model consists of several objects comprising a mesh and a texture for each body part.

    I sent you an email with the model attached.

    thank you again for your interest and your quick response
     
  3. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Version 1.4.1 is now out!

    Fixes a minor bug with frame pre-generation and multi-threaded normal calculation.
     
    ikemen_blueD and JBR-games like this.
  4. cj31387

    cj31387

    Joined:
    May 23, 2012
    Posts:
    141
    I see that the voxelizer makes the models very chunky, does mesh animator allow for making things voxelized but a little higher detail. I'm thinking of doing a wolfenstien like remake and was thinking i could use mesh animator to convert 3d models to a sprite resolution and look similar to wolfenstien, pixelated but not extremely pixelated like the voxelizer demo. Is achieving about this resolution with mesh animator possible? http://www.wolfenstein3d.co.uk/wsjafrikapic.gif
     
  5. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    You can set a custom compression value to achieve whatever level of accuracy you want. So you can make it look a "pixelated" as you wish. The lower the accuracy, the more blocky it'll look.

     
    twobob and cj31387 like this.
  6. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    There is bug in the current version in the Asset Store (version 1.4.2) that won't allow you to create meshes if you're not combining more than one mesh together. The fix is submitted for approval, but if anyone needs it before that goes through, let me know and I'll send them the updated script.
     
    JBR-games and ikemen_blueD like this.
  7. Mansoor-dp

    Mansoor-dp

    Joined:
    Sep 17, 2014
    Posts:
    1
    awesome asset and i am just trying to use it first time, issue is that when i am exporting the crowd from a single fbx placing it specifically at a position in my scene its changing the placing after getting baked.

    Also iam trying to Combine multiple meshes in a separate test but they are not getting baked
    Approaches i tried are:

    1. Exported 2 different fbx files and tried to combine them
    2. Exported 1 fbx and copied its mesh several time and tried baking

    Both arent working, need to know what am i doing wrong in this
    Thanks
    any help is appreciated
     
    Last edited: May 16, 2016
  8. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey,

    The offset positions will not get baked, you want to bake the FBX first, then position the baked version in your scene.

    For the issue with the mesh combining, as long as the meshes are a child of the same object, it should combine properly. If it's not feel free to shoot me an email or PM me the FBX file and I'll take a look at it for you.
     
  9. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    Has anyone done performance test on static /not mecanim animated objects? e.g. Buildings, rocks or stuff that moves but isn't animated, like cars ? Any idea?
     
  10. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    I'm not sure why you would be using this asset for that sort of thing? Do you mean like moving a bunch of cars via bones or animation in a separate software then baking those?
     
  11. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    No, as I understand the system you also do fine tuned LOD stages and whatnot to increase performance. I wondered if your product may have even more use cases. Full auto LOD, one could drive the LOD according to areas with high geometry density or FPS?
     
  12. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    155
    Hi, I just found your asset and it is pretty impressive. I was looking for a way to increase performance of my RTS game (to allow for more units on the map) and this asset looks like it could help. I do have some questions tho:
    1. are there any limitations on the model and/or animations?
    2. is there a support for LOD? Lets say I would like to use various compression levels as the camera distance changes and ideally at the closest level it would switch back to Mecanim to get max quality
     
  13. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
  14. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    609
    Great to see this asset on the front page of the asset store, hope it helps generate some more sells, as this is an absolutely awesome asset...
     
  15. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    The current LOD implementation is used strictly to control playback FPS of the animated asset to help with performance, it doesn't do any actual model swapping. But you can use Unity's built in system for that (see below)

    1. The only limitations will come from the level of detail in the meshes. The higher the vertex count, the greater the memory footprint and file size since it has to store each frame of animation in memory after it re-generates them at runtime. CPU performance shouldn't really be affected by vertex count though, only the number of actual instances you have in the scene.
    2. To go along with what @Skyfly was saying, the LOD system only controls the playback FPS of the animations to reduce CPU usage. BUT you could use Unity's built in LOD system to use a Mecanim animated asset as LOD level 0, then once the object far away swap the LOD to a MeshAnimator asset. You would just use Unity's LOD group, and the nearest LOD would use the SkinnedMeshRenderer and Mecanim, and the lower LOD's would use the MeshRenderer on the MeshAnimator object. And you could also make multiple versions of the asset using different compression levels for each LOD level for better performance, as long as you disable the running scripts when the LOD level switches.

     
    local306 likes this.
  16. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Thanks!
     
  17. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    I thought your compression system (some posts above ) could be (ab)used for LOD?
     
  18. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    It doesn't actually compress the mesh as in reducing vertex count. It clamps the accuracy of the animation data to save on file size. Though if your looking to make some quick LOD's, I've tested this asset in combination with the Krabl Mesh Processors for some pretty awesome results.
     
  19. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    Above you talk about voxelizing and a pixelated look. These are just results of animation compression and keep the polycount?
    Sorry for bothering you.
     
  20. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    From the manual (about compression settings)
    "Determines how many floating point numbers to store for vertex positions."

    Will this result in a reduced amount of rendered polygons? I understand that your system gets down draw calls under certain conditions. I just try to understand what exactly happens when you compress models and if that would get down polycount.
     
  21. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    It's no problem I'm happy to answer your questions! The compression setting clamps the accuracy of a vertex position. So if its actual position is 1.234 it might clamp it to just 1.2. So if you have two vertices within that small range from each other, when the animation is played back it will place them at the same position making it appear blocky or voxelized. But the vertex count and polygon count remains the same. It's not so mesh compression as it is file size compression since it throws out all that extra positional data.
     
  22. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    Thanks jschiek, I beginn to understand.
    In the end I will buy anyway I guess :D
     
  23. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    312
    Really interesting asset! Have you tried this yet with the GPU instancing in 5.4, would that lead to even better performance?
     
  24. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    It's planned for my next update! Using Mesh Animator to bake the skinned meshes, then GPU instancing to draw them since GPU instancing doesn't support skinned meshes yet :)
     
    iivo_k likes this.
  25. RichyK

    RichyK

    Joined:
    Feb 8, 2015
    Posts:
    47
    Hi, I've just purchased Mesh Animator, and tried it on a spider asset I need to convert from the store (https://www.assetstore.unity3d.com/en/#!/content/22986). I used the prefab from that asset and converted it. Mesh Animator created 5 files for the animations and two additional files (spider_AnimatedMesh & spider_AnimatedMesh_combinedMesh). When I then add the spider_AnimatedMesh object to the scene, focus the camera on it and press play, the model disappears from the cameras view. In the inspector the current frame property is increasing but I see no model.

    What have I done wrong?

    Richard
     
  26. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey Richard,

    Sounds like you're doing everything correct, I'll download the asset and test it out and get back to you shortly.
     
  27. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    @RichyK I downloaded and converted the spider, and it seems to be working just fine. Which version of Unity are you using?
     
  28. RichyK

    RichyK

    Joined:
    Feb 8, 2015
    Posts:
    47
    Hi, I'm on version 5.3.4f1. Oh and my build target is Android, don't know if that would make a difference?
     
  29. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey @RichyK, I've tried it in that version of Unity as well and it's still working. You're just trying to convert the FBX file that came with the asset store package right? The spider_AnimatedMesh prefab it creates is what you want to use in your scene which it seems like you're already doing, so I'm not quite sure what could be going wrong. If you want you can zip up your project and send it to me and I'll take a closer look.
     
  30. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Hi,

    Is it possible to move individual characters in a crowd? The compressed animations are per mesh right, so the crowd is comprised of different component that all together use one draw call, correct?

    What would be the best way to have individual characters moving? Can I bake root motion into Mecanim animations, or do I have to move the GameObjects by script? I assume the latter is the only way to go.
     
  31. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Currently each mesh is a draw call, they aren't all drawn as one until I release the next update which will feature GPU instancing. So you can move and place them however you wish. The rendering overhead is much cheaper than using skinned meshes however, at the cost of slight memory increase.

    You'll also have to move the root via script as the root animation data gets thrown out. However you might be able to use the root animation for the motion, and just not use the skinned mesh renderer and achieve the same results.
     
  32. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Thank you very much for the quick reply. I think I understand how it all works now.

    I just have one more question. Would it be possible to have the mesh compression only work for a certain LOD level?

    For instance I could have a crowd, where people close to the player have realistic facial and eye animations when close to the player, but simpler voxelized mesh animations when they are farther away from the player?
     
  33. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Yeah you could just use Unity's built in LOD system for that. Using Mecanim and and a SkinnedMeshRenderer for the close LOD or a animated mesh with little compression. Then a higher compressed mesh for the lower LOD levels. Just know that mesh animator cannot share the pool of animation meshes between compression levels, so you'd have two sets of meshes stored in memory.
     
  34. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I can deal with the memory since I'm developing for PC. I'm just worried about my root motion that is baked into my animations.

    I don't quite understand how I would achieve this. How can I use just the root motion of a character animation to move a GameObject?
     
  35. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    609
    That would make things much easier if possible im going to look into that :)
     
  36. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    http://docs.unity3d.com/Manual/RootMotion.html

    Well for the root motion to be applied you'd have to keep the original skinned mesh hierarchy and animator and controller, and just remove the skinned mesh renderer. That way you'll still get the motion (I believe) on the transforms. Then what you can do is use the MecanimMeshAnimatorController script included in the asset to allow the Animator to control the playback of animations on the MeshAnimator. I'll try and get an example working tonight when I get home.

    I'm not 100% sure it'll work, but I think it will.
     
  37. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Thank you very much for looking into this. Ideally an automatic mesh animator that is initiated at certain LOD's would be ideal. But this solutions should be great as well if it works.
     
  38. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I can't seem to make humanoid animations work that don't come from the same model. I use many different human models but they all get their animations from one model. This works great since many models can share the same rigged animation. It looks really good, and is fast to work with.

    The Mesh Animator simply ignores animations that aren't attached to the model. This makes this asset very useless for me, since the time it would take to refactor all animations would simply be too prohibitive and soul crushing. The rigs don't match each other 100%.

    Is there any way to use the mecanim avatar system to bake animations?
     
  39. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey,

    When baking you can add custom animations to the list to bake by selecting them and clicking the Add Custom Clip button, BUT you need to do this for each variation of the model as the source. The system stores vertex data for each frame of animation so if the models are different in vertex count or positioning (even if using the same base rig) then you'd need to bake each one.

    I'd love to add some sort of runtime baking setup so you could just convert things on the fly, but that won't make it in for some time.
     
  40. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I figured that out pretty early on. The problem is that there is no animation result. The mesh just disappears. I can send you a small project if you wish.
     
  41. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Oh okay. Yeah absolutely I'll take a look and get it fixed.
     
  42. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Any news?
     
  43. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey guys! A small update has been released to the asset store that greatly increases the performance of the custom normal smoothing angle and also allows for instant normal calculation so they show up properly on the first frame (shout-out to Cesar for the bug reports). Also garbage collection generation when generating animation frames has been drastically reduced.

    Version 1.4.5
    • Added Instant Normal Calculation option for instantly re-calculating the normal's of a mesh to display correctly on the first generated frame.
    • Added Recalculate Normal's On Rotation to properly update the normal's if the object is rapidly rotated.
    • Significantly increased the speed and reduced garbage collection of using custom normal smoothing angles.
    • Fixed Play Automatically still playing when disabled.
    I'm still looking into Humanoid rig generation and will post here when I get it figure out.
     
  44. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    I've pushed a new update to the asset store that now supports baking humanoid rigs. If you'd like a copy of the update immediately before it hits the asset store email or PM me your invoice # and I'll get you a link.
     
  45. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Version 1.4.6 is now live! This update includes the ability to bake humanoid rigs.
     
  46. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Version 1.4.7 is live!
    Re-targeted avatars can now be baked using a different avatars animation.
    Root motion can now be baked into the Mesh Animation.
     
    ZJP likes this.
  47. zmaxz

    zmaxz

    Joined:
    Sep 26, 2012
    Posts:
    143
    I am trying to combine multiple meshes ,but.........How to fix this error? Error.jpg
     
  48. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Hey zmaxz, It appears that your mesh has multiple materials which is currently not supported. You need to make sure all combined meshes share a single material. I'm working on fixing this, but haven't been able to complete it yet.
     
  49. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Now that 5.4 is out, are you looking to utilise the awesome new GPU Instancing in Mesh Animator at all?
     
  50. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    369
    Yup! Actually going to try and get a working prototype today if I can!
     
    twobob likes this.
unityunity