Loading 3D Model Problem

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 1473 Views - Last Post: 08 November 2011 - 02:03 PM

#1 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Loading 3D Model Problem

Posted 07 November 2011 - 09:06 AM

I want to load a 3d model(Animated model) in my project!
But after Exporting it to *.FBX model and importing the model in xna it has been rotated, Like The Attachment...
Who know what can I do to import my animated models
Is This A Good Question/Topic? 0
  • +

Replies To: Loading 3D Model Problem

#2 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Loading 3D Model Problem

Posted 07 November 2011 - 09:11 AM

Show us the code that handles loading the model, and upload the attachment this time. If it's an image, just use the img tags rather that uploading an image file here.
Was This Post Helpful? 1
  • +
  • -

#3 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 09:45 AM

I know the problem is not in the code ;
Becuase just my models have this problem ;
the other models that have been exported befor, are ok.
I use 3ds max 2009 to export my models..
Was This Post Helpful? 0
  • +
  • -

#4 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Loading 3D Model Problem

Posted 07 November 2011 - 10:04 AM

Are your models facing forward when you export them? XNA uses the Z axis as forward. Make sure that the model is facing you in it's bindpos at frame 0 in the Front viewport in 3ds Max when you export. If that doesn't change anything, investigate the models that work fine and see if you can figure out what is different about them that allows them to display properly.
Was This Post Helpful? 0
  • +
  • -

#5 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 10:32 AM

Whate do you mean (Are your models facing forward ?)!!!
How can I use image tags to show you a screen shot of my 3ds Max view port and axes status?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,523
  • Joined: 12-June 08

Re: Loading 3D Model Problem

Posted 07 November 2011 - 10:42 AM

Quote

How can I use image tags to show you a screen shot of my 3ds Max view port and axes status?

1. Linking:
a. Upload image to website
b. post image link in comment section.
c. highlight entire image link
d. click the 'image tag' button which should surround the image link with [ img] [/ img] tags.
e. click post
f. profit

2. full editor.
a. open up the comment in the full editor
b. have your image saved to your pc.
c. click the 'attach' button at the bottom of the page.
d. navigate to your image
e. attach it.
f. click the 'add to post' next to the attachment to add it to your comment.
g. click 'post'
h. profit!

Just remember you have a max quota for attachments in DIC...
Was This Post Helpful? 1
  • +
  • -

#7 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 10:53 AM

This is my 3ds max status
Attached Image
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,523
  • Joined: 12-June 08

Re: Loading 3D Model Problem

Posted 07 November 2011 - 10:57 AM

It might have been a while since I last was 3d modeling, but shouldn't your front view be x as the horizontal and y as the vertical (instead of z being the vertical)? z should be depth, right? From the look of it, putting that model in a regular xyz coordinates puts it face down.
Was This Post Helpful? 0
  • +
  • -

#9 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 11:04 AM

You mean I shoul use bottom view insted front?
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9195
  • View blog
  • Posts: 34,523
  • Joined: 12-June 08

Re: Loading 3D Model Problem

Posted 07 November 2011 - 11:59 AM

I am saying your model is facing down in a normal xyz plane.. you should grab it and reorientated it.



Never mind.. strike what I said. After comparing a large number of 3d max tutorials it seems the majority have the x/y create the "floor" and z shoots up vertical.

Neeeeeeeeeeeeeeever mind.
Was This Post Helpful? 0
  • +
  • -

#11 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 12:30 PM

I think you were right ;
because the model face is forward to Y axes.
Is there any way to change axes orientation(not by rotating)
Was This Post Helpful? 0
  • +
  • -

#12 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Loading 3D Model Problem

Posted 07 November 2011 - 01:04 PM

3ds Max uses Z as the vertical axis and Y as the depth axis for some strange reason.

I don't see anything from the image that looks wrong. Your model is definitely facing forward in the bindpos, assuming that is frame 0 in your animation.

Which method did you use for rigging the model? Did you build a custom rig with bones, or did you use biped? Biped can cause some issues when exporting. I'm not 100% sure on the specifics, but it has something to do with a root bone missing or something along those lines.
Was This Post Helpful? 0
  • +
  • -

#13 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 01:25 PM

I used bone and skin modifier ;
I think biped is not supported by XNA ;
Was This Post Helpful? 0
  • +
  • -

#14 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Loading 3D Model Problem

Posted 07 November 2011 - 01:41 PM

Go ahead and show us the code for it. I have a feeling the matrices that you are using are rotated around the model instead of the model itself being rotated.
Was This Post Helpful? 0
  • +
  • -

#15 saeedvp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 07-November 11

Re: Loading 3D Model Problem

Posted 07 November 2011 - 02:35 PM

the code is in several classes ;
I have a class Transformation ;

with the following properties
        Vector3 translate;
        Vector3 rotate;
        Vector3 scale;
        Matrix matrix;

        public Transformation(Vector3 translate, Vector3 rotate, Vector3 scale)
        {
            this.translate = translate;
            this.rotate = rotate;
            this.scale = scale;
            matrix = Matrix.Identity;
        }




Here is a summary of Player class that inheritance the TerrainUnit Class

        static float MAX_WAIST_BONE_ROTATE = 0.50f;
        static int WAIST_BONE_ID = 2;
        static int RIGHT_HAND_BONE_ID = 10;

        PlayerWeapon playerWeapon;

        public override void Draw(GameTime time)
        {
            playerWeapon.Draw(time);

            base.Draw(time);
        }




here web have a summary of TerrainUnit clas:



        private void NormalizeBaseVectors()
        {
            headingVec = Transformation.Matrix.Forward;
            strafeVec = Transformation.Matrix.Right;
            upVec = Transformation.Matrix.Up;

            headingVec.Normalize();
            strafeVec.Normalize();
            upVec.Normalize();
        }

        public override void Update(GameTime time)
        {
            float elapsedTimeSeconds = (float)time.ElapsedGameTime.TotalSeconds;
            animatedModel.Update(time, Matrix.Identity);

            // Update the height and collision volumes
            if (linearVelocity != Vector3.Zero || gravityVelocity != 0.0f)
            {
                Transformation.Translate += linearVelocity * elapsedTimeSeconds * speed;
                UpdateHeight(elapsedTimeSeconds);
                needUpdateCollision = true;
            }

            // Update coordinate system when the unit rotates
            if (angularVelocity != Vector3.Zero)
            {
                Transformation.Rotate += angularVelocity * elapsedTimeSeconds * speed;
                NormalizeBaseVectors();
            }

            base.Update(time);

        }



This one is in the load content

        gameLevel.Player.Transformation = new Transformation(new Vector3(-210, 0, 10),
                new Vector3(0, 70, 0), Vector3.One);



And finally I draw it bye this single line ;
     gameLevel.Player.Draw(gameTime);



the code is in several classes ;
I have a class Transformation ;

with the following properties
        Vector3 translate;
        Vector3 rotate;
        Vector3 scale;
        Matrix matrix;

        public Transformation(Vector3 translate, Vector3 rotate, Vector3 scale)
        {
            this.translate = translate;
            this.rotate = rotate;
            this.scale = scale;
            matrix = Matrix.Identity;
        }




Here is a summary of Player class that inheritance the TerrainUnit Class

        static float MAX_WAIST_BONE_ROTATE = 0.50f;
        static int WAIST_BONE_ID = 2;
        static int RIGHT_HAND_BONE_ID = 10;

        PlayerWeapon playerWeapon;

        public override void Draw(GameTime time)
        {
            playerWeapon.Draw(time);

            base.Draw(time);
        }




here web have a summary of TerrainUnit clas:



        private void NormalizeBaseVectors()
        {
            headingVec = Transformation.Matrix.Forward;
            strafeVec = Transformation.Matrix.Right;
            upVec = Transformation.Matrix.Up;

            headingVec.Normalize();
            strafeVec.Normalize();
            upVec.Normalize();
        }

        public override void Update(GameTime time)
        {
            float elapsedTimeSeconds = (float)time.ElapsedGameTime.TotalSeconds;
            animatedModel.Update(time, Matrix.Identity);

            // Update the height and collision volumes
            if (linearVelocity != Vector3.Zero || gravityVelocity != 0.0f)
            {
                Transformation.Translate += linearVelocity * elapsedTimeSeconds * speed;
                UpdateHeight(elapsedTimeSeconds);
                needUpdateCollision = true;
            }

            // Update coordinate system when the unit rotates
            if (angularVelocity != Vector3.Zero)
            {
                Transformation.Rotate += angularVelocity * elapsedTimeSeconds * speed;
                NormalizeBaseVectors();
            }

            base.Update(time);

        }



This one is in the load content

        gameLevel.Player.Transformation = new Transformation(new Vector3(-210, 0, 10),
                new Vector3(0, 70, 0), Vector3.One);



And finally I draw it bye this single line ;
     gameLevel.Player.Draw(gameTime);


Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2