PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.09k stars 1.56k forks source link

PCSX2 Stereo 3D (Request to get a patch applied to mainline) #1461

Closed Sarania closed 2 years ago

Sarania commented 8 years ago

So recently CHRONOMASTER got the GSdx Stereoscopy patch working with modern GSdx. I've tested it, it works quite well(but not with all games, about half of what I tried). Because it seems to be on it's own codepath and is just enabled/disabled by a checkbox, I really don't see any reason to not put it in the official PCSX2. With the stereo option disabled it just behaves like normal GSdx.

Of course it's possible there is something I'm missing(and I haven't seen the actual code) so of course we need to discuss and see the code. But assuming there is no chance of it causing any issues when the option is off I'm heavily in favor of merging it in to the official build!

I will ping @refractionpcsx2 and @gregory38 since they are the resident GSdx people!

Here is the post in question which has a build that you can test if you like: http://forums.pcsx2.net/Thread-Gsdx-3D-Stereoscopy-Patch?pid=522990#pid522990

5

FlatOutPS2 commented 8 years ago

It will add another part to the complicated GSdx that will need to be maintained and issues that will need to be fixed. Wouldn't it be better to keep it as a nice alternative plug-in for now for the few enthousiasts who use it? Maybe if Chronomaster keeps updating and fixing it, it might be worth considering in time for 1.6.0. Upgrading the patch to the modern GSdx was the easy part. I know this because I did that myself a few months ago(just for DX11).

It also has (unless Chronomaster already removed those) some keyboard shortcuts that conflict with the keyboard controls I play with that need to removed(or altered, but there are already too much hidden shortcuts for us keyboard users to keep track of).

refractionpcsx2 commented 8 years ago

any reason SBS and UO were abbreviated? im sure it would fit on there. it would also be good if there is a brief label after each one depending on their use case, at least with Interlaced as I'm not sure where that would be used, im guessing proper 3d glasses? the SBS and OU ones can just have (VR)

mirh commented 8 years ago

I agree this is probably "niche".. Though it would suck for this to rotten again too. And.. cmon: "stuff to be maintained, issues to be fixed" really? :p

Perhaps it could be moved to HW Hacks sub-menu?

Sarania commented 8 years ago

@refractionpcsx2 - It's extremely common for them to be abbreviated like that. You will see "SBS" and "OU" more than the written out versions honestly. Interlaced mode is for certain kinds of 3d monitors. A tooltip would definitely be useful.

I have no real problem with it being a separate plugin if that's the way we wanna go. As long as it's actually included in releases and doesn't rot away again. Most modern emulators have a 3D mode of some kind and we should be no different! Not just because it's another feature, but personally I think it's a very cool and useful one.

Sarania commented 8 years ago

Oh also, @mirh - Yeah I think moving it over to HW hacks would be a good idea.

FlatOutPS2 commented 8 years ago

I agree this is probably "niche".. Though it would suck for this to rotten again too. And.. cmon: "stuff to be maintained, issues to be fixed" really? :p

Have you tried the plugin? There are numerous issues with it, it doesn't work with OGL yet, and changing the settings is really awkard with keyboard shortcuts(there should be a seperate 3D menu for that). If Chronomaster(or someone else) is willing to continue improving it, it would be a worthy addition. But I'd say right now it isn't ready yet.

mirh commented 8 years ago

Have you tried the plugin? There are numerous issues with it, it doesn't work with OGL yet

Yes, but no 3D is worse than half-assed 3D. And for as much people -generally- are lame.. I dunno, couldn't a very big EXPERIMENTAL SHITTY tag keep them calm?

Besides, chronomaster is just the "porter" to 1.4.0 (while KrossX was just the thread "maintainer"). Actual dev is called under moon, which aside of that single post is vanished. Judging by grammar and local time in his profile, I can tell you he's probably some japanese gsdx madman.. but nothing else.

Sarania commented 8 years ago

The only issues I really found is it doesn't work with all games. The ones it works for it seems to work well.

Also I really DON'T think there should be a separate menu for separation etc. Reason being is that's something that really needs to be adjusted on the fly. Popping in and out of menus and stopping/restarting emulation would be a nightmare there IMO. We do need to rectify any hotkey conflicts obviously.

As for the code - yeah CHRONOMASTER just ported undermoons work to modern GSdx. Several of us(including myself) had tried before but failed. It does need work, yes. That's why I didn't just make a PR or anything. But I do think it's worth the work.

I would volunteer myself for some of that work because I am really interested in it, but honestly, it's not likely it would get done for a WHILE. With everything going on in my life right now I just don't have time for much! If it's still sitting here that far in the future(hope not), I will definitely take a whack at it. I'm talking about fixing hotkeys, tidying up things, etc. The actual GSdx code... no. I have enough trauma in my life right now. XD

FlatOutPS2 commented 8 years ago

Also I really DON'T think there should be a separate menu for separation etc. Reason being is that's something that really needs to be adjusted on the fly. Popping in and out of menus and stopping/restarting emulation would be a nightmare there IMO. We do need to rectify any hotkey conflicts obviously.

Yes, that's why we should really have a GSdx menu that can work on the fly. :P But that's where the upcoming OSD might be of some use.

Several of us(including myself) had tried before but failed.

Really? Because I did(partially) and it was pretty easy, Now it doesn't work by just automatically patching it to newer builds ofcourse, but with a few, fairly straightforward, manual adjustments it was done in a few hours(or probably days if you like Chronomaster did the entire patch and made some improvements).

tabnk commented 8 years ago

Nice feature. Got to try it soon

ssakash commented 8 years ago

I think it's rather unlikely to get it merged at it's current state, it also seems to have a dedicated code for OSD.

In case anyone is interested on getting this merged it would be nice to,

FWIW, It also seems to do some changes to the normal code (when the option isn't enabled), so yeah it would be nice if someone tries to manage the code and get it to a merge-able state.

FlatOutPS2 commented 8 years ago

I've already made an updated version based on the latest master. And I've looked into adding the new OSD manager instead of the dedicated code, though the Stereo 3D is D3D only for now and OSD manager OGL only. Other than that it seems pretty straightforward to replace it.

We'd also need a list of games that currently don't work, so we can look into that eventually.

ssakash commented 8 years ago

@FlatOutPS2

Why not consider opening a Pull request ? code could be reviewed and further suggestions could be made based on user preferences. Blyss seems to be quite determined on merging this one to master !

FlatOutPS2 commented 8 years ago

I will, but only after the OSD manager has been merged.

mirh commented 8 years ago

@ssakash I thought we had already seen there's no downside in maintaining D3D9?

ssakash commented 8 years ago

@mirh

I think you missed the discussion after that where gregory had also decided to also drop support for D3D9 : http://forums.pcsx2.net/Thread-Gsdx-future-discussion?pid=511375#pid511375

Quoting one of the post:

The future GSdx will just drop DX9 and GL3.3 limited drivers (various GL4 features are compatible with GL3 hardware class, even GL2 HW class). It means that Windows DX10/GL3 GPU will only have access to DX10/11 renderer. On linux, DX10/GL3 will be supported on the free driver.

Hmm, I guess I have to re-open #1171 with updated details then.

FlatOutPS2 commented 8 years ago

No matter what is decided on that front, I've already included the D3D9 code and I don't see a reason not to keep it as so far it hasn't really increased the workload.

CHRONOMASTER commented 7 years ago

@FlatOutPS2 what hotkeys are an issue?

I'm thinking about making a sub-menu for the Stereo options. I plan on adding all the options (stereo separation, etc.) to it with the settings being per game, including a toggle for the hotkeys.

FlatOutPS2 commented 7 years ago

@CHRONOMASTER I don't know exactly, I haven't looked up a list of the (conflicting) hotkeys. Are you going to make a Stereo 3D pull request?

CHRONOMASTER commented 7 years ago

@FlatOutPS2 I don't think the code is ready for a pull request just yet. @ssakash made some good points that I plan on pursuing.

Currently I have forked the master to my stereoscopic-3d branch. In the coming days I will commit the changes against the current GSdx. Then I will work on adding all the options* to the GUI, and try to add per game settings.

*For easy access to view/change a setting, and a hotkey toggle for fine-tuning in-game.

Any suggestions are welcome. I'm still getting used to GitHub so bear with me if I delete my branch and recreate it.

shinra358 commented 7 years ago

@FlatOutPS2 and changing the settings is really awkard with keyboard shortcuts(there should be a seperate 3D menu for that)."

Trust me. It really is better to control convergeance and all other 3D effects with keyboard shortcuts. It takes some time to get 3D effects to look right with certain things. Having it be controllable in the menu like dolphin is really a great pain. With this, you would want to see your active changes on the fly. Not to keep having to go back and forth through the menus. This was a great big problem for 3D support in Sleeping Dogs on Steam.

But if you want to still have it so users can easily share their settings with one another without, that's fine. And your keyboard presses will change the values indicated in the menu of course. But in no way is it viable to remove the keyboard shortcuts for changing the settings. That is a great necessity for 3D gaming.

Not only that, this cant be fully released without it having per game configuration options or it will be a nightmare for every 3D user. You will be too busy adjusting all the time and by the time you do, you won't even feel like playing anymore. 3D users do not want to keep doing that anymore.

masterotaku commented 7 years ago

@CHRONOMASTER seems to have vanished since half a year ago, and I'm still extremely interested about this feature. I tried to put the stereoscopic code in a recent GSdx build but failed spectacularly (more than 100 errors when compiling that I don't know how to fix). The latest available 3D plugin doesn't have the mipmapping feature because it's old.

About per game settings, I think there should be a folder in the PCSX2 root to store the "stereo_lval" and "stereo_wval" values from the "GSdx.ini" file. A hotkey to store current game settings automatically would be the best way.

I have tested around 20 games and I haven't seen any major problems (I was expecting lots of broken effects but I almost didn't find any. Positively surprised). Most of them need different stereo values to be perfect. But the biggest problem is the way convergence is simulated here. It should change the angle of the cameras to modify the point where they cross, but in PCSX2, pressing "shift" and "+" (or "-" to reduce) changes the X position of the right camera ("stereo_lval"), effectively shifting HUD and interfaces (which should be at a fixed position) to the right. This also produces a big separation increase too, making it more tedious to compensate "stereo_lval" with "stereo_wval".

Some games need a pretty big "convergence" value, so they end with missing or heavily misplaced HUD, and also geometry pop in in only the left side of the right eye view (because the image tries to access geometry that shouldn't be seen. This could in theory be solved with render fixes like the widescreen codes have).

In case someone wants to see my configuration numbers, here they are:

//DBZ Sparking Meteor, KH, KH2, DBZ Infinite World and more. stereo_lval=60 stereo_wval=7200

//Soul Calibur 3. stereo_lval=110 stereo_wval=2750

//Castlevania Lament of Innocence, Devil May Cry, Okami. stereo_lval=15 stereo_wval=120000

//Ys V. stereo_lval=170 stereo_wval=2200

//Crash Bandicoot Wrath of Cortex. stereo_lval=110 stereo_wval=1850

//Tales of Legendia, Dawn of Mana. stereo_lval=120 stereo_wval=2150

//FFXII. stereo_lval=150 stereo_wval=1350

//Tekken 5, Jak & Daxter. stereo_lval=130 stereo_wval=2150

//Persona 4. Strong HUD pop out. stereo_lval=20 stereo_wval=80000

//Persona 3 FES. High convergence, HUD pop out. stereo_lval=30 stereo_wval=40000

//Persona 3 FES and Persona 4. Low convergence, screen depth HUD. stereo_lval=45 stereo_wval=16000

//Metal Gear Solid 2, Metal Gear Solid 3, Ratchet and Clank 3. stereo_lval=90 stereo_wval=4500

//Marvel VS Capcom 2. stereo_lval=40 stereo_wval=20000

CHRONOMASTER commented 7 years ago

@masterotaku Wow, it's been that long? Time goes fast. Been so busy with work, classes, and other projects I ended up completely dropped the ball on this. Hopefully I will have some time in the coming days to take a look at those errors.

masterotaku commented 7 years ago

@CHRONOMASTER The compiling errors must have been on my end. It's the first time I touch C++ code, there are more than 30 files to modify and current GSdx builds have changed variable names, methods and stuff (I manually copied all your patch content and had to change some things, because at first I got over 400 compiling errors). Something was bound to fail because of my inexperience.

I'm sure that you'll do better. And thank you for answering and for your work :).

sudonim1 commented 7 years ago

This is still incredibly hacky and a lot of code, right? I can't see why we would want to mainline this. If you think it's not hard to maintain, then it's not hard to maintain as a fork.

gregory38 commented 7 years ago

Would it be possible to see the VR patches ? I would like to reformat with clang the GSdx plugin. However it would be a nightmare for not-yet-merged-pending work.

masterotaku commented 6 years ago

After using the workaruound posted in the other github issue (https://github.com/PCSX2/pcsx2/issues/2106), I'm doing 3D in a different way than before.

I'm stereoizing shaders myself, and NOT using the old GSdx build that has stereoscopic 3D. It's good timing that since recently 3Dmigoto can do shader modifications via regex, not depending on individual dumped shaders. This will make it work for everyone (with Nvidia GPUs), and different shader hashes created by different GSdx builds or configurations won't matter.

I still depend on the SpecialK trick I do to force exclusive fullscreen, until PCSX2 has that mode officially (which will fix some crashes and make booting games 100 times easier).

In the end, this will only work with the DX11 hardware renderer, and only for Nvidia users. There are multiple 3D modes that will work (3D Vision, anaglyph, SBS, TAB, and interlaced, IIRC).

And by the way, stereoization (after using the regex) only works if custom resolution is used. If I use the native resolution multipliers, I also have to get the hash of the render target and stereoize it in the 3Dmigoto config file. And it's different for each resolution. There could be a "StereoTextureEnable" setting in the drivers that can do it automatically, but I haven't found it yet.

Is there anything I should be aware about? Like exceptions for stereoization depending on some some values, etc. For now I get some bad shadows or textures in some games that were fine in the stereoscopic build. Once I'm home today I'll dump different shaders with the stereoscopic build to see if it behaves differently with different shaders.

Now to sum up:

Good things, compared to using the GSdx stereoscopic build without mods:

Bad things:

mirh commented 6 years ago

In the end, this will only work with the DX11 hardware renderer

Well, d3d9 (and only, for some reason) officially supports 3D vision in windowed mode. And as for opengl... Minus whatever bugs there might or might not be in the driver, most of times you open windowed fullscreen you get automatically switched to exclusive. But on that front I guess nvidia is a bitch and only allows quadro cards to work.

Sure thing though, with whatever obtrusions DWM is imposing on us, the choice to abandon exclusive in the first place doesn't feel so smart anymore.

And by the way, stereoization (after using the regex) only works if custom resolution is used

Guess like we have finally found an utility for that setting! /s

Said this, "3D world" really is a messy affair. Being native, working on linux and/or with Vive would be three points I'd like to see eventually though.

shinra358 commented 6 years ago

there are lots of games in which 3d works in windowed mode. you should find a solution where you can activate it regardless of fullscreen or not.

masterotaku commented 6 years ago

@mirh and @shinra358 , DX11 games can't work in 3D in windowed mode (borderless or not), as you see. I think we would have some working examples by now if it were possible (please correct me if I'm wrong).

There is a DX9 wrapper for 3D too (Helixmod dll), and it works, but shaders would have to be stereoized manually instead of using regex. For OpenGL there is the wrapper Helifax made, but has one drawback: it converts games to 3D in a frame sequential way. Meaning that a 60fps game will work at 30fps per eye. I haven't checked if this wrapper works with PCSX2. It has a find/replace configuration, similar to what I do in 3Dmigoto.

Both of them for Nvidia GPUs, of course. And the DX9 one with only normal 3D Vision.

About having to use custom resolutions, it looks like going from the "pcsx2-v1.5.0-dev-2211-g58f2b6c25-windows-x86" build to the "pcsx2-v1.5.0-dev-2249-g49cd6bc78-windows-x86" build fixed it! Did something important change about resolutions between them? Now I'm using native multipliers and they work.

Now that I've tested more games, I've seen that games that have half the vertical resolution (like DMC and Jak & Daxter) don't get stereoized unless I use a custom resolution with a lot higher vertical resolution, like 3840x4320, to compensate that halving. I haven't checked (and can't right now) if aspect ratio of the resolution needs to be so exact.

God of War has a different issue that I'll try to fix tomorrow. Maybe it's a render target too what gives problems.

I've been making some advancements in 3D and it's looking nice. Still not perfect, but less bugs than yesterday and in some ways already superior to the old 3D mode, regarding graphics.

masterotaku commented 6 years ago

My work is finished: http://helixmod.blogspot.com.es/2018/01/pcsx2-dx11.html

Or in "https": https://helixmod.blogspot.com.es/2018/01/pcsx2-dx11.html

Testing will be appreciated, if anyone is interested.

lightningterror commented 6 years ago

Hope the gui doesn't change much after this, otherwise you'd need to edit some parts of the guide :stuck_out_tongue:

MokuDuk commented 5 years ago

just to mention - along with existing methods [big big big big thanks to all11] TriDef is working too: https://forums.pcsx2.net/Thread-Gsdx-3D-Stereoscopy-Patch?pid=595137#pid595137

masterotaku commented 5 years ago

Just in case someone wasn't aware of it, I updated the PCSX2 3D Vision fix a few days ago (same link as before: https://helixmod.blogspot.com/2018/01/pcsx2-dx11.html).

This time I provide an ingame OSD that shows the status of all the hotkeys, and most importantly, a depth hunting feature that makes perfect game fixes easier to do and universal (I checked with another person a game from a different region and it was working. KH2). It consists of 40 possible fixed depth values (of "r0.z") and 4 depth ranges for each one of the three regexes. With some hotkeys, you see the values in the OSD and visually elements between two ranges will be in 2D.

However, there is a big problem for future compatibility. I can't trigger 3D Vision in any way with drivers newer than 391.35. Those magic drivers somehow make 3D Vision trigger for most borderless windowed DX11 games, contrary to what should supposedly happen (DX11 being compatible with 3D only in exclusive fullscreen).

I'm going to be experimenting with and comparing dll files from the 391.35 drivers to the newest version, trying to see where the "magic" happens and if it's possible to restore it.

I saw that the exclusive fullscreen request was closed (https://github.com/pcsx2/pcsx2/issues/836). That's discouraging, because it would be the real fix for this problem. For the moment (maybe never) I don't have the skills to try to do it myself.

MokuDuk commented 5 years ago

@masterotaku thank you once again!) By the way I have an underclocked GTX 660 and it's working good with Nvidia Vision on 417.23 driver [I only use Nvidia Vision with Discover Glasses Anaglyph Mode]

But I'm oftenly restarting graphics driver with CRU, and use a lot of different resolutions in both of that utility and Nvidia Control Panel, maybe restarting of it is a key to properly trigger 3D Vision in rare cases] [or restarting of uxsms]

lightningterror commented 5 years ago

So with Nvidia killing off 3D Vision can we close this ?

masterotaku commented 5 years ago

Official 3D Vision support will end on April 2020. There's still some time.

But this github issue is for a general purpose 3D. Nothing to do with 3D Vision in theory. Dolphin has 3D modes that all 3D TVs can handle (but not 3D Vision monitors).

My mod is just a thing apart from that.

lightningterror commented 5 years ago

Ah cool then, nvm what I said.

tadanokojin commented 4 years ago

Don't know status of this but recent change with GSdx means modernized d3d swapchain. I've never had anything to do with stereo3d but maybe it's of use.

shinra358 commented 4 years ago

If this is happening, please ensure the settings get hotkeys. It would not be pleasurable switching back and forth thru the emu. #former3dvisionuser

marcussacana commented 2 years ago

Nothing yet huh... I think I will try with reshade later

lightningterror commented 2 years ago

Closing as niche, plus legacy.

masterotaku commented 2 years ago

Closing as niche, plus legacy.

Understandable. I may be one of the very few people who care about it but I don't think I'll ever get to the point of adding 3D to PCSX2 natively (I don't have the skills for that).

However I keep updating the 3D Vision fix to make sure it still works. My last update was this month, and I checked that it was fine with the Qt interface. The implementation of flip model in PCSX2 really made things easier and I appreciate that.

Reminder that my fix is exclusive to Windows and Nvidia GPUs older than the 3000 series (for now), so it can't be used by everyone. If this ever changes, I'll let people know in the PCSX2 forums, I suppose.

marcussacana commented 2 years ago

I like 3D, I really wanted play some games with VR but it's just sad how they don't want a feature like that.

MokuDuk commented 2 years ago

agreeing that native and "true" way is more appreciated but everyone should notice and respect ReShade's efforts of Depth3D, SuperDepth3D (and few more) which overcame TriDef in approximate methods of so-called "fake3D" which can be configured very and very quite even to a "true". It's working for any given flat image and having best of all performance and "compatibility" with motion blur, or other "complex" effects. I wish I would have time to learn and to join development, or at least popularize or spread 3D stereo gameplay, but life went unexpected ways. For anyone who would try - remember there are world forces that value money more then video games and graphics, they will mute everything which is not "selling VR" right now