PHYSX 4: RAISING THE FIDELITY AND PERFORMANCE OF PHYSICS SIMULATION - - PowerPoint PPT Presentation

physx 4 raising the fidelity and performance of
SMART_READER_LITE
LIVE PREVIEW

PHYSX 4: RAISING THE FIDELITY AND PERFORMANCE OF PHYSICS SIMULATION - - PowerPoint PPT Presentation

PHYSX 4: RAISING THE FIDELITY AND PERFORMANCE OF PHYSICS SIMULATION IN GAMES Kier Storey, Principal Software Engineer | Date | Booth S466| South Hall www.nvidia.com/GDC PHYSX Scalable, robust rigid body simulation Cross-platform


slide-1
SLIDE 1

www.nvidia.com/GDC

Kier Storey, Principal Software Engineer | Date | Booth S466| South Hall

PHYSX 4: RAISING THE FIDELITY AND PERFORMANCE OF PHYSICS SIMULATION IN GAMES

slide-2
SLIDE 2

2

PHYSX

Scalable, robust rigid body simulation Cross-platform Multi-threaded and GPU accelerated Visual debugging and profiling tools Integrated into numerous tools and existing game engines

slide-3
SLIDE 3

3

RIGID BODIES

Efficient and accurate distance-based contact generation Sweep-based CCD and speculative CCD Support for common joint types (spherical, revolute, fixed, prismatic, distance, custom) Fast and robust iterative solver Efficient scene query system Flexible filtering system Extensions for vehicles and characters Two interfaces: “retained” and “immediate” mode

slide-4
SLIDE 4

4

PHYSX 4

Open-source BSD license TGS: New, more robust, non-linear rigid body solver New reduced coordinate articulation implementation Provides game-level performance with robotics-quality simulation fidelity More scalable broad phase Overhauled joint implementation Optimizations for complex multi-shape actors

slide-5
SLIDE 5

5

TGS SOLVER

Non-linear iterative solver Improved robustness to ill-conditioned cases Significantly faster converging than PGS Improved high-mass ratio simulation Provides “gentle de-penetration” without damaging convergence Improved joint drive handling Similar performance to PGS solver

slide-6
SLIDE 6

6

TGS COMPARISON

Revolute Chains with Drives

0.05 0.1 0.15 0.2 0.25 0.3 1 27 53 79 105 131 157 183 209 235 261 287 313 339 365 391 417 443 469 495 521 547 573 599 625 651 677 PGS TGS

slide-7
SLIDE 7

7

TGS COMPARISON

High-mass Ratio Chains

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 1 90 179 268 357 446 535 624 713 802 891 980 1069 1158 1247 1336 1425 1514 1603 1692 1781 1870 1959 2048 2137 2226 2315 PGS TGS

slide-8
SLIDE 8

8

TGS COMPARISON

Toy-scale Kapla tower

2 4 6 8 10 12 14 16 18 20 1 130 259 388 517 646 775 904 1033 1162 1291 1420 1549 1678 1807 1936 2065 2194 2323 2452 2581 2710 2839 2968 3097 3226 3355 3484 PGS TGS

slide-9
SLIDE 9

9

TGS CONVERGENCE

0.5 1 1.5 2 2.5 3

10,000:1 Mass Ratio Chain error 100 iterations

TGS PGS

Error

slide-10
SLIDE 10

10

REDUCED COORDINATE ARTICULATIONS

Hierarchical kinematic tree multi-body system Currently supports fixed, revolute, spherical and prismatic joints Support for limits, PD drive controllers and joint friction Loop joints, self-collisions and interactions with external bodies handled through PGS/TGS solver Inverse dynamics Closely-matches analytical models Deep integration with TGS solver yields improved simulation robustness

slide-11
SLIDE 11

11

RESULTS

PhysX Warehouse Demo

slide-12
SLIDE 12

12

RESULTS

ANYmal training

slide-13
SLIDE 13

13

IMMEDIATE MODE

Direct access to PhysX low-level functionality Contact generation Constraint definitions (contacts and joints) Low-level rigid body solver Extremely low-overhead. Ideally-suited for simulating small sets of bodies with as little latency as possible.

slide-14
SLIDE 14

14

RETAINED MODE IMMEDIATE MODE

PxScene* scene = gPhysics->createScene(desc); scene->addActor(*PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), material); PxShape* box = gPhysics->createShape (PxBoxGeometry(PxVec3(1.f), material); PxRigidDyn* dyn; for(int i = 0; i < 1000; ++i) { dyn = gPhysics->createRigidDynamic (PxTransform(PxVec3(0.f, 1.f+2.f*i, 0.f)); dyn->attachShape(*box); updateMassAndInertia(*dyn, 1.f); scene->addActor(*dyn); } for(int frame = 0; frame < 100; ++ frame) { scene->simulate(1.f/60.f); scene->fetchResults(true); } using namespace physx::immediate; const int nbBodies = 10; PxRigidBodyData bodyDescs[nbBodies]; PxSolverBodyData data[nbBodies+1]; PxSolverBody solverBodies[nbBodies+1]; PxConstraintDesc contacts[nbBodies]; PxConstructStaticSolverBody( PxTransformFromPlaneEquation(PxPlane(0,1,0,0)), data[0]); PxConstructSolverBodies(bodyDescs, &data[1], 10); PxReal dt = 1.f/60.f, invDt = 60.f; for(int frame = 0; frame < 100; ++frame) { applyGravity(&data[1],gravity,nbBodies,dt); int cts = 0; for(int i = 0; i < nbBodies; ++i){ if(generateContacts(boxGeom, planeGeom, data[i+1],data[0],contacts[cts])) cts++; for(int i = 0; i < cts; ++i) createConstraints(contacts[i], invDt); solveConstraints(contacts, solverBodies); integrateSolverBodies(solverBodies); }

slide-15
SLIDE 15

15

GPU RIGID BODIES

Hybrid CPU/GPU rigid body simulation Enabled with flags on the scene Exact same interface and feature set as CPU simulation Highly-scalable GPU broad phase GPU-accelerated distance-based contact generation GPU-accelerated PGS and TGS solver Automatically handles transfer of data between host and device Designed for interactive/gameplay-effecting simulation, not just visual effects

slide-16
SLIDE 16

www.nvidia.com/GDC

Michelle Lu, Principal Software Engineer | 14 March, 2019 | Booth S466| South Hall

PHYSX 4.1

slide-17
SLIDE 17

17

PHYSX 4.1

Extends immediate mode to support articulations and TGS solver GPU-accelerated articulations (coming soon) Significantly optimized CPU articulations Optimizations and bug fixes

slide-18
SLIDE 18

18

ARTICULATION SOLVER

Forward dynamics optimizations and fixes Optimized contact/joint solver solves simple constraints (articulation-rigid) in O(1) time rather than O(logn) time Improved accuracy of joint drives/limits Improved convergence Improved spherical joint support

slide-19
SLIDE 19

19

PERFORMANCE IMPROVEMENTS

1000 24 DOF Articulations on the ground

5 10 15 20 25 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 201 206 211 216 221 226 231 236 241 246 251 256 261 266 271 276 281 286 291 296 301 306 311 316 321 326 331 336 341 346 351 PhysX 4.0 PhysX 4.1

slide-20
SLIDE 20

20

IMMEDIATE MODE ARTICULATIONS

Small/simple API Direct access to link/joint properties Direct simulation functions for forward dynamics on a single articulation Coupled solver function that solves constraints between articulations and rigid bodies New snippets showcasing immediate mode articulations and joints

slide-21
SLIDE 21

21

IMMEDIATE MODE PERFORMANCE

1 Articulation

0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 121 124 127 130 133 136 139 142 145 148 151 154 157 160 163 166 169 172 175 178 181 184 187 190 193 196 199 PxScene 4T PxScene 0T Immediate Mode

slide-22
SLIDE 22

22

MULTIPLE INDEPENDENT SIMULATIONS

400 simple articulations

slide-23
SLIDE 23

23

IMMEDIATE MODE PERFORMANCE

400 Articulations

2 4 6 8 10 12 14 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 121 124 127 130 133 136 139 142 145 148 151 154 157 160 163 166 169 172 175 178 181 184 187 190 193 196 199

Thousands

PxScene 0T PxScene 4T Immediate Mode Immediate Mode 4T

slide-24
SLIDE 24

24

WHEN EVERYTHING INTERACTS!

400 Articulations

10 20 30 40 50 60 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 121 124 127 130 133 136 139 142 145 148 151 154 157 160 163 166 169 172 175 178 181 184 187 190 193 196 199

Thousands

PxScene 4T PxScene 0T Immediate Mode

slide-25
SLIDE 25

25

GPU ARTICULATIONS

Work-in-progress Extends GPU PGS and TGS Rigid Body solver to support articulations Supports mixed simulation (rigid bodies + articulations) Provides significant performance uplift compared to CPU-based articulations Ideally-suited to simulations of 100s or 1000s of articulations and rigid bodies

slide-26
SLIDE 26

26

GPU ARTICULATION PERFORMANCE

1800 swinging 18-dof chains with limits

2 4 6 8 10 12 14 16 18 1 10 19 28 37 46 55 64 73 82 91 100 109 118 127 136 145 154 163 172 181 190 199 208 217 226 235 244 253 262 271 280 289 298 307 316 325 334 343 352 361 370 379 388 397 406 415 424 433 442 451 460 469 478 487 496 505 514 523 532 541 550 559 568

Chart Title

PhysX 4.1 CPU PhysX 4.1 GPU

slide-27
SLIDE 27

27

GPU ARTICULATIONS

Faithful port of PhysX 4.0 articulation solver completed Multi-body interaction between articulations and rigid bodies/other articulations complete GPU version of optimized PhysX 4.1 contact/joint solver currently in the works Articulation support in GPU TGS solver in progress

Future work

slide-28
SLIDE 28

28

PHYSX FOR GAMES

PxScene simulation provides a scalable, asynchronous n-body simulation Ideally-suited for simulating the main gameplay-effecting bodies Immediate mode ideally suited for smaller-scale physics simulation Local secondary physics for characters, network replays etc. GPU simulation can be used to scale simulations massively e.g. scalable destruction, server-side destruction/simulation etc.

slide-29
SLIDE 29

29

NON-GAMING APPLICATIONS

Industrial simulation Robotics Reinforcement learning Immediate mode for low-latency small-scale simulations GPU articulations for larger-scale simulations Model-based control Forward and inverse dynamics Visual FX

slide-30
SLIDE 30

www.nvidia.com/GDC

Gordon Yeoman, Developer | 14 March, 2019 | Booth S466| South Hall

BEYOND GAME VEHICLE PHYSICS?

slide-31
SLIDE 31

31

OUTLINE

PhysX Vehicles are now being used in non-gaming vehicle simulation applications such as NVIDIA DriveSim. Using games technology in non-gaming applications leads to an obvious question.

Q: What is the integrity of the PhysX vehicle model in scenarios currently of interest? A: Let’s compare with world class, industry-standard vehicle dynamics simulators and analyse the results.

slide-32
SLIDE 32

32

PHYSX VEHICLE FEATURE SET

Engine (1-d rigid body, drive torque curve, damping) Drivetrain (clutch, gearbox, final drive, differential) Suspension (spring-damper) Wheels (1-d rigid body) Tires (longitudinal/lateral slip angles/forces, non-linear response, friction) 3d rigid body (jointed to sidecars, trailers etc)

What is a PhysX vehicle?

slide-33
SLIDE 33

33

SIDE BY SIDE COMPARISION I

Run PhysX side by side with leading 3rd party simulator used widely by automotive industry Configure vehicle data to be as closely matched as possible Run PhysX and leading 3rd party simulator and compare simulation results Test acceleration, braking, steering conditions that represent usual and safe driving behaviors

Test methodology

slide-34
SLIDE 34

34

SIDE BY SIDE COMPARISION II

Drive PhysX and 3rd party simulator with identical driving input (steer, brake, throttle) updated at 75Hz PhysX and 3rd party simulator drive on the same road geometry and friction Run PhysX and 3rd party simulator at 1KHz Sample simulation state (wheel rolling speed, vehicle speed) at 60Hz. Plot trajectory of maneuver

Test methodology

slide-35
SLIDE 35

35

THROTTLE AND BRAKE

Rev the engine Engage the clutch Accelerate to top speed in 1st gear Apply the brake at 30 seconds

slide-36
SLIDE 36

36

LANE CHANGE MANEUVER

Rev the engine Engage the clutch Throttle forwards Steer maneuver to change lanes (note: placeholder images)

slide-37
SLIDE 37

www.nvidia.com/GDC

Gordon Yeoman| gyeoman@nvidia.com

QUESTIONS

slide-38
SLIDE 38

www.nvidia.com/GDC

Gordon Yeoman, Developer | 14 March, 2019 | Booth S466| South Hall

BEYOND GAME VEHICLE PHYSICS?

slide-39
SLIDE 39

39

OUTLINE

PhysX Vehicles are now being used in non-gaming vehicle simulation applications such as NVIDIA DriveSim. Using games technology in non-gaming applications leads to an obvious question:

Q: What is the integrity of the PhysX vehicle model in scenarios currently of interest? A: Let’s compare with world class, industry-standard vehicle dynamics simulators and analyse the results.

slide-40
SLIDE 40

40

PHYSX VEHICLE FEATURE SET

Engine (1-d rigid body, drive torque curve, damping) Drivetrain (clutch, gearbox, final drive, differential) Suspension (spring-damper) Wheels (1-d rigid body) Tires (longitudinal/lateral slip angles/forces, non-linear response, friction) 3d rigid body (jointed to sidecars, trailers etc)

What is a PhysX vehicle?

slide-41
SLIDE 41

41

SIDE BY SIDE COMPARISION I

Run PhysX side by side with leading 3rd party simulator used widely by automotive industry Configure vehicle data to be as closely matched as possible Run PhysX and leading 3rd party simulator and compare simulation results Test acceleration, braking, steering conditions that represent usual and safe driving behaviors (accelerate, brake, lane change steering)

Test methodology

slide-42
SLIDE 42

42

SIDE BY SIDE COMPARISION II

Drive PhysX and 3rd party simulator with identical driving input (steer, brake, throttle) updated at 75Hz PhysX and 3rd party simulator drive on the same road geometry and friction Run PhysX and 3rd party simulator at 1KHz Sample simulation state (wheel rolling speed, vehicle speed) at 60Hz. Plot trajectory of maneuver

Test methodology

slide-43
SLIDE 43

43

THROTTLE AND BRAKE

Rev the engine Engage the clutch Accelerate to top speed in 1st gear Apply the brake at 30 seconds

slide-44
SLIDE 44

44

LANE CHANGE MANEUVER

Rev the engine Engage the clutch Throttle forwards Lane change maneuver begins at 10s Lane change maneuver ends at 16s

slide-45
SLIDE 45

www.nvidia.com/GDC

Gordon Yeoman| gyeoman@nvidia.com

QUESTIONS