Jump to content
  • Advertisement
Sign in to follow this  
bushman_IL

Unusual Scaling Problem in XNA (C#)

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I have a very simple model of a table that is a diameter of 2 units. When I render the model in my XNA (C#) application, everything looks great. However when I scale x/z by 2, it looks like it is scaling larger than a magnitude of 2. Attached are two pictures (unscaled and scaled). I have drawn a plane down the center of the table and two plans 2 units apart in the unscaled, and then 4 units apart in the scaled.

The code below is how I create my world matrix for the mesh:


// the world position gets cached on processing of the scene node in the center of the bounding volume
Vector3 vWorldPosition = m_BoundingVolume.Center;

Matrix mTranslation;
Matrix mScale;
Matrix mRotation;

Vector3 m_vScale = new Vector3(2.0f, 1.0f, 2.0f);

Matrix.CreateTranslation(vWorldPosition.X, vWorldPosition.Y, vWorldPosition.Z, out mTranslation);
Matrix.CreateFromQuaternion(ref m_qOrientation, out mRotation);
Matrix.CreateScale(ref m_vScale, out mScale);

m_mCachedWorldMatrix = mScale * mRotation * mTranslation;



As you can see the code is very simple, so I am not sure where I am going wrong. Can any one suggest any ideas, or even any ideas of a way to debug this, I have exhausted all avenues I can think of.

Thank you!!

Share this post


Link to post
Share on other sites
Advertisement
You can certainly debug the vertex shader with PIX, which is probably where I'd start. Check the world space vertex position and see if it's what you'd expect, and also see if the matrix is what you expect.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!