common-shaders icon indicating copy to clipboard operation
common-shaders copied to clipboard

[Request] Side-by-side shader for playing on an HMD

Open vgf89 opened this issue 10 years ago • 14 comments

Would it be possible to create a simple side-by-side type shader (scale game down a little, place same cloned video on left and right side of screen) for use with an HMD (Oculus Rift, Google Cardboard/other phone HMD)?

vgf89 avatar Sep 24 '14 00:09 vgf89

Whoops, just noticed this issue.

Sure. I just pushed something to the 'misc' subdirectory. I don't know of any way to make it place the side-by-side images perfectly for all resolutions, so I put some runtime parameters in that you can adjust to line things up.

hunterk avatar Nov 28 '14 14:11 hunterk

The only setting that appears to really be missing is the ability to set the y-position (or reworking the settings to have separation, height, and width instead, so that everything stays centered)

vgf89 avatar Dec 27 '14 02:12 vgf89

Ha, I actually had it in there for awhile and then took it out because I didn't think it was necessary. I just re-added it. Let me know if it needs any more work.

hizzlekizzle avatar Dec 27 '14 03:12 hizzlekizzle

test Not sure what's going on with the pincushion settings. The blue-ish area flickers different shades (also shows up with yellow for a few frames on the Chrono Trigger start animation).

The blue area gets close to surrounding, rather than overlapping, the game if you turn the curvature radius down. test2

Same problem in Super Mario World. No idea what's going on here, but it seems to be grabbing the color from some edge or corner of the game image, given how it behaves with the Chrono Trigger start screen and the color here.

Also, some Super Mario World test3

It seems to happen regardless of what libretro core I use. This problem only happens with the pincushion distortion on.

vgf89 avatar Dec 27 '14 04:12 vgf89

Yeah, that's not really intended, but it is indeed functioning as expected (though it's not as immediate on my end; may be GPU-specific...). You can try increasing the value after '#define d' in the shader code, which mitigates the effect, but also reduces the curvature effect. So, crank it up and turn the radius down and see if it keeps the weird out-of-bounds color stuff from taking over.

I don't have a HMD, so I was just coding blind, based on what oculus rift pics I could find online, but can you make a screenshot of an ideal placement and curvature (assuming the weirdness wasn't happening) that I can use as a guide?

hizzlekizzle avatar Dec 27 '14 13:12 hizzlekizzle

Is there any chance a version of this could be made without barrel distortion? Most of the hmds i've used looked just fine without it. Here's a good example of what I mean: https://i.ytimg.com/vi/7BkXnryT33I/maxresdefault.jpg

HelenSkelter avatar Feb 06 '16 05:02 HelenSkelter

You can disable the pincushion effect in the parameters.

You can also try this other version I made in glsl that's a little different: https://github.com/hizzlekizzle/glsl-shaders/blob/master/misc/side-by-side-simple.glsl

hizzlekizzle avatar Feb 06 '16 13:02 hizzlekizzle

That one works way better, however I don't seem to be able edit the parameters on the android version. Specifically it looks shifted to the right with the right view cutoff so I'm trying to edit the horizontal placement.

HelenSkelter avatar Feb 07 '16 06:02 HelenSkelter

Okay so since the current version crashes when I try to open the Menu Parameters I used an older version and got everything adjusted well. Thank you very much!

HelenSkelter avatar Feb 07 '16 07:02 HelenSkelter

Awesome! I'm glad it worked for you. I'm not sure why it crashes on the current version and adb didn't give me any good clues :/ I haven't tried any nightlies to see if they act any better but hopefully, it'll be fixed in the next release.

hizzlekizzle avatar Feb 07 '16 15:02 hizzlekizzle

Oh I'll try the nightlies as well. That would be great, I'm having weird issues with the menu in the older version (1.2) that shows down the process.

What exactly would it take to get this included as a default shader with profile and/or added in as a Cardboard/SBS mode? I can go through and make profiles if that'd help.

HelenSkelter avatar Feb 08 '16 21:02 HelenSkelter

Oh also I posted instructions on how I got it working here if that helps anything:

https://www.reddit.com/r/GoogleCardboard/comments/44kow7/i_got_retroarch_working_in_sbs_with_no_artifacts/

HelenSkelter avatar Feb 08 '16 21:02 HelenSkelter

@HelenSkelter I added in a preset that you can load directly instead of doing the glslp hokey pokey you described in the post. I went ahead and put in your settings in the preset, as well. https://github.com/hizzlekizzle/glsl-shaders/blob/master/misc/cardboard-vr.glslp

Also, have you tried the anaglyph-to-side-by-side.glsl shader that's in there? It lets you play virtualboy games in 3D. You just need to go into the core options and set the anaglyph preset to any option other than red/blue or yellow/blue. I think red/electric cyan works well.

hizzlekizzle avatar Feb 09 '16 21:02 hizzlekizzle

Oh thank you very much, that'll save me a lot of time. I had but I didn't know to avoid those combinations before, that's really neat! I wonder if something like that is possible for those Anaglyph 3D Master System games.

Unfortunately those settings vary widely between systems. Would the best option be to make a profile for every system and then post them somewhere?

HelenSkelter avatar Feb 11 '16 05:02 HelenSkelter