XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

question about perspective field of view

Last post 11/20/2009 6:22 AM by vonture. 5 replies.
  • 11/19/2009 8:26 PM

    question about perspective field of view

    hello, i'm making a remake of the old lode runner, this is my screen shot of my 1 level




    i think that the "curve" effect in my render is because i'm using the Matrix.CreatePerspectiveFieldOfView, i have tried using matrix.CreateOrthographic but when i using the orthographics way the object seems to be too big and i don't know how to zoom out the camera, i have tried to zoom out the camera changing the values of the z axis in the camera position, camera target and the last thing i have tried was to put away the bricks and the stairs using the z axis too, but is not working, can someboy help me point to me on how to solve the "curve" of my render ? thank you in advance.

    www.vrs.com.ve
  • 11/19/2009 9:09 PM In reply to

    Re: question about perspective field of view

    Answer
    Reply Quote
    An ortho projection is what you want to use (you can read up a bit more on it here for how it actually works). 

    To "zoom" an orthographic projection, you have to apply a scale to everything rather than changing the Z values of the positions of the objects.  You'll want to throw a Matrix.CreateScale(x) into your world matrix when rendering the models/primitives.
  • 11/20/2009 12:49 AM In reply to

    Re: question about perspective field of view

    Your screenshot looks like you're looking up from somewhere below your model. Is the camera position in the center of the model? Doing so would probably remove the curved appearance.

    Another thing to consider is what view angle you've got set.
  • 11/20/2009 12:51 AM In reply to

    Re: question about perspective field of view

    Is there a reason you're not using SpriteBatch?
    Previously known as "Rainault".
    Twitter - me, Jade Vault Games
    Announcing ASCII Quest, a Roguelike under development for Xbox LIVE Indie Games
  • 11/20/2009 2:44 AM In reply to

    Re: question about perspective field of view

    i'm drawing 3d model i can't use the spritebatch.

    yes i have put my camera a little up to see the 3d models, because if i put the camera at the 0,0,0 the object will draw without a 3d view, this is my line of code that setup the camera:

    viewMatrix = Matrix.CreateLookAt(new Vector3(0.0f, 1500.0f, 5000.0f), posicion_brick, Vector3.Up); 

    and this if my code to create the field of view

    proyeccion = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectratio, 1.0f, 10000.0f); 

    i have tried with the orthographic view and crateing the scale in the world matrix and the models were too big, i have tried positive and negative values and both result in bigger models.

    also tried to put the camera position to 0,0,0 but when i put the camera in that position nothing show up in the screen.

    www.vrs.com.ve
  • 11/20/2009 6:22 AM In reply to

    Re: question about perspective field of view

    Answer
    Reply Quote
    kainvampire:
    i'm drawing 3d model i can't use the spritebatch.

    yes i have put my camera a little up to see the 3d models, because if i put the camera at the 0,0,0 the object will draw without a 3d view, this is my line of code that setup the camera:

    viewMatrix = Matrix.CreateLookAt(new Vector3(0.0f, 1500.0f, 5000.0f), posicion_brick, Vector3.Up); 

    and this if my code to create the field of view

    proyeccion = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectratio, 1.0f, 10000.0f); 

    i have tried with the orthographic view and crateing the scale in the world matrix and the models were too big, i have tried positive and negative values and both result in bigger models.

    also tried to put the camera position to 0,0,0 but when i put the camera in that position nothing show up in the screen.



    When you create a scale matrix, a scale from 0 - 1 is smaller than the normal size, and 1+ is larger.  To make the models 50% of their normal size, use a scale of 0.5f.
Page 1 of 1 (6 items) Previous Next