Sunday, May 24, 2020

RPCS3 (PlayStation 3 emulator) [OpenGL]







3D Vision fix for RPCS3, the PlayStation 3 emulator. This fix was made thanks to the OpenGL wrapper that Helifax made (using the "OpenGL3DVision-v10.1.Beta" 64 bit version).


Update (2020-05-24): fix updated to work with newer emulator versions (at least 0.0.10-10425), because recently something changed in the code of the shaders. You can download the old fix here. The most recent fix is in the installation steps below.


Installation of the fix
- Download this file and extract its contents in the folder where "rpcs3.exe" is, like "rpcs3-v0.0.6-8503-f2a2dfda_win64" (it changes per build).
- Open the properties of the "rpcs3.exe" file and check the "Run as administrator" checkbox.


Configuration and running games
Configure the emulator options like this (globally or per game):
- GPU -> Renderer -> OpenGL
- Emulator -> Emulator Settings -> Automatically start games after boot
- Emulator -> Emulator Settings -> Start games in Fullscreen mode
- Emulator -> Emulator Settings -> Use native user interface

Choose the rest of settings as you like, like resolution scale, anisotropic filter, etc. That can be game dependant or depending on your hardware.
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 everything is configured and prepared, play a game. After you are ingame, you can press the "Pause" key to disable the top right information window.


Fps limits
The OpenGL wrapper works in a way that divides fps by two in 3D. It means that for games like these you will be capped at half the fps per eye. If a game is usually 30fps in 2D, it means 15fps per eye in 3D. It it's 60fps in 2D, then 30fps per eye in 3D.

This is done in a frame sequential way. Each frame happens in a different moment in time. To give a simple example, imagine L1 is frame one (in time terms) going to left eye, R2 is frame two going to right eye, and so on:
- DirectX with 3D Vision Automatic: L1 R1 L2 R2 L3 R3 L4 R4. Four moments in time, eight total eye frames.
- OpenGL with this wrapper: L1 R2 L3 R4. Four moments in time, four total eye frames. You get half the visual information than DirectX in the same time.

To get 60fps per eye, you need games to run at 120fps in 2D. Thankfully, some games have patches for increased fps in RPCS3, surpassing the original capabilities. Let's take Demon's Souls as an example, which is an originally 30fps game.


Save that as "patch.yml" in the emulator folder. Make sure you have made a custom config for the game (right click a game and configure something for it) and then edit its yml file inside the "config\custom_configs" folder.

With "Vblank Rate: 120", the game will run at real 60fps, meaning 30fps per eye.
The other setting they tell you to change is "Clocks scale: 200". However, this doesn't control something important about game speed in this case. Instead, it controls the frame skipping rate of the game. It means that the game will always be targeting the full framerate, but when your PC can't keep up, it will display a black frame (for one of the eyes). Thankfully, the eyes remain synchronized, but these black frames can be very annoying. I recommend leaving Clocks scale at 100 (the original 30fps 2D). I prefer slowdowns rather than black frames.

You can set the vblank rate to 240 to get 60fps per eye (and also enable the 120fps patch), but realistically in 2019 we can't reach that number with current CPUs.

Silent Hill Downpour works at 60fps 2D (30fps 3D) with just the "Vblank Rate: 120" setting.


Problems and limitations
OpenGL is noticeably slower and has more graphics glitches than Vulkan in this emulator. If you can get good fps in Vulkan it doesn't mean they will be so close to that in OpenGL.

If a game for some reason closes the game window to open it later, it will inevitably crash. Example: Kingdom Hearts 2.5, or sometimes when the emulator wants to compile PPU modules after a game has started (which usually happens just once).


Hotkeys
- 0 to 9 (not the numpad): multiple convergence settings, from lower to higher. Default is 1 convergence. Each game will need different numbers and you can edit them in "3DVisionWrapper.ini", after the ";Convergence hotkeys." line.


Game fixes
For now, this fix specifically fixes all 3D issues of Demon's Souls (haloing, water and shadows).

The rest of games should already have basic stereoization and should be playable, if the emulator works in 2D already. I can't promise any game specific fix other than this or other future games I feel like fixing, because the fixing process in this case is tedious and time consuming.

If the emulator can at some point in the future make native 3D modes work, I'll try to adapt that to 3D Vision.


If you liked the fix and want to contribute for more future fixes, you can donate to this PayPal account: masterotakusuko@gmail.com

15 comments:

  1. Whaaaat? omg you are amazing bro!!

    ReplyDelete
  2. Amazing work Masterotaku
    Can`t thank you enough for all the hard work you have done!

    ReplyDelete
  3. Got the Flamelurker caught there, did you? One thing I'm curious about is how the targeting dot is handled in Demon's Souls. On the PC, it's at the same depth as the rest of the HUD (I usually have it at 0.7). Is the targeting dot still the same as HUD depth? HUD depth is screen depth 0 in this case? I don't think my system is really up to handling RPCS3, I'm more just curious how the 3D effects in Demon's Souls emulated compare to the 3D effects in Dark Souls native PC versions.

    ReplyDelete
    Replies
    1. "Got the Flamelurker caught there, did you?" -> Yes, but that strategy was so boring and slow that I beat it the normal way.

      The HUD in all games, unless something unexpected happens, should be at screen depth. Including the targeting textures in Demon's Souls.

      I don't know if I would be able to identify HUD shaders in a generic way without breaking other effects. The find/replace features in this wrapper aren't as useful as a regex replacement and there aren't infinite slots for that (I'm already using most of them).
      Remember that emulators usually make shaders change after a short time or even depending on settings, so doing an HUD mod with dumped shaders would be a bad idea. So things will stay as they are now for the moment.

      Delete
  4. Amazing!!! PS3 in 3d (even for games not made to be in 3d)! Thanks Masterotaku! We have Dolphin (Wii + gamecube), PS2, now PS3, and PSP that can be played in 3D.. Any other emulators that work with 3d Vision?

    ReplyDelete
    Replies
    1. RetroArch (for the VirtualBoy, NES, Sega Master System, and some anaglyph PS1 games): https://helixmod.blogspot.com/2018/04/retroarch-dx11.html
      Project64: https://helixmod.blogspot.com/2018/08/nintendo-64-jabos-direct3d-plugin-dx11.html

      I'm currently working on putting a Nintendo DS emulator called "melonDS" in 3D, but I don't know if I'll be able to reach perfect results.

      Delete
  5. And the new 3ds emu work with 3d vision now, too (almost forgot).

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. I got this error:rsx:linkage failed:vertex info
    0(340):error C1503:undefined variable "tmp15"
    (0) error C2003:imcompatible options for link
    Any help,please?

    ReplyDelete
    Replies
    1. Download the fix again now. I've corrected the fix for the changes in the emulator.

      Delete
  8. @masterotaku, thank you so much for this fix! I seem to be having some difficulty with the shadows in demons souls, like character shadows are in one eye and other object shadows in the game are in the other eye. Any idea why that might be happening? This happens whether or not I am using the 60fps patch as well.

    ReplyDelete
  9. Thank you so much

    ReplyDelete
  10. @masterotaku, thnx for the amazing fix. I was wondering if you might have any plans of updating the fix especially with Vulkan now that RPCS3 supports playstation 3d. Game specific fixes are tedious but it would be a dream come true to play Tekken games in 3D Vision :)

    ReplyDelete
  11. Thank you so so much!!! 3d gaming and VR forever!!!!

    ReplyDelete