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

Unity 5 and Physx 3.3.0 details...

Discussion in 'Unity 5 Pre-order Beta' started by web76, Mar 19, 2014.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yep - I can see the long term benefits but it requires pretty much a rewrite of Unity at this point, when a dll will solve the issue in the meantime. It's a good suggestion and probably one Unity's thought about many times. The UI for instance is open source.

    And I'm still not sure it actually stops people from doing anything given there is dll support. It just means less bloat for those who would have to be capable of dealing with dlls to begin with, or at least that level of competence. In any case a good suggestion for Unity 6 or such.
     
  2. Freezy

    Freezy

    Joined:
    Jul 15, 2012
    Posts:
    234
    Well they are working on it, at least in some parts, Unity 5 is a great step forward towards less cross-class dependencies.
     
  3. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    I thought doing something like meshCollider.sharedMesh = otherMesh; would work on a background thread.

    Apparently I misunderstood the 'fully multithreaded' thing!
     
  4. Freezy

    Freezy

    Joined:
    Jul 15, 2012
    Posts:
    234
    thread safety is most likely the key here. If you need to change the item in a safe way set a temporary mesh reference to the new mesh, then have it update the mesh just before rendering (and set the temp to null).
    You can't work around speed limitations this way though, as the 3D scene still needs to lock to allow updates to meshes and then recalculates everything it needs for efficiency. You can however offload the actual generation out of the locked state this way, possibly gaining huge performance benefits because it now does most of the heavy lifting elsewhere.

    Threaded means that multiple things are working at the same time, not that you can willy nilly hop and skip cross threads without needing to lock the thread or part that you are editing first, or creating some kind of buffer that gets checked for changes.
     
  5. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
  6. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Yes, I know how threading "works", and yes, I'm quite new to it and so I still have a great deal of knowledge to gain when it comes to how to make it work most effectively.

    One thing I definitely lack knowledge on is what Unity is doing behind the scenes in many cases, including with the Physics system... knowing this information would help me understand the multithreaded nature of it better. I'm not entirely sure where to learn this, though.
     
  7. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
    sorry to say this, but physx multithreading is bullsh*t.... 90% or more of calculations is done on main thread, and physx never uses more than 30% of cpu power( like it would be still limited to one thread ). So yeah, it uses other threads than main, but like once time on every few seconds.
     
  8. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Check the timeline profiler. For me, it does utilize all threads when simulating physics. When you look at a general OS CPU usage meter, it is hard to tell that, because it depends a lot on how well the rest of the code is multi-threaded (which depends on what is going on in your scene). That is why we added the new timeline profiler in 5.0 - it makes it easy to see exactly where time is being spent across all threads.
     
  9. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
    Yes, im looking at new timeline profiler, and as I said sadly it very rarely uses other than main threads. Maybe physx using other threads only for some calculations?
    Because I use lot of trigger kinematic rigidbodies(as field of views), so it's not typical usage of physx, just lot of collision tests( I am in this trigger ? ).
    A little ot; I really appreciate engagement of Unity team on forums, it's really nice to see that developers DO care about typical users problems ;)
     
  10. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This is possible. I don't know enough about how multi-threading works internally in PhysX to be able to answer that. I can tell that it definitely works for my tests for scenes with a lot of rigidbody objects colliding with each other.
     
  11. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    The most iritating weakness of physx is the week precision of the joints.. I really hoped that the articuladed joint type would get implemented, the precision on that kind of joint is way higher..
     
  12. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
    Did you set solver iteration cout to 100? It is responsible for "strength" of physx joints.
     
  13. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Yes, it is just hard to get realistic movement on lets say a crane with robotic gripping mechanism in the tip.. Heavy rigid bodies and light ones in the same jointed crane... The tip then seems soft.. And not metal robotic like when you lift other heavy masses with it...
     
  14. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Does anyone have any performance comparison tests of 16 wheel colliders in a scene in Unity 4 compared to Unity 5 running on an iPhone 4?

    I have 16 wheel colliders in my scene and iPhone 4 CPU performance is absolutely horrible with the physics.
     
  15. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    oh my god that fire

    eeeeeeeeeeeeeeeeeeeeee