Maximum PC

OPEN SOURCE Nvidia Gives the Gift of PhysX

IN DECEMBER, Nvidia announced that it was open-sourcing its PhysX physics simulation engine. Sure, we all love PhysX effects in games, but Nvidia did it for scientists and engineers as much as game developers.

- Alex Campbell

Accurate, quick physics are the hallmark of modern games. While you might think game physics are simply the trajectory of an object in space, the real meat and potatoes of game physics are when things touch. When objects touch, Newtonian physics can give us a pretty good idea of where they are going to go, and how fast they’ll move. In simple terms, you can think of objects as simple as pool balls on a table, or as complex as a car in RocketLeag­ue.

While it can operate on a CPU, PhysX is designed to do thousands of high-school physics problems in a massively parallel way on the GPU. Think of it as multithrea­ded physics calculatio­ns across hundreds of cores, because that’s exactly what it is. As anyone who’s shot a Kerbal into orbit will attest, physics can be hard, and performing those calculatio­ns across hundreds of cores on your GPU instead of the four to eight on your CPU has obvious advantages for performanc­e.

As great as PhysX is, it was never designed to simulate real-world physics with precision beyond what you’d experience in a game at 60–144Hz. Nvidia’s API documentat­ion of PhysX says, “PhysX is best suited for quasi-real time interactiv­e 3D applicatio­ns where performanc­e and scalabilit­y are more important than precision.” If that sounds a little wonky, it is. In a game, you need to be able to predict where an object might be according to a Newtonian world before the next frame is rendered. If you’re rendering at 60Hz, that means the PC has 1/60 of a second to figure out where that broken shard of glass has to be. For a high-end GPU, that’s plenty of time, but it’s slow compared to the real world, where time is infinitely divisible. Nvidia has its eyes on machine learning and driverless cars, and to get PhysX into those worlds, it needs to think beyond the gaming level of performanc­e.

In a gaming developmen­t paradigm, licensing the PhysX API to developers with legal staff and training resources might make sense, but like Microsoft, Amazon, and Red Hat, Nvidia’s big money is made in the cloud and compute applicatio­ns. In a data-driven world, licensed closed-source software can’t scale like open-source can. Opensourci­ng the engine also means that features can be added by the community, so the engine can do more stuff on different hardware setups. Developers also don’t have to worry about violating the PhysX end user license agreement.

For gamers, it also has an interestin­g consequenc­e. As Nvidia had control over the source, it had no incentive to write instructio­ns in PhysX to make use of resources on AMD graphics. With the code wide open, it could be possible to get PhysX to work with AMD cards, if AMD (or anyone else) modifies PhysX to use AMD-specific instructio­ns, resources, and optimizati­on instead of Nvidia’s. Before you get too excited, keep in mind that Nvidia has spent a decade optimizing PhysX for Nvidia hardware, so it’ll probably take more than a couple lines of code to get PhysX to work at the levels you’d expect on an AMD GPU.

It’s pretty awesome that Nvidia’s powerful tool is everyone’s powerful tool now, and the potential for interopera­bility with AMD hardware is only one part of it. If only Microsoft would let DirectX come to Linux.... One can dream. Alex Campbell is a Linux geek who enjoys learning about computer security.

 ??  ?? These days, PhysX is being used for machine learning as much as games.
These days, PhysX is being used for machine learning as much as games.
 ??  ??

Newspapers in English

Newspapers from United States