Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Unity 2019.2 DOTS Physics Test: 343k Compounds Cubes

Discussion in 'Physics Previews' started by Antypodish, Aug 14, 2019.

  1. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,816
    Just sharing my simple stress test.

    Basics physics queries testing of 343k cubes in compound, using Unity 2019.2 DOTS Physics.

    Running on my 5 years old PC rig.
    Rendering at approx 183-151 FPS (5.5-6.6ms).
    Tris: 8.2 Millions
    Verts: 10.3 Millions
    RAM usage: 1GB (in editor).

    Collision debugging queries, as per CompoundDemo, with Query tester distance set to 1 (default 10).

    Simulation is run only in Unity editor, so it is expected to perform even better in build.

     
    hippocoder and Grizmu like this.
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Thx!! Any thoughts or conclusion?
     
    Antypodish likes this.
  3. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    The FPS, It's beautiful.
    DOTS physics = performance. Imagine all of the simulation games that people will create in the upcoming years using this bad boy, which were not possible without the DOTS approach. I'm already excited myself seeing what it can do.
     
    Last edited: Aug 17, 2019
    AlanMattano and Antypodish like this.
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,816
    Sorry do late replay. Forum sometimes does not notify me about new posts.

    I think conclusion is, as already mentioned, amazing performance. Incredible for both desktops as for mobiles.

    And if there is still too for further improvement by amazing Unity DOTS team, that would be even further breath taking.

    I remember year back where 50-100k entities rendering was super big thing. Now we got over 300. That even, without any additional optimization. Not sure if culling happens automatically, for hidden mesh entities, inside the cube. If not, that means even further improvement.

    Now considering modern mid-high end hardware, rather than 5 years old rig, that can potentially rise further performance boost.
     
    AlanMattano likes this.
  5. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    404
    Looks great! Any chance you could put a plane underneath please and see what the performance is like when they hit the plane and fall apart?
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,816
    They are as one big collider compound.
    Compound allows to gain performance, In terms of physics.

    I would need to check, how effectively decompose compound. But what I could do instead I suppose, is to spawn all cubes with own colliders in same formation and see how they will behave. I can not promise when, as I got different priorities atm. Sorry.

    However, there is physics demo, which shows many cubes drop and collision tests.
     
  7. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    404
    Ok no worries and thanks for response. I am just generally interested in quantifying relative performance of dots vs physx physics to see what the benefit might be.
     
    Antypodish likes this.
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,816
    That is valid point.
    Yet for that reason alone, I still keep my original project with tweening approach, where I use PhysX. DOTS physics seems still early for what I need. Yet may be sufficient for your use.
     
  9. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    404
    I agree dots physics seems a little immature for use in production. But i am keeping an eye on it!
     
  10. KingAustin

    KingAustin

    Joined:
    Jan 12, 2016
    Posts:
    20
    Quick question.
    how did you get up to 300k cubes at 100+ fps?

    your in the editor so some performance loss there and i think in newer DOTS versions you do get free frustum culling but you are rendering both the scene view and the game view and all the cubes at once so less performance there. Also your recording

    overall even without physics how were you able to get to 300k cubes? i doubt physics would have made it more efficient.
    My current stats is currently at 30k and 40fps with just the game view and no optimization.
     
    Last edited: Oct 30, 2019
  11. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,816
    @KingAustin I haven't done anything special in this test.
    At least I can not think of anything specific, for optimization.
    Was just simple stress test.

    I simply modified CompoundDemo
    EntityComponentSystemSamples/UnityPhysicsSamples/Assets/Tests/Compound/CompoundDemo.cs
    to generate compound of 70x70x70 cubes.

    In Querytester
    EntityComponentSystemSamples/UnityPhysicsSamples/Assets/Demos/3. Query/Scripts/QueryTester.cs
    I reduced a bit raycast distance.

    I don't think there was any mesh culling at the time of testing.
     
  12. KingAustin

    KingAustin

    Joined:
    Jan 12, 2016
    Posts:
    20
    I see.
    I have yet to implement the physics system im my project and i am currently using the plain DOTS tools to spawn and render cubes. By any chance could it be a difference in computer power, seems unlikely but there is a chance it has an effect. Other than that im not sure if the physics tools are effecting performance enough to render more cubes at once.

    My objects currently have these component sets, which is essentially rendering and position. Im sure some static component existed before but i dont see your physics testing using it.

    Code (CSharp):
    1.             ComponentType.ReadWrite<RenderMesh>(),
    2.             ComponentType.ReadWrite<LocalToWorld>(),
    3.             ComponentType.ReadWrite<Translation>(),
    4.             ComponentType.ReadWrite<Rotation>(),
    5.             ComponentType.ReadWrite<Scale>()
    I tried to load up the samples but i got quite a few errors popping up that i was not able to fix, but the results would have been similar, im not able to render 300k cubes and even previously in older DOTS versions the best i had in editor was up to 100k.

    It could be a rendering issue i am using the LWRP simple materials and the built-in cube mesh. Other than this i dont see anything that could be stalling my rendering. One this i have noticed is the GFX.WaitForPresent was popping up and that the profiler graph was not rendering the full time taken.

    I am manually updating my worlds systems from the default world not sure if it would have an effect.
    sorry if i am intruding on this post but i do myself want to know how to render so many cubes.

    Ill try upgrading to 2019.2. I am certain im using the latest entities package, not sure what good it will do but its worth some tries. maybe it will fix the physics package testing i was doing as well.

    Edit: upgraded to 2019.2, created my own spawning script and my 50^3 cube was taking 100Ms to render so about 10 FPS. you look away and you get more frames.
     
    Last edited: Nov 11, 2019