Game Development Community

Skinned DTS Sort Order Prediction

by Raxx · in Artist Corner · 01/18/2006 (12:28 pm) · 2 replies

Hello, it's me again, trying to find out how to predict the order the skinned meshes will be sorted in the final DTS file. After studying the source files for the max2dts exporter (or trying to anyways, I'm no programmer :P), the dump files, and test dts files I made, I came to a few conclusions, hopefully semi-correct.

First of all, the sort order is affected heavily by which bones they are assigned to. That is to say, it checks the bones for skinned objects assigned to it, starting from the root bone to the children bones. So from my guess, if root_bone had meshes 1 and 3, and child_bone had 2, 3, and 4, then when listing all the objects, it'll do 1 3 2 3 4 in that order.

I'm not too sure if this affects it, but I think the skins' order is swapped afterwards, supposedly so that it orders it correctly by detail size, where the first is swapped with the second, third with the fourth, or in some other manner that I don't understand.

Turns out that whether it's solid or transparent doesn't affect the final sort order at all.

Now, with this information, I decided that the best way to find out exactly how the bones affect the sort order was by assigning only one bone to a series of skinned meshes, and then determining the pattern in the end. The determined pattern could then be compared to combinations involving multiple bones, etc.

Having only one bone assigned to all the meshes meant that when it checked that bone, it would list all the meshes assigned to it without any additions from other bones.


Here's the results of my pattern-finding so far:

The top row is the order of the meshes in 3dsmax. The bottom row is the order of the meshes in the DTS output. The --Reversed/--Non-Reversed dividers indicate the most basic pattern finding attempt, which is meant to find which numbers would be swapped with each other when going from left to right, to get the order that showed up in the DTS output. Under each divider, is the arrangement of the top row, before being modified by the #<>#. #<># indicates what numbers are swapped, so for 6 5 4 3 2 1 6 6<>1, 6 gets swapped with 1, and the row under it reflects that change.

a b c d e f
a e d f b c

1 2 3 4 5 6 --Converted the above rows to numerical form
1 5 4 6 2 3
--Reversed
6 5 4 3 2 1 6<>1
1 5 4 3 2 6 3<>6
1 5 4 6 2 3
--Non-Reversed
1 2 3 4 5 6 2<>5
1 5 3 4 2 6 3<>4
1 5 4 3 2 6 3<>6
1 5 4 6 2 3

1 2 3 4 5
4 1 5 3 2
--Reversed
5 4 3 2 1 5<>4
4 5 3 2 1 5<>1
4 1 3 2 5 3<>5
4 1 5 2 3 2<>3
4 1 5 3 2
--Non-Reversed
1 2 3 4 5 1<>4
4 2 3 1 5 2<>1
4 1 3 2 5 3<>5
4 1 5 2 3 2<>3
4 1 5 3 2

1 2 3 4
3 4 1 2
--Reversed
4 3 2 1 4<>3
3 4 2 1 2<>1
3 4 1 2
--Non-Reversed
1 2 3 4 1<>3
3 2 1 4 2<>4
3 4 1 2

1 2 3
3 2 1
--Reversed
3 2 1
--Non-Reversed
1 2 3 1<>3
3 2 1

That I can tell, this turns up no patterns. Can you guys find one?

The next step for me would be to try different forms of swapping, or patterns that didn't involve swapping. So before I had to go so far, I decided to go ahead and post this up, on the chance that some of you figured it out or already know how to predict the sort order, or have a good clue.

Perhaps whichever GG employee(s) that wrote the max2dts exporter could share some information?

It isn't random, that I know of, I think it sorts the list 2 or 3 times in different ways before it finally gets exported.

#1
03/02/2006 (10:19 am)
Cant you just link the objects or groups up in the hiarchircy? Then you would allways know.

In lightwave you can just edit the parent child relationship of objects (dosn't have to be bones).

Mabye im confused about what you are doing.
#2
03/02/2006 (12:17 pm)
Look at the array order of the nodes in the objects() command in Maxscript, I think you will see a more logical understanding about how things are working after that.