Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Drawing 70 million cubes with 40 fps!

Discussion in 'General Graphics' started by Ezowned228, Oct 30, 2018.

  1. Ezowned228

    Ezowned228

    Joined:
    Sep 29, 2013
    Posts:
    1
    One day, my friend told me that unity3d is not good enough for voxel games with a large number of cubes, and I answered him - "hold my beer” ...


    Area size: 512x512x512 (135 millions) and half of this is filled with cubes (perlin noise). So total number of cubes almost 70M.
    Total vertices 20k, tris 10k.
    GPU: gtx 1050
    Ram usage: ~1,2GB







     
  2. GameDeveloperAf

    GameDeveloperAf

    Joined:
    Jul 3, 2020
    Posts:
    71
    How did you do this
     
  3. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,068
    I remembered this topic.:)
     
  4. GameDeveloperAf

    GameDeveloperAf

    Joined:
    Jul 3, 2020
    Posts:
    71
    Do you know the answer of this question?
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,240
  6. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,133
    setting position of each by passing a Material PropertyBlock with SetMatrixArray?
    The problem is if each instance is a 6-face cube there is potential for massive over-draw, so not sure this is fast or preferable to an optimised mesh with culled faces and entire cubes, unless things changing every frame

    The stats on the screens suggest rendering each tower of cubes, rather than every single one
     
  7. GameDeveloperAf

    GameDeveloperAf

    Joined:
    Jul 3, 2020
    Posts:
    71
    I FOUND THIS ANSWER FROM HIS YOUTUBE VIDEO COMMENT

    i've used a sime-transparent planes (cutout aplha shader) for render each type of orthogonal faces. For example, all forward faces of cubes with same z coordianes are rendering via one big quad so i have 512 big quads (with transparent cutout shaders) for each side type. And total quads count is 6*512 = 3072. data stored in 3d textures but i think that's not relly good way for volume rendering (need pretty much resources for alpha-testing). I'm probably will make it using raymarching

    But I did not understand how he drew it using shader
     
    Last edited: May 25, 2021
    richardkettlewell likes this.
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444

    upload_2021-5-25_14-1-12.png
     
  9. GameDeveloperAf

    GameDeveloperAf

    Joined:
    Jul 3, 2020
    Posts:
    71
    :eek::eek::eek: