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

Mesh Animator - Highly efficient animated crowds. For support, please use email.

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

  1. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    I am on 2018.4 so I download from the Asset Store browser. I solved it by downloading the asset with a 2019 version of the editor, switched back to 2018 and now the package content was correct. just if someone else has the same issue.
     
  2. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    I hoped this would solve this issue but I still have no visible models at all receiving the error:
    Shader error in 'Mesh Animator/Standard': variable 'vertexInput' used without having been completely initialized at Assets/MeshAnimator/Shaders/MeshAnimatorStandardBase.cginc(37) (on d3d11)

    Strange thing is that it worked in the beginning.
     
  3. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Hi. I used mesh animator 1.5.9 in my previous projects, now i upgrade it to last version 2.0.16 and it have significant size different in baked animations. in v2 baked animation size rised x8. 3.5mb vs 24.3mb, 28.7mb vs 193.3mb. Even on low bake settings in v2 it still have huge different (0.1 compression 167mb, no compression 193mb in v2 MA vs 28.7mb in v1 MA on standart settings). And i cant now use it in my mobile project. Is it a bug or something? I guess i have to use 1.5.9v

    UPD: i found what make x8 size of files. its mesh normal mode - baked. Question: is it a necessary setting?

    UPD2: There is a bug, i have 10 animations, i dissabled 2 of them in MA window, 8 to bake. After bake popup: 10 animations baked.

    UPD3: Another bug. In 1.5.9 version bake goes well. In v2 i have invisible mesh. Ive bake my zombie character, it have 1 skinned mesh of body and 1 mesh of hair. In v1, everything is ok, in v2 - combined mesh is good (body and hair present), but when i drop prefab in the scene, it shows only hair, body is invisible, or just not apear, i dont know. there is no body even in wireframe mode.
     
    Last edited: Nov 21, 2020
  4. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Only if you need accurate mesh normals during animation

    This is a display bug issue only. It doesn't actually bake all 10.

    Do you have the component on your skinned mesh turned off? If the component is disabled, it will be discarded in the bake.
     
  5. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Ok.
    Ok.
    No, its enabled, and baked mesh is good, but in prefab preview and when i drop it in scene, mesh is wrong. I did the same thing in the previous version and everything was fine. Also, if i remove from MA window hair mesh, prefab in scene is good after bake. idk why its happening. Skinned mesh of body and hair mesh share same material.
     
  6. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Hello, just purchased your asset and I'm having problems.

    1-After baking (shader mode) if I put the prefab in the scene it is HUGE I have to change the import scale from 1 to 0.01 why? There are no scale curves in my animation not sure why this happens.

    2-When I put a material with your custom shader on it the character becomes invisible. Managed to make it work once but I cant seem to get it working anymore, I tried baking multiple times with different settings, couldn't get anything to work

    3-Any idea why I still end up with 1 batch per character?

    4-Where is the section in the manual describing the Bake preference setting "Bake texture size" and "Bake texture quality" ?

    5-I exposed transforms for my character's head and hands but they are not animated

    6-When baking (especially in batch mode) you should have a "cancel button" and in batch mode you shouldn't be showing a dialog box waiting for you to click ok before continuing, it kinda defeats the purpose.

    7-I think batch mode is broken, it sent everything in the same folder (and yes those were assets that I baked before, the manual says it will reuse the same settings but they have the same animations so its a mess)

    Thank you.

    Update1: I think I found the solution to problem 1 & 2. I used to put my new material (with your shader) on the character AFTER it was baked. I just tried putting the material BEFORE baking and now is it visible AND the scale is fixed. Not sure what is going on here but if it's working as intended you may want to mention that in a "Troubleshooting" section of the manual.

    Update2: I was having further issues with invisible meshes, turns out if any objects in the hierarchy on the path to your mesh is not scaled at 1,1,1 you will have problems.In retrospect that may have been the problem all along.
     
    Last edited: Nov 25, 2020
    JBR-games likes this.
  7. GameMechanics

    GameMechanics

    Joined:
    Jul 15, 2013
    Posts:
    57
    Are there any lower poly assets for a crowd that work with this? I need a sporting event crowd. I just got this and have not imported a Mixamo one yet. The problem with those are they are 50k models and have lots of parts. The examples have one part "Human". Still working on it.
     
  8. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    108
    Hi, guys
    Are there any news about HDRP shader mode?
    I've wait for this for a long time><.
     
  9. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    How can I get access to Mesh Files generated by Mesh Animator? Currently they are generated at runtime with name *(Clone).

     
    Last edited: Dec 4, 2020
  10. cemleme

    cemleme

    Joined:
    Mar 24, 2017
    Posts:
    30
    Hello,

    I am trying to bake a complex and branched object.

    using snapshot mode, highest quality or no compress

    the problem is there are multiple non-skinned renderer mesh filters under the branch with different materials but somehow they all get the same material at the end

    please see the attached screenshot. the one on the left is the baked one and the branches shown on the circle somehow gets the material of the crystals on top

    the right one is the regular skinned mesh + mesh object

    anyone faced with a similar problem? or is there anything I am doing wrong?

    thanks
     

    Attached Files:

  11. RedGirafeGames

    RedGirafeGames

    Joined:
    Sep 30, 2016
    Posts:
    32
    Hi,
    as I understood the bones are lost during baking, is there a solution to parent objects to a bone transform? For example to put a weapon in hand of the model?
     
  12. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    There is a public static dictionary that stores the generated frames at runtime on the SnapshotMeshAnimation class
    Code (CSharp):
    1.  
    2. public static readonly Dictionary<Mesh, Dictionary<SnapshotMeshAnimation, Mesh[]>> GeneratedFrames = new
    3. Dictionary<Mesh, Dictionary<SnapshotMeshAnimation, Mesh[]>>();
    So you could access it that way

    Code (CSharp):
    1. SnapshotMeshAnimation.GeneratedFrames[yourMeshAnimatorComponent.baseMesh][yourMeshAnimatorComponent.currentAnimation][desiredAnimationFrameIndex]
     
  13. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Yes you can expose transforms (bones) during the baking process
     
    RedGirafeGames likes this.
  14. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Can you PM me the model? I will take a look
     
  15. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    If you PM me the model I can take a closer look.
     
  16. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I'm not much of a programmer. I write most logic in playmaker. I would love see feature to save static mesh (model) from a current pose of skinned mesh renderer.
     
  17. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    Hi Jacob, I'm hoping you can help me. (I've tried searching to no avail.)

    To make this simple, I have a horde of ShaderMeshAnimator zombies chasing my character using Play("Run"). When they're close, they Play("Attack"). When I move away, they Play("Run") again, and sometimes disappear from view. Upon getting close, they reappear and Attack as they're supposed to.

    I'm not using LOD, and get the same result regardless of "Update when offscreen".

    If I use Crossfade instead of Play, they scale to zero over a few frames instead of instantly vanishing, which is interesting.
     
    Last edited: Dec 8, 2020
  18. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    Before I forget, you should change MeshAnimationCreator.cs:1907 to:
    Code (CSharp):
    1. Debug.Log(string.Format("Mesh Animator: Baked {0} animation{1} successfully!", clips.Count , clips.Count > 1 ? "s" : string.Empty));
    ...to avoid pesky confirmations disrupting a time-consuming batch-build.
     
  19. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    Any news/ETA on HDRP support?

    Sorry to nag it's just desperately needed for my project.
     
  20. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Anyone else having problems with the Standard shader not allowing each instance to be at a different animation time? Works fine with the other shaders.

    Also, does this guy reply to emails?
     
  21. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Sorry if I missed your emails. You are using the latest version? 2.0.17?
     
  22. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    760
    Are any of you guys using this within ECS?

    1. Does it work with Hybrid Renderer V2?

    2. In the Walkthrough video, it shows a "Shader Mesh Animator" component being attached to each gameobject. In ECS, there are no gameobjects to attach the "Shader Mesh Animator" component to. So how do you change the animation from idle to run for example? I haven't purchased MA, so I can't look at the "Shader Mesh Animator" or "Snapshot Mesh Animator" source code to see how it changes animation states.
     
    Last edited: Dec 13, 2020
  23. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    It does not work with ECS. As it depends on the mesh filter (for snapshot mode) and mesh renderer (for shader mode). In theory it could work with ECS, but not out of the box.

    Hybrid renderer isn't supported as the converted shaders included are only for URP and built-in pipelines as of now
     
  24. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    760
    Okay, thanks. In that case, I'll try and find another asset that works with ECS.
     
  25. cepoimario280135

    cepoimario280135

    Joined:
    Jan 24, 2020
    Posts:
    12
    Hello all , just upgraded to unity 2020.2 as it just got released out of beta and it seems that neither the shadergraph or shader are rendering
    Code (CSharp):
    1. Shader error in 'Mesh Animator/Universal Render Pipeline/Lit': 'InitializeStandardLitSurfaceData': output parameter 'outSurfaceData' not completely initialized at Assets/MeshAnimator/Shaders/URP/MeshAnimator-URP-LitInput.hlsl(89) (on d3d11)
    in urp 10.2.2
     
  26. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Yes 2.0.17 that you just uploaded to the store.

    And I just did a retest and while batched on the standard all characters with the same animations are in sync (same time). When using the other shaders they can all be at different times no matter the animation.

    Example with standard:
    upload_2020-12-15_14-52-26.png
    You can see 2 (maybe 3) distinct groups and within each group they are all at the same time.

    Here is the exact same thing with the shade changed to Mobile/diffuse:
    upload_2020-12-15_14-57-47.png

    See the difference? Even the distribution of the animations is different, as if they was only one animation and timing per batch on standard? Obviously it's more apparent when moving.
     

    Attached Files:

    Last edited: Dec 15, 2020
  27. the_unity_saga

    the_unity_saga

    Joined:
    Sep 17, 2016
    Posts:
    265
    hey i LOVE your asset, as i am in the process of designing a entire game around it.

    sure there are some problems but i am willing to live with the performance gains.

    I have a couple questions:

    are we allowed to use the meshes that come with it for commercial use? i dont see a license on the models

    how do you make a LIT transparent cut out shader?

    or more specifically, how would I turn the Human Colored shader included in this asset into a simple cutout shader with lighting? I am trying to figure out what key things in the shader code I need to add to make it do what I want but I am having a hard time figuring it out, if you can point me at what code to change in the shader code that would be a great help.
     
  28. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    I will need to test with the latest version

    Should be able to release a fix for this soon, must've missed setting up an instance id somewhere.
    Feel free to use the included models as you wish, 2 of them I created. The skeleton is a free asset https://assetstore.unity.com/packag...ds/fantasy-monster-skeleton-35635#description

    It's fairly simple to convert a basic shader to support mesh animator, details are here: http://jacobschieck.com/projects/meshanimator/documentation/documentation.html#customshadersupport
     
    tcz8 likes this.
  29. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Hi, i pm'd a model to check, take a look please
     
  30. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    108
    Hi, @jschieck .
    Looks like there's no chance to support HDRP shader moden any more. So, Does the URP shader moden works fine?
     
  31. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    Unfortunatley no. This is what I get regularly in URP: models disappear. Sometimes builds work, other times they don't.
    upload_2020-12-18_14-49-15.png
     
  32. cepoimario280135

    cepoimario280135

    Joined:
    Jan 24, 2020
    Posts:
    12
    Yes it works but not on the latest URP version 10.2.2 with unity 2020.2 there are some shader errors thrown and the mesh is not rendering
     
  33. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    @jschieck here is the full repro for the bug where all MA disappear. version 2.0.17 in 2020.1.17 on urp 8.31
     
    HenryChinaski and Klausology like this.
  34. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    Hello, a very strange problem. When GPU Instancing is enabled on MA shader, a strange glitch appears. Any solution? Thanks

    Edit: the problem is with the tree, which is not visible on the left. It's casting a shadow on the tent. Not a shadow problem since the glitch is still there if I turn shadow casting off on the tree.
    Edit2: maybe GPU instancing is not intended to use with Mesh Animator shaders? Maybe it doesn't hurt the performance?
    Edit3: it happens only with one material out of two.
    Edit4: one material is invisible with MA shader and no idea why.
    Edit5: other MA objects disappearing too.. Maybe I will better stick to snapshot..
    Edit6: could be because of some recent changes to Unity. Having problems with snapshot too, one mesh doesn't animate at all..
    Edit7: In 2020.1.10 same visual distortion glitch is there too.
    Edit8: 1.Glitch remains with shader mode.
    2. One type of object keeps disappearing (it's sharing the same mesh with another prefab) in shader mode. Tried duplicating the same mesh to use as a different one to no avail.
    3. Switching to snapshot mode with problematic objects.
    Edit8: Sometimes problem 2 doesn't happen for some reason. Now those objects' aren't disappearing in shader mode.
    Edit9: I get "NullReferenceException: Object reference not set to an instance of an object" after baking a new object and entering play mode. The object becomes invisible.
    Edit10: Unity's restart fixed the invisibility problem. I hope it will last.

    P.S. Sorry for that many edits lol

    Merry Christmas!

    Unity 2020.2







     
    Last edited: Dec 26, 2020
  35. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    61
    Hi!
    I have a texture animation which is running smoothy at the default (or higher) speed, but when I slow it down it becomes jerkily.
    That's of course because of the limited amount of frames, but is it possible to interpolate between animation key frames in order to always have a smooth animation regardless of the speed?
    If for example at X time I am halfway between frame Y and Z, interpolate the vertex position between its value in Y and in Z at 0.5.
    Thanks!
     
    Last edited: Dec 22, 2020
  36. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    I'm having an awesome time with this asset but encountered 2 problems:

    1- Any ideas why sometimes cross fade works very well between two animations and sometimes it causes a jerk as if it skipped the cross fade?

    I tested it with a script cross fading back and forth between two animations in a loop and it happens no matter the cross fade speed but "maybe" it occurs more often under a speed of 0.3-0.4? Not sure.

    2- Is there a way to avoid the inflated/deflating meshes when entering play mode? (or does that happen in the editor only?)

    Thank you!
     
  37. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    and another bug: in v 2.0.17 URP 8.31 when baking something made of multiple skin and meshes the resulting mesh doesn't include the skinmesh.
    original
    upload_2020-12-23_7-29-36.png
    MA asset got no legs
    upload_2020-12-23_7-29-19.png
     
  38. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    I've replied via email

    Can you PM and example package or model this is happening with?

    It's possible, but becomes more complex when the vertices bleed over into a new texture halfway through an animation/frame. You'd have to blend the two frame colors (vertex position) over the current and next frame. I decided to not tackle this in the initial release of shader mode.
     
    laurentlavigne likes this.
  39. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Fixed this issue in 2.0.18

    - Fixed standard shader not displaying individual animations correctly.
    - Fixed PlayQueued pausing the next animation.
    - Fixed IndexOutOfRangeException error when re-baking shader mode animations.
     
    laurentlavigne and hopeful like this.
  40. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    Happy new year, any ideas on how to fix this? It's like a ghost mesh following the normal one. Shader animation, 2020.2
    Edit: happens only if speed is modified via scripting.
    Edit2: happens all the time now, even if speed isn't modified. Looks like the same issue as before with that tree. Giving up and switching to the Snapshot mode and will hope shader Mesh Animator will work one day.
     
    Last edited: Jan 2, 2021
  41. cemleme

    cemleme

    Joined:
    Mar 24, 2017
    Posts:
    30
    Hello,

    I have a scene with many snapshot meshanimated objects. they appear fine but when the scene first loads I get this error:

    Code (CSharp):
    1. KeyNotFoundException: The given key was not present in the dictionary.
    2. System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <4756199cf52a4f14b33cdcc5659f782e>:0)
    3. FSG.MeshAnimator.Snapshot.SnapshotMeshAnimator.OnDestroy () (at <4deb72a49bb345b2bcbd315bdf0cb8e5>:0)
    4.  
    the scene works fine except the error.

    do you have any idea about this? why would there be OnDestroy calls when the scene first loads?


    edit: this error occurs only when the scenes is async preloaded

    Thanks
     
    Last edited: Jan 13, 2021
  42. Gaoyu2020

    Gaoyu2020

    Joined:
    Aug 25, 2014
    Posts:
    19
    please fix models disappear on the latest URP version 10.2.2 with unity 2020.2
     
  43. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Hi @jschieck, i'm currently using Unity's own Animation Instancing demo but this has huge spikes when enabling an instanced object.

    upload_2021-1-15_14-0-40.png

    0.7MB of garbage and 10ms spent on enabling objects obviously isnt ideal, does your plugin have similar issues?
     
    Last edited: Jan 15, 2021
  44. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    You will see a spike when the first instance is created (texture or mesh generation), and standard game object instantiation GC, but then subsequent instances won't have additional allocation on enabled/disable.

    So it's best to create an instance in your scene at the start, then you'll have all that out of the way as you create or enable more instances.
     
    TJHeuvel-net likes this.
  45. photonic

    photonic

    Joined:
    Dec 29, 2012
    Posts:
    47
    Hi @jschieck, I have the same error with your standard shader on 2019.4.14f1, built-in render pipeline.
    Any chance you have an idea how to solve that?
    Thanks!
     
    HenryChinaski likes this.
  46. thao050192

    thao050192

    Joined:
    Jul 17, 2017
    Posts:
    5
    i have error with snap shot mode, some one suggest me to fix it.Thanks
     

    Attached Files:

  47. Atheosls

    Atheosls

    Joined:
    May 19, 2017
    Posts:
    7
    Not Supported
    Code (CSharp):
    1. WrapMode.Clamp  WrapMode.Once  WrapMode.ClampForever
     
  48. Atheosls

    Atheosls

    Joined:
    May 19, 2017
    Posts:
    7
    when use Shader Mode The Action of OnAnimationFinished is unuseful upload_2021-1-18_17-11-22.png
    upload_2021-1-18_17-12-9.png
    There's been an enforced pause
     
  49. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey @jschieck .

    Just downloaded this and about to start playing. First thing I have to do though is check the code since I need to make a system on top of this since I will eventually job/burst compile our animations.

    Anyway I noticed you use properties a lot, any chance of removing them in the next update? The reason being is that Unity is terribly dishonest about them, properties are not inlined so calling them has the same or possibly more of a performance cost than calling a method.

    So things like .Length on an array will effectively call a method each time. Far quicker to call it once and store it in a variable to be read as needed (GetInterpolatingFrames in MeshAnimationBase is a good example) or better yet, store the length somewhere like a scriptable object if you know it wont change.

    The only info Unity has on this is here:
    https://docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity8.html

    They make more of a difference than people realise and when you start talking about 10k objects its a prime situation to get rid of them and get back noticeable CPU time :)

    Would also be nice to stick this flag in some of the most relevant places (just above method declarations for methods with small blocks of code called frequently)
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
     
    laurentlavigne likes this.
  50. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Im using Mesh Animator with the job system and burst, its really fast and the plugin definitely is not a bottleneck. You also might want to double check the recommendations on that page with il2cpp, things are definitely different there.
     
    laurentlavigne likes this.