Drawing image with SlimDX in game world menu

User Tag List

Results 1 to 9 of 9
  1. #1
    -Ryuk-'s Avatar Elite User CoreCoins Purchaser Authenticator enabled
    Reputation
    529
    Join Date
    Nov 2009
    Posts
    1,028
    Thanks G/R
    38/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drawing image with SlimDX in game world

    Hey all,

    Im wondering how to draw an image in game like Sonar by YetiBots does... For these that don't know what I mean

    Drawing image with SlimDX in game world-screen-02-jpg

    I can draw lines and boxes using DrawUserPrimitives, but I am not sure how I would go about the image. I know SlimDX has a Texture & Sprite Object... Has anyone tried this with SlimDX and can point me in the right direction?


    Thanks
    |Leacher:11/2009|Donor:02/2010|Established Member:09/2010|Contributor:09/2010|Elite:08/2013|

    Drawing image with SlimDX in game world
  2. #2
    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)
    It's actually very simple. All you do is create a plane thats orthogonal to the cameras forward vector and set up a small rectangle for the texture there.
    Extract Right, Up and Forward vectors from the view matrix and use them to set up a billboarded quad to which you apply the texture.
    Last edited by Master674; 08-29-2014 at 01:10 PM.

  3. #3
    -Ryuk-'s Avatar Elite User CoreCoins Purchaser Authenticator enabled
    Reputation
    529
    Join Date
    Nov 2009
    Posts
    1,028
    Thanks G/R
    38/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Master674 View Post
    It's actually very simple. All you do is create a plane thats orthogonal to the cameras forward vector and set up a small rectangle for the texture there.
    Extract Right, Up and Forward vectors from the view matrix and use them to set up a billboarded quad to which you apply the texture.

    Okay I will see if I can figure that out.

    On another note:
    Some time ago in another drawing thread we spoke about Zbuffer with rendering, did you ever sort this without hooking the other function? (I don't remember the name)
    |Leacher:11/2009|Donor:02/2010|Established Member:09/2010|Contributor:09/2010|Elite:08/2013|

  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)
    Originally Posted by -Ryuk- View Post
    Okay I will see if I can figure that out.

    On another note:
    Some time ago in another drawing thread we spoke about Zbuffer with rendering, did you ever sort this without hooking the other function? (I don't remember the name)
    I don't remember what I did in WoW but for Wildstar and other games I just grab the games DepthStencilView by hooking ID3D11DeviceContext::OMSetRenderTargets and set it again when drawing my stuff.

  5. #5
    namreeb's Avatar Legendary

    Reputation
    658
    Join Date
    Sep 2008
    Posts
    1,023
    Thanks G/R
    7/215
    Trade Feedback
    0 (0%)
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Ryuk, if you get this working I hope you will share some of your experiences here. This is something I've always wanted to try but never got around to doing.

  6. #6
    Wildbreath's Avatar Contributor
    Reputation
    162
    Join Date
    Feb 2012
    Posts
    121
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ui z-layer first and it value 0.6 as i remember
    PHP Code:
            public static void SetupViewport()
            {
                
    D3DViewport viewport Device.GetViewport();
                
    viewport.MinZ 0;
                
    viewport.MaxZ 0.94f;
                
    Device.SetViewport(viewport);
            }

            public static 
    unsafe void SetupView()
            {
                
    Matrix matrix Matrix.LookAtRH(Camera.PositionCamera.Position Camera.Forward(), Vector3.Up);
                
    Device.SetTransform(D3DTransformStateType.VIEW, &matrix);
            }

            public static 
    unsafe void SetupProjection()
            {
                
    Matrix matrix Matrix.PerspectiveFovRH(Camera.GetFov() * .6f1.777fCamera.NearZCamera.FarZ);
                
    Device.SetTransform(D3DTransformStateType.PROJECTION, &matrix);
            } 
    and
    PHP Code:
                Device.SetRenderState(D3DRenderStateType.ZENABLE1u);
                
    Device.SetRenderState(D3DRenderStateType.ZWRITEENABLE1u);
                
    Device.SetRenderState(D3DRenderStateType.ZFUNC, (int)D3DCmp.LESSEQUAL); 

  7. #7
    -Ryuk-'s Avatar Elite User CoreCoins Purchaser Authenticator enabled
    Reputation
    529
    Join Date
    Nov 2009
    Posts
    1,028
    Thanks G/R
    38/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Wildbreath View Post
    ui z-layer first and it value 0.6 as i remember
    PHP Code:
            public static void SetupViewport()
            {
                
    D3DViewport viewport Device.GetViewport();
                
    viewport.MinZ 0;
                
    viewport.MaxZ 0.94f;
                
    Device.SetViewport(viewport);
            }

            public static 
    unsafe void SetupView()
            {
                
    Matrix matrix Matrix.LookAtRH(Camera.PositionCamera.Position Camera.Forward(), Vector3.Up);
                
    Device.SetTransform(D3DTransformStateType.VIEW, &matrix);
            }

            public static 
    unsafe void SetupProjection()
            {
                
    Matrix matrix Matrix.PerspectiveFovRH(Camera.GetFov() * .6f1.777fCamera.NearZCamera.FarZ);
                
    Device.SetTransform(D3DTransformStateType.PROJECTION, &matrix);
            } 
    and
    PHP Code:
                Device.SetRenderState(D3DRenderStateType.ZENABLE1u);
                
    Device.SetRenderState(D3DRenderStateType.ZWRITEENABLE1u);
                
    Device.SetRenderState(D3DRenderStateType.ZFUNC, (int)D3DCmp.LESSEQUAL); 

    Both camera.NearZ & Far.Z are both 0 for me! I can draw above everything with setting a hard coded value of 1 for NearZ

    Originally Posted by namreeb View Post
    Ryuk, if you get this working I hope you will share some of your experiences here. This is something I've always wanted to try but never got around to doing.
    I will do
    |Leacher:11/2009|Donor:02/2010|Established Member:09/2010|Contributor:09/2010|Elite:08/2013|

  8. #8
    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)
    WoW had a function called World::GetNearClip/World::GetFarClip. You will need correct clipping values if you want to draw with z-testing.
    I don't know if WoW does the same but WildStar sets the DepthStencilView to nullptr before it calls Present so you might have to grab the depth buffer by hooking OMSetRenderTargets or SetDepthStencilSurface for DX9.

  9. #9
    -Ryuk-'s Avatar Elite User CoreCoins Purchaser Authenticator enabled
    Reputation
    529
    Join Date
    Nov 2009
    Posts
    1,028
    Thanks G/R
    38/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by namreeb View Post
    Ryuk, if you get this working I hope you will share some of your experiences here. This is something I've always wanted to try but never got around to doing.
    Originally Posted by Master674 View Post
    WoW had a function called World::GetNearClip/World::GetFarClip. You will need correct clipping values if you want to draw with z-testing.
    I don't know if WoW does the same but WildStar sets the DepthStencilView to nullptr before it calls Present so you might have to grab the depth buffer by hooking OMSetRenderTargets or SetDepthStencilSurface for DX9.
    Yep, I was talking to someone on skype yesterday and remembered that. The problem is finding those functions again!
    |Leacher:11/2009|Donor:02/2010|Established Member:09/2010|Contributor:09/2010|Elite:08/2013|

Similar Threads

  1. Replies: 6
    Last Post: 08-20-2015, 02:04 AM
  2. [Selling] World of Warcraft Account with other Blizzard Games
    By RedTrainer0318 in forum WoW-US Account Buy Sell Trade
    Replies: 0
    Last Post: 07-31-2012, 12:26 AM
  3. 2.4 PTR - changes and additions to the in-game world
    By Vladinator in forum World of Warcraft Exploration
    Replies: 5
    Last Post: 02-11-2008, 03:02 AM
  4. Got a problem with items in-game.
    By razlken in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 01-25-2008, 10:44 PM
  5. Chat with people around the world, Using the CMD!
    By WoWLegend in forum Community Chat
    Replies: 4
    Last Post: 08-02-2007, 09:43 AM
All times are GMT -5. The time now is 06:08 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search