libretro / glsl-shaders

This repo is for glsl shaders converted by hand from libretro's common-shaders repo, since some don't play nicely with the cg2glsl script.
941 stars 225 forks source link

Cocktail cabinet - no rotation #3

Open CaptCraiger opened 8 years ago

CaptCraiger commented 8 years ago

Is it possible to change the cocktail shader to not rotate the game? My Pi is already setup in portrait mode and doesn't need the rotation. Thank you!

hizzlekizzle commented 8 years ago

You still want to rotate one of the game images, though, right?

CaptCraiger commented 8 years ago

Yes. One turned 180 degrees a on top of the other.

hizzlekizzle commented 8 years ago

I made a Cg version and uploaded it to the common-shaders repo. Once it gets auto-converted to GLSL, I'll come back to it and add the runtime parameters and push it up to this repo.

CaptCraiger commented 8 years ago

Where does the auto-converter version get sent to?

hizzlekizzle commented 8 years ago

It goes into the online updater, under 'update glsl shaders'. It's there now, so I'll try to get the parameters in tomorrow and post it here.

hizzlekizzle commented 8 years ago

Alright, here you go: https://github.com/hizzlekizzle/glsl-shaders/blob/master/misc/cocktail-cab-portrait.glsl Let me know how it treats you.

It should get pulled into the online updater in a few minutes/hours.

Chirpybob commented 7 years ago

Hiya, sorry to reopen an old thread, but i could really use some help. As originally questioned, i need to rotate a shader.

I have a cocktail table (with 2 controls either side) and have placed a pi 3 inside running retropie/attract mode. I have set up the controls so that i can switch between two shaders, a standard shader for 1 player mode, and the 'cocktail cabinet' shader for 2 player mode, to be switched in game as needed.

The reason i cant use the rotate function in retroarch is because it rotates both shaders, therefore always putting one of them off center.

I have tried the 'cocktail-cab-portrait' shader. But although the picture is rotated correctly, the image is still distorted, and no ammount of adjusting or playing with the preview options will make it display correctly (with 'cocktail cabinet' shader, plus retroarch rotation however, i can)

I posted a question in the retropie forum and was directed here.

So..... Is it possible to put a rotate command in either shader?

Thanks for your time. Chirpy.

hizzlekizzle commented 7 years ago

Depending on what your other shader is, you can try replacing the texcoord assignment line (that is, vTexCoord = TexCoord;) in the vertex shader with: vTexCoord = ((TexCoord - 0.5) * mat2x2(0.0, 1.0, -1.0, 0.0)) + 0.5; Swap the 1.0 and -1.0 there in the mat2x2 to rotate it CCW instead of CW.

Chirpybob commented 7 years ago

Hi there, thanks for replying.

I've gone through all the glsl files in retroarch and cant find any with the word 'vTexCoord' in to edit. Do i need to open the file in another program? Am i making a noob mistake? (probably).

hizzlekizzle commented 7 years ago

Most of the ones I've hand-converted have it in there but the auto-converted ones don't. Which shader are you using that needs to rotate? Some are more difficult than others.

Chirpybob commented 7 years ago

The cocktail-cabinet.glsl if possible. But barring that one absolutely any shader that will show a clear picture, doesn't need to be authentic as it will be applied to multiple systems/emulators. If any other shader can be rotated 90 degrees, i could then tell retroarch to rotate the screen again, thus straitening the cocktail cabinet shader.

Chirpybob commented 7 years ago

Apologies, i was looking in the completly wrong area at shaders, I can see where the 'vTexCoord' word is used often, however i have yet to find and shader with the line 'vTexCoord = TexCoord'.

Taking one form the top of the list for example. '3dfx_pass_0.glsl':

under '// compatibility #defines' on line 148 i see '#define vTexCoord TEX0.xy' I tried to change the 'TEXO.xy' to the code you gave me. but with no luck. the shader worked, but with no rotation.

I also tried inserting the code into various areas in '// Paste vertex contents here:', but no joy there either.

hizzlekizzle commented 7 years ago

Ah, wait, nevermind. I was testing that line with the slang shaders, which have some key differences from the regular GLSL shaders that specifically complicate this task.

How about having a separate config that just disables rotation and sets video_shader_enable to "true" and you can use configuration > load configuration whenever you want to play it in cocktail orientation? The rest of the time, the screen would be rotated with no shader.

Chirpybob commented 7 years ago

I've tried that, using the configuration editor included with retropie. I disabled all rotation, but the shader doesn't care. (As a matter of fact, nothing cares, things rotate exactly the same. This setting seems useless....) I can also see in the shader parameters, that when i change the width, the height is changed and vice versa. This is consistant with a rotated screen. Is there any way to identify what line of code tells the shader to rotate? Or to make a fresh shader that only rotates?

If this can be done, it would mean (in my eyes) the perfect cocktail machine. with no need to go into any menus thus making it as user friendly as you can get. :-)

hizzlekizzle commented 7 years ago

I guess I'm not following what the actual problem is. When I go to settings > video and change the rotation to 90 or 270 degrees, it rotates the screen and the shader.

The cocktail cabinet shader rotates and doubles the image so that two people on either end of a widescreen monitor have their own copy of the image.

What's missing?

Chirpybob commented 7 years ago

Apologies if i'm not being clear.

Rotating the screen with retroarch settings does allow you to use the 'cocktail-cabinet.glsl' on portrait mode (after tweaking the parameters slightly). However if you want to switch straight to another shader (using hot keys assigned in retroarch), that shader will be at an incorrect angle. And you would then have to go back into retroarch settings in order to rotate it back.

If either shader could be rotated individually, they could then be made to sync up, taking away the need to go into retroarch settings each time.

So when i have friends round to use my cocktail table. (who like games but not computers) I can tell them to press 1 button for 1 player, and another button for 2 player. As opposed to explaining how to enter a menu and rotate the screen. :-)

Newbieuseros commented 2 years ago

Hi hizzlekizzle OK. I am totally new in all of this. End trying to make some cocktail cabinet with mirror screen games. And have a similar problem:

I tried two variants:

  1. https://raw.githubusercontent.com/libretro/glsl-shaders/master/misc/cocktail-cab-portrait.glsl
  2. https://raw.githubusercontent.com/libretro/glsl-shaders/master/misc/cocktail-cabinet.glsl

The first version doesn't really rotate the screen image but I do it myself with "sudo nano /boot/config.txt" etc. Works fine except the image is too narrow (up-down) for horisontal games, for example for "Cadillacs and dinosaurus" and I can t do nothing to expand it.

The second does rotate shader and does have a expanded picture but it is opposite to screen orientation.

My question is: Have you made a version in which the shader does not rotate, ie rotates according to the orientation of the screen and at the same time, allows the image of the game to be freely expanded for horizontal games. Ah, yes, and also can use billinear filtering, because the first version can not (does not allow it) Thanks in advance !