Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

This must be super-basic, but I don't know where the problem is, since I just started with 3D-Programming.

Why is my model "ballTest" so small on the screen?

private Model _model;
private Matrix view, proj;

//Initialize()
_model = Content.Load<Model>("ball test");
view = Matrix.CreateLookAt(new Vector3(0, 0, 10), new Vector3(0, 0, 0), Vector3.Up);
proj = Matrix.CreateOrthographic(800, 480, 0.1f, 30.0f);

//Draw
_model.Draw(Matrix.Identity, view, proj);
share|improve this question
    
Maybe because you created it that small, and in the 3D editor you move the camera in so very close that now you're used to how big it looked in there, but in reality it's not that big? –  user1306322 Mar 14 '13 at 15:42
    
It also looks like your zFarPlane is a little bit low, isn't the camera to far away from the object that it only renders part of it? Otherwise, increase zFarPlane and or check my answer below. –  Deukalion Mar 14 '13 at 15:47
add comment

2 Answers 2

up vote 0 down vote accepted

You have to specify the scale of the model, depending on the size of your model you might have to increase or decrease it in size.

float scale = 1f; // No scaling, 0.5f = half size, 2f = double the size
Vector3 Rotation = Vector3.Zero; // No rotation
Vector3 Position = Vector3.Zero; // Default position = 0,0,0

Matrix world = Matrix.CreateScale(scale) *
               Matrix.CreateRotationX(MathHelper.ToRadians(Rotation.X)) *
               Matrix.CreateRotationY(MathHelper.ToRadians(Rotation.Y)) *
               Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation.Z)) *
               Matrix.CreateTranslation(Position);

then

_model.Draw(world, view, projection);
share|improve this answer
add comment

It all really depends how your camera is set up and what is the size of your model in units.

In your case you could bring the camera closer by reducing the z-distance of the position vector at Matrix.CreateLookAt.

An even better idea would be to normalize all your model sizes and then set the desired size yourself:

Lets imagine your model as a simple sphere and work with the sphere radius where 2 * radius would be the total diameter of your model. First of all, we can normalize the radius by doing this (I assume your model consists of 1 mesh at this point):

Matrix world = Matrix.CreateScale(1 / _model.Meshes[0].BoundingSphere.Radius);

Now when drawing the model with

_model.Draw(world, view, proj);

it would draw your model in the world space with a radius of 1 unit.

If for example you want your model to have a total radius of 4 units, you could do this

const int desiredRadius = 4;
Matrix world = Matrix.CreateScale((1 / _model.Meshes[0].BoundingSphere.Radius) * desiredRadius);
_model.Draw(world, view, proj);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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