physx 4 raising the fidelity and performance of
play

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


  1. 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

  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 2

  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 3

  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 4

  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 5

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

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

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

  9. TGS CONVERGENCE 10,000:1 Mass Ratio Chain error 100 iterations 0 0.5 1 1.5 Error 2 2.5 3 TGS PGS 9

  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 10

  11. RESULTS PhysX Warehouse Demo 11

  12. RESULTS ANYmal training 12

  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. 13

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

  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 15

  16. PHYSX 4.1 Michelle Lu, Principal Software Engineer | 14 March, 2019 | Booth S466| South Hall www.nvidia.com/GDC

  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 17

  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 18

  19. 10 15 20 25 0 5 1 6 11 16 21 26 31 36 41 46 51 PERFORMANCE IMPROVEMENTS 56 61 66 71 1000 24 DOF Articulations on the ground 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 PhysX 4.0 161 166 171 176 181 186 PhysX 4.1 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 19 346 351

  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 20

  21. 0.02 0.04 0.06 0.08 0.12 0.14 0.16 0.18 0.1 0.2 0 1 4 7 10 13 16 19 22 IMMEDIATE MODE PERFORMANCE 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 PxScene 4T 73 76 79 1 Articulation 82 85 88 91 PxScene 0T 94 97 100 103 106 109 112 115 Immediate Mode 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 21 196 199

  22. MULTIPLE INDEPENDENT SIMULATIONS 400 simple articulations 22

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

  24. Thousands 10 20 30 40 50 60 0 1 4 7 10 13 16 19 22 WHEN EVERYTHING INTERACTS! 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 PxScene 4T 70 400 Articulations 73 76 79 82 85 88 91 PxScene 0T 94 97 100 103 106 109 112 Immediate Mode 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 24 196 199

  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 25

  26. 10 12 14 16 18 0 2 4 6 8 1 10 19 28 37 46 55 GPU ARTICULATION PERFORMANCE 64 73 82 91 100 109 118 1800 swinging 18-dof chains with limits 127 136 145 154 163 172 181 190 199 208 217 226 235 PhysX 4.1 CPU 244 253 Chart Title 262 271 280 289 298 307 PhysX 4.1 GPU 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 26 559 568

  27. GPU ARTICULATIONS Future work 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 27

  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. 28

  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 29

  30. BEYOND GAME VEHICLE PHYSICS? Gordon Yeoman, Developer | 14 March, 2019 | Booth S466| South Hall www.nvidia.com/GDC

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend