Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    507
    Yup done that, il2cpp doesn't inline either :)

    BTW not saying its a bottle neck, not even run it yet! But its an easy area to see improvement
     
  2. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    507
    Also I just tried to make a material using the standard shader provided and its throwing this error:

    Shader error in 'Mesh Animator/Standard': variable 'vertexInput' used without having been completely initialized at Assets/MeshAnimator/Shaders/MeshAnimatorStandardBase.cginc(37) (on d3d11)

    Using the built in renderer on Unity 2020.1
     
  3. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    507
    Wow.... um ok is there any reason why you are keeping the alpha channel for the textures? So far as I can see you always set it to 1 which means if its not being used 25% of the data in the textures is doing nothing!

    Screenshot_2.png

    Screenshot_3.png
     
  4. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    601
    There are some more questionable things going on, e.g. the _shaderTime property. That might as well be
    Time.timeSinceLevelLoad.

    Custom shaders are also missing documentation on how to apply normals correctly, best to just copy over whats done in their shaders (like mobile/diffuse)
     
    Last edited: Jan 22, 2021
  5. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    601
    This plugin has a lot of issues. Just fyi if you have different meshes that use the same material it breaks, you have to manually make different materials for each mesh.
     
  6. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    428
    Shader time and unity time are not the same thing. As a game is paused and unpaused or minimized and maximized the two can become out of sync.

    This is a requirement for material property blocks and instancing...
    This is controlled in the bake window by the texture quality setting. Believe me I am well aware there are more efficient ways to do things as I've been using Unity for a very long time, but when you make an asset that's thousands of people use, you have to make it accessible as well, for both new users and pros.
     
    Last edited: Jan 25, 2021
  7. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    507
    This has nothing to do with what I'm talking about. You can change the texture format in this window. But those formats are still wrongly utilised.

    Congratulations, but you still could have easily made it accessible and not waste 25% of the data... The workflow is exactly the same, literally nothing would have been different to end users if this was accounted for in the first place. Since it wasn't done properly in the first place though, people would need to rebake animations and that is indeed a mess.
     
  8. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    428
    Thank you for your feedback, enjoy your refund, lets reserve this thread for paying customers.
     
    HenryChinaski and LaireonGames like this.
  9. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    601
    You and i know thats the case. But clearly if your plugin requires this it should be documented that this is the case. Newer users will not know this, and run into the same issue i had. Why isnt there a warning built in?

    I plan to make a workaround for myself too, simply instantiate one new material per sharedmesh. That completely solves the issue.
     
  10. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    26
    Hi, im still using 1.x version on MA. Im looking now how working 2.0.18 with my models. There is big differece between these versions? There is no bugs now with my models. Ive tried a new shader animated mode, and there is a huge animations size. For example, snapshot: 2.8 mb, shader animated: 16mb, etc. up to 64mb. Its too large. I guess there is no point to use it and i should better stay on snapshot mode? I working on mobile game and size is importal to me.
     
  11. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    26
    Also, there is a thing, present even in last version. When animated mesh offscreen, events not working, when using regular animator, they works. Example, i have my enemies footsteps working by animation events, and because of it, my footstep sounds not working when my enemies not in the camera right now
     
  12. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    428
    There are lots of changes, but no major performance improvements for snapshot mode from 1x to 2x. Shader animated can produce larger memory footprints, but it's very dependent on the model and animation length. If snapshot mode is working great then no reason to switch.
    Do you have the Update When Offsceen option enabled on the Mesh Animator component?
     
  13. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    26
    Hi, thanks for reply. No i didnt enable it. There is big performance difference if i will enable it? Because only what i want to work offscreen are events and i have a lot of enemies on screen
     
  14. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    96
    Any good news for HDRP shader animated mode?
     
  15. alejojamcity

    alejojamcity

    Joined:
    Aug 30, 2018
    Posts:
    7
    Hello @jschieck, We are creating a new game where we plan to have hundreds of animated units on screen. In the past we have struggled to have many concurrent skinned mesh rendered units, so we recently purchased Mesh Animator to give it a go.

    We are testing on our baseline device a moto e6 play, which has very weak hardware (CPU Quad-core 1.5 GHz Cortex-A53, GPU PowerVR GE8100). We set up a benchmark scene where we try to instance 150 animated characters. We tried a simple SMR with an animator and a single looped animation, vs Mesh Animator both in Shader and Snapshot modes. We tried this on both the old rendering pipeline and in URP 10.2.2 running on Unity 2020.2.2.

    Here are the results for the Legacy Render Pipeline:
    Legacy-Animator.png

    Legacy-MeshAnimatorShader.png

    Legacy-MeshAnimatorSnapshot.png

    Although Mesh Animator using Shader mode was very underwhelming (which makes sense due to the very poor GPU on the device), Snapshot mode worked really well maxing out at 60fps.

    When we switched to URP, Shader was still underwhelming, although a bit better than in Legacy, but Snapshot mode worked really poorly, maxing out at 40 fps compared to 60 on legacy, and worse than using skinned meshes and an animator:

    URP-MeshAnimatorShader.png

    URP-MeshAnimatorSnapshot.png

    We were wondering if you may have an idea on why this could happen, as we were really encouraged about the potential of using Mesh Animator in the project but unfortunately, it will be built on top of the Universal Render Pipeline.
     
    Last edited: Feb 4, 2021
  16. alejojamcity

    alejojamcity

    Joined:
    Aug 30, 2018
    Posts:
    7
    It seems that the URP shaders have some compile errors on URP 10.2.2. Could this be related? Currently, shaders reside under the Failed to compile folder in the shaders drop down and show multiple errors when selected:

    Screenshot 2021-02-04 155953.png
     
  17. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    96
    Hi, I've got this iusse on MA 2.0.18。 Did you find a good way ?
     
  18. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    92
    Unfortunately I wasn't able to solve this issue, the developer did not respond either. What I did was to change all my animation to looping animation, and then manually call pause using a coroutine by setting the yield return waitforseconds to a value of my choosing. :(
     
  19. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    96
    Great idea, thank you. ^_^
     
    Klausology likes this.
  20. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    Is anyone getting good results with crossfade?
    It jitters a lot in shader mode.
     
  21. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    92
    Hey @laurentlavigne! I used crossfade in shader mode without jitters. Though I was using the built in render pipeline, not sure if that made any difference.
     
  22. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    URP works as well in the demo scene but not in my game. The wrapper code and state machine I use works fine in the old animation component so there must be something about meshanimator that's different.
    Perhaps it's because crossfade is being hit hard nearly every frame and with speed change to match the chararcter speed. How do you call .Crossfade? Can you share some code? Also do you change the speed of the animator?
    I'm wondering if the stutter comes from the speed being too low, I believe shader mode doesn't do blend between the vertex frames so it's a hard frame...
     
  23. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    92
    Hmmm it is definitely strange that it is working in the demo but not in your game. What baking FPS did you use? I noticed that baking FPS at 30 wasn't particularly smooth for my game. Baking at 60fps was satisfactory for my use case. Changing the speed too low does make things not smooth in my experience as well. I do not change the speed of the animator unfortunately.

    My code is relatively simple:

    Code (CSharp):
    1.  
    2. //Chase playah if not too far away
    3. if (playahToEnemyDistance <= 15f)
    4. {
    5.      IsChildrenChasingPlayah[i] = true;
    6.  
    7.      ChildrenMA[i].Crossfade(ChildrenType[i] == 1 ? "Run_Enemy1" : "Walk_Enemy1", 0.4f);
    8. }
    9. else
    10. {
    11.       //Idle if too far away
    12.       IsChildrenIdling[i] = true;
    13.                
    14.       ChildrenMA[i].Crossfade("Idle_Enemy1", 0.4f);
    15. }
    This is a small snippet in an update loop for the enemies. You will notice that I have a run_enemy animation and a walk_enemy animation. I do this instead of adjusting the speed of the animator as I have found that this yields a better result. Mayhaps you could try doing something similar? Also, the boolean (IsChildrenChasingPlayah and IsChildrenIdling) are there to ensure I do not call crossfade again unnecessarily.

    Also, if you wanted some visual, you can see in the first 10 seconds of my video, the enemies are getting pushed constantly and resuming their chase animation frequently without jitters too:

     
    Last edited: Feb 9, 2021
    chadfranklin47 and hopeful like this.
  24. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    I'll bake at 240Hz and see. Good thing my models are low poly :)
    I "think" (can't be too sure with old code that I wrote back when I was a sperm) that the AI spams Play on every frame. This worked perfectly in the legacy animation component, somehow... oh I remember now yeah: if you spam the same clip to legacy it'll assume that you want to continue with the same clip so if you want to restart you needed to Rewind. That's a bold assumption, which we seem to have worked around somehow and worked like fabulous.
    Alright now I hate reading someone else's code but with the dev AWOL...
    Down the rabbit hole I go...
    Gotcha!
    upload_2021-2-9_9-55-46.png
    Each time CrossFade is called, the tick is reset. So yeah durrr it'll jitter when spammed.
    Time to be more gentle with MA.

    This is pissing me off. I'll revise my asstore review down 1 star for each week of silence.
     
    Klausology likes this.
  25. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    92
    Ouh! So that was the issue! Glad it has been solved :)

    Yea, I know how you feel. It is also partly why I am holding back on reviewing the asset as I would very much like to give it a full 5-star review. This asset is truly without equal on the asset store. The asset isn't abandoned, gets updated periodically. It even gets a new and improved shader mode! In fact, the developer does respond, just not every single time. When I first bought this asset and discovered an issue with exposed transform crossfading, the developer responded and provided a fix rather quickly! On top of that, the developer has to deal with complaints that are not even a problem with the asset itself at times. That, and the current state of the world now might explain the occasional missed queries from customers. That being said, it can be a little discouraging when some issues are not acknowledged at all :( ¯\_(ツ)_/¯
     
  26. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    No it's not solved, it requires major change in how the AI pokes at the animation system.
    Same! That's also why I held back rating for 6 month bumping head on all these glitches. 6 month is good patience and ratings are the only way we know what we're getting into and this is potentially a big waste of time so it's important that they reflect the experience. That said, you're right, some ppl are suffering a great deal these days so I'll go easy and just describe the problems for those who read the reviews past the star rating..
     
  27. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    92
    Owww! :confused: That is a bummer, we have to be gentle with MA as you have said indeed.

    You are certainly right about this as well. Hmmmm =/
     
  28. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    I added an extra coat of vaseline and now it's working.
    Here is what I did for those diving into it: added a priority flag to those clips that need to override others, for example an attack, death and test if a new clip is requested by the AI that its flag is either == or > to that of the currently played clip. Now it's nearly indistinguishable from the base legacy behavior. Which is pretty badass on 100s of creatures, on a switch.
     
    hopeful, Klausology and Jmonroe like this.
  29. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    121
    Yeah, same here, URP shaders throwing errors on URP 10.3.1. Have you been able to do anything about it by any chance?
     
  30. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    121
    I'm also running into an error when the Bake FPS is set to 120 and the "Frame Skip" values are less than 4:

    DivideByZeroException: Attempted to divide by zero.
    FSG.MeshAnimator.Snapshot.DeltaCompressedFrameData.op_Implicit (FSG.MeshAnimator.Snapshot.DeltaCompressedFrameData s) (at Assets/MeshAnimator/Scripts/Snapshot/SnapshotMeshFrameData.cs:82)
    FSG.MeshAnimator.Snapshot.SnapshotMeshAnimation.get_frameData () (at Assets/MeshAnimator/Scripts/Snapshot/SnapshotMeshAnimation.cs:35)
    FSG.MeshAnimator.Snapshot.SnapshotMeshAnimation.OnEnable () (at Assets/MeshAnimator/Scripts/Snapshot/SnapshotMeshAnimation.cs:55)
    UnityEditor.AssetDatabase:CreateAsset(Object, String)
    FSG.MeshAnimator.MeshAnimationCreator:CreateSnapshots() (at Assets/MeshAnimator/Editor/MeshAnimationCreator.cs:1798)
    FSG.MeshAnimator.MeshAnimationCreator:CreateSnapshots() (at Assets/MeshAnimator/Editor/MeshAnimationCreator.cs:1478)
    FSG.MeshAnimator.MeshAnimationCreator:OnGUI() (at Assets/MeshAnimator/Editor/MeshAnimationCreator.cs:912)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    Has anyone run into this one before or know what it means?
     
  31. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    bug - this happens after bake:
    upload_2021-2-19_13-30-10.png
     
  32. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    bug -- when recompiling
    upload_2021-2-19_13-31-53.png

    upload_2021-2-19_13-32-6.png
     
  33. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    and in URP, with the included lit shader or custom shader, objects disappear
    upload_2021-2-19_13-35-57.png
     
  34. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    the MA component still counting frames so I don't know what's happening but this bug has been creeping in since version 2.0.18
    upload_2021-2-20_20-59-4.png
    note: disappears also in a build!

    edit: this problem only appears on models that are composed either of multiple meshes merged together or multiple materials.
    solution = switch to snapshot :/
     
    Last edited: Feb 22, 2021
  35. andthenwhat

    andthenwhat

    Joined:
    May 11, 2015
    Posts:
    3
    [Nevermind, SOLVED]
    is there a fix (or ETA for a fix) for the shader errors in URP? I read through the thread since the first mention of the issue, but didn't see one (apologies if I missed it):

    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)

    Shader error in 'Mesh Animator/Universal Render Pipeline/Simple Lit': 'InitializeInputData': output parameter 'inputData' not completely initialized at Assets/MeshAnimator/Shaders/URP/MeshAnimator-URP-SimpleLitForwardPass.hlsl(44) (on d3d11)

    in the shader, if you just start the shader with e.g. outSurfaceData = (SurfaceData)0; it removes the errors and everything seems to work fine.
     
    Last edited: Feb 22, 2021
    Jmonroe likes this.
  36. chadfranklin47

    chadfranklin47

    Joined:
    Aug 11, 2015
    Posts:
    121
    Could you be a bit more specific? Where should we put that line in which shader file?
     
  37. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    note: for URP users. if somehow shader animation works for you, know that the shader graph vertex subgraph is about 2x slower than the hand written MA lit!
     
    Last edited: Feb 25, 2021 at 7:35 PM
    Klausology likes this.
  38. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    26
    Also there is a bug with events. IDK was it fixed in recent updates, but. When you see mesh animator, and it play some events, for example play footstep sound. If you turn camera to other way from Manim (no offscreen update), wait some time, and focus camera on Manim again, it will trigger all not played events at ones. As if it stores all events, but not playing them, and when you have Manim on camera again it plays all events, which makes no sence
     
  39. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,582
    Yeah this thing is a mess. In the same vein, I tried using LOD and what happens is the animations get out of sync by more than the deltaFPS.
     
    Klausology likes this.
  40. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    96
    Hi
    Anyone got this issue?
    the gameobject can't follow the expose transform well on shader mode.
    Please check this out:
    issue.gif
    the weapon can't follow the hand ><
    @jschieck Could you please help?
     
unityunity