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

Unproject may be buggy?

Last post 5/26/2008 5:34 AM by Lord Ikon. 5 replies.
  • 3/24/2008 5:13 AM

    Unproject may be buggy?

    Changing code in Game.cs to the following line breaks the Picking Demo (http://creators.xna.com/Headlines/developmentaspx/archive/2007/01/01/Picking-Sample.aspx).
     
     
     
                // ... and use that value to create the projection matrix.
    projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
    MathHelper.ToRadians(45.0f), aspectRatio, .01f, 100000000);

    (I just changed the far plane)

    There doesn't seem to be any info on this problem... Any ideas? Workarounds? I really do need such a large area.

  • 3/24/2008 7:49 AM In reply to

    Re: Unproject may be buggy?

    Yea... the ZBuffer is waaaaaaay too huge. If you need it to go that big, then you need to make the minimum (the 0.01) larger. If you really need that kind of range (and I doubt it, there are easier workarounds for most scaling issues) then you can try multiple renders with smaller scales: say a 10000-10000000, a 10-10000, and a 0.01-10, then combine them. Without knowing more about the project and what you are trying to do, that's about all the advice i can give.
    Regards,
    Louis Ingenthron
    Fortis Venaliter
    Lead Developer of FV ProductionsFV Productions
  • 3/24/2008 12:50 PM In reply to

    Re: Unproject may be buggy?

    In layman's terms, you are trying to map the range [0, 1] onto [0.01, 10000000].  With floating point numbers, that is not going to work so well.  To make matters worse, the range [0, 1] uses a logarithmic scale.  Decrease the space between the near and far planes.
  • 5/23/2008 8:07 PM In reply to

    Re: Unproject may be buggy?

    Swordshock:
    In layman's terms, you are trying to map the range [0, 1] onto [0.01, 10000000].  With floating point numbers, that is not going to work so well.  To make matters worse, the range [0, 1] uses a logarithmic scale.  Decrease the space between the near and far planes.

    Better yet... keep the far plane the same and change you near plane to be something more reasonable.

    I'd recommend reading the link below... 

    http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html

  • 5/24/2008 4:04 AM In reply to

    Re: Unproject may be buggy?

    MissileControl:
    Swordshock:
    In layman's terms, you are trying to map the range [0, 1] onto [0.01, 10000000].  With floating point numbers, that is not going to work so well.  To make matters worse, the range [0, 1] uses a logarithmic scale.  Decrease the space between the near and far planes.

    Better yet... keep the far plane the same and change you near plane to be something more reasonable.

    Did I specifically suggest he move the near plane farther away?  I simply said to move the near and far planes closer together (which could be achieved by moving either the near or the far plane).  :-)

  • 5/26/2008 5:34 AM In reply to

    Re: Unproject may be buggy?

    In addition to the suggestions already made, it is a known issue to the XNA team that the Unproject method has a bug.

    Here's a link to the Microsoft Connect issue:https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=318306&SiteID=226

    XNA QuickStart Engine (3D Game Engine for XNA) | My site
    "I'll be whatever I want to do!", Philip J. Fry
Page 1 of 1 (6 items) Previous Next