Panda PhysX

Return to Panda Features in Development

Panda PhysX

Postby enn0x » Tue Oct 14, 2008 3:50 pm

Quite a lot has changed since I released NxPanda. For example Ageia has been bought by NVIDIA, and NVIDIA continued to support PhysX. This also means a slightly less restraining license for PhysX, and it means that hardware acceleration is not only possible on old AGEIA PhysX cards, but also on new NVIDIA graphics cards (GeForce 8-series, 9-series and 200-series).

http://www.panda3d.net/phpbb2/viewtopic.php?t=3108

Somewhere in the above thread I announced that I want to redesign the NxPanda wrappers for PhysX. This is more than a year ago. Well, here is the first public release of the new approach:

http://enn0x.p3dp.com/libpandaphysx_0.4.0.zip

This time it is not a wrapper around PhysX classes, but an attempt at integrating with Panda3D. I use Panda3D's interrogate to create Python wrapper around C++ classes which both shadow PhysX objects and provide additional functionality.

Main focus is on ease of usage, and not on feature-completeness. Also I try to make use of as many Panda3D features as possible, like the event system, the notification system, or the reference count system.

The code is still far from complete, but basic rigid body physics and character controllers work well. Next steps will be documentation and fixing problems (for version 0.5.0), then going for more functionality like raycast cars, cloth, softbodies and fluids (for version 0.6 or later).

Some highlights:
- Windows and Linux. I compiled on Windows Vista and Ubuntu Gutsy Gibbon.
- Automatic synchronisation of visual objects. You don't have to update NodePath coordinates are rotations by hand.
- Automatic hardware detection.
- Built-in debug mode.

Like before you will need to have the PhysX System Software installed (Version 8.09.04). This can be downloaded from the official NVIDIA PhysX page (link is below). If you have recent NVIDIA graphics driver installed (GeForce v177.39 driver package and above) then you already have the PhysX System software since it is included in the driver package. A third option is to use the smaller "game installer" for PhysX 2.8.1, but I think NVIDIA will discontinue to support the game installers.

http://developer.nvidia.com/object/physx_downloads.html

Since the 0.5.0 release will be a bugfix only release feel free to flame me with problems, bugs, suggestions or criticism.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby enn0x » Sat Oct 25, 2008 1:41 am

http://enn0x.p3dp.com/libpandaphysx_0.4.1.zip

This is a maintainance release. No big features have been added:

* Adds documentation on class level for all classes.
* Adds documentation on method level for many classes.
* Adds support for fixed and variable timesteps.
* Adds feedback filter for smoth autostepping for box controllers.
* Displacement algorithm for controllers now supports minDist parameter.
* Adds raycastAll method to scenes.
* PhysKitchen::cookMesh renamed to cookTriangleMesh
* PhysKitchen::cookConvex renamed to cookConvexMesh
* Removed a bug in SConstruct (interrogate did not parse cxx files)
* Removed a compile warning on Linux (delete void*)
* Upgraded to scons-1.1.0 and added a missing import in physController.h
* Uses quadtree pruning structure for accelerating scene squeries.

(see included file doc/HISTORY.txt)

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby BMCha » Sun Nov 02, 2008 9:26 pm

How do you run the samples? I tried making a shortcut that ran the py files off panda's python, just like the default samples. But the python window shows up, and then the panda window, which is black and doesn't refresh.
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby enn0x » Mon Nov 03, 2008 3:22 am

Interesting. Is this Windows or Linux? What happens if you open a console, change directory to the samples directory, and then type "ppython.exe 02_Debug.py"? There should be some output on the console. Please post it.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby rdb » Mon Nov 03, 2008 7:16 am

Hmm, there doesn't seem to be a linux download for 64-bits on the PhysX download page, unfortunately. Otherwise, I'd love to try it out.
rdb
 
Posts: 9577
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby enn0x » Mon Nov 03, 2008 6:55 pm

Support for 64bit Linux has been announced for PhysX 3.0, which is sheduled somewhere next year. Sorry, no 64bit SDK so far. Hmm... by the way I don't know if Panda PhysX compiles on 64bit Windows.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby BMCha » Tue Nov 04, 2008 12:19 am

I'm on Windows. When I type that command in, I get the same as before.
The output of the console is this:
Code: Select all
DirectStart: Starting the game.
Warning: DirectNotify: category 'Interval' already exists
Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
:util(warning): Adjusting global clock's real time by 1.8599e-005 seconds.

And the Panda window is still unresponsive.
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby enn0x » Tue Nov 04, 2008 2:55 pm

Of course it is still unresponsive. You didn't change anything. Running it from the command prompt is purely to collect information. Now I know WHERE it hangs. Next I want to find out WHY it hangs.

So please provide some more information. Starting with your OS (version, service pack), the Panda3D version (did you compile yourself?), Panda PhysX version (there are already two, yay!). What I am most interested in is you PhysX System Software version, the PhysX info and settings from the Windows Controll Panel and please create a logfile from the "extended diagnosis" if you can (depending on your hardware you don't have this option). How did you install the PhysX System Software (standalone or included with the NVIDIA graphics drivers), and what is your graphics card and which driver version do you have?

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby BMCha » Tue Nov 04, 2008 9:38 pm

I am running (as reported in system properties)Windows XP Media Center Edition 2002 SP2, Panda3d 1.5.3 Windows binaries, PandaPhysX 0.4.1, PhysX system software 08.09.04, installed with the Geforce PhysX for 8800s update, running in GeForce PhysX mode on my 9600GSO(8800GS rebranded), running forceware 178.13, and the extended diagnosis is only available to real physX cards.
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby enn0x » Fri Nov 07, 2008 3:29 pm

Back again. I would try to uninstall the "NVIDIA PhysX v8.09.04" via Control Panel (but not the "NVIDIA Drivers"), and then re-install it again. The PhysX System Software alone can be downloaded from from the NVIDIA page above. If this doesn't help try to use an older PhysX System Software version, for example v8.04.25. I have heard rumors that the combined installer has some problems.

But before you do please download the following dll and replace it with your version. It adds a few debug outputs at the time of engine initialization. Then run this small script and post the console output:

http://enn0x.p3dp.com/libpandaphysx.pyd

Code: Select all
from pandac.PandaModules import loadPrcFileData
loadPrcFileData( '', 'notify-level-physx spam' )

#import direct.directbase.DirectStart

print '--pre--'
from libpandaphysx import PhysEngine
print '--post--'


enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby BMCha » Fri Nov 07, 2008 7:50 pm

Looks like I need to redownload. (should I get the sdk?)

Code: Select all
--pre--
:physx(spam): init module
:physx(spam): @enter: _sdk=00000000


Also, (this may or may not be useful information) the physx demos, including the water physics demo, work fine.


EDIT: I reinstalled the system software, and it still hangs after:
:physx(spam): @enter: _sdk=00000000
Maybe I need to wait longer for the import to complete?
Or do I need the SDK.
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby enn0x » Fri Nov 07, 2008 9:43 pm

I don't think that the SDK will help. Please try to disable hardware acceleration in PhysX settings, and if this does not help try to install the older PhysX_8.04.25_SystemSoftware.exe driver:

http://developer.nvidia.com/object/physx_archives.html

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby ynjh_jo » Fri Nov 07, 2008 10:26 pm

BMCha, how could you get glxGraphicsPipe on Windows ?
http://ynjh.tk
Intel P4Prescott 2.8GHz HT | ATI Radeon HD4670 1GB GDDR3
User avatar
ynjh_jo
 
Posts: 1795
Joined: Tue Apr 18, 2006 12:41 am
Location: Malang, Indonesia

Postby BMCha » Sat Nov 08, 2008 12:12 am

Success! Disabling Geforce PhysX worked. Thanks for all the help.

And I don't exactly understand you question ynjh_jo. That refers to Panda using OpenGL to display, right?
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby ynjh_jo » Sat Nov 08, 2008 12:23 am

Up to v1.5.3, on Linux, it's glx.
On Windows, it's wgl or wdx.
http://ynjh.tk
Intel P4Prescott 2.8GHz HT | ATI Radeon HD4670 1GB GDDR3
User avatar
ynjh_jo
 
Posts: 1795
Joined: Tue Apr 18, 2006 12:41 am
Location: Malang, Indonesia

Postby BMCha » Sat Nov 08, 2008 12:28 am

Now I remember, I didn't feel like typing all the generic console messages, so I found someone's console log and copied in the first few lines. For me it actually is wgl, though.
BMCha
 
Posts: 43
Joined: Sun Jul 13, 2008 1:32 am
Location: California, USA

Postby enn0x » Sat Nov 08, 2008 8:09 am

Success! Disabling Geforce PhysX worked. Thanks for all the help.

Glad it works now, but it's not yet "success". Current state is that some users (you are the only one so far :-) can't use hardware accelleration even if it should be possbile on their hardware. Not a satisfying status for me.

I will try to find a solution, but move this to PM until we have a result.

Now I remember, I didn't feel like typing all the generic console messages, so I found someone's console log and copied in the first few lines.

No need to typ everything.
In the console window, upper left corner of the window decoration, there is a icon, and the icon has a context menu. Select "Properties", and in the properties window enable "Quick edit mode" and "Insert mode". Then you can mark text with your mouse and copy it by pressing the "enter" key.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby dorosp » Wed Nov 19, 2008 6:34 am

Hi enn0x,

Thanx for all the effort you are putting into this. I am just wondering, does the current version of your work support cloth simulations? or not yet?
Na sas fai i moula!
dorosp
 
Posts: 47
Joined: Tue Nov 20, 2007 3:06 pm

Postby enn0x » Wed Nov 19, 2008 3:43 pm

Not yet. It's on my todo list, but somewhere in the middle. Next things will be vehicles and more maintenance for *basic* features. I don't want to propose a date, but maybe around christmas.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby enn0x » Mon Nov 24, 2008 1:54 pm

http://enn0x.p3dp.com/libpandaphysx_0.4.2.zip (3.3M)

Another maintainance release. Also some code cleanup has happened and some new features have been added:

* Adds overlap testing (sphere, capsule).
* Adds shapeType parameter to raycasting and overlap testing.
* Classes without PUBLISHED methods get now wrapped too, e.g. PhysConvexShape.
* Adds a method to set ShapeFlags on shape descriptors.
* Adds methods to set the global position & orientation on PhysActors.
* Adds methods to set the maximum angular velocity on PhysActors.
* Adds methods to set/get the skin width of a shape or shape descriptor.
* Adds wheel shapes (PhysWheelShape, PhysWheelShapeDesc).
* Adds contact reporting.
* Adds methods to query/control sleeping of PhysActor.
* Fixed a bug in PhysController.setH().
* Adds documentation for several more methods.

(see included file doc/RELEASE-NOTES.txt)

The included binaries are built for Panda3D-1.5.4.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Executor » Tue Nov 25, 2008 6:45 am

I'm in need of some help with the cooking process. When cooking a custom model, the kitchen returns a status of 1, so it does work. But when loading the model in the convex sample (04_Convex.py), I replace the tetra model with my custom model, I get these assertion failures:

Assertion failed: meshPtr at line 50 of c:\users\rpf\desktop\physx\source\physMeshPool.cxx
Assertion failed: meshData at line 30 of c:\users\rpf\desktop\physx\source\physConvexShapeDesc.cxx


I am quite new to Panda, Python and PhysX, but just editing a filename can't be the problem, must be the model. The egg model was exported from 3dsmax 8.
Please help.
User avatar
Executor
 
Posts: 73
Joined: Tue Nov 25, 2008 6:10 am
Location: South Africa

Postby enn0x » Tue Nov 25, 2008 11:57 am

There are three possible problems:

1.) How did you cook the mesh? Using PhysKitchen( ).cookTriangleMesh or using PhysKitchen( ).cookConvexMesh? If you open the .nxb file created by the Kitchen, what are the first characters ("NXSMESH" or "NXSCVXM")?

2.) The implementations of the Kitchen methods are not very clever, they just try to find vertices and use them as a vertex cloud. This is fine for *simple* meshes. Maybe the Max exporter has some features which cause problems. Can you send me the .egg file for analysis?

3.) Problems with the filepath. I assume you checked this already.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Executor » Wed Nov 26, 2008 8:04 am

Ok...
1. It's using cookTriangleMesh.

2. I tried the steps.egg model that comes with your samples.

3. Yip, checked the paths. I believe it would give a different error for this though, would it not? The start in path is same as the 04_Convex.py file's folder.
User avatar
Executor
 
Posts: 73
Joined: Tue Nov 25, 2008 6:10 am
Location: South Africa

Postby enn0x » Wed Nov 26, 2008 1:47 pm

1. It's using cookTriangleMesh.


But when loading the model in the convex sample (04_Convex.py), I replace the tetra model with my custom model, I get these assertion failures: ...


If you cook something as a triangle mesh then you have to load it again as a triangle mesh. If you cook something as a convex mesh then you have to load it as a convex mesh.

Triangle meshes and convex meshes are not the same binary files, even though I use the same filename extension (.nxb) for both in my samples. You can use different extensions if this helps you keeping your models organized.

Please note that triangle meshes are for static geometry (things that never move), and convex meshes are for dynamic geometry (things that move around in the scene).

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Executor » Fri Nov 28, 2008 10:45 am

Thanks, I'm getting things to work now, finally.

Just want to know...
When I want to use a shape like the capsule, does my model have to be centered over the origin, or must it be placed above the origin? Is there a way to set the direction of it?
User avatar
Executor
 
Posts: 73
Joined: Tue Nov 25, 2008 6:10 am
Location: South Africa

Postby enn0x » Sat Nov 29, 2008 9:01 am

I don't understand your question, sorry. Can you elaborate a little bit about what you mean with "model" and "origin"? Best would be to use Pand3D or PandaPhysX class names.

You mean the NodePath assigend to a PhysActor, or the PhysShape added to the PhysActor?

"Origin" is a property of a coordinate system. There are several coordinate systems involved, for example the global CS or rendered geometry (NodePath "render"), the local CS of a NodePath (relative to it's parent NodePath), the CS of the PhysScene, the global CS of a PhysActor (relative to the PhysScene), the local CS of a physShape (relative to PhysActor), just to name the most important ones.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Executor » Sun Nov 30, 2008 4:42 pm

When I say model I meant the actual model that the 3d artist builds in Blender or etc. and with shape I meant both the PhysShape and the blender model's shape.
About the origin, I meant the model origin, as in blender. Example:
Image

About the direction. Why I ask is because I get this result:
Image
The capsule is rolling sideways and the model is obviously not correctly oriented with the PhysShape or whatever. I don't know, thats why I ask. This is my code:

Code: Select all
      self.m_Model=loader.loadModel(modelname)
      self.m_Model.reparentTo(render)
      self.m_Model.setPos(0,0,10)
      self.m_Model.setHpr(0,0,0)
      
      tmpshape = PhysCapsuleShapeDesc()
      tmpshape.setHeight( 1.8 )
      tmpshape.setRadius( 0.35 )

      tmpbody = PhysBodyDesc( )
      tmpbody.setMass( weight )

      tmpactor = PhysActorDesc( )
      tmpactor.setBody( tmpbody )
      tmpactor.addShape( tmpshape )
      tmpactor.setGlobalPos( self.m_Model.getPos(render) )

      self.m_PhXActor = world.m_PhXScene.createActor( tmpactor )
      self.m_PhXActor.attachNodePath( self.m_Model )
User avatar
Executor
 
Posts: 73
Joined: Tue Nov 25, 2008 6:10 am
Location: South Africa

Postby enn0x » Sun Nov 30, 2008 7:06 pm

...the model is obviously not correctly oriented with the PhysShape or whatever.

Not really obvious, since the screenshot only shows rendered geometry. It does not show the collision geometry. Turn on physx debug rendering, and do another screenshot. Then it will be obvious.

My best guess it that you have aligned the visible capsule along the z-axis. Your blender screenshots don't reveral what axis is up, so making random guesses is verything I can do. PhysCapsuleShape is aligned along the y-axis.

If this is true then you have two options. Both ways work fine:
1.) either rotate the PhysCapsuleShape by setting a local transform.
2.) or rotate your visible geometry in Blender, then export again.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Executor » Tue Dec 02, 2008 11:27 am

Thanks for the help so far enn0x.

I just rotated the visible geometry for now, but it was the PhysCapsuleShape's local transform that I was really looking for, I believe.

Anyway, is there a way to visualize a PhysRay when rendering the PhysScene's debug node? I'm trying to use the PhysRay for a 3rd Person camera to check if its going through anything.

By the way, PhysX works 10x better and easier than ODE, in my opinion.
User avatar
Executor
 
Posts: 73
Joined: Tue Nov 25, 2008 6:10 am
Location: South Africa

Postby enn0x » Tue Dec 02, 2008 2:11 pm

Anyway, is there a way to visualize a PhysRay when rendering the PhysScene's debug node?


The rays used in raycasting are not part of the PhysScene, they are just temporary objects. The debug renderer can not show them.

There are two other options for visualizing them:

1.) What I have done in the raycast sample: use two spheres, and move them to the origin and the end of the ray every frame.

2.) Use the Panda3D class "LineSegs" to create a NodePath which is a line from the ray's origin to it's end every frame. If I find some time I will modify the raycast sample this way for the next release.

Performance is not an issue here since this is just for debugging.

By the way, PhysX works 10x better and easier than ODE, in my opinion.

Thanks, but it comes at a high cost: PhysX is not open source, and my bindings for PhysX are still at an early stage.

enn0x
enn0x
 
Posts: 1383
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Next

Return to Panda Features in Development

Who is online

Users browsing this forum: No registered users and 1 guest