When exporting a model from 3ds Max as FBX to import it into XNA, what metrics should I choose to make 1 unit in 3ds Max equal to 1 unit in XNA?

For example: I have a sphere model with 1m radius exported to XNA. When drawing I use:

Matrix[] transforms = new Matrix[model.Bones.Count];
foreach (ModelMesh mesh in model.Meshes)
    foreach (BasicEffect be in mesh.Effects)
        be.World = mesh.ParentBone.Transform * Matrix.CreateScale(radius)
                    * TransformMatrix;
        be.View = camera.view;
        be.Projection = camera.projection;

Radius is defined in my class as float.

This will draw a ball smaller than 1.


There isn't really a one-size-fits-all solution for this. You can make 1 unit in XNA equal to 1 metre, or 1 kilometre if you'd like. What I'd recommend is you find a transform and stick with it. Start with exporting a 1m sphere into XNA, adjust the scale and/or camera until it looks right, then base everything off that scale.

  • \$\begingroup\$ but this way is not accurate ? is there any default size ? \$\endgroup\$ – MhdSyrwan Jan 13 '12 at 0:52
  • 1
    \$\begingroup\$ Modeling units have nothing to do with real world quantities like meters, yards or pixels. At the beginning of every real world project a convention is chosen, let's say that 1 "unit" is equivalent to 1 "centimeter." Everyone works with that decision in mind from that point forwards. There is no default "size" because size makes no sense except in this convention chosen at the beginning of the project. <edit> To clarify, this convention is made simply so people can talk about models in people-friendly terms, no other reason. \$\endgroup\$ – Patrick Hughes Jan 13 '12 at 1:23
  • 3
    \$\begingroup\$ Size is relative thus the only two things you need worry about is that: 1) all the models are correctly sized relative to each other and... 2) that the camera setup is proportioned correctly relative to the size of the models to give the look you're after. Unless you're projecting to a specific display in an attempt to display in real world sizes, accuracy is what you make it. \$\endgroup\$ – lzcd Jan 13 '12 at 1:25
  • 1
    \$\begingroup\$ Unless you're playing tricks with your models the scale will always be 1.0. \$\endgroup\$ – Patrick Hughes Jan 13 '12 at 5:04
  • 1
    \$\begingroup\$ I wouldn't expect them to; there really isn't any correlation between 3ds units and XNA units. \$\endgroup\$ – DMan Jan 13 '12 at 15:42

Not withstanding what Dman is conveying, since you are not following through fully with your matrix[] transforms, there may (or may not) be scaling information inside them that you are not taking into account when setting your be.World.

Use transforms[mesh.parentBone.index] instead of mesh.parentBone.Transform

  • \$\begingroup\$ they are the same ! what is the difference ? \$\endgroup\$ – MhdSyrwan Jan 13 '12 at 14:31
  • 2
    \$\begingroup\$ Possibly in your case, but not always. transforms[mesh.pb.i] will take into account all transforms above it in the hierarchy scheme. mesh.pb.t is the local transform only and isn't affected by upper level transforms. But if there is no bone hierarchy, then yes, they are the same which is the reason I added: "may (or may not)". So when you call the method CopyAbsoluteTransformsTo, it takes each m.pb.t and multiplies it to all transforms above it in the hierarchy chain and returns the result. If there were scaling info in the bone transforms above the m.pb.t, you would have missed it. \$\endgroup\$ – Steve H Jan 13 '12 at 14:51
  • \$\begingroup\$ You only have a sphere, and there isn't really a hierarchy of bones in a sphere alone. \$\endgroup\$ – DMan Jan 13 '12 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.