Auto center model
Moderator: Moderators
Auto center model
Hej,
The pivot / center of imported objects seems to be set to the center of the mesh automatically regardless of the "Auto center model" setting when importing 3ds files. Potential bug?
Regards,
Kjell
The pivot / center of imported objects seems to be set to the center of the mesh automatically regardless of the "Auto center model" setting when importing 3ds files. Potential bug?
Regards,
Kjell
Strange. That shouldn't happen.
Can you please upload or email a model which illustrates this problem? Are you sure it is exported correctly? As mentioned elsewhere the easiest way to test your model is correct is by importing it back into the program you exported it from.
By the way Kjell, are you Swedish?
Can you please upload or email a model which illustrates this problem? Are you sure it is exported correctly? As mentioned elsewhere the easiest way to test your model is correct is by importing it back into the program you exported it from.
By the way Kjell, are you Swedish?

Hej VilleK,
No I'm not Swedish .. I did however used to live in Göteborg
Anyway .. I've attached a .3ds containing a 1x1x1 box with it's pivot at 0,0,0 and it's cog at 5,0,0. The easiest way to visualize the problem is to set the model's RotationVelocity.Z. And yes, it does import back into my 3d modelling application correctly.
Regards,
Kjell
No I'm not Swedish .. I did however used to live in Göteborg

Anyway .. I've attached a .3ds containing a 1x1x1 box with it's pivot at 0,0,0 and it's cog at 5,0,0. The easiest way to visualize the problem is to set the model's RotationVelocity.Z. And yes, it does import back into my 3d modelling application correctly.
Regards,
Kjell
- Attachments
-
- box.zip
- (395 Bytes) Downloaded 574 times
In the attached file I've imported your file twice. First with autocenter off and then with autocenter on. Then set rotationvelocity and spawn them next to each other.
They definitely have different pivot-point, although it appears that it is not 0,0 for the autocenter off version. Please explain what you mean with "cog at 5,0,0". Perhaps you can post a pic on how it looks inside your modeling-program complete with axis displayed?
I just remembered that I noticed earlier that when importing models exported from Maya that it works better not to use the "pivot" setting, instead just move the model away from world origo and then export it. Perhaps you can try this also.
Aha not swedish, then. "Kjell" sounds very swedish
They definitely have different pivot-point, although it appears that it is not 0,0 for the autocenter off version. Please explain what you mean with "cog at 5,0,0". Perhaps you can post a pic on how it looks inside your modeling-program complete with axis displayed?
I just remembered that I noticed earlier that when importing models exported from Maya that it works better not to use the "pivot" setting, instead just move the model away from world origo and then export it. Perhaps you can try this also.
Aha not swedish, then. "Kjell" sounds very swedish

- Attachments
-
- boxtest.zip
- (47.49 KiB) Downloaded 553 times
Hej,
COG stands for "Center of Gravity". I presumed you actually used that approach for calculating the center of a model automatically ( average x,y,z value of all vertices ).
I did notice the difference with the "Auto center model" setting turned off as well. Then the COG ends up at 0,0.5,0. But I have no idea why or how it ends up that way.
This is what the file looks like ( and should look like ) when imported in XSI .. I also tried importing the file into 3DS to verify that there was nothing wrong with the data, and it appeared exactly the same.
Regards,
Kjell
COG stands for "Center of Gravity". I presumed you actually used that approach for calculating the center of a model automatically ( average x,y,z value of all vertices ).
I did notice the difference with the "Auto center model" setting turned off as well. Then the COG ends up at 0,0.5,0. But I have no idea why or how it ends up that way.
This is what the file looks like ( and should look like ) when imported in XSI .. I also tried importing the file into 3DS to verify that there was nothing wrong with the data, and it appeared exactly the same.
Regards,
Kjell
- Attachments
-
- box.jpg (57.15 KiB) Viewed 17763 times
I found the part in 3ds-file where pivot is stored. It seems it is attached to keyframe-data instead of one single pivot for the whole file.
Please test attached version of ZDesigner.exe.
Please test attached version of ZDesigner.exe.
- Attachments
-
- ZDesigner_test_pivot.zip
- (632.42 KiB) Downloaded 574 times
Hej VilleK,
Almost, but not quite. The pivot is being taken in consideration now .. which is good, although it seems to be inverted, but there is something else going on that shouldn't happen. This is going to be tricky to explain ...
The behavior you mentioned when trying to export from Maya, is actually causing things to malfunction. For example if you'd have a 1,1,1 sized box with it's position/pivot and COG at 5,0,0, it actually gets imported in ZGE ( "Auto center model" turned off ) with COG 5,0.5,0 while you would expect COG 0,0,0. Where that 0.5 comes from, still beats me.
In the new build you attached, when you'd have a 1,1,1 box with it's pivot at 5,0,0 and it's COG at 10,0,0, after importing with "Auto center model" turned off, the box ends up with a COG of 0,1.5,0 this time ( should have been 15,1.5,0 though, hence the inverted comment .. or 15,0,0 without the bug ). Which is not what one would want.
Perhaps this will be easier to tackle over ICQ / MSN?
Regards,
Kjell
1st Edit: Removed incorrect remark
Almost, but not quite. The pivot is being taken in consideration now .. which is good, although it seems to be inverted, but there is something else going on that shouldn't happen. This is going to be tricky to explain ...
The behavior you mentioned when trying to export from Maya, is actually causing things to malfunction. For example if you'd have a 1,1,1 sized box with it's position/pivot and COG at 5,0,0, it actually gets imported in ZGE ( "Auto center model" turned off ) with COG 5,0.5,0 while you would expect COG 0,0,0. Where that 0.5 comes from, still beats me.
In the new build you attached, when you'd have a 1,1,1 box with it's pivot at 5,0,0 and it's COG at 10,0,0, after importing with "Auto center model" turned off, the box ends up with a COG of 0,1.5,0 this time ( should have been 15,1.5,0 though, hence the inverted comment .. or 15,0,0 without the bug ). Which is not what one would want.
Perhaps this will be easier to tackle over ICQ / MSN?
Regards,
Kjell
1st Edit: Removed incorrect remark
Last edited by Kjell on Wed Mar 05, 2008 1:43 pm, edited 1 time in total.
Can you please supply a 3ds-file like this (I do not have a modeling tool installed on this computer), together with a screenshot on how it should look from your modeling program so I can investigate further. Perhaps also a screenshot of the relevant settings (pivot etc) if it can be displayed easily in your tool.Kjell wrote:In the new build you attached, when you'd have a 1,1,1 box with it's pivot at 5,0,0 and it's COG at 10,0,0, after importing with "Auto center model" turned off, the box ends up with a COG of 0,1.5,0 this time ( should have been 15,1.5,0 though, hence the inverted comment .. or 15,0,0 without the bug ).
Thanks for helping, we will nail this bug

Now this is strange, your new box.3ds have pivot at 0,0,0 and the vertices are centered around 10,0,0.
I use a tool called "Opener" by Mike Lischke to inspect the 3ds-contents. I include it here if you want to try it. To use open a file then go to the "chunk structure" tab-page and click "full dump".
I use a tool called "Opener" by Mike Lischke to inspect the 3ds-contents. I include it here if you want to try it. To use open a file then go to the "chunk structure" tab-page and click "full dump".
- Attachments
-
- box_3ds_info.gif (4.57 KiB) Viewed 17703 times
-
- Opener.zip
- (460.45 KiB) Downloaded 579 times
Hi VilleK,
Sorry for the confusion, this difference is caused by resetting the XForm before exporting. Also I was incorrect about the pivot being animatable ... and while it seems like you can do this, it actually just offsets the Mesh Matrix and stores the movement in a position/rotation keyframe of the object itself. So the value I believe you should be after is the 4th vector of the Mesh_Matrix (4xFloat3), and remains 5,0,0 no matter if the XForm is reset or not.
Regards,
Kjell
Sorry for the confusion, this difference is caused by resetting the XForm before exporting. Also I was incorrect about the pivot being animatable ... and while it seems like you can do this, it actually just offsets the Mesh Matrix and stores the movement in a position/rotation keyframe of the object itself. So the value I believe you should be after is the 4th vector of the Mesh_Matrix (4xFloat3), and remains 5,0,0 no matter if the XForm is reset or not.
Regards,
Kjell
I've googled on "3ds 4160" and found some discussions on the problem. Looks like I'm not the only one finding this difficult.
It looks like the last vector of Mesh_Matrix holds "local origin" of the object. So I guess I should add this value to all the vertices to get the final position?
Remember that ZGE does not really support pivot-points (this could be a new feature though, a pivotpoint property on model), instead all vertices are moved. In the one of the ZGE sample projects for instance I use a MeshBox followed by a MeshExpression for adding a constant to all the vertices in effect moving the pivot point.
It looks like the last vector of Mesh_Matrix holds "local origin" of the object. So I guess I should add this value to all the vertices to get the final position?
Remember that ZGE does not really support pivot-points (this could be a new feature though, a pivotpoint property on model), instead all vertices are moved. In the one of the ZGE sample projects for instance I use a MeshBox followed by a MeshExpression for adding a constant to all the vertices in effect moving the pivot point.
Hej VilleK,
Well, first of all I would change the import behavior slightly, in that by default it creates a model component for each separate object in the .3ds file. So for the box example ( the one with the cyan colored text ) a model component would be created with a position of 5,0,0, and the corresponding mesh would have it's vertices around the relative/local CoG of 5,0,0. So you actually subtract the Mesh_Matrix[position] from the vertex values.
And I don't think being able to move the pivot point ( or moving the object's vertices in relation to it's center ) is a much needed feature as it's not supported by most applications and formats anyway.
Regards,
Kjell
Well, first of all I would change the import behavior slightly, in that by default it creates a model component for each separate object in the .3ds file. So for the box example ( the one with the cyan colored text ) a model component would be created with a position of 5,0,0, and the corresponding mesh would have it's vertices around the relative/local CoG of 5,0,0. So you actually subtract the Mesh_Matrix[position] from the vertex values.
And I don't think being able to move the pivot point ( or moving the object's vertices in relation to it's center ) is a much needed feature as it's not supported by most applications and formats anyway.
Regards,
Kjell