Jump to content
  • Advertisement
Sign in to follow this  
jalpeshk

[XNA 4.0] Models & Screen Size

This topic is 2788 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

I made a thread a few weeks back about this issue, but wasn't so impressed with my implementation and understanding. I've worked on improving my code, and feel that it's not something that I'm likely doing wrong.

I've created two models in Blender (1 x 1 x 1) and exported using default options. I've created my world, projection, and camera to have the models scale to 55px by 55px. When viewing them using an isometric view, or top view, the models render perfectly (they take up 55x55 pixels). The cube and pyramid were created from the same model, with the latter having the top vertices set to center and just exported.

My game will use a stylistic shear similar to that of Ultima VII. It is accomplished by multiplying the world matrix of the models by the following:

Matrix shearMatrix = Matrix.Identity;
shearMatrix.M23 = (float)(-1 * Math.Cos(MathHelper.ToRadians(-45)));
shearMatrix.M21 = (float)(-1 * Math.Sin(MathHelper.ToRadians(45)));

The shear works as expected, but there is some unexpected results between the cube and the pyramid. The latter have a base of 55x55, perfect. However, the cubes seem to resize into 56x55, not what I want. What are some potential issues here? Why is the pyramid not getting stretched, but the cube is? Are there other ways to get this shear perspective without a matrix?

I can create a demo project if someone is interested in examining the code.

qtJL6.png

Share this post


Link to post
Share on other sites
Advertisement
Sorry to bump, but zero views. :(

If anyone needs to me clarify anything or provide a demo project with the same issue, please do let me know. I'm quite baffled on how to solve this issue as it's not a model export problem.

Share this post


Link to post
Share on other sites
When I resize my model in Blender to be 0.99 x 0.99 x 1, and then scale it in XNA to 0.55f, the right dimension on the base is rendered (55x55 pixels). Anyone have a reason as to why there is a rounding error causing an extra pixel to be rendered in the original post?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!