Basically I'm trying to export a model in fbx format through the XNA content processor and I'm finding that the model itself is getting modified and being shifted slightly to the right and being scaled down a bit too. I am certain the FBX file being exported by 3D Studio Max is properly alligned at the center and of a larger scale.

If I export an FBX file with more than one mesh in it the exporter seems to work fine, so not sure what's up with that either...

*Just found that no matter what rotation/orientation I give a model XNAs content exporter seems to reset it to an identity matrix. i.e. I create a long box and give it an angle of 20degrees, XNA resets it to 0 degrees when I draw it...

THis is as it appears in 3D StudioMax: https://i.stack.imgur.com/e0oW4.png

This is how it appears in XNA: https://i.stack.imgur.com/1vOcx.png

Both are being viewed from the same angle and direction but varying distances.

Now what is really odd is if I create another mesh in max, say a box, and export that (along with the original model), it works fine: https://i.stack.imgur.com/SIDg9.png

So long as there is more than one mesh in the fbx model it draws fine, if there is less its orientation which I applied to it in 3D studio max is removed when I draw it.

Here's my code for drwaing the mesh:

foreach (ModelMesh mesh in model.Meshes) { 
    foreach (BasicEffect effect in mesh.Effects) { 
        effect.World = boneTransforms[mesh.ParentBone.Index];
        Vector3 cameraPosition = Camera.Get.Position; // new Vector3(0, 0, 0);     
        //cameraPosition.X = -Camera.Get.PosX; 
        //cameraPosition.Y = Camera.Get.PosY; 
        effect.View = Camera.Get.View;
        // Matrix.CreateLookAt(cameraPosition, cameraPosition + Camera.Get.LookDir,

        effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4
            , BaseGame.Get.GraphicsDevice.Viewport.AspectRatio
            , 0.01f, 1000000); 
        //Matrix.CreateOrthographic(800 / 1, 480 / 1, 0, 1000000);

        //effect.TextureEnabled = true;
        effect.LightingEnabled = true;
        effect.PreferPerPixelLighting = true;  
        //effect.SpecularColor = new Vector3(1, 0, 0); 


2 Answers 2



The first bone in the model contains the orientation the object had at time of export in 3dsmax. Doing a matrix transform using this bone (to the left of world matrix, matrix multiplication order matters) should orient your model correctly. Eg. If your model's rotation is set to Quaternion.Identity (no rotation) and you transform via first bone, your model should appear with same orientation as you see in 3dsmax.

^^ I found that out the painful way after wondering the same thing, why my models kept showing up backwards...

(3dsmax 2010, exporting as fbx version 200900)

See this snippet from my draw method:


Matrix[] modelTransform = new Matrix[gameobject.TexturedModel.Model.Bones.Count]; gameobject.TexturedModel.Model.CopyAbsoluteBoneTransformsTo(modelTransform);

            Matrix worldMatrix = Matrix.CreateFromQuaternion(gameobject.Rotation) * Matrix.CreateScale(mGlobalScale * gameobject.Scale) * Matrix.CreateTranslation(gameobject.Position);

            foreach (ModelMesh mesh in gameobject.TexturedModel.Model.Meshes)
                foreach (BasicEffect effect in mesh.Effects)
                    if (gameobject.TexturedModel.UseTexture) //override the default texture
                        effect.Texture = gameobject.TexturedModel.Texture;


                    effect.PreferPerPixelLighting = true;

                    //effect.World = worldMatrix;            
                    effect.World = modelTransform[mesh.ParentBone.Index] * worldMatrix;

                    effect.Projection = projectionMatrix;
                    effect.View = viewMatrix;

            //if (gameobject is CompoundUnit)
            //    ((CompoundUnit)gameobject).ChildObjects.ForEach(child => DrawGameObject(child));

I haven't had this problem with max & FBX. Are you sure your camera positions are equivalent?

Are you still using the transforms even though you only have one mesh? (I'm talking about the myModel.CopyAbsoluteTransformsTo(). And using those transforms in the effect.World property.) Often people will skip this if there is only one mesh but if you do skip it, it can produce a problem like what you are experiencing.

Scale is tricky to get right. It is a combo of setting units properly in max & the exporter. I often simply open the imported FBX in my favorite editor (usually in VS after importing to the project) and scrolling down to the bottom where is sets 'GlobalScaleFactor' and manually setting it there.

  • \$\begingroup\$ Hi, I just posted my drawing code, I use CopyAbsoluteBoneTransformsTo and still get the error... It also seems like the max exporter is stupid, it keeps exporting the scale factor as 2.54 even though in the settings I have set it to '1'... sigh \$\endgroup\$
    – meds
    Mar 26, 2011 at 12:44
  • \$\begingroup\$ Yeah, that is consistent with what I find about the scale too. \$\endgroup\$
    – Steve H
    Mar 26, 2011 at 12:50
  • \$\begingroup\$ good to know it's not just me and it in fact does suck :) \$\endgroup\$
    – meds
    Mar 26, 2011 at 13:10
  • \$\begingroup\$ Doesn't look like your getting much response from either thread. If you want to copy & past the FBX files on a pastebin ( xna.multigan.com/pastebin ), & reply back here with a link to it, I'll take a look at them and see if I can help figure it out. I can tell you the content pipeline processing does not cause these things. \$\endgroup\$
    – Steve H
    Mar 26, 2011 at 16:19
  • 1
    \$\begingroup\$ If it's exporting the scale as 2.54 rather than 1 it sounds like you might be modeling in inches and exporting in centimeters. \$\endgroup\$
    – user744
    Mar 26, 2011 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .