Saturday, August 17, 2019

Citra (Nintendo 3DS emulator) - SBS to 3D Vision -







3D Vision fix for Citra, the Nintendo 3DS emulator. This fix converts the native SBS (side by side) 3D mode to 3D Vision, thanks to the OpenGL wrapper that Helifax made (using the "OpenGL3DVision-v10.1.Beta" 64 bit version).


Update (2019-08-17): fix updated to improve the "less than 0.5" convergence case, to not clip the screen in "Large Screen" layout. I have added hotkeys and updated some sections.


Installation of the fix
- Download this file and extract its contents in the folder where "citra-qt.exe" is, like "Citra\nightly-mingw" if you use nightly builds.
- Open the properties of the "citra-qt.exe" file and check the "Run as administrator" checkbox. Just in case, do it for the other Citra exe files. This will allow the wrapper to create a profile for the emulator.


Configuration and running games
- Preferably, use Nvidia DSR to put your desktop at 4x your native resolution to avoid the pixelation of this 3D conversion (pixels will be twice as wide due to stretching, but DSR will hide that).
- Configure the emulator 3D options, setting "Stereoscopic 3D Mode" to "Side by Side" and whatever depth you like. I prefer 100%.



- You can also choose the "Background Color" you prefer for unused screen space.
- Make sure that in the current windows (or drivers) session you have used something in 3D at least once. Usually OpenGL refuses to trigger 3D Vision otherwise. For example, open a 3D screenshot, put it in fullscreen, enable 3D, exit fullscreen, and enable 3D again in windowed mode.
- After that, when you are ready to launch a game, preferably put the emulator window in fullscreen.
- Launch a game, and preferably press F11 to make it completely fullscreen. You may need to turn on 3D manually, if the emulator doesn't trigger it automatically.


Emulator window depth
You will see the game window at screen depth as the base depth. If the game doesn't use 3D or anything, you won't need the glasses. However, I made a screen depth feature that uses convergence as a modifier. It moves only the right eye image whe you push the screen to depth (+convergence) and the left eye image when you make it pop out (-convergence), to avoid image cropping in the "Large Screen" layout.

The Nvidia convergence I set for this fix is 0.50. This puts the game window at screen depth, with the formula I use. If you reduce convergence, the screen will pop out. If you increase convergence, it will be at more depth. This last thing is useful for games that use low separation, like "The Legend of Zelda: A Link Between Worlds".

If you exceed the useable limits, the image will break and you will see how this 3D mode conversion works.


Increasing Citra separation
Go to "C:\Users\YOURUSERNAME\AppData\Roaming\Citra\config", open "qt-config.ini", and edit the "factor_3d" setting to something higher than 100. The limit is 255. This way you can have a much higher separation than what the console allows.

Use it alongside pop out screen (see the section above) to make the game will effectively have more convergence, compensating the maximum separation of the infinite plane. At the cost of changing the depth of the HUD.


Touchscreen
The emulator expects you to click on the original squished touchscreen. However, due to this conversion, the screen won't have the same shape, so the ingame buttons you'll try to press won't be where you think they should be.


Hotkeys (not the numpad)
- 1: default convergence, 0.5. This puts the emulator screens at screen depth.
- 2 to 5: different pop out presets, from more pop out to less pop out.
- 6 to 0: different presets that push the screens to depth, from less to more.


Warning
In my experience, you can only play one game in one emulator session. If you want to play another game, close the emulator and open it again.

If a game can't be played in 3D on the real Nintendo 3DS, it can't be played in 3D at all. At most you can push the flat image to depth, if you like it.


For those interested in how I did this
To make this conversion, I needed to modify the "StereoShaders\stereo_frag.c" file. They are a few lines of code starting from line 60 ("//SBS to 3D Vision."). If you need to flip the eyes, just change the content of those "if/else" conditions.
I also changed some settings in "3DVisionWrapper.ini".


I have only played a handful of games, starting with the "Citra Nightly 1327" version.

5 comments:

  1. You guys never cease to surprise me. Cemu Zelda, now this...

    ReplyDelete
  2. First, thank you for intorducing me to Citra, I had no idea that there was a good 3DS emulator, I tried some of my games and most of them are working great. Playing Snake Eater in big screen with crisper visuals is a blessing.

    Second, thanks for the 3DV support, but Citra crashes with the fix for me when I use it with my 3DTV. It starts with sound, but no visuals, only showing Citra window as some kind of residual. When I minimize and maximize, it starts showing the game, I can see the interlaced lines, 3D works, but in a second it crashes with a error message about fonts, etc.

    I did everything as your instructions. My system is not ultra stable, so I'm not sure if it's my PC or the fix or the fix only intended for 3DV Ready displays, not for 3DTVs.

    I actually prefer playing with SBS, so tried your SBS to 3DV fix for the sake of curiosity and just wanted to let you know this as a feedback.

    ReplyDelete
    Replies
    1. I knew someone would have problems soon :p.
      There's something I noticed yesterday: to make it work correctly, you need to have used something in 3D in that windows session before. Like opening a 3D screenshot, putting it in fullscreen (make sure the glasses are working), close it and then try playing Citra.

      If I don't do that, I also get a corrupted Citra window. I'll add this as a warning later.

      Delete
  3. Wow amazing work Masterotaku!!! I got your fix working perfectly on my Windows 10 1803 build with recentish drivers. Citra with 3D vision looks 10x better than an OG 3DS :)

    I dual boot Windows 7 for compatibility purposes as Windows 10 is bound to eventually break 3D vision as it is no longer supported. Unfortunately I was not able to get your fix working on Windows 7. With Windows 7, I use an older driver (388.43) as it is one of the last to support quad buffered 3D in Opengl for things like gzdoom.

    Anyway once I have the fix setup in Windows 7 (and I made sure to run another 3D vision game prior), and I have things to launch in fullscreen, Citra just opens an invisible window (the 3D vision module is triggered and I can hear the game running but all I can see is my desktop).

    If I launch Citra in windowed mode, the game launches with a white box over everything. I can see tiny slivers of the game running in 3D at the top and bottom of the window, but the vast majority is covered by this white box no matter what settings I try.

    Any tips?

    ReplyDelete
    Replies
    1. The only tip I might have is in the instructions:
      "Make sure that in the current windows (or drivers) session you have used something in 3D at least once. Usually OpenGL refuses to trigger 3D Vision otherwise. For example, open a 3D screenshot, put it in fullscreen, enable 3D, exit fullscreen, and enable 3D again in windowed mode."

      Sometimes I have to try a few times before it works, sometimes restarting the drivers, or keeping a 3D screenshot open. Other times it works right away. All on Windows 10, though. I haven't used Windows 7 since 2017.

      Delete