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

Skinned mesh instancing--- has anyone managed to get it to work?

Discussion in 'Developer Preview Archive' started by KarelA, Oct 15, 2012.

  1. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Does anyone have any experience with the new mesh instancing feature?

    I would like to play around with this, but the docs are lacking and i would really appreciate any sample code as a starting point.

    Thanks

    Nevermind: I figured it out. May i say that the performance gain is staggering :)
    If anyone is interested in this then let me know.
     
    Last edited: Oct 16, 2012
  2. Frederic66

    Frederic66

    Joined:
    Oct 18, 2012
    Posts:
    3
    It is encouraging that you are seing significant performance improvements. Would it be possible for you to post a short note with pointers on the skinned mesh instancing usage with LOD enabled?

    Thanks Regards
    Fred
     
  3. xadhoom

    xadhoom

    Joined:
    Sep 2, 2010
    Posts:
    91
    Hi KarelA,

    I´m also interested to learn how it works in Unity.

    xad
     
  4. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Hi

    To have the basic bakemesh working is quite simple actually. Here is a starting point code snippet for you.

    Put this script on your skinned mesh gameobject.
    Then in inspector assign the mesh you would want to instance onto meshRef.

    Code (csharp):
    1.  
    2.  
    3. public SkinnedMeshRenderer skinnedRef;
    4. public Mesh meshRef;
    5.  
    6. void Start()
    7. {
    8.     skinnedRef = gameObject.GetComponent<SkinnedMeshRenderer>();
    9. }
    10.  
    11.  
    12. coid Update()
    13. {
    14.    skinnedRef.BakeMesh(meshRef);
    15. }
    16.  
    17.  
    18.  
     
  5. Frederic66

    Frederic66

    Joined:
    Oct 18, 2012
    Posts:
    3
    Do you have some rough numbers for the performance gain?

    Like the number of entities moving on the screen before and after the skinned mesh instancing, the FPS before and after, whether all of your models have animations, how many bones each model has etc.

    Thanks in advance
    Fred