Search Unity

Unity - render 10,000 objects at once using DrawMesh

Discussion in 'General Graphics' started by theDawckta, Feb 7, 2015.

  1. theDawckta

    theDawckta

    Joined:
    Jun 16, 2014
    Posts:
    50
    I have a performance problem I am working on and need some help. It's a very simple question really. With the attached script is Graphics.DrawMesh the fastest way for me to render the objects. If there is a faster way to do this I would love for someone to help out. I just need to get the meshes on the screen as quickly and efficiently as possible. Would there be a way to do this with a shader maybe? That is the only thing I could really think of that might help as it seems like it would offload the work to the gpu instead of being cpu bound. I just know nothing of shaders so can't really figure out if this is possible or not.

    If anyone see's a way to improve my update function significantly I would love to hear about this as well.

    Any help is greatly appreciated.
     

    Attached Files:

  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Geometry, ie mesh data, is generally separate from what a shader does, although in modern shaders you can mess with geometry and modify it etc... but you still have to feed something in to get something out (i think). . probably combining some meshes will help cut down on overhead, e.g. objects that don't move and have the same materials.
     
  3. theDawckta

    theDawckta

    Joined:
    Jun 16, 2014
    Posts:
    50
    Thanks for the reply,

    That is just the thing though, they all have to move independently, I am starting to think this is the best way to do it. I wonder if there would be a way to combine all those meshes before hand and just use one draw mesh call considering that is the heaviest function in the algorithm.