Search Unity

About Particle System, Render Mesh performence

Discussion in 'Unity Cloud Diagnostics' started by Arhspros, Jul 30, 2018.

  1. Arhspros

    Arhspros

    Joined:
    Nov 11, 2014
    Posts:
    14
    I use a very simple 1000 max particles, Render with mesh(about 200 verts and 300 tris), on my 4 core-8 thread Ryzen CPU, it runs very very slow(about 5 frames). But on a i5-7200 cpu, same condition, it runs much much more faster(around 30 frames).

    the unity version is 2017.1.1f1

    Then I used a 2018.2 unity3d, and in Render tag, I click "Enable mesh GPU instancing", and change the material which the particle uses to Particle/Standard Surface, I runs very v ery fast. but this option and shader only supported in 2018.1f later.

    aa.PNG

    with 2018.2's profile I can see it very clearly that, when I click the "Enable Mesh GPU instancing" option and use the Particle/Standard Surface shader, the misson is distributed to all the job threads, but if not, it's on only one thread
    click "Enable Mesh GPU instancing" and use Particle/Standard Surface shader
    bb.PNG
    no click
    cc.PNG

    so my question is , yes it works fine under version 2018.1f1 later, but if I still wanna use 2017_1 version, is there a some way to fix this problem? and if i create a shader similar to Particle/Standard Surface(this one is not included in 2017_1) shader in 2017_1 will it work?
     
  2. Arhspros

    Arhspros

    Joined:
    Nov 11, 2014
    Posts:
    14
    Is there anyone can give a proper answer? Now I'm gonna try to translant the shader of 2018.1f Particle/Standard Surface to 2017.1, hope it'll work.......
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    No, because it's a new feature, not just a shader. @richardkettlewell is the expert here :)
     
    richardkettlewell likes this.
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    There is no easy way to get great performance on 2017.1 with this setup. Unfortunately, mesh particles are slow in this version.

    In 2017.1, every vertex of the mesh is transformed on the CPU, for every particle.
    In your case, that is 200 vertices, multiplied by 1,000 particles, which is 200,000 transformations.

    This work happens on a worker thread, but only 1 worker thread, because it is 1 particle system. You could make it run faster by splitting the particle system into multiple smaller systems. Then more CPU cores will help out. But managing multiple systems might be undesirable for you, as it would complicate your asset management.

    In 2018.1, we have moved the majority of the computation to the GPU, when using a compatible shader. So you only pay for 1,000 transformations on the CPU, and the GPU does the per-vertex work.
     
    hippocoder likes this.
  5. Arhspros

    Arhspros

    Joined:
    Nov 11, 2014
    Posts:
    14
    Thank you for your relply. What I do is Exactly "splitting the particle system into multiple smaller systems"(one 1000particles int three 300particles). and the Effect is similar but it did run much faster.
     
    richardkettlewell likes this.
  6. Arhspros

    Arhspros

    Joined:
    Nov 11, 2014
    Posts:
    14
    But still, when I run with a I5-7400 4core 4thread PC, it runs about 25 fps, when I run with a AMD Ryzen 4core 8thread PC, it runs only below 5fps, even 1,2, for a while... Their single processor frequency is very close. But the performance is so different. Maybe there is some hardware compatibility issue? I mean, unity3d base render logic code doesn't optimize with AMD Ryzen, consider Ryzen series is relatively new one.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds weird, just file a bug and post the case number in this thread. Assuming both computers have good GPUs :)
     
  8. Arhspros

    Arhspros

    Joined:
    Nov 11, 2014
    Posts:
    14
    See the attached files, I've packaged with project file and the GIF with 2 PC and PC hardware report. The I5-7400 with Inter graphics 630 runs much faster then the AMD ryzen with one thread. With 2018 enabel GPU mesh instance, AMD ryzen performs better than intel i5-7400.
    And I've also run the Offical Demo BookOfDeath, AMD Ryzen runs smoothly, about 50 fps, but the i5-7400 PC runs like only 5fps, because it's GPU is too low.
     

    Attached Files:

  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
  10. jake-ruyi

    jake-ruyi

    Joined:
    Aug 8, 2018
    Posts:
    1
  11. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Hi, from reading the reports, you appear to be saying the AMD CPU performs much worse than the i5, and that it shouldn't.

    I've no idea how that Ryzen CPU should perform vs the i5 (bug report doesn't give enough info for me to use a CPU comparison website). However, as it's a SoC system, it perhaps has very different performance characteristics.

    From the bug report: "we can infer that Unity engine may has a GPU Instancing optimization for Raven & i5-6600k, but not for <our platform>" (I have no access to https://ontrack.amd.com/browse/EXTFF-135)

    I can tell you that we don't use any form of GPU instancing prior to Unity 2018.1 for mesh particles, and that the code path is exactly the same (100% CPU code) on every type of CPU - we don't use any vendor/cpu specific strategies in this code. The algorithm simply transforms every vertex of the mesh into world space based on particle positions, and repeats for every particle.

    I don't envisage us being able to do anything about this (and definitely not in the next 2 weeks).