DirectX Rendering in 4.0.1 menu

User Tag List

Results 1 to 13 of 13
  1. #1
    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)

    DirectX Rendering in 4.0.1

    Has anyone else come across the issue of not seeing any objects rendered (user defined) via an end scene hook, ever since the Cata patch?

    Currently I am using an implementation from a few patches ago that I was working on about the same time mnbvc was also (refer to http://www.mmowned.com/forums/world-...gameworld.html). Both the new offsets for the Camera struct (wow.exe base + 0x00981C20) and Cam offset (0x7F4 have been applied. Otherwise I have not changed anything else with rendering.

    I am guessing this is something new to do with Blizzard implementing new lighting or shader effects (what with the new fancy flare effects on the Azeroth's sun). Unfortunately I am not very familiar with those areas of DirectX to know which of the 200 or so RenderState's to play with. Cheers if anyone has already solved this and has an idea of where I should be looking.

    DirectX Rendering in 4.0.1
  2. #2
    Tobii's Avatar MMOwned Helper Authenticator enabled
    Reputation
    263
    Join Date
    Aug 2007
    Posts
    303
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have this issue when i tab out of the game and back in..
    But well, its only from time to time..

  3. #3
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not experiencing any problems here...

    How do you build your Projection and View matrices?
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  4. #4
    adaephon's Avatar Active Member
    Reputation
    76
    Join Date
    May 2009
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try rendering something on the screen that doesn't rely on WoW's camera structure just to see if it is the rendering or the object/world or world/screen matrices stuffing you around. For example, I can render a basic primitive (such as a rotating cube) in game without any problems, but it uses my own matrix and consequently always sits in the middle of the screen (like a UI overlay).

  5. #5
    _Mike's Avatar Contributor
    Reputation
    310
    Join Date
    Apr 2008
    Posts
    531
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's how I do it, the only problem is that depth testing doesn't work because the ZNear and ZFar values of my projection matrix are wrong. I haven't had any luck finding the proper values yet.
    If you're not using shaders just replace _shaderConstants->SetMatrix() with IDirect3DDevice9::SetTransform()
    Let me know if something is unclear and I'll post more code.
    Code:
    void D3D::BeginDrawing(const Camera* cam)
    {
    	if(_stateblock)
    	{
    		_stateblock->Release();
    		_stateblock = NULL;
    	}
    	//FIXME: Add error checking..
    	dev->CreateStateBlock(D3DSBT_ALL, &_stateblock);
    
    	//FIXME: Needs the real ZNear/ZFar, can't find them in the camera struct any more.
    	D3DXMatrixPerspectiveFovRH(&_projMatrix, cam->Fov() * 0.6f, cam->AspectRatio(), 0.0f, 10000.0f);
    	D3DXVECTOR3 eye = cam->Position();
    	D3DXVECTOR3 at = eye + cam->ForwardVector();
    	D3DXMatrixLookAtRH(&_viewMatrix, &eye, &at, &D3DXVECTOR3(0, 0, 1));
    
    	dev->SetVertexShader(_vs);
    	dev->SetPixelShader(_ps);
    
    	_shaderConstants->SetMatrix(dev, "View", &_viewMatrix);
    	_shaderConstants->SetMatrix(dev, "Proj", &_projMatrix);
    
    	dev->SetVertexDeclaration(_vdecl);
    	dev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    	dev->SetRenderState(D3DRS_LIGHTING, FALSE);
    	dev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
    	dev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
    	dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
    }
    
    void D3D::EndDrawing()
    {
    	if(_stateblock)
    	{
    		_stateblock->Apply();
    		_stateblock->Release();
    		_stateblock = NULL;
    	}
    }
    
    void D3D::DrawCube(D3DXVECTOR3 const& targetpos)
    {
    	if(dev->TestCooperativeLevel() != D3D_OK)
    		return;
    
    	D3DXMATRIX world;
    	D3DXMatrixIdentity(&world);
    	D3DXMatrixTranslation(&world, targetpos.x, targetpos.y, targetpos.z);
    	_shaderConstants->SetMatrix(dev, "World", &world);
    
    	dev->SetStreamSource(0, _cubeVB, 0, sizeof(D3DVERTEX));
    	dev->SetTexture(0, _cubeTexture);
    
    	dev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 12);
    }
    In my EndScene hook:
    Code:
    d3d->BeginDrawing(cam);
    std::for_each(Objects.begin(), Objects.end(), [&d3d](std::pair<wowguid, WowObject*> obj) {
    	if(obj.second->Name() == "Ragged Young Wolf")
    	{
    		d3d->DrawCube(obj.second->Position());
    	}
    });
    d3d->EndDrawing();
    Last edited by _Mike; 10-25-2010 at 01:18 PM.

  6. #6
    caytchen's Avatar Contributor
    Reputation
    138
    Join Date
    Apr 2007
    Posts
    162
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why recreate and kill your stateblock every single time? Then again, I'm having problems properly releasing the resources for my stuff; pre-Reset for some weird reason doesn't work and I get a Reset() deadlock whenever the device is lost since D3D tells me I have not released all my resources. VS Debugger fails me on this, too. (just goes into its typical "resume execution and pretend we were not single-stepping before" mode)

  7. #7
    _Mike's Avatar Contributor
    Reputation
    310
    Join Date
    Apr 2008
    Posts
    531
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Robske. I never expected the FarZ to be as small as 1.0 All the d3d tutorials I've looked at has always had it as a really big number.

    Originally Posted by caytchen View Post
    Why recreate and kill your stateblock every single time?
    Because when I cached the stateblock wow on rare occasions uses different render states that what is stored in the stateblock and I get weird results. And recreating it once per frame isn't any noticeable performance hit for me.
    Last edited by _Mike; 10-25-2010 at 01:46 PM.

  8. #8
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by _Mike View Post
    Thank you Robske. I never expected the FarZ to be as small as 1.0 All the d3d tutorials I've looked at has always had it as a really big number.
    I deleted my post because I was unsure and wanted to check, but seems like you already verified it...

    Part of the updated camera struct:

    ...
    Vec3 position
    Mat3 matrix
    float fov
    float unk0
    int unk0
    float NearZ
    float FarZ
    ...
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  9. #9
    _Mike's Avatar Contributor
    Reputation
    310
    Join Date
    Apr 2008
    Posts
    531
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And the AR has been removed from the camera struct (or moved really far down, I only scanned the first 100 bytes or so). I'm reading it from
    **(float**)(wowbase + 0x8260A4);

  10. #10
    martinochsan's Avatar Member
    Reputation
    -9
    Join Date
    Sep 2008
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rendering is damn hard :P

  11. #11
    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)
    Still no cigar...generally what value should we expect for the Camera->aspect? I would have thought 1.7333... (for 1920x1080 reso), but I could not find such a value in the camera struct. In relation to the camera struct can anyone foresee any problems with this specification:

    Code:
    struct SCameraInfo
    {
    	DWORD	dwFoo1[2]; 
    	float	fPos[3];
    	float	fViewMat[3][3];
    	float	fFov;
    	float	unknown0;
    	int	unknown1;
    	float	zNearPlane; 
    	float	zFarPlane; 
    	float	aspect;
    };
    Also perhaps I am doing something in my matrices that I am just overlooking:


    Code:
    cam = (SCameraInfo*)*((DWORD*)((*(DWORD*)(GetWoWBase() + 0x00981C20))+0x7F48));
    
    D3DXMatrixPerspectiveFovRH( Proj, cam->fFov*0.6, cam->aspect, 0.0f, 1.0f );
    
    D3DXVECTOR3 vEyePt( cam->fPos[0], cam->fPos[1], cam->fPos[2] );
    D3DXVECTOR3 vLookatPt = vEyePt + D3DXVECTOR3(cam->fViewMat[0][0], cam->fViewMat[0][1], cam->fViewMat[0][2]);
    D3DXVECTOR3 vUpVec( 0.0f, 0.0f, 1.0f );
    D3DXMatrixLookAtRH( View, &vEyePt, &vLookatPt, &vUpVec );
    
    pDevice->SetVertexShader(NULL);
    pDevice->SetPixelShader(NULL);
    
    pDevice->SetTransform(D3DTS_VIEW, &View);
    pDevice->SetTransform(D3DTS_PROJECTION, &Proj);
    
    D3DXMatrixIdentity(&World);
    D3DXMatrixTranslation(&World, x, y, z);
    pDevice->SetTransform(D3DTS_WORLD, &World);
    Otherwise I can just draw standard trianglestrips using DrawPrimitiveUP (not in wow's 3D plane).

    Edit: I should have refreshed my browser, didn't see your post about the Aspect Ratio _Mike.
    Last edited by Harland; 10-26-2010 at 05:50 AM.

  12. #12
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by _Mike View Post
    And the AR has been removed from the camera struct (or moved really far down, I only scanned the first 100 bytes or so). I'm reading it from
    **(float**)(wowbase + 0x8260A4);
    Thanks, but I'll stick to calculating it manually for now - don't feel like maintaining an offset for something as trivial as this.
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  13. #13
    abdula123's Avatar Sergeant
    Reputation
    14
    Join Date
    Feb 2010
    Posts
    46
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in 3.3.5a zNearPlane was always 0.2, and zFarPlane was dependent on graphics settings (AFAIR - from 182 to 720)

    so I test value 180 as zFarPlane on 4.0.3a with lowest graphics settings

    (also I set Viewport's minZ = 0, and maxZ = 0.94 before drawing)

    http://filebeam.com/eec55dfbd2970594...877e0b362b.jpg

    positioning looks good (z-buffer work almost ok, except small errors on far distances caused by small zFarPlane miss)



    but I want to draw my graphics below user interface frames

    so I hooked SetViewport call , and do my drawings not before EndScene call, but before second SetViewport call

    ...... EndSecene ......
    minz, maxz 0.0 0.94
    ------------> there my drawings <-----------
    minz, maxz 0.998047 0.999023
    minz, maxz 0.0 0.94
    minz, maxz 0.999023 1.0
    minz, maxz 0.0 0.94
    minz, maxz 0.0 0.94
    minz, maxz 0.999023 1.0
    minz, maxz 0.0 0.94
    minz, maxz 0.0 1.0
    minz, maxz 0.0 1.0
    minz, maxz 0.0 0.94
    minz, maxz 0.0 1.0
    ...... EndSecene ......

    http://filebeam.com/1e82d635440a8834...93c07901f4.jpg

    ui not overlayed, but fps fall down.



    ----
    anybody found new location of zFarPlane and other?
    Last edited by abdula123; 11-30-2010 at 05:55 AM.

Similar Threads

  1. Rendering ADT with DirectX
    By ejt in forum WoW Memory Editing
    Replies: 2
    Last Post: 07-28-2017, 11:39 AM
  2. Disabling DirectX rendering on D3D11 game.
    By larcerkev in forum Programming
    Replies: 1
    Last Post: 11-16-2014, 10:52 PM
  3. DirectX Rendering Overlay Issues
    By lanman92 in forum WoW Memory Editing
    Replies: 1
    Last Post: 09-05-2011, 01:10 AM
  4. Implementation Suggestions for Managed DirectX Rendering
    By Harland in forum WoW Memory Editing
    Replies: 7
    Last Post: 07-24-2010, 02:04 AM
  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 12:46 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