Automatic Generation of Dynamics Data from Graphics Meshes, including Rag Doll models from Skeletal Deformed Meshes and Approximate Convex Decomposition.The CreateDynamics toolkit is delivered both as source code and as a DLL plug-in. Unlike some of the previous offerings, there is a substantial amount of source code in this project. Could it be cleaned up? Yes, I'm sure it could. However, I have limited amounts of time and sometimes I have to take functionality over aesthetics.
The key thing is you get source. That means you can rebuild it. The second key thing is you get a plug-in, so you can use this as a 'tool' without having to worry about the source at all.
After this shaky introduction I suppose you are wondering what the heck does it do?
What is the CreateDynamics Toolkit? CreateDynamics is an open source library that automatically generates dynamics data from static or deformed skeletal meshes. It can be used as a DLL plug-in or the source can be linked directly into your own application.
What formats does it accept? For deformed skeletal meshes CreateDynamics can read the Unreal PSK file format or Granny 2 files generated from the Rad Game Tools exporter. You must be a licensee of Granny to have access to the exporter and sources.
For static mesh data it accepts Unreal PSK, Granny 2, and Wavefront OBJ files. You can also submit your own raw static data directly through the API. There is not yet a public interface to submit raw skeletal deformed meshes. However, if this is a feature people would like to have it can be added. (You must be a Granny licensee to build the source with Granny support.)
What kind of dynamics data does it generate? CreateDynamics can interpret a deformed skeletal mesh and infer a constrained ‘rag doll’ model from it. It can convert the input geometry into a format suitable for cloth simulation. Finally, it can perform approximate convex decomposition to produce efficient collision models for mesh data. Collision fitting supports convex hulls, boxes, spheres, and capsules.
Future versions will provide improved support for constrained systems and cloth modeling.
What data formats does it produce? CreateDynamics generates output data in PSCL, COLLADA and NxUstream formats. PSCL stands for the ‘physics scripting language’ which is used by the PhysX Rocket application. It is easily human readable and generally useful for debugging. No source code library is provided to read PSCL for a game engine. If there is a strong need for such a tool it might be made available.
The format promoted by Ageia is ‘NxUStream’ which is a reflective object model of the PhysX SDK stored in either XML or binary form. A complete XML schema is provided. The CreateDynamics toolkit exports data in XML form and can then be converted into binary for your target platform by running the tool NxuConvert. The file name extension adopted for PSCL is ‘.PSC’. NxUStream uses ‘.XML’ for XML and ‘.NXB’ for the binary version. COLLADA files have the extension of ‘.DAE’.
Can I generate my own file format? Yes. There is a single source file in the CreateDynamics library which writes the output data to disk. It is a relatively simple and straightforward task to modify this source to save the data out in any format you see fit. The source file is called ‘Accumulate.cpp’ and is located in ‘\CreateDynamics\AutoPhysX’.
Does CreateDynamics output COLLADA physics? The CreateDynamics toolkit now has basic support for COLLADA physics import and export. Use the import and export options under the file menu to load and save a COLLADA .dae file. This can be imported in other tools using COLLADA-DOM, FCollada or your custom parser. COLLADA physics content can be created using various tools like Maya, Max, XSI and Blender 2.42.
What features will future versions of CreateDynamics support? Future versions of the CreateDynamics toolkit might provide support for pre-fractured assets and automatic generation of deformed skeletal meshes for soft-body simulations. Since each of these features must operate on both the graphics data as well as the physics data they present significant architectural design challenges
While it is relatively simple to produce a ‘fractured object’ representation by taking advantage of the aggregate convex decomposition library, it is much more difficult to produce the graphics representation of the object at the appropriate split boundaries. Automatically generating a deformed skeletal mesh is a more straightforward project; but selecting a format for the graphics representation is an open question.
Better support for cloth conversion as well as improved user interfaces and API would be likely feature improvements as well.
Does CreateDynamics work with 3D Studio Max or Maya? Not currently. While it is certainly a long term goal to integrate the features of CreateDynamics into these production tools it is not ready for that yet. We feel it is better to make a version of the tool available to developers for early feedback and give them the opportunity to integrate it into their own tools pipeline. By providing it in open source form, as well as a DLL plug-in, we hope to engage the development community in the evolution of this project.
How can I use CreateDynamics as a stand-alone production tool? CreateDynamics has been integrated into a stripped down version of PhysX Rocket. It provides a graphics front end that allows you to easily experiment with the features of the tool. CreateDynamics can also be used as a console application from the command line. One of the most exciting opportunities provided by the CreateDynamics library is the ability to batch convert a large number of game assets based on a set of scripted rules.
How do I convert my own assets with PhysX Viewer? Simply drop a PSK, GR2, or Wavefront OBJ file into the directory ‘\PhysXViewer\data\mesh’ and it will show up in the menus.
Where do I find my output? After converting an input graphics mesh into a dynamics asset the DLL will produce two output files; one in PSCL and one in XML. Rocket runs the PSCL version by default since it can bind with the source graphics. To run the NxUstream file directly select the checkbox ‘use nxustream’. If you do this you will only see the dynamics assets.
If you were to convert a file called ‘test.obj’ you would get as outputs
‘\CreateDynamics\data\pscl\test.psc’
‘\CreateDynamics\data\pscl\test.xml’
‘\CreateDynamics\data\pscl\test.dae'
How do I adjust the dynamics settings for CreateDynamics? CreateDynamics is a ‘rules’ based system. The library reads an ASCII text file that defines the physics properties to be applied when converting a data asset. When using the PhysX Rocket tool this file is generated based on the current settings of the graphics user interface; using checkboxes, sliders, and combo boxes. Future releases of CreateDynamics will provide an improved front end. Additionally, you can design your own user interface relative to your own tools chain. The main point is that, regardless of the front-end user interface, CreateDynamics decides how to apply conversion rules based on a data driven script system.
The ‘rules’ system accepts wild-card strings to apply dynamics properties to a specific bone or set of bones in a deformed skeletal mesh.
What is the status of CreateDynamics? CreateDynamics is currently in an ‘alpha’ release state. It is being provided to developers because feedback is needed to help steer the project going forward. Is this a useful tool? What are the most important features? What changes would you like to see to the API? What do you believe are the most important features for future development? Currently the approximate convex decomposition seems to perform very well. While it does run slowly, still it produces very high quality collision models. The rag doll generation shows great promise since it can generate a first approximation dynamics model in seconds, however, a great deal more work is needed to tweak rag doll models and fix all cases where it might fail. Sample data is provided so that you can experiment with the tools for yourself. All sample data is courtesy of Simutronics Corporation. This sample data is still under their copyright and may only be used for testing inside this tool.
Does CreateDynamics support binding to graphics data? No. CreateDynamics only represents the physics model. You will need to retain a semantic binding between your graphics representation and the physics model on your own. The ‘name’ field of the mesh and all of the constrained bodies is retained and allows you to perform late binding between the NxActor and your skeletal mesh. For users of the Granny library from Rad Game Tools we have developed a run-time library that will synchronize a Granny Model to an NxUStream physics collection on the fly. A sample application that shows how to convert a Granny Model into a rag doll or blended animation is available from Rad Game Tools.
Is CreateDynamics a multi-platform library? No. Since most tools for game development run on the Windows platform CreateDynamics is provided in that form. While, theoretically, there is no reason the source could not be recompiled and targeted to other platforms it has only been developed and tested on Windows to date.
What comes with this download?(The CreateDynamics toolkit.)In my next post I will include a 'viewer' application with a nice GUI front end for CreateDynamics. However, this posting is designed to show how to use it as a developer. The build directory layout looks like this.
AutoPhysX : Contains the library that converts mesh data to physics data based on rules.
CreateDynamics: Contains the solution file and source to produce the DLL plug-in.
ConvexDecomposition: Contains the approximate convex decomposition library.
granny: If you are a Granny licensee this is where you would place 'granny.h' and 'granny2.lib'
grimp: Contains source to load Granny files (only available to Granny licensees)
PhysXRagdoll : Contains a console app that demonstrates how to use the plug-in.
psk: Contains source to load a PSK skeletal deformed mesh.
snippets: Contains source to generally useful utilities.
The demo application directory PhysXRagdoll contains:
beshon.bin : A sample skeletal deformed mesh in Rocket .BIN format.
character.bin : A sample skeletal deformed mesh in Rocket .BIN format.
character.rul : Custom rules to be applied to the 'character.bin' skeleton.
CreateDynamics.dll : The release build of the CreateDynamics plug-in.
CreateDynamics.txt : Debug log output.
CreateDynamicsDEBUG.dll : The debug build of the CreateDynamics plug-in.
deer_bound.bin : A sample skeletal deformed mesh in Rocket .BIN format.
homer.psk : A sample skeletal deformed mesh in PSK format.
hornbug.bin : A sample skeletal deformed mesh in Rocket .BIN format.
ob_chair_gothic.obj : A chair model in Wavefront OBJ format.
ob_chair_wood.obj: A chair model in Wavefront OBJ format.
ob_chess_table.obj: A chess table in Wavefront OBJ format.
ob_nice_table.boj: A table in Wavefront OBJ format.
ob_work_table.obj: A table in Wavefront OBJ format.
physxragdoll.cpp : Source to the console appliation demonstrating usage.
PhysXRagdoll.exe : The console appilcation. Example: "PhysXRagdoll character.bin"
PhysXRagdoll.sln : The .NET 2003 solution file to the console application.
PhysXRagdoll.vcrpoj : The .NET 2003 project file.
rules.rul : The default rules.
wavefront.cpp : A utility to load a Wavefront OBJ file.
wavefront.h : Header file for the Wavefront OBJ file reader.