rendering in gameworld menu

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39
  1. #16
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep, nice
    where did you get the value 0.94 from?

    c++ version:
    Code:
    		D3DVIEWPORT9 Viewport;
    		pDevice->GetViewport(&Viewport);
    		Viewport.MinZ = 0.0f;
    		Viewport.MaxZ = 0.94f;
    		pDevice->SetViewport(&Viewport);
    
    		pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
    		pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
    		pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);

    rendering in gameworld
  2. #17
    Kryso's Avatar Active Member
    Reputation
    40
    Join Date
    Jul 2009
    Posts
    97
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hooked few dx functions and dumped all calls with parameters.

    http://dl.dropbox.com/u/1799304/Mmow...ame%20dump.txt

  3. #18
    kynox's Avatar Member
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kryso, I noticed you were using a tacky way of creating your view matrix, which will also fail in cases when your Forward is different to how you've hard-coded it to be.

    This should help:

    Code:
    class CSimpleCamera
    {
    public:
        virtual float GetFov( );
        virtual idVec3& Forward( idVec3& vecOut );
        virtual idVec3& Right( idVec3& vecOut );
        virtual idVec3& Up( idVec3& vecOut );
    
        idVec3 Forward( )
        { idVec3 fwd; Forward( fwd ); return fwd; }
    
        char unknown4[4];
        idVec3 vecPosition;
        idMat3 matFacing;
        float NearZ;
        float FarZ;
        float Fov;
        float Aspect;
    };
    
    class CGCamera : public CSimpleCamera
    {
    public:
        int m_hModel;
        char field_4C[60];
        unsigned __int64 Target;
        char unknown144[8];
        DWORD Flags;
        int unknown156;
        INT64 m_relativeTo;
        char field_A8[112];
        float Distance;
        char unknown272[12];
        float HeightOffset;
    };
    
    void Renderer::SetupProjection()
    {
        CGCamera* Camera = GetCamera();
    
        D3DXMATRIX ProjMat;
    
        if ( Camera == nullptr )
            D3DXMatrixIdentity(&ProjMat);
        else
            D3DXMatrixPerspectiveFovRH( &ProjMat, Camera->GetFov() * 0.6f,
            Camera->Aspect, Camera->NearZ, Camera->FarZ );
    
        m_ProjMatrix = ProjMat;
        m_pDevice->SetTransform( D3DTS_PROJECTION, &ProjMat );
    }
    
    void Renderer::SetupView()
    {
        CGCamera* Camera = GetCamera();
        D3DXMATRIX ViewMat;
    
        if ( Camera == nullptr )
            D3DXMatrixIdentity(&ViewMat);
        else
        {
            idVec3 vecPosition(Camera->vecPosition);
            idVec3 vecAt(vecPosition + Camera->Forward());
    
            D3DXVECTOR3 Eye( vecPosition[0], vecPosition[1], vecPosition[2] );
            D3DXVECTOR3 At( vecAt[0], vecAt[1], vecAt[2] );
            D3DXVECTOR3 Up( 0, 0, 1 );
    
            D3DXMatrixLookAtRH( &ViewMat, &Eye, &At, &Up );
        }
    
        m_ViewMatrix = ViewMat;
        m_pDevice->SetTransform(D3DTS_VIEW, &ViewMat);
    }
    Last edited by kynox; 03-30-2010 at 07:56 PM.

  4. #19
    Kryso's Avatar Active Member
    Reputation
    40
    Join Date
    Jul 2009
    Posts
    97
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kynox: yep, there were some issues with that thanks a lot

  5. #20
    misz's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Finaly managed to draw something on the screen, now its time to get it 3D!!.

    But now when i try to make it 3d i dont see the thing i draw.

    Here is my code,C#, What am I doing wrong?

    Code:
    public void FillRectangle(float width, float height, Vector3 pos, Color color)
    {
    device.VertexShader = null;
    device.PixelShader = null;
    device.SetTransform(TransformState.World, World);
    device.SetTransform(TransformState.View, View);
    device.SetTransform(TransformState.Projection, Projection);
    device.VertexFormat = VertexFormat.PositionRhw | VertexFormat.Diffuse | VertexFormat.Texture1;
    device.SetTexture(0, null);
    float startXDown = pos.X - (width / 2);
    float startYDown = pos.Y + (height / 2);
    float endXDown = startXDown + width;
    float endYLeftSide = pos.Y - (height / 2);
    Vertex[] data1 = newVertex[3];
    data1[0].Color = (uint)color.ToArgb();
    data1[0].X = startXDown;
    data1[0].Y = startYDown;
    data1[0].Z = pos.Z;
    data1[0].RHW = 1.0f;
    data1[1].Color = (uint)color.ToArgb();
    data1[1].X = endXDown;
    data1[1].Y = startYDown;
    data1[1].Z = pos.Z;
    data1[1].RHW = 1.0f;
    data1[2].Color = (uint)color.ToArgb();
    data1[2].X = endXDown;
    data1[2].Y = endYLeftSide;
    data1[2].Z = pos.Z;
    data1[2].RHW = 1.0f;
     
     
    Vertex[] data2 = newVertex[3];
    data2[0].Color = (uint)color.ToArgb();
    data2[0].X = startXDown;
    data2[0].Y = startYDown;
    data2[0].Z = pos.Z;
    data2[0].RHW = 1.0f;
    data2[1].Color = (uint)color.ToArgb();
    data2[1].X = startXDown;
    data2[1].Y = endYLeftSide;
    data2[1].Z = pos.Z;
    data2[1].RHW = 1.0f;
    data2[2].Color = (uint)color.ToArgb();
    data2[2].X = endXDown;
    data2[2].Y = endYLeftSide;
    data2[2].Z = pos.Z;
    data2[2].RHW = 1.0f;
     
    device.SetRenderState(RenderState.Ambient, Color.FromArgb(255, 127, 127, 127).ToArgb());
    device.SetRenderState(RenderState.Lighting, true);
    device.SetRenderState(RenderState.CullMode, 0);
    device.DrawUserPrimitives<Vertex>(PrimitiveType.TriangleList, 1, data1);
    device.DrawUserPrimitives<Vertex>(PrimitiveType.TriangleList, 1, data2);
    }
     
    public bool WorldToScreen(Vector3 position, outVector3 screen)
    {
    screen = Vector3.Project(position,device.Viewport.X,device.Viewport.Y,device.Viewport.Width,device.Viewport.Height,device.Viewport.MinZ,device.Viewport.MaxZ, (World*View*Projection));
    return screen.Z < 1f;
    }
    public Matrix View
    {
    get
    {
    return Matrix.LookAtRH(newVector3(CamX, CamY, CamZ), newVector3(LookX, LookY, LookZ), newVector3(0, 0, 1f));
    }
    }
    public Matrix Projection
    {
    get
    {
    return Matrix.PerspectiveFovRH(fieldOfView * 0.6f, aspect, zNearPlane, zFarPlane);
    }
    }
    public Matrix World
    {
    get
    {
    return Matrix.Identity * Matrix.Translation(PlrX, PlrY, PlrZ);
    }
    }
    
    And the code to draw:

    Code:
    Vector3 vec = newVector3();
    device.WorldToScreen(newVector3(PlrX, PlrY, PlrZ), out vec);
    device.FillRectangle(500, 500, vec, Color.Red);
    
    Last edited by misz; 04-05-2010 at 09:02 AM.

  6. #21
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you don't need a world to screen function when drawing in the game world
    and you have to translate the object at a position you can see, like for example on your local players position: Direct3D Matrices

  7. #22
    misz's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, ty for reply.

    So, i want to set the World matrix to Identity, that should allow me to use world cord for the rendering stuff.

    When it comes to the View matrix i feel abit usure.
    What i need is the Eye pos, witch is in this case the WoW Camera Pos.

    What about Lookat?

  8. #23
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kynox posted the source how to create these matrices some posts above
    and i posted how i do it here, which could be found using the search function :P http://www.mmowned.com/forums/wow-me...ml#post1835379

  9. #24
    misz's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My matrices are correct, but seems i still cant see the stuff i draw.

  10. #25
    Harland's Avatar Member
    Reputation
    8
    Join Date
    Oct 2007
    Posts
    50
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice work on the z-buffer problem Kryso Thanx for posting your solution. I almost solved it, but then you posted your solution So Cheers!


    Anyway, after learning a crapload about how the z-buffering works, i had an idea to play with to see if i could render under the UI.

    I managed to get it rendering under the UI, but the way i did it is not very good at all

    Code:
    HRESULT __stdcall My_SetViewport(LPDIRECT3DDEVICE9 pDevice, D3DVIEWPORT9* pViewport)
    {
    	D3DVIEWPORT9* temp;
    	temp = pViewport;
    
    	if (temp->MinZ == 0.0 && temp->MaxZ == 1.0f)
    	{
    		count++;
    		if (count == 9)
    		{
    			GetWoWStuff(pDevice);
    			D3DRendering(pDevice);
    			SetWoWStuff(pDevice);
    		}
    	}
    	return Real_SetViewport(pDevice, pViewport);
    }
    I start off by saving all the wow rendering options with GetWoWStuff(), i then do my rendering, and then restore the wow rendering properties with SetWoWStuff() before i return back to wow with the original SetViewport function.

    (I check for SetViewport with MinZ: 0 MaxZ: 1 because if you look at the dump Kryso posted, you will notice the main chunk of rendering is done with MinZ: 0 MaxZ: 0.94. This is where all the game objects are rendered. After that, the dump shows wow then rendering with MinZ: 0 MaxZ: 1, so this must be the UI.)

    I have just guess and checked the count of times the SetViewport is called with parameters MinZ=0, MaxZ=1, and it seems rendering with the 9th count works just fine. If you render with 8 for example, wow will crash? 10 = minimap, 11 = UI (castbar,health,etc) will disappear. Although sometimes wow will randomly crash, so its not 100% foolproof.

    Its a pretty messy way of doing it, but if you manage to render WITH wow, instead of AFTER (ie in endscene), you can render your objects before the UI. If you change the render order, you can manually change the Z order. So if we render before the UI is rendered, wow will then render the UI on top.

    Also, it will render my objects under most of the UI, but if you notice the objects are still rendered on top of the "The world teleport" object. Its not 100% perfect, but its a step in the right direction

    I don't have too much time to continue reversing and tweaking all the parameters needed to render under the UI and 100% not cause crashes. So i hope this will help someone, or steer someone in the right direction?
    Rendering under the UI isn't a HUGE priority for me, but if someone figures it out, post how u did it cause im interested
    Attached Thumbnails Attached Thumbnails rendering in gameworld-untitled-jpg   rendering in gameworld-untitled2-jpg   rendering in gameworld-untitled3-jpg   rendering in gameworld-untitled4-jpg  

  11. #26
    misz's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Finaly got it working, but not in the way i intended.

    Right now im running without the SetTransform, for View and Projection, and instead convert the cords, with WorldToScreen.

    I know the View and Projection matrices are good, couse i get good resulst when drawing using WorldToScreen.

    But why does SetTransform not work?, anyone had simlar issuses.

  12. #27
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    because you didn't read the thread properly you are doing the same mistake as i did at the beginning:
    Originally Posted by Kryso View Post
    No you still need to set view and projection matrices - I think wow uses shaders for this stuff so you need to set it by yourself (correct me if I'm wrong, I'm not exactly expert in d3d stuff). Also now I noticed you are using D3DFVF_XYZRHW.. thats for 2D IIRC and for world rendering you need to use D3DFVF_XYZ.

    http://dl.dropbox.com/u/1799304/Mmow...510_122100.jpg

  13. #28
    misz's Avatar Member
    Reputation
    1
    Join Date
    Nov 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mnbvc View Post
    because you didn't read the thread properly you are doing the same mistake as i did at the beginning:
    One word, "RHW", can do so much.

    Thank You, now its working propperly.

  14. #29
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw, am i the only one with this problem:


    when i mouseover a unit or hover a button in the game menu, or hide my interface all transparent objects i draw become a bit darker. when mouseovering a player and moving my mouse away, my objects stay dark for 1-2 sec. when i hover the buttons in the game menu or press alt+y it instantly changes from light to dark and back.

    i thought that there is maybe another renderstate which needs to be set by me. i checked if anything like this happens with the "pix" tool (comes with the directx sdk) but there was nothing happening when i mouseover a player.
    does anybody here know how to fix this?

  15. #30
    kynox's Avatar Member
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mnbvc View Post
    btw, am i the only one with this problem:


    when i mouseover a unit or hover a button in the game menu, or hide my interface all transparent objects i draw become a bit darker. when mouseovering a player and moving my mouse away, my objects stay dark for 1-2 sec. when i hover the buttons in the game menu or press alt+y it instantly changes from light to dark and back.

    i thought that there is maybe another renderstate which needs to be set by me. i checked if anything like this happens with the "pix" tool (comes with the directx sdk) but there was nothing happening when i mouseover a player.
    does anybody here know how to fix this?
    Turn off lighting.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Some rendered WoW art (not for the faint of modem)
    By Pinkhair in forum Art & Graphic Design
    Replies: 33
    Last Post: 09-28-2007, 04:59 AM
  2. Musters guide to: Making WoW renders.(Warning Pictures!)
    By Adrenalin3 in forum Art & Graphic Design
    Replies: 11
    Last Post: 08-28-2007, 02:02 PM
  3. renders
    By Sekspyz in forum Art & Graphic Design
    Replies: 5
    Last Post: 08-16-2007, 06:06 PM
  4. Where to get a render?
    By lohkies in forum Art & Graphic Design
    Replies: 2
    Last Post: 03-06-2007, 04:25 PM
  5. How do I render Vid's in fraps?
    By theillbehaviored in forum World of Warcraft General
    Replies: 0
    Last Post: 09-25-2006, 09:54 AM
All times are GMT -5. The time now is 08:26 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