WoD Depth Buffer/3D clipping madness menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WoD Depth Buffer/3D clipping madness

    Hey everyone!

    Since patch 6.0 hit last week, I started working on WoW again and I encountered something that's quite strange.
    When I draw 3D objects with clipping, they're kinda broken now. The clipping only looks okay when my camera is zoomed in. When I zoom out my camera, all objects start to disappear behind the terrain.

    Okay: https://i.imgur.com/ZEKBXIu.jpg
    Not okay (slightly zoomed out): https://i.imgur.com/gNNjfBa.jpg

    My near clip and far clip values are taken from World::GetNearClip & World::GetFarClip. Viewport Depth is still constant 0.94f.
    The depth target is taken from a hook in CWorldSceneRender::Render; it's the depth buffer that the game uses to draw the world.

    The projection matrix that I use is taken from GxuXformCreateProjection_Exact (0x77A89; 19034), which looks like this:

    Code:
    static Matrix PerspectiveFovWoW(float fovy, float aspect, float zn, float zf) {
        float xs = tanf(fovy * 0.5f) * zn;
        float xn = zn / (xs * aspect);
    
        Matrix mat = {
              xn,    0.0f,                            0.0f,  0.0f,
            0.0f, zn / xs,                            0.0f,  0.0f,
            0.0f,    0.0f,           (zn + zf) / (zf - zn),  1.0f,
            0.0f,    0.0f, ((zf * -2.0f) * zn) / (zf - zn),  0.0f
        };
    
        return mat;
    }
    The look at matrix for WoW's coordinate system looks like:

    Code:
    static Matrix LookAtWoW(const Vector3 &eye, const Vector3 &at, const Vector3 &up) {
        Vector3 zaxis = (at - eye).normalize();
        Vector3 xaxis = Vector3::Cross(zaxis, up).normalize();
        Vector3 yaxis = Vector3::Cross(xaxis, zaxis);
    
        Matrix mat = {
                    xaxis.x,         yaxis.x,         zaxis.x, 0.0f,
                    xaxis.y,         yaxis.y,         zaxis.y, 0.0f,
                    xaxis.z,         yaxis.z,         zaxis.z, 0.0f,
            -xaxis.dot(eye), -yaxis.dot(eye), -zaxis.dot(eye), 1.0f
        };
    
        return mat;
    }
    GetNearClip/GetFarClip offsets:

    Code:
    uintptr_t GetNearClip = 0x4F847C; // 19034
    uintptr_t GetFarClip = 0x4F8452; // 19034
    Camera offsets:

    Code:
    struct CameraHolder {
        struct VMTHolder {
            uint32_t FOV = 0;
            uint32_t Forward = 1;
            uint32_t Right = 2;
            uint32_t Up = 3;
        } VMT;
    
        uintptr_t Position = 0x8;
    } CGCamera;
    I was wondering if anyone of you guys did anything drawing related since MoP/WoD and if you have similar issues.
    Without Z-testing everything looks fine ofcourse.

    Thanks

    WoD Depth Buffer/3D clipping madness
  2. #2
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    It is very, very early here, so I may be missing something obvious, but I don't see the problem?

  3. #3
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by namreeb View Post
    It is very, very early here, so I may be missing something obvious, but I don't see the problem?
    Take a look at the second screenshot. If I zoom out with the camera the white circle below my character completely disappears "behind" the terrain. In the second screenshot it's already half behind the terrain when it should actually be at the character position.

  4. #4
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The issue is in GxuXformCreateProjection. I've adjusted this projection matrix a little and it seems to work now.

    Feel free to use it:

    Code:
    static Matrix PerspectiveFov(float fovy, float aspect, float zn, float zf) {
        float ys = 1.0f / tanf(fovy / 2.0f);
        float xs = ys / aspect;
    
        Matrix mat = {
              xs,  0.0f,                 0.0f,  0.0f,
            0.0f,    ys,                 0.0f,  0.0f,
            0.0f,  0.0f,       zf / (zf - zn),  1.0f,
            0.0f,  0.0f, -zn * zf / (zf - zn),  0.0f
        };
    
        return mat;
    }

Similar Threads

  1. Horde Speaking To Alliance - In Depth!
    By Viskus in forum World of Warcraft Exploits
    Replies: 38
    Last Post: 11-25-2006, 12:07 PM
  2. In depth skill guide (does everything)
    By Marlo in forum World of Warcraft Guides
    Replies: 4
    Last Post: 10-07-2006, 09:35 PM
  3. More in-depth Auctioneer Mod Guide
    By Matt in forum World of Warcraft Guides
    Replies: 5
    Last Post: 08-26-2006, 11:34 PM
  4. Make NPC Guards Mad!
    By Tbone in forum World of Warcraft Exploits
    Replies: 19
    Last Post: 07-14-2006, 10:34 PM
  5. Stackable Buffers
    By Matt in forum World of Warcraft Exploits
    Replies: 0
    Last Post: 05-02-2006, 01:15 PM
All times are GMT -5. The time now is 07:25 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search