Article index:
Here is a small PhysX demo for testing purposes, created with GLSL Hacker. This demo, based on the latest beta version of PhysX 3.3, uses the cloth module of the PhysX engine and shows animated flags made up of 50×50 vertices. The demo also displays some information about the PhysX device using functions available in PhysX 3 SDK. The demo is coded in Lua and shows the use of Lua modules.
SonicWall VPN Clients provide your employees safe, easy access to the data they need from any device. Download and install the latest version of NetExtender, Mobile.
PhysX 3 flag demo for Windows, CPU PhysX
This demo is available for Windows 64-bit and Mac OS X 10.{7, 8, 9}. On Windows, the flag simulation can be done with the CPU or the GPU (you can switch between both modes with the G key). On OS X, only the CPU mode is available…
And the Linux version ? It should be available shortly, as soon as I will have fixed a linking issue with the PhysX libs.
PhysX 3 flag demo for Mac OS X
Two words about GPU PhysX. GPU PhysX in the current PhysX 3.3 SDK is only available for cloth and particle modules. And GPU PhysX is available only under Windows. But good news, a trusted source told me that GPU PhysX is also planned for Linux and OS X (the bad news: the release date is not yet planned…).
Now GPU PhysX on Windows. To take advantage of GPU PhysX for clothes, a PhysX application should create more cloth instances than the number of SMX (streaming multiprocessors). The GeForce GTX 780, for example, has 12 SMX, that’s why the demo creates 12 flags to fully exploit the GK110, each cloth being simulated by a SMX (192 CUDA cores). Here are some framerates for the GTX 780 testbed (Intel i5-4670K):
– CPU PhysX: 180 FPS
– GPU PhysX: 280 FPS
And for a GeForce GTX 660 with 5 SMX (then 5 flags) we have:
– CPU PhysX: 270 FPS
– GPU PhysX: 370 FPS
Nice speed boost!
But there is a constraint: the number of vertices of the flag. To get the max performance, the grid that shapes the flag must have around 2500 vertices (50×50) to fit in GPU shared memory. As soon as you use a grid with more vertices (80×80 for example), there’s no difference between the GPU and the CPU. It’s even worse, GPU PhysX getting slower than CPU PhysX!
In the demo, the each flag is made up of 50×50 vertices. You can change this number in the demo (file: PhysX3_Flag_Demo/demo/physx3_flag_v2_gl3.xml, line 100).
CPU PhysX is perfect for low number of clothes or for clothes with more than 3000 vertices. But for many clothes with around 2000 vertices, GPU PhysX is the solution.
PhysX 3 flag demo for Windows, GPU PhysX
I often see, on forums, people saying that PhysX requires a NVIDIA hardware. This is WRONG. If you have a NVIDIA GPU, PhysX can use it (if the developer enabled this feature) to accelerate some simulations. But if you do not have a NVIDIA GPU or do not want to run GPU simulations, all PhysX simulations are done on CPU. That way, you can run a PhysX-based app with any graphics card because only CPU is used for physics computations. The following screenshots show the demo running with a Radeon HD 5770 and with Intel HD Graphics 4000:
PhysX 3 flag demo on Radeon HD 5770 using the CPU for simulations
PhysX 3 flag demo on Intel HD Graphics 4000 using the CPU for simulations
You can download the PhysX 3 flag demo for Windows and Mac OS X here:
Webmasters: hotlinking is not allowed, please use the post url as download link.
Windows 64-bit [download#356#image] Mac OS X 10.7, 10.8, 10.9 |
Unzip the archive somewhere, and launch PhysX3_Flag_Demo.exe (Win64) or PhysX3_Flag_Demo.app (OS X). The source code (Lua + GLSL) is available in the demo/ folder.
PhysX 3 flag demo for Windows, GPU PhysX
Related posts: