Dolphin, the GameCube and Wii emulator - Forums

Full Version: 3D Vision patch (v2 !!)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
It's quite simple - don't use the crappy 3D implementatoin in Dolphin with DX9. Use Dx11 and press the 3D hotkey (consult Nvidia panel) to toggle the effect anytime. The game will be rendered in true 3D (no difference than Dx9 3D) and it's perfectly stable with not a single issue. Not sure why others haven't found this out. I posted this all over the dolphin goolge code issues and got zero response.

They basically need to pull out whatever they did in Dolphin and simply let nvidia handle it with the hotkey just like all the pc games out (Batman, etc). Not sure what they did or why but it seems 100% unneccesary to me. I've had 2 different 3D monitors and have been 3Ding games for years - I know what I'm doing here - and I'm telling you to use Dx11 (if you can) for all this until they fix DX9 properly.

Half of my GC/Wii games render fine in 3D, the rest have various shadow/depth issues which are completely out to the devs hands - every game does it's own thing with rendering, no different than all the pc games out there - some have issues, some are perfect, without even developing for 3D.
Interesting... this doesn't work for me. When I change to the DX11 renderer, start the game, and press Ctrl+T (which is the 3D enabler) nothing happens. From what I understand, Dolphin basically uses windowed mode 3D, and that's why the Nvidia drivers can't detect it and start rendering the game in stereo 3D. The DX9 3D Vision checkbox simply puts Dolphin in exclusive full screen mode like most every other 3D application. Not sure why Dolphin does window mode rendering in the first place... seems strange. If it didn't, no special effort for stereo 3D support would be needed.

Of course, all of this ignores the fact that 3D Vision now supports windowed mode stereo 3D, but that has to be coded in, which seems like it won't happen. DX11 is now supported by 3D Vision as well, where it used to only be DX9, which explains why they only bothered with DX9 in the first place.

What exact steps are you using to enable Stereo 3D in DirectX 11 mode? What is your setup? I'd love to know. To get it working for me, I've had to reduce my resolution to 1280x1024, strech the aspect ratio to window, and then set my monitor stretch to full screen. This works... but isn't as high res as I'd like. Any other aspect ratio except 4:3 and 5:4 just makes various elements render wrong in Zelda Skyward Sword.
(03-18-2012, 04:13 PM)zelin Wrote: [ -> ]What exact steps are you using to enable Stereo 3D in DirectX 11 mode? What is your setup? I'd love to know. To get it working for me, I've had to reduce my resolution to 1280x1024, strech the aspect ratio to window, and then set my monitor stretch to full screen. This works... but isn't as high res as I'd like. Any other aspect ratio except 4:3 and 5:4 just makes various elements render wrong in Zelda Skyward Sword.

Huh, I guess it could have to do with my new 3D monitor - AcerH274R (passive 3D). I can enable 3D in DX11 at any time (windowed or fullscreen) with my Nvidia hotkey at my default 1920x1080 res. See screenshot (windowed). Nothing else special - pc info in sig.
Is this Nvidia Only ?
(03-19-2012, 11:35 AM)Gir Wrote: [ -> ]Is this Nvidia Only ?

I THINK it may work with AMD 6xxx, but idk for sure.
(03-19-2012, 03:39 AM)Legend80 Wrote: [ -> ]
(03-18-2012, 04:13 PM)zelin Wrote: [ -> ]What exact steps are you using to enable Stereo 3D in DirectX 11 mode? What is your setup? I'd love to know. To get it working for me, I've had to reduce my resolution to 1280x1024, strech the aspect ratio to window, and then set my monitor stretch to full screen. This works... but isn't as high res as I'd like. Any other aspect ratio except 4:3 and 5:4 just makes various elements render wrong in Zelda Skyward Sword.

Huh, I guess it could have to do with my new 3D monitor - AcerH274R (passive 3D). I can enable 3D in DX11 at any time (windowed or fullscreen) with my Nvidia hotkey at my default 1920x1080 res. See screenshot (windowed). Nothing else special - pc info in sig.

Yeah, that's strange. That doesn't work for me. I've even set my monitor to always be in 3D mode, and pressed Ctrl+T, but that does nothing in DirectX11. We even have the exact same video card. What drivers are you using? Can you send a screenshot of your "Set up stereoscopic 3D" screen in the Nvidia Control Panel? Have you actually tried Zelda: Skyward Sword? Does Stereo 3d work with this game in Directx11?
(03-30-2012, 02:21 PM)zelin Wrote: [ -> ]Yeah, that's strange. That doesn't work for me. I've even set my monitor to always be in 3D mode, and pressed Ctrl+T, but that does nothing in DirectX11. We even have the exact same video card. What drivers are you using? Can you send a screenshot of your "Set up stereoscopic 3D" screen in the Nvidia Control Panel? Have you actually tried Zelda: Skyward Sword? Does Stereo 3d work with this game in Directx11?

The hotkey on both of my acers monitors toggles the 3d effect in any dx game. I have the 460gt w/295 drivers. I don't have Zelda.
(03-30-2012, 02:21 PM)zelin Wrote: [ -> ]Have you actually tried Zelda: Skyward Sword? Does Stereo 3d work with this game in Directx11?

I'm currently making patches for Skyward Sword because I want to finally play this game in Stereo3D (NVidia 3DTV Play 720p 16:9). The current state is: Some level parts are only rendered for the left eye.

Here are my patches so far:

1) Enable stereo handling for frame buffer elements in general for DX11.
Core/VideoCommon/Src/TextureCacheBase.cpp - TextureCache::CopyRenderTargetToTexture

unsigned int scaled_tex_w = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledX(tex_w) : tex_w;
unsigned int scaled_tex_h = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledY(tex_h) : tex_h;
+ if (tex_w < 640 || tex_h < 528 || tex_w == tex_h)
+ {
+ scaled_tex_w = Renderer::GetBackbufferWidth();
+ scaled_tex_h = Renderer::GetBackbufferHeight();
+ }

Without the above patch, many 2D stats are killing areas of stereovision on screen. Example: Mario Kart multiplayer lower-right screen, Mario Galaxy Luigi Ghost House player statistics upper left screen, etc.)

2) Bad post processing removal by replacing ugly effects with transparent texture.
Plugins/Plugin_VideoDX11/Src/TextureCache.cpp

added code:
static D3DTexture2D *transparentTexture = 0;
static void CreateTransparentTexture()
{
const int SIZE = 32;
transparentTexture = D3DTexture2D::Create(SIZE, SIZE, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC, DXGI_FORMAT_R8G8B8A8_UNORM, 1);
// Lock the surface and write the alpha values.
D3D11_MAPPED_SUBRESOURCE texmap;
HRESULT hr = D3D::context->Map(transparentTexture->GetTex(), 0, D3D11_MAP_WRITE_DISCARD, 0, &texmap);
if (FAILED(hr)) PanicAlert("Failed to map a texture at %s %d\n", __FILE__, __LINE__);
for (int y = 0; y < SIZE; y++)
{
u32* pDst32 = (u32*)((u8*)texmap.pData + y * texmap.RowPitch);
for (int x = 0; x < SIZE; x++)
{
*pDst32++ = 0x00000000;
}
}
D3D::context->Unmap(transparentTexture->GetTex(), 0);
}
void TextureCache::TCacheEntry::BindTransparent(unsigned int stage)
{
if (!transparentTexture) CreateTransparentTexture();
D3D::context->PSSetShaderResources(stage, 1, &transparentTexture->GetSRV());
}

Plugins/Plugin_VideoDX11/Src/VertexManager.cpp - VertexManager::vFlush()

add after here:
// 0s are probably for no manual wrapping needed.
PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0);

if (tentry->IsEfbCopy())
{
// Replace alpha blend effects with transparent texture.
if (bpmem.blendmode.blendenable && (
// Zelda TP: Unknown 2D post processing resulting in blurry screen
(i == 0 && tentry->format == 0xb && tentry->native_width == 304 && tentry->native_height == 224) ||
// Metroid M: Unknown lighting effect causing extreme color flicker
(i == 0 && tentry->format == 4 && tentry->native_width == 160 && tentry->native_height == 120) ||
// Zelda SS: Unknown 2D post processing resulting in blurry screen
(i == 1 && tentry->format == 6 && tentry->native_width == 608 && tentry->native_height == 456) ||
false))
{
tentry->BindTransparent(i);
}
// Skip distorting post processing effects.
else if (!bpmem.blendmode.blendenable && (
// Metroid M: Unknown 2D post processing killing stereo in upper half of screen
(i == 0 && tentry->format == 6 && tentry->native_width == 640 && tentry->native_height == 480) ||
false))
{
goto shader_fail;
}
// Fix accumulated Z-Position.
if (// Zelda TP: Water effect.
(bpmem.blendmode.blendenable && i == 0 && tentry->format == 6 && tentry->native_width == 304 && tentry->native_height == 224) ||
false)
{
absoluteWPos = true;
}
}

3) Fix wrong sized rendertarget to texture blits
Core/VideoCommon/Src/BPFunctions.cpp - CopyEFB

// bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
if (g_ActiveConfig.bEFBCopyEnable)
{
// Zelda SS: Softener effect resolution fix.
if ((dstFormat == 4 && srcRect.left == 0 && srcRect.top == 0 && srcRect.right == 554 && srcRect.bottom == 456) ||
(dstFormat == 4 && srcRect.left == 0 && srcRect.top == 0 && srcRect.right == 526 && srcRect.bottom == 456))
srcRect.right = 608;

This fixes all distortions.

Edit: Screenshot added.
[attachment=7597]
Could you post a compile with these changes? Also, can you put them into the DX9 driver as well? I can't get 3D working in DX11 for some reason. One good thing is that using the newest beta drivers (301.24) 3D Vision now detects 3D in a window and renders that in stereo as well. So I don't need to use the 3D Vision checkbox to get it working anymore in DX9. However, I'm still getting some stuttering issues unless I enable the checkbox, so I wouldn't remove it. DX11 is still a no go for me no matter what I've tried.

Have you seen my thread about the rendering problems? It turns out that having the trees not render in one eye only happens in certain resolutions. In other resolutions, there are other problems, such as blurred parts not rendering in 3D, double images, or only objects rendered in 3D. In some resolutions nothing is rendered in 3D. All of these problems go away when Scaled EFB Copy is unchecked, but then the game looks low-res. Here is the link: http://forums.dolphin-emu.org/showthread.php?tid=20734
(04-16-2012, 02:02 PM)zelin Wrote: [ -> ]Could you post a compile with these changes?
Here you go: http://www.multiupload.ch/2RXWYF9A0C
It's the complete package with the whole stuff (custom textues, saves, settings), which might be a problem to post here. If someone complains, please remove the problematic items and reupload.
See below for updated Dolphin.exe .

(04-16-2012, 02:02 PM)zelin Wrote: [ -> ]Also, can you put them into the DX9 driver as well?
Done.

(04-16-2012, 02:02 PM)zelin Wrote: [ -> ]I can't get 3D working in DX11 for some reason.
That's easy to fix: Dolphin doesn't create the device using a correct window handle! The window for CreateDevice has to have it's own device context, which means it has to be the main application window. Also the device should be created full-screen.

Change the following line in D3DBase.cpp:
> swap_chain_desc.Windowed = TRUE;
to
> swap_chain_desc.Windowed = FALSE;

And in EmuWindow.cpp in OpenWindow:
> wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
to
> wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
and
> m_hWnd = CreateWindow(m_szClassName, title, (g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision) ? WS_EX_TOPMOST | WS_POPUP : WS_CHILD, 0, 0, width, height, m_hParent, NULL, hInstance, NULL);
to
> m_hWnd = CreateWindow(m_szClassName, title, WS_OVERLAPPEDWINDOW, 0, 0, width, height, GetDesktopWindow(), NULL, hInstance, NULL);

You should be able to run DX11 with my build (just run, no switching, 3d enable/disable etc.). But I had to hardcode the refresh rate to 60Hz (3DTV Play shit).

(04-16-2012, 02:02 PM)zelin Wrote: [ -> ]One good thing is that using the newest beta drivers (301.24) 3D Vision now detects 3D in a window and renders that in stereo as well. So I don't need to use the 3D Vision checkbox to get it working anymore in DX9. However, I'm still getting some stuttering issues unless I enable the checkbox, so I wouldn't remove it. DX11 is still a no go for me no matter what I've tried.
Checkbox is still needed for fullscreen. I wouldn't try gaming in a window because the driver isn't working at full speed then and it just seems ugly.

(04-16-2012, 02:02 PM)zelin Wrote: [ -> ]Have you seen my thread about the rendering problems? It turns out that having the trees not render in one eye only happens in certain resolutions. In other resolutions, there are other problems, such as blurred parts not rendering in 3D, double images, or only objects rendered in 3D. In some resolutions nothing is rendered in 3D. All of these problems go away when Scaled EFB Copy is unchecked, but then the game looks low-res. Here is the link: http://forums.dolphin-emu.org/showthread.php?tid=20734
Thanks. I tried different resolutions, but in DX11 the result is always the same (no rendering on right eye). If I disable scaled EFB Copies, different shaders are used and I don't have any stereovision at all.

Update:
Got DX9 working. There is some window-resize code which kills the render device in full screen setup. I had to delete the following lines to be able to use full screen in DX9.

Plugin_VideoDX9/Src/Renderer.cpp - Swap
> SetWindowSize(fbWidth, fbHeight);
>
> const bool windowResized = CheckForResize();

replace those 3 lines with
> const bool windowResized = false;

and you're fine.

Update:
Got everything working in DX9 and DX11. The problem was a 32x32 size framebuffer with invalid Z data. I made a new rendersystem specific method to fix framebuffer sizes which ignores sizes 32 or lower.

void Renderer::EFBToScaledFix(const float tex_w, const float tex_h, unsigned int &scaled_tex_w, unsigned int &scaled_tex_h)
{
if ((32 < tex_w && tex_w < 640) || (32 < tex_h && tex_h < 528) || (tex_w > 32 && tex_w == tex_h))
{
scaled_tex_w = Renderer::GetBackbufferWidth();
scaled_tex_h = Renderer::GetBackbufferHeight();
}
}

Here's the updated Dolphin.exe: http://www.multiupload.ch/9BWF9AA5GR

Update: Could someone please add screen refresh rate selection in dolphin GUI?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18