Search Unity

Question Rendering Massive Amounts of Objects Without Lags

Discussion in 'General Graphics' started by jjde0711, Nov 11, 2022.

  1. jjde0711

    jjde0711

    Joined:
    Nov 3, 2020
    Posts:
    1
    Hello everyone,

    we want to render 50.000+ objects in a Unity 3D environment.
    For simplification you can imagine our goal to be a 3D graph with fixed position vertices and a growing amount of edges over time. Currently we can only import the spheres and we're stuck at about 5 fps. Since we're looking for an immersive VR experience once our graph is visualized we will need a lot more fps.

    What we've tried:
    • We have looked into Batching but for our visualization we want the individual objects to be able to change colors. As far as we've looked into batching it does solve the fps problems, but these color changes wouldn't be possible.
    • We also tried using 2D sprites that rotate towards the main camera, this did cause more lags unfortunately.
    • we concluded that light/shadow calculation isn't the problem.

    any Ideas?

    what our current setup looks like:
    Capture.PNG
     
  2. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    672
    Batching is mandatory for something like this. 50k draw calls will kill performance on any platform.

    You can certainly make batching work with different colors. If you use the SRP Batcher, just make a copy of the material and set the color. If you use the built-in render pipeline, set the color in a materialpropertyblock and make sure that the color is an instanced property. Also, instancing must be enabled on the material.

    Sprites/Billboards should also work, but you don't want to create 50k game objects for it. You might have to write a custom shader and make a manual instanced draw call.

    Finally, also look into the VFX graph. If you turn the spheres into particles, they should be rendered very efficiently.
     
    jjde0711 likes this.