Join VipMods site Today!

"Its' free and it takes less than 1 minute!"

Announcement

Collapse
No announcement yet.

WorldToScreen HELP

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WorldToScreen HELP

    Okay so this is my first attempt for making D3D ESP.
    I can't seem to draw for ALL players, it's drawing my OWN coordinates.
    When I mean my own coordinates, if I get killed by a player and see who killed me, next to him will be the boxes.
    Btw, the code here is mostly from Nseven's source.
    Any ideas ?? One last thing, only shows when my CHAMS are activated ( probably z Buffer )

    Code:
    void AddModel(LPDIRECT3DDEVICE9 Device, int iTeam)
    {
        float xx, yy;
        D3DXMATRIX matrix, worldmatrix, m1;
        D3DXVECTOR4 position, input;
        D3DVIEWPORT9 dip_viewport;
        Device->GetViewport(&dip_viewport);
        Device->GetVertexShaderConstantF(90, m1, 4);
        Device->GetVertexShaderConstantF(0, worldmatrix, 4);
     
        input.x = worldmatrix._14;
        input.y = worldmatrix._24;
        input.z = worldmatrix._34 + (float)(aimheight * 2);
     
        D3DXMatrixTranspose(&matrix, &m1);
        D3DXVec4Transform(&position, &input, &matrix);
     
        position.x = input.x * matrix._11 + input.y * matrix._21 + input.z * matrix._31 + matrix._41;
        position.y = input.x * matrix._12 + input.y * matrix._22 + input.z * matrix._32 + matrix._42;
        position.z = input.x * matrix._13 + input.y * matrix._23 + input.z * matrix._33 + matrix._43;
        position.w = input.x * matrix._14 + input.y * matrix._24 + input.z * matrix._34 + matrix._44;
     
        xx = ((position.x / position.w) * (dip_viewport.Width / 2.0f)) + dip_viewport.X + (dip_viewport.Width / 2.0f);
        yy = dip_viewport.Y + (dip_viewport.Height / 2.0f) - ((position.y / position.w) * (dip_viewport.Height / 2.0f));
     
        ModelInfo_t pModelInfo = { static_cast<float>(xx), static_cast<float>(yy), iTeam };
     
        ModelInfo.push_back(pModelInfo);
    }
    Shader Logg inside Stride ( 80 )

    Code:
    //
    // Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
    //
    // Parameters:
    //
    //   float4x3 g_SkinBoneMatrix3[30];
    //   float4x4 g_ViewProj;
    //   int g_nActerID;
    //   int g_nOutLineTable;
    //
    //
    // Registers:
    //
    //   Name              Reg   Size
    //   ----------------- ----- ----
    //   g_SkinBoneMatrix3 c0      90
    //   g_ViewProj        c90      4
    //   g_nActerID        c94      1
    //   g_nOutLineTable   c95      1
    //
    
        vs_3_0
        def c96, 1, 3, 0, 0
        dcl_position v0
        dcl_blendweight v1
        dcl_blendindices v2
        dcl_position o0
        dcl_texcoord o1
        add r0.x, c96.x, -v1.x
        add r0.x, r0.x, -v1.y
        add r0.x, r0.x, -v1.z
        mul r1, c96.y, v2
        mova a0, r1
        mul r1, v1.y, c0[a0.y]
        mad r1, c0[a0.x], v1.x, r1
        mad r1, c0[a0.z], v1.z, r1
        mad r1, c0[a0.w], r0.x, r1
        mad r2, v0.xyzx, c96.xxxz, c96.zzzx
        dp4 r1.x, r2, r1
        mul r3, v1.y, c1[a0.y]
        mad r3, c1[a0.x], v1.x, r3
        mad r3, c1[a0.z], v1.z, r3
        mad r3, c1[a0.w], r0.x, r3
        dp4 r1.y, r2, r3
        mul r3, v1.y, c2[a0.y]
        mad r3, c2[a0.x], v1.x, r3
        mad r3, c2[a0.z], v1.z, r3
        mad r0, c2[a0.w], r0.x, r3
        dp4 r1.z, r2, r0
        mov r1.w, c96.x
        dp4 o0.x, r1, c90
        dp4 o0.y, r1, c91
        dp4 o0.w, r1, c93
        dp4 r0.x, r1, c92
        mov o0.z, r0.x
        mov o1.z, r0.x
        mov r0.xz, c96
        mad o1.xw, c94.x, r0.xyzz, r0.zyzx
        mov o1.y, c95.x
    
    // approximately 31 instruction slots used
    outside of stride

    Code:
    //
    // Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
    //
    // Parameters:
    //
    //   float4x4 g_matWorldViewProj;
    //
    //
    // Registers:
    //
    //   Name               Reg   Size
    //   ------------------ ----- ----
    //   g_matWorldViewProj c0       4
    //
    //
    // Default values:
    //
    //   g_matWorldViewProj
    //     c0   = { 0, 0, 0, 0 };
    //     c1   = { 0, 0, 0, 0 };
    //     c2   = { 0, 0, 0, 0 };
    //     c3   = { 0, 0, 0, 0 };
    //
    
        vs_2_0
        dcl_position v0
        dcl_texcoord v1
        dp4 oPos.x, v0, c0
        dp4 oPos.y, v0, c1
        dp4 oPos.z, v0, c2
        dp4 oPos.w, v0, c3
        mov oT0.xy, v1
    
    // approximately 5 instruction slots used
    DIP

    Code:
    if(Stride == 80)
        {
            AddModel(pDevice, 1);
        }
    CHAMS code
    Code:
    else if (Stride == 80 ) 
            { 
                if (GetAsyncKeyState(VK_F9) & 1)
                    doDisassembleShader(pDevice, "shader1.txt");
    
                float sRed[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
                float sGreen[4] = { 0.0f, 0.5f, 0.0f, 0.0f };
                DWORD dwOldZEnable = D3DZB_TRUE;
                pDevice->SetPixelShaderConstantF(18, sRed, 1);
                pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
                pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
                DrawIndexedPrimitive_orig(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
                pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
                pDevice->SetPixelShaderConstantF(18, sGreen, 1);
            }
    EndScene
    Code:
        if (ModelInfo.size() != NULL)
        {
            UINT BestTarget = -1;
            DOUBLE fClosestPos = 99999;
     
            for (unsigned int i = 0; i < ModelInfo.size(); i++)
            {
                if (esp)
                {
                    ModelInfo[i].CrosshairDistance = GetDistance(ModelInfo[i].vOutX, ModelInfo[i].vOutY, ScreenCenterX, ScreenCenterY);
     
                    if (ModelInfo[i].vOutX > 1 && ModelInfo[i].vOutY > 1)
                        LBox(pDevice, (int)ModelInfo[i].vOutX - 10, (int)ModelInfo[i].vOutY - 10, 20, 30, Green);
     
                    if (ModelInfo[i].vOutX > 1 && ModelInfo[i].vOutY > 1)
                        DrawMyText(pFont, (int)ModelInfo[i].vOutX - 10, (int)ModelInfo[i].vOutY - 10, White, "%.f",  ModelInfo[i].CrosshairDistance / 2);
     
                }
            }
        }
        ModelInfo.clear();
    Images
    http://i.imgur.com/RvsrdQg.jpg
    http://i.imgur.com/kCjQpUZ.jpg



  • #2

    I have tried this method with a few games, I think you would need to check the coordinates and be sure they are world coordinates. also d3dvec4transform might cause issues also. Try and reverse the call back and see how they are transforming the coords.

    Comment

    • #3

      yeah well you're late bro ! I released it already.
      World was 0-4 and I used 4-4 also and my world matrix was bad in my W2S



      Comment

      Working...
      X
      Back to Top