createCloth crash

dronbas

23-12-2010 17:00:55

Hi!
I have PhysX SDK 2.8.1., Detritus and Critter. Almost all nxogretutorials work well, including those that simulate cloth (flags). But 1004 tutorial (Pipes) crashes.
In my simple application I wrote the code:
NxOgre::ClothDescription clDescr;
clDescr.mMesh = MeshManager::getSingleton()->load("ogre://balloon.xcl");
clDescr.mDensity = 0.15f;
clDescr.mThickness = 0.2f;
clDescr.mFriction = 0.25f;

clDescr.mFlags |= NxOgre::Enums::ClothFlags_Pressure;
clDescr.mPressure = 1.0f;
clDescr.mGlobalPose.set(NxOgre::Vec3(10, 5, 0));

NxOgre::Cloth* cloth = mRenderSystem->createCloth(clDescr);

In createCloth the follwing line gives a crash when calling GC::safe_new4<Cloth>
mScene->createCloth(description, renderable, NxOgre::Enums::Priority_MediumLow);

Unhandled exception at 0x06fa89c7 (PhysXCore.dll) in VHSample.exe: 0xC0000005: Access violation reading location 0xfe78173c.
What can be wrong?

betajaen

23-12-2010 17:22:26

That demo doesn't work. I think it's due to the mesh being properly made. I'll get around to fixing it properly. But pressurised cloth DOES work, I've been using it recently.

dronbas

23-12-2010 17:28:43

Ok. It crashes with balloon.xcl. When I use my own cloth it is rendered like all triangles of the mesh are separated and move up and down chaotically. I've created the cloth file with this code using Critter
NxOgre::Enums::MeshType eMeshType = NxOgre::Enums::MeshType_Cloth;
Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(meshFile + ".mesh", "Media");
MeshData *NxMeshData = Critter::MeshFunctions::read(mesh);
NxMeshData->mType = eMeshType;
NxMeshData->cook("file://" + meshFile + ".xcl");
delete NxMeshData;

Is it the right way?

betajaen

23-12-2010 17:33:40

PhysX requires a specific set up of meshes to use with Cloth, I've learned this the hard way. Basically there cannot be any duplicate vertices ever, otherwise it falls apart like you've seen.

The Ogre mesh blender exporter exports it incorrectly, but my Flower Blender exporter works perfectly. If you can get your original mesh into Blender, then use my Flower exporter, then convert into Flour. It should work then.

dronbas

23-12-2010 17:35:26

Thank you for the hint!I'll try.

dronbas

24-12-2010 09:47:02

It seems that to make it work I should say prayers.
I've created a cylinder in 3dsmax, exported it into blender, then exported it into flower (flower mesh), and converted it using flour into xm file. Then I create a pressured cloth using this xm file. Again when rendering starts the cyninder is moving weirdly and doesn't looks like a cylinder. What can be wrong this time?

betajaen

24-12-2010 10:03:03

You have enabled the pressure flags, set the pressure to 1.0 and there are no holes in the mesh?

dronbas

24-12-2010 10:07:37

Yes. I've tried 2 ways:
1. create a cylinder in 3dsmax and export it into blender via 3ds format. And then create xm file.
2. create a cylinder in blender, ...
The second way worked. So the problem is to transfer my model into blender from 3dsmax.

betajaen

24-12-2010 10:45:17

There may be a way to merge duplicate vertices in Blender, perhaps an optimise function.

I suppose the best term long solution for all of us, is to have a flower exporter written for 3DSMax.