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 (2020-02-07): fix updated with performance optimizations (basically, deleted unnecessary code for this fix from the files in the "StereoShaders" folder). You may see 10-20% lower GPU usage now. Still higher than not using this fix, but better than before.

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. Sometimes 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.
- IMPORTANT: open two instances of Citra and play in the second one. This is necessary to make 3D Vision work.
- 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 (the first time. For next game launches, it's preferable to let them use fullscreen directly to avoid distortion). 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
First make sure you don't have any emulator instance or process running. Then 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".

15 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
  4. Increasing Citra separation:

    I did some testing on a bunch of 3DS games at different depths. Remember to enable pop out mode in the in game options for 3D classics and Mario Land 3D. Here's what I've got so far:

    80s Overdrive: 150
    Streets of Rage: 200-255
    Sonic 2: 200
    Mario Kart 7: 255
    New Super Mario Bros 2: 255 (use nightly, crashes on canary)
    Ecco the Dolphin: 255
    3D Space Harrier: 255
    Shantae and the Pirate's Curse: 255
    Dragon Quest 7: 150
    Speed X 3D Hyper Edition: 100 (extreme depth by default)
    Zelda Majora's Mask: 200 (requires touch screen button to access menu)
    Zelda Ocarina of Time: 100-125 (with 125, preset 3 converges on Link when camera's at a normal distance, also requires touch screen to access the menu)
    Bravely Second: 150
    Zelda A Link Between Worlds: 255 (excellent 3D, but crashes consistently at the first boss)
    Star Fox 64: 255 (underclock the emulated CPU to 25% for the best performance)
    Yoshi and Poochy's Woolly World: 200-255
    Tetris: 255 (playing field is flat, but backgrounds have depth, and there's an animation that plays when you get a Tetris in the foreground)
    Cave Story: ~200?
    Mario 3D Land: 255 (underclocking emulated CPU might help performance?)
    Culdcept Revolt: 125

    ReplyDelete
  5. Bonjour et merci a masterotaku pour tous sont travail sur les différent jeux fixer, en essayent une version différente de Citra, j’ai découvert que l’écran tactile en 3D avez tous les boutons au bonne endroit ! Je vous mais le lien de cette version : https://lunrealgameria.com/emulateur-3ds-citra/download/








    Écran tactile
    L’émulateur s’attend à ce que vous cliquiez sur l’écran tactile écrasé d’origine. Cependant, en raison de cette conversion, l’écran n’aura pas la même forme, de sorte que les boutons ingame que vous allez essayer d’appuyer ne seront pas là où vous pensez qu’ils devraient être.

    (Résolue)

    ReplyDelete
  6. Hi Masterotaku, thank you so much, thank you so much for the fix, is a great job! I followed all your steps, but unfortunately doesn't work for me, maybe your fix is incompatible with my 13.4.0 citra valentin version, but specifically, after install the fix and followed all your tips to make 3D work, I still see double screen on my display, even keeping a 3D activate screenshot in background...am I wrong something? Can I do something to solve? any help would be greatly appreciated...thanks in advance!

    ReplyDelete
    Replies
    1. Also tried all emulator's internal resolutions...but no way...

      Delete
    2. here,gtx 1080ti
      i7 8700k
      pilote 325.31
      citra 13.4.0
      works at the top in 3d visions

      Delete
  7. I have tried using it before with success but now it doesn't seem to work. When I play for example super mario 3DS in citra, it says everything is active and that NVIDIA 3D vision is enabled, but the 3D emitter for NVIDIA 3D vision will not go bright green and trigger. I cannot seem to figure out what I am doing wrong. I have tried starting other working 3D applications before using Citra with 3D vision and it still will not trigger.

    ReplyDelete
  8. It's not working here either, it doesn't look like Citra is triggering the OpenGL wrapper, I changed the line "EnableSplashScreen = false" to true and there's no splash screen when the opengl32.dll is in the same folder as citra-qt.exe

    ReplyDelete
    Replies
    1. this version seems to be hooking/working correctly, someone mentioned it in a post about ReShade not working...
      https://github.com/citra-emu/citra-nightly/releases/tag/nightly-1893

      Delete
  9. Is there any way to use view > screen layout > separate windows so you could have the touchscreen be in 2D on another monitor?

    ReplyDelete