Search Unity

New friction features in PhysX 4

Discussion in 'Physics' started by Edy, Apr 10, 2020.

  1. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    Hello,

    I've noticed these entries in the PhysX 4 release notes:
    • Optional torsional friction model to simulate rotational friction when there is just a single point of contact.
    • A flag to enable friction constraints to be processed every frame has been added
    • A new flag has been added to PxMaterial to improve friction accuracy. The flag is disabled by default to maintain legacy behavior.
    Please, could we have those options exposed in the physics (and/or Rigidbody) settings?

    Currently I'm noticing many unrealistic effects with the friction that seem quite related with the absence of those options. I've been unable to configure the friction to produce actual realistic effects since the update to PhysX 3.

    I think that the friction model in PhysX 3+ was so aggressively tuned for performance and gameplay that it lost the accuracy and realism it had in PhysX 2. Those new options in PhysX 4 seem to turn on the missing accuracy and I'd hope them to produce realistic friction effects again. The previous attempt was with the Two-Directional friction, but unfortunately that produced very small improvements in particular situations only.

    I don't know who's currently in charge of the PhysX integration, so I'm mentioning @yant and @LaurentGibert. Feel free to let me know if I should mention anyone else.

    Thanks!
     
    SparrowGS, airnamics and hippocoder like this.
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    We're definitely looking into the friction stuff. As you pointed out, we have exposed 2D friction recently (2019.3). I'll take a look into exposing the torsional friction. As to the material flag -- I'm not sure it's all that useful. I think it goes with the patch friction mode to modify the way a contact set is aggregated to produce input for constraints. It's still not a per-contact constrain model unlike 2D, it's a few constraints per the contact set -- so the accuracy is really limited anyways.
     
    airnamics and hippocoder like this.
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    I see, thanks for the update. What about processing the friction constraints every frame? May that provide more accurate results? (at a expected increment in the CPU footprint, of course)
     
    airnamics likes this.
  4. Vilmantas

    Vilmantas

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    29
    Friction constraints are processed every frame if you choose Termporal Gauss Siedel - TGS as a solver in Physics project settings vs legacy PGS.
     
    Edy likes this.
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    That's good to know, thanks! Will give it a try.
     
  6. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    @Vilmantas, @yant, I've tried Temporal Gauss Seidel and it's a complete disaster in Rigidbodies with WheelColliders. Please test TGS while using vehicles. Some effects can be made more evident at higher physics rates (i.e. 500 hz, fixed timestep 0.002), but they are still there at regular rates.

    If there's any asleep Rigidbody colliding with the static scenery the vehicles suffer a completely wrong behavior, like sliding sideways or getting stuck at low speeds. One of the weirdest effects happens at low speeds (< 1 m/s): the vehicle suddenly stops completely, but Rigidbody.velocity still reports its velocity as if it were in motion.
     
    Last edited: Jul 15, 2020