Silgrad Tower from the Ashes

Full Version: The Great Battle of Collision Shapes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Once upon a time there were two races of collision shapes living in the land of Nif. The TriStripsShapes, huge, twenty feet tall creatures. They could survive almost anywhere without problems, but unfortunately their brain had the size of a peanut.

Then there were the Primitives, a race of intelligent, but tiny people. A single Primitive couldn't do much, but they were a social race and often came in large numbers.

These two races fought each other for a long time. Sometimes the TriStripsShapes would win when even a large number of Primitves couldn't overcome them. Other times the Primitves would claim victory when they found a single and weak TriStripsShape that was easy to defeat.

But none of the two races did any good to Nif. The TriStripsShapes used up more resources than they needed in their mindless idiocy, leaving a barren wasteland behind them. The Primitves were intelligent, but they were simply too small to make up for the damage the TriStripsShapes did.

But the gods were gracious. Tazpn, the mighty ruler of heaven, decided to create another race. They were of average size and were nearly as intelligent as the Primitves. He called them MOPPs.

Now the three races are fighting for domination. Who will perish, who will prevail? Will the land of Nif finally find its peace? This is the story of the great battle of collision shapes...


Hmmm...yeah. The reason for this thread is not that I want to tell you a story, it's about the performance tests I did using the different collision shapes available now. I simply wanted to know the exact performance differences between the different shapes.


The Setup

I've made two tests. I call them 'The Basic Test' and 'The Simple Test'. For all of the tests I used very simple placeholder meshes and skeletons without bodies (floating skulls) as creatures to make sure the rendering/animating of meshes doesn't influence the performance result. I created three different types of collision for each test and ran a performance test independantly by only using one type at a time. I've made collision built from primitives, MOPP shape collision and PackedTriStripsShape collision as comparison. I placed hundreds of those meshes and 21 creatures that walk around constantly in a test cell to get the result.

I loaded the cell, saved and ran the same way of about 5000 game units while running FRAPS for a benchmark with the different collision shapes. I ran each test twice and compared the results to make sure there was no weird coincidence messing with the results. But they all were about the same with +/- 2% difference only.


The Basic Test

This one uses a mesh similar to the Dwemer 2way from my tileset, so it has average detail (I replaced the mesh itself with a simple box afterwards for testing, see above). The primitive collision is made up of 12 box shapes and 2 capsule shapes. The mesh based collision has 48 triangles, covering the same areas as the primitives to the same degree.

MOPP

Avg: 120.561 - Min: 76 - Max: 170

Primitives

Avg: 79.911 - Min: 57 - Max: 106

PackedTriStripsShape

Avg: 61.293 - Min: 48 - Max: 74

The MOPP shape wins this one clearly. I was surprised how bad the PackedTriStripsShape really is. Don't even want to know how bad the non-packed TriStripsShape is.


The Simple Test

Most of the times you will have many redundant sides when using Primitves (like in the first test, where boxshapes were often used as one-sided planes), but some meshes have a nearly perfectly clean shape that uses most of the primitives without any redundant sides. In this test I used a mesh that is more appropriate for primitve collision. It uses a cube mesh with four quadratic pillars coming out of it. The primitve collision uses five boxshapes with only 5 sides of the total amount of 30 sides redundant, the MOPP and PackedStrips use 50 triangles.

MOPP

Avg: 118.509 - Min: 75 - Max: 170

Primitives

Avg: 104.219 - Min: 69 - Max: 145

PackedTriStripsShape

Avg: 60.868 - Min: 46 - Max: 75

To my surprise the MOPP won this one as well quite clearly. Just like before the PackedStrips had ~50% of the MOPP performance only.

I didn't make a test with a single box primitve compared to a 12 triangle MOPP/TriStrips shape. I think it's safe to assume the performance difference doesn't matter much, you can use one or the other. For mobile objects you should always use primitives or convexshapes I guess, that's at least what Beth did and there has to be a reason. Probably mesh based collision and animation doesn't work well.

...so the war came to an end. The TriStripsShapes vanished from the land of Nif and were never seen again. Only few Primitves were left, a shadow of what they used to be. A new age had begun, the glorious age of MOPP.

EDIT: Just did a test after converting the first real tile (Dwemer 2way) collision from my old PackedStrips/Boxshape combo to MOPP. Put 240 tiles in a cell with 10 creatures and ran the same route twice, just like I did with the other tests.

Old collision

Avg: 77.506 - Min: 71 - Max: 93

New MOPP collision

Avg: 136.919 - Min: 118 - Max: 194

Wohooo! You can expect a huge performance increase for my tileset once I'm done with updating all the tiles.
Thanks for the info, it's handy to know the performance differences between the collision types.

Did Bethsofts use packed/non packed triStripShapes? From your tests it would seem there is little reason to do so. I can't help but think they must be there for a reason, though.
I found your tale amusing, Phitt. All hail tazpn! :worship:

The tests were very informative and enlightning. I didn't know mopp shapes were that good, but I'm sold on them now. Only problem with them I've noticed so far is that they often get exported misaligned from the visual model, and the only trick I know of to counter it as of yet is to manually move the collision in Nifskope.

Quote:Originally posted by Phitt
For mobile objects you should always use primitives or convexshapes I guess, that's at least what Beth did and there has to be a reason.

Most of the time, but I'm quite sure I've seen physiqued Bethesda models using mopp shapes.

Quote:Originally posted by nick_op
Did Bethsofts use packed/non packed triStripShapes? From your tests it would seem there is little reason to do so. I can't help but think they must be there for a reason, though.

I've never seen them do that though. Maybe another game uses them and that's why the nif format can support them? Just a guess on my part.
Quote:Originally posted by Razorwing
I found your tale amusing, Phitt. All hail tazpn! :worship:

The tests were very informative and enlightning. I didn't know mopp shapes were that good, but I'm sold on them now. Only problem with them I've noticed so far is that they often get exported misaligned from the visual model, and the only trick I know of to counter it as of yet is to manually move the collision in Nifskope.

Quote:Originally posted by Phitt
For mobile objects you should always use primitives or convexshapes I guess, that's at least what Beth did and there has to be a reason.

Most of the time, but I'm quite sure I've seen physiqued Bethesda models using mopp shapes.

Quote:Originally posted by nick_op
Did Bethsofts use packed/non packed triStripShapes? From your tests it would seem there is little reason to do so. I can't help but think they must be there for a reason, though.

I've never seen them do that though. Maybe another game uses them and that's why the nif format can support them? Just a guess on my part.

The trick to the collision shapes seems to be to collapse and reset the x-form on your simple shape once you move the pivot to the same location as the object's pivot. At least, thats how I have done it.
Quote:Originally posted by ShadowDancer
The trick to the collision shapes seems to be to collapse and reset the x-form on your simple shape once you move the pivot to the same location as the object's pivot. At least, thats how I have done it.

Hmm... that's interesting. So I should:
1) Reset the Xform of the collision mesh(es)
2) Center the visual model's pivot point
3) Set the pivot point(s) of the collision mesh(es) to the visual model's pivot point
Quote:Originally posted by nick_op
Thanks for the info, it's handy to know the performance differences between the collision types.

Did Bethsofts use packed/non packed triStripShapes? From your tests it would seem there is little reason to do so. I can't help but think they must be there for a reason, though.

The reason I tested with PackedStrips is that we (the poor modders) didn't have the possibility to use MOPP collision until some weeks ago when Tazpn figured out how to export it by looking into the open source havok SDK that was released shortly before. So we had to use PackedStrips for mesh based collision (and a year ago we even had to use non-packed strips). Bethesda used MOPP on all their meshes but one (an Ayleid statue that uses a non-packed TriStripsShape, that's at least the only one I've seen). Guess it's a leftover from the beginning of the development when MOPP wasn't available. Although Morrowind used a different collision setup I think the collision is comparable to non-packed TriStripsShapes. That's why the collision in Morrowind isn't very detailed and the performance isn't that good anyway. Without havok, ragdolls etc detailed colllision isn't that important, but I guess Bethesda just couldn't do it that way again with the new features.

Quote:Originally posted by Razorwing
Hmm... that's interesting. So I should:
1) Reset the Xform of the collision mesh(es)
2) Center the visual model's pivot point
3) Set the pivot point(s) of the collision mesh(es) to the visual model's pivot point

Yes, but first put the pivot at xyz 0 coordinates for both the collision and the visual model (you can of course set it to something else if both meshes have the same coordinates, but there is no reason not to have it at 0 - you don't have any transforms on the meshes then and can use a RigidBody instead of a RigidBodyT, which might help performance a tiny bit), then reset x-form on both of them. That way everything will be exported correctly. You can also see if you have any flipped normals then. I sometimes have this problem when I mirror a mesh.
Quote:Originally posted by Phitt
Quote:Originally posted by nick_op
Thanks for the info, it's handy to know the performance differences between the collision types.

Did Bethsofts use packed/non packed triStripShapes? From your tests it would seem there is little reason to do so. I can't help but think they must be there for a reason, though.

The reason I tested with PackedStrips is that we (the poor modders) didn't have the possibility to use MOPP collision until some weeks ago when Tazpn figured out how to export it by looking into the open source havok SDK that was released shortly before. So we had to use PackedStrips for mesh based collision (and a year ago we even had to use non-packed strips). Bethesda used MOPP on all their meshes but one (an Ayleid statue that uses a non-packed TriStripsShape, that's at least the only one I've seen). Guess it's a leftover from the beginning of the development when MOPP wasn't available. Although Morrowind used a different collision setup I think the collision is comparable to non-packed TriStripsShapes. That's why the collision in Morrowind isn't very detailed and the performance isn't that good anyway. Without havok, ragdolls etc detailed colllision isn't that important, but I guess Bethesda just couldn't do it that way again with the new features.

And you would fall through the collision in quite a few places in Morrowind as well. I don't know how many times I have fallen though the collision in the Mage's Guild in Balmora and its not just in one spot in the cell either, there are multiple places where it can happen although the prevalent one is at the bottom of the stairs.

The Ayleid statue is one of those odd things. Its sort of like Bethesda left little hints for doing stuff along the way. Its the same with the Troll loading screen. It allows modders to come along and reproduce things without working from scratch.

Quote:
Quote:Originally posted by Razorwing
Hmm... that's interesting. So I should:
1) Reset the Xform of the collision mesh(es)
2) Center the visual model's pivot point
3) Set the pivot point(s) of the collision mesh(es) to the visual model's pivot point

Yes, but first put the pivot at xyz 0 coordinates for both the collision and the visual model (you can of course set it to something else if both meshes have the same coordinates, but there is no reason not to have it at 0 - you don't have any transforms on the meshes then and can use a RigidBody instead of a RigidBodyT, which might help performance a tiny bit), then reset x-form on both of them. That way everything will be exported correctly. You can also see if you have any flipped normals then. I sometimes have this problem when I mirror a mesh.

Yes, move the pivot first and then reset the x-form. Another thing to note about the 0,0,0 point is that it is the location of the hand on items that can be held (like a torch).
Quote:Originally posted by ShadowDancer
Its the same with the Troll loading screen. It allows modders to come along and reproduce things without working from scratch.

Please tell me more! I'm absolutely fascinated! What is so special about the troll loading screen?
Quote:Originally posted by Deeza
Quote:Originally posted by ShadowDancer
Its the same with the Troll loading screen. It allows modders to come along and reproduce things without working from scratch.

Please tell me more! I'm absolutely fascinated! What is so special about the troll loading screen?

Loading Screens are the screens that pop up when Oblivion is loading new cells. The Troll loading screen is just that, a loading screen with a picture of a troll. But it was "uncompiled" for lack of a better term and the Boxes and blank spots were left in it. Modders came along, found the items, and used them to make new loading screens that look pretty close to the originals. You can find a tutorial on it here.
I see. Very interesting. So what was the deal with the Ayleid statue? Was that how they found out how to make custom statues?
Pages: 1 2 3