AGEIA, manufacturer of the first mass-market PPU cards, has come under pressure from upcoming graphics cards with integrated hardware physics, for example NVIDIA 8 Series Quantum Effects Technology. Only a few games support AGEIA PhysX cards so far, and if they don’t gain market share soon they will be second to the big GPU companies.

One effect of this pressure has been that AGEIA has lowered their license fees for their physics SDK some month ago. From 50000$ to ZERO! Commercial use too.

Maybe I will buy a PhysX card next month, maybe not. But even without hardware acceleration (530 million sphere/sphere collisions per second…duh) their physics engine is tremendous, both concerning speed and features. Whatever, here is a first preview for NxPanda (or whatever the final name will be. Nx because of Novodex, the original name for their physics engine):

The demo is compiled for windows, but AGEIA has a Linux SDK too. To run the demos you will need to have Panda3D-1.4.0 and the latest AGEIA PhysX system software (7.07.24). Beware, the system software is a large download. Not as large as Panda3D, but still ~30M:

For now I follow the PhysX API very closely, so integration with Panda3D is only “light”. But once I have learned more about using PhysX I might re-design and integrate more tight.

Only a very small part of the PhysX API is wrapped by now, and it will be some time before I work on more advanced features like fluids or soft bodies. Still, here are some highlights:

  • Kinematic character controllers, with stair stepping, slop limit, jumping and crouching. Something I found to be tricky to implement with other physics engines (ODE, Newton). A small “mini game” is included. Hmmm… actually not a game since their is no goal for the player, so just a techdemo.

  • Cloth. Well, see yourself. No tearing and attaching so far. Turn off the debug renderer to see the real fps (more than 500 on my PC).

The downside: PhysX might be powerful, but is not open source. This mean PhysX is not suited to replace the built-in collision & physics systems of Panda3D. It will always stay just an alternate way to do physics.


Looks very good, enn0x! Thanks very much for sharing!
It’s indeed a pity that it’s not opensource… because if I use it in my game, I can’t call it opensource no more :frowning:

1 question: “Turn off the debug renderer to see the real fps”
Any suggestion how to do that?

Thank you very much. It’s not exactly sharing, because I didn’t release the source code so far. I will, once a “0.1” state is achieved, and PandaProjects is running.

F3 toggles the debug renderer in all scripts, except for the very first one which just shows how to initializes the engine. The debug renderer is a big impact on framerate, because every frame all the wireframe geometry is created anew. And I am pretty sure I didn’t choose the fastest way to do this.

Open source: Well, yes, I would prefer if PhysX was open source too. But maybe this is wishing for too much. PhysX might not be equal to Havok in all aspects, but it is close.

I know it is very hard to define what open source really is. I think open source software can utilize other closed source libraries, but this is just my opinion. There wouldn’t be any open source software possible on MS Windows otherwise, since any code sooner or later uses OS functionality, for example output to the console, or opening a window. And these MS Windows system functionality is closed source. So Panda3D on MS Windows would not be opens source, because of “#include <windows.h>” and linking against M$ CRT.


I <3 you Ennox! I needed physics for my game and this looks a lot easier than PYODE!

I installed and did everything your first post said to do, but on my system it is creating an error on all 5 (that I tested) of the demos…the error is close to

self.sdk = Nx.createphysicsSDK()
could not create NxPhysicsSdk

on line 96 in the 01_basics tutorial…

Are you sure you have the latest AGEIA drivers?

I thought I did and got that error but it was fixed when I downloaded the link in the first post.

oops…I scrolled down to the bottom of the page and downloaded the second latest version :slight_smile: sorry

So we can use this free of charge for a commercial game? How do i download it? How exactly do i use it with Panda? Is there any tutorials on how to, or is this download a tutorial?


I believe that Ageia is required to be installed on all computers for it to work, in addition to the dlls that ennox is using to bind it. This means that to distribute a game with it, you have to include the ageia installer as well. As far as I know, physx is free for commercial and private use now, but it is still closed source. The download consists of 11 examples along with a game and a way to “cook” nx models from nodepaths.

What is missing (and it would be really helpful ennox) is a list of all the commands wrapped so that we do not have to guess which commands there are. (documentation can be found for physx in general online)

Hey ennox, this doesn’t work with panda 1.4.1, can you recompile the binaries (or give the source :slight_smile: please

Sorry for the late response. Just back from a holiday on a boat at the red sea, and the only piece of electronic equipment I had with me has been my old Aladin diving computer. I will try to answer some of the above questions:

Panda3D 1.4.1:
I have re-compiled for Panda3D 1.4.1, and replaced the above download. So now the requirements are AGEIA PhysX system software 7.07.24 or later and Panda3D 1.4.1.

At the moment (pre-alpha!) documentation consists only of a few tutorials and examples. But as with every Python module you can use introspection to find out what classes/methods/attributes exist (that’s “print dir( object )”). Also you can use pydoc to create a minimal html documentation. But this only lists what methods exist, and not what arguments are required/possible.

Writing full documentation is quite a bit of work, and until I know exactly what way I will go with NxPanda I won’t put much effort in writing manuals or docstrings. Please see below for future plans.

PhysX system software:
The PhysX system software is very similar to DirectX. It contains all versions of the physics engine runtime, plus hardware drivers for the PhysX cards. Just like DirectX. And like DirectX, PhysX needs to be installed only once for several PhysX-enabled applications/games.

There has been some talk on the AGEIA forums about the size of the system software, and AGEIA announced to create smaller, customized installers with one of the next releases.

30M might be big at the first glance, but look at typical games nowadays: distributed on one DVD usually, with several gigs of content (models, textures, speech, music/sounds, …). 30M for PhysX and 60M (???) for DirectX doesn’t matter much.

For online distributed games you could ask the end user to download and install the PhysX system software himself. Downloading the system software from AGEIA is free of charge and does not require registration.

There are many shades of “free”. For certain PhysX is not open-source, and it is not GPL/LGPL. But unlike other products like Havok, 3D Max or SpeedTree there is a way to use it for commercial and non-commercial applications without license fees. With a few restrictions.

Please go to the below link and read the topic “How do I become a licensed developer and what are the licensing terms?”:

I’m not a lawyer, so please tell me if you think NxPanda is violating any part of the PhysX EULA. I’m rather positive, since there are other projects too, like for example NxOgre (link below), which is released under the LGPL.

Right now I consider NxPanda to be in a pre-alpha state. I don’t know much of the PhysX C++ API. And I am not yet sure which would be the best practice for using it with Panda3D.

One option (which is currently used) is a “wrapper” that keeps close to the PhysX C++ API. Integration with Panda3D is at the level of automatic conversion of arguments like Vec3, Mat4 or Point3, plus callbacks and some utils like parsing a NodePath geometry.

Another option would be to integrate more tight with Panda3D. Perhaps offering classes derived from NodePath which handle physical bodies, triggers or other game objects. Similar to the native Panda3D physics system, but based on PhysX. Pro-rsoft has given a good example on how to extend Panda3D using C++ and interrogate. But this would require some design work first (and better knowledge on how to use the PhysX API).

Comments, ideas and suggestions are welcome, of course.


I decide to use Nxpanda for my game, but i have some question ^^
I tryed to texture a cloth without succes i just get the color of the texture on it, is there a way of doing this ?
Do you intend to make a attachment system for cloth ?
Another thing, if i rotate vertically the cloth to 90° into the tutorial, the close fall like that :

She fall from the camera (front of the crate) horizontaly, insteed of falling from the top to the bottom of the screen.
Is there a way for making a falling of a cloth rotated at 90° ?

Sorry for my poor english ^^
and a big applause for your good work ^^

Thank you for your interest. I hate to say so, but NxPanda is still in a very early stage. I don’t even dare to make a first full release. So please be prepared for strange behavior.

For now my focus is on making the basic features of NxPanda stable (rigid bodies, controller, joints, triggers, raycast…). I do this by writing a small demo-game, and while I do so fix any kinks or memory leaks I encounter. The demo-game will be 3rd person RPG, similar to your Herdelia project, but without any network support, and without any good looking graphics. More advanced features like cloth, fluids or mesh paging are far down on my priorities list. About your questions:

I guess you did it this way:

        self.clothNP = self.clothData.generate( )
        self.clothNP.reparentTo( render )
        self.clothNP.setColor( 1, 1, 0.5 )
        self.clothNP.setP( 90.0 )

This won’t work because every frame the cloth mesh gets updated. Updating works by reading all vertices from C++ NxMeshData, and using a GeomVertex(Re)Writer to update the vertex position. The vertices generated by Nx are in global space (“render”), so adding a transform (translation, rotation, scale, shear) to clothNP will result in a mismatch between the physical world and the visual world.

Or in other words: the physics simulation doesn’t know that you have rotated the cloth if you modify clothNP. I could add code to read the clothNP transform and transform each vertex before writing it to the vertex writer, but this would be a significant slowdown.

The right way would be to tell NxPanda that the mesh is translated and rotated by replacing the first line with the second line, where matrix is a Mat4 with translation AND rotation:

        #clothDesc.globalPosition = pos
        clothDesc.globalPose = matrix

Texture are not supported by now. Texture is a bit tricky, since the cloth could tear (not supported yet, too), and tearing changes the number of vertices. So Nx has to remember the original index for each mesh vertex. The PhysX C++ API has support for this, but it is not yet wrapped.

Attaching the cloth to something is possible, and already wrapped, but experimental. Uncomment these lines (346-348) in the cloth demo:

        for i in range( length ):
            p = pos + Vec3( -stride * i, 0, 0 )
            self.cloth.attachVertexToGlobalPosition( i, p )


Ok thanks you for your answers ^^
i’ll try this.
just a last question, how can i do that ?

I didn’t find anything about it on the manual.
good luck for this huge work !

Either by using a dummy node, e.g. like this:

np = NodePath( 'dummy' )
np.setPos( 1, 2, 3 )
np.setR( 30.0 )
matrix = np.getMat( )

…or by computing it yourself, e.g. like this:

m1 = Mat4.rotateMat( 30.0, Vec3( 0, 1, 0 ) )
m2 = Mat4.translateMat( Vec3( 1, 2, 3 ) )
matrix = m1 * m2

Order is important: m1 * m2 is not the same as m2 * m1 !!!


ok thx, i must make this onto clothNP and then make
clothDesc.globalPose = matrix

Thank you a lot :wink:

Umm… no.

clothNP does no exist at the time when you configure cloth and clothDesc. You will have to use a separate dummy node or compute the matrix yourself. Computing it yourself is probably the better way. But below is the modified code using a dummy node.

        np = NodePath( 'dummy' )
        np.setPos( pos )
        np.setP( 90.0 )
        matrix = np.getMat( )

        # cloth
        clothDesc = Nx.NxClothDesc( )
        ###clothDesc.globalPosition = pos
        clothDesc.globalPose = matrix
        clothDesc.thickness = 0.1
        clothDesc.bendingStiffness = 0.5
        clothDesc.stretchingStiffness = 1.0
        clothDesc.friction = 0.3
        clothDesc.flags |= Nx.NX_CLF_BENDING
        clothDesc.flags |= Nx.NX_CLF_COLLISION_TWOWAY
        clothDesc.clothMesh = mesh
        clothDesc.meshData = self.clothData
        print clothDesc.isValid( )

        self.cloth = self.scene.createCloth( clothDesc )

        # cloth NP
        self.clothNP = self.clothData.generate( )
        self.clothNP.reparentTo( render )
        self.clothNP.setColor( 1, 1, 0.5 )

Another way would be to create the cloth vertices in a different way. Clothes are not restricted to planar meshes. It can be tubes for example. The ultimate goal is to have characters clothed in cloth. But I reckon this will need physics hardware support and a faster way to update the Panda3D meshes.

The code below creates the mesh vertices vertical (x/z plane) and not horizontal (x/y) plane like in the original demo.

        points = [ ]
        for j in range( length + 1 ):
            for i in range( width + 1 ):
                x = stride * i - 0.5 * stride * width
                y = 0
                z = stride * j - 0.5 * stride * length
                points.append( ( x, y, z ) )


Ok, thnaks a lot i’ll look at it.

Hi, I’m trying to make a trigger to represent the field of view from the NPCs.

Well, doing the shape as Nx.NxSphereShapeDesc( ) it works, the TriggerReport detects the collisions. Here is the code to create the shape:

shapeDesc = Nx.NxSphereShapeDesc( )
shapeDesc.radius = 5.0
shapeDesc.shapeFlags |= Nx.NX_TRIGGER_ENABLE =
shapeDesc.localPose = shapeDesc.localPose.translateMat( Vec3(0, 1, -5) ) # Translate the sphere to simulate the field of view.

Result is a pink sphere in front of the bunny.

Instead of a sphere I want to use a pyramid shape, but the TriggerReport don’t detect anything :frowning:

Making the pyramid shape:

cooking = Nx.getCookingLib( )
cooking.initCooking( )

meshDesc = Nx.NxConvexMeshDesc( )
meshDesc.flags = Nx.NX_CF_COMPUTE_CONVEX
meshDesc.points = [ (  0,  0,  -7 ),
                            (  1,  3,  0 ),
                            (  1, -3,  0 ),
                            ( -1,  3,  0 ),
                            ( -1, -3,  0 ) ]

# option (1): save to file and load again
#print cooking.cookConvexMesh( meshDesc, 'models/pyramid.nx' )
#mesh = self.sdk.loadConvexMesh( 'models/pyramid.nx' )

# option (2): cook in memory
mesh = Physx.physx.sdk.createConvexMesh( meshDesc, cooking )

shapeDesc = Nx.NxConvexShapeDesc( )
shapeDesc.meshData = mesh
shapeDesc.shapeFlags |= Nx.NX_TRIGGER_ENABLE = 

The result is an orange pyramid. I guess it should be pink to work like the sphere :stuck_out_tongue:

If someone can help… thanks!

For triggers these interactions are not possible:

  • convex vs. triangle mesh
  • triangle mesh vs. triangle mesh.

See the SDK documentation for more details:
SDK > Guide > Collision Detection > Triggers

I think it is best to use only primitives for triggers.