Results 1 to 4 of 4

Thread: SetPrimDepth

  1. #1
    Moderator Dave2001's Avatar
    Join Date
    Dec 2001
    Location
    USA
    Posts
    310

    SetPrimDepth

    We're trying to translate SetPrimDepth z into a z value that we can use like any other vertex's z.

    According to docs, SetPrimDepth uses the following equation, with screenZ the value input to SetPrimDepth:
    screenZ=(z/w)*0x3fe0 + 0x3fe0

    This is kind of a hard question to ask, but we need to know sooo much more about how this equation works.

    I believe the place to start is what exactly does w represent for SetPrimDepth? Or does z even represent the z we're trying to find?



    [edited to make question much shorter & less history ]
    Last edited by Dave2001; July 1st, 2002 at 14:21.


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    Glide64 developer Gonetz's Avatar
    Join Date
    May 2002
    Location
    Siberia, Russia
    Posts
    362

    Smile

    ok, i think i found solution.

    we have screenZ, from above formula we get
    z/w = (screenZ-0x3fe0)/0x3fe0, so we know z/w

    z = vertex_z*projection[2][2] + projection[3][2]

    w = vertex_z*projection[2][3] + projection[3][3]

    projection[2][3] usually -1 and projection[3][3] is 0. we use such projection matrix for calculation near and far clipping planes.
    so,

    w = -vertex_z =>

    vertex_z = - (projection[3][2])/(projection[2][2]+z/w)

    desired z = w = -vertex_z

    DukeNukem64 works correct with this z, hurrah!

  3. #3
    Moderator Rice's Avatar
    Join Date
    Nov 2001
    Location
    U.S.
    Posts
    1,578
    Gonetz, the solution is cool, thanks.
    - Rice
    http://1964emu.emulation64.com

  4. #4
    Moderator Dave2001's Avatar
    Join Date
    Dec 2001
    Location
    USA
    Posts
    310
    Hmm, that solution seems to work fine with Duke Nukem 64, but Extreme-G 2, with the sky triangle covering the whole screen, gets a z value of 0 with z update enabled...

    Good job though
    Last edited by Dave2001; July 3rd, 2002 at 00:49.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •