Performance Problem

Performance Problem

Hi: I'm working on a destruction system. In my test I create a teapot,and split it into 15 pieces of fragments in the 3dsmax.And for each piece,I create a convex hull and convert them into Havok Mopp format shape.And on these shapes I create 15 rigid bodies and add them to the simulation world. At the beginning period(about 0.5~1 second) of the simulation,the performance is quite low.Each step(50ms) cost about 500ms.And after the pieces scatter around,the step cost reduce to about 1 ms.I know at the beginning period,all the pieces are so close to each other and there must be a lot of penetration.This definately will cost more calculation time.But is it really normal to cost aboult 500ms? There are only 15 rigid bodies ,each with about 20~30 triangles. It seems something must be wrong.Can someone help me to analysis this situation? The attachment is a hkm file recording the whole simulation.

AllegatoDimensione
Download teapot.rar5.5 MB
4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

ixnehc-This simple simulation should not run this slowly. Something is wrong.If you examine the movie you sent, you will see lots of contact points and lots of rigid body interpenetration. There are even contact points (the blue arrows) that don't seem to be coming from any other object in particular. I will suggest a number of things. In addition, you can take a snapshot of the world while you are simulating it through the VDB at Viewers > Grab World Snapshot (Binary Tagfile). You can post that and I will be able to check your world settings.Recommendations:m_collisionTolerancehkpWorldCinfo (the struct passed when you construct a world) has a field called m_collisionTolerance. For what you are doing it should probably be the default value of 0.1. The behavior you are seeing (lots of contact points) can be explained by too large a m_collisionTolerance. This value means objects that are physically quite far apart will think they are interacting, which creates extra work.Transform SceneWhen you are exporting shapes from 3DSMax, make sure you have the right "Transform Scene" filter on. 3dsmax works in inches, but Havok expects meters, so it's standard to include this transform. Read about it in the Docs at:Havok Content Tools >3ds Max Tools > Tutorial: Export and Animation BasicsI'm not sure this is affecting you, but thought I would mention it in case you haven't read through that yet.hkpEasePenetrationActionhkpEasePenetrationAction is used to damp collisions when bodies are added in a penetrating state. You may wish to add this to your simulation to suppress the violence of there separation when they are first added to the simulation. You can see how it is used here:Demos\Physics\Api\Dynamics\RigidBodies\InitialPenetration\InitialPenetrationDemo.cppCollision FiltersHavok provides collision filters to turn off collision between adjacent bodies. This may be something you want to do at first. The bodies will just pass through one another. I suggest you look at:\Demos\Physics\Api\Collide\CollisionFiltering\CollisionFilter\CollisionFilterDemo.cppWhat type of simulation are you using, discrete or continuous? If you are using a continuous simulation you probably want the body types to be DEBRIS_SIMPLE_TOI. This will reduce some of the work required for each piece. You can read about it in the All Products Manual:Havok Physics > Articles > Continuous Physics > 2.3.2 Object Quality Types-Josh

Josh
Developer Support Engineer
Havok
www.havok.com

Hi Josh: Thank you for so detailed explanation. The collision tolerance value is fine.I am using the default value,so it's already 0.1. I'm using my own tool to export the meshes from the max,so it's not a problem. I tried thehkpEasePenetrationAction you mention,but it does not help,no improvment.The contact points remains huge in number. I think the fragment NEED to collide with each other,especially its adjacent body.If i disable the collision,the destruction effect may be weird. TheDEBRIS_SIMPLE_TOI flag makes no difference. I re-check the tiangles of the rigid bodies,and find the number is more than I estimate before. The triangle number of each rigid body actually ranges from 50 to 150. Is it too many? Attachment is a snapshotI grab.

Allegati: 

AllegatoDimensione
Download VDBSnapshotTagfile_teapot.hkx209 byte

Hey ixnehc-I was unable to load the snapshot. Did you use "Viewers > Grab World Snapshot (Binary Tagfile)"? You can also take the snapshot from code as demonstrated in:physics\api\dynamics\world\worldsnapshotAfter you take the snapshot, confirm that you can load it correctly by either modifying that demo or by writing your own application.It is possible (and perhaps likely) that your exporter is setting properties for rigid bodies incorrectly. I will try looking at a snapshot but I would recommend you use the Havok Content Tools to export your rigid bodies.-Josh

Josh
Developer Support Engineer
Havok
www.havok.com

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi