Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGL: Stereoscopic 3D Support #1439

Merged
merged 66 commits into from Nov 28, 2014
Merged

Conversation

CrossVR
Copy link
Contributor

@CrossVR CrossVR commented Oct 29, 2014

This branch adds side-by-side stereoscopic 3D support through a single pass with a geometry shader. The geometry shader handles the duplication of the geometry and will project each vertex according to the projection matrix for each eye.

The stereoscopic projection matrix is generated from the normal projection by means of a shearing transformation (courtesy of @comex).

All framebuffers have been changed to layered framebuffers (courtesy of @degasus) each layer represents one eye. Using this layered rendering method means we already support EFB2Tex copies with the correct stereoscopic projection.

When testing the current build keep MSAA and XFB disabled, these options are not yet compatible with stereoscopy

To-Do

This PR

  • Fix SBS pillar boxing for 4:3 ratio.
  • Add options to customize stereoscopy parameters.
  • Add support for top-bottom and anaglyph.
  • Prevent @Parlane from ticking to-do boxes.

Future PR

  • Add stereoscopy support for EFB format emulation.
  • Add support for layered EFB2Tex copies with MSAA enabled.
  • Add stereoscopy support to Virtual XFB.
  • Add support for Quad Buffers and 3D display modes.
  • Allow users to fill in their real IPD in mm.

@JMC47
Copy link
Contributor

JMC47 commented Oct 29, 2014

The initial support works perfectly on my crosseyed approach. Game compatibility seems identical to 3D Vision, a lot of the same errors/problems happen.

note: I had to modify the code to flip the eyes.

@CrossVR
Copy link
Contributor Author

CrossVR commented Oct 29, 2014

@JMC47 Which errors are we talking about specifically? I can use them to test compatibility.

@JMC47
Copy link
Contributor

JMC47 commented Oct 29, 2014

F-Zero GX has lines on the menus. Olimar's Health Bar has really weird depths in Pikmin 2, Luigi's Mansion's shadows are offset per eye. Pokemon Colosseum's Shadows are just way off, and the ground disappears at most settings, you have to turn the settings WAY down.

"vec4 sampleEFB(ivec2 pos) {\n"
" return texelFetch(samp9, pos, 0);\n"
" return texelFetch(samp9, ivec3(pos, 0), 0);\n"

This comment was marked as off-topic.

This comment was marked as off-topic.

@comex
Copy link
Contributor

comex commented Oct 29, 2014

Nice.

I haven't looked in detail, but are the changes in API usage here capable of causing any compatibility or performance problems?

@degasus
Copy link
Member

degasus commented Oct 29, 2014

@comex On bad driver, always. But in theory, layered rendering with one layer should have no overhead (tested by JMC already). There is also a bit slowdown because of the harder uid checker (could still be optimized) and the bigger vertex constant buffer. But this should both be less than 1%.

@CrossVR CrossVR force-pushed the ogl-stereo-3d branch 8 times, most recently from 064bb17 to d41d974 Compare October 31, 2014 14:53
@degasus
Copy link
Member

degasus commented Nov 24, 2014

3D branch still works on Qualcomm

It also works fine on all of my tested plattforms but llvmpipe, but I think is a llvmpipe issue.

LGTM

@CrossVR
Copy link
Contributor Author

CrossVR commented Nov 24, 2014

@degasus @Sonicadvance1 I made some small changes to the way the stereoscopy settings are handled. It should functionally behave the same, but it will allow us to more easily tweak the stereoscopy settings.

I also did away with the Mono Depth EFB option in the settings which only has a very specific use and is just confusing to users.

@CrossVR
Copy link
Contributor Author

CrossVR commented Nov 24, 2014

On IRC @degasus and me decided it would be best to merge the PR in a disabled state for now. It would allow us to review the feature in parts and releasing it only when we feel it is completely ready.

We'd also be able to concentrate on 2D regressions before we start fixing 3D bugs.

…g is reset.

Previously the message would never display, because stereoscopy would be turned off before the warning.
@CrossVR CrossVR force-pushed the ogl-stereo-3d branch 3 times, most recently from 42e9c79 to e5d2876 Compare November 27, 2014 14:39
We'll enable the stereoscopy options globally when it is ready for release.
…pdate their descriptions.

Previous convergence distance was much too large.
Sonicadvance1 added a commit that referenced this pull request Nov 28, 2014
@Sonicadvance1 Sonicadvance1 merged commit ce05976 into dolphin-emu:master Nov 28, 2014
@CrossVR CrossVR deleted the ogl-stereo-3d branch November 29, 2014 00:10
@Icekhaos
Copy link

And here's yet another enhancement. Good job folks, keep this work up.

@Kodiack
Copy link

Kodiack commented Nov 30, 2014

I don't play with stereoscopic 3D, although I do play with OpenGL. Yet, this commit still seems to have introduced a significant performance regression on my R9 290-based system. Prior to 4350 I am able to sustain a solid 41 FPS on the Skyward Sword title screen with 4xIR and 8xMSAA. After this commit, I only get 20 FPS with the same settings; I have difficulty even sustaining 30 FPS at 4xMSAA.

Again, I do not utilise stereoscopic 3D, so I am unsure why this is occurring, but it is definitely related to this pull request.

@CrossVR
Copy link
Contributor Author

CrossVR commented Nov 30, 2014

@Kodiack Could you submit this to the bug tracker with your system specifications? We were afraid this might happen, which is the reason we merged this early in a disabled state.

@Kodiack
Copy link

Kodiack commented Nov 30, 2014

@Armada651 Not a problem. I'll go ahead and submit a report now. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants