Search Unity

Render 250000 sphere in a Unity Scene?

Discussion in 'General Discussion' started by learner1988, Oct 5, 2020.

  1. learner1988

    learner1988

    Joined:
    May 19, 2017
    Posts:
    2
    I have a csv file which has position and rotation value and it contains 250000 rows. I need to generate a sphere's using this CSV file data for each position. I tried using Instantiating and it is taking a toll on my computer and also the Unity. The Unity crashes each time I try to load. So, my question is what is the best possible to way to render this 250000 sphere in the Unity which having problem with the performance? Any tutorials or resource that is helpful.
     
  2. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    3,021
    Use either DOTS or DrawMeshInstanced.
     
    neginfinity likes this.
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Why spheres? Can you get by with faking it with a billboard? Any normal projection of a sphere will result in a circle, so do you really need the depth? I suspect that you don’t need the back face, you aren’t casting or receiving shadows, so you don’t really need the geometry. If you want to light it, you can fake that too with a normal map.
     
    superpig likes this.
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Use DrawMeshInstanced or maybe mesh-based particle systems.
     
    learner1988 likes this.
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Good answers for Dots and drawMeshInstantiated/indirect.
    Or create one, or multiple big meshes, consisting these small meshes, if they don't move.
     
    learner1988 likes this.
  6. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Could try and tick on "Enable GPU Instance" on the material and see if that works. Seems like that would be the first 'test' to try.

    While probably not the best as it's a general use thing, so the above answers will definitely give you better performance without a doubt. But if this works and is what you need, just saved you a lot of time. lol
     
    Joe-Censored likes this.