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

CRT-Royale Geometry Modes #106

Closed
Ebsy opened this issue Jun 3, 2019 · 4 comments
Closed

CRT-Royale Geometry Modes #106

Ebsy opened this issue Jun 3, 2019 · 4 comments

Comments

@Ebsy
Copy link

Ebsy commented Jun 3, 2019

Hi,

I posted in libretro/glsl-shaders#40 recently with @hizzlekizzle and thought I should open a new issue after moving to the vulkan driver/slang shaders exclusively.

Setting the geometry parameter in CRT-Royale will mostly show a black screen. After some tweaking with the parameters an image is displayed but it's clearly the wrong image. It looks like there's some issue with crt-royale-geometry-aa-last-pass.

Setting geometry to 0 shows the following (correct) image
Screenshot_5

Setting geometry to 3 and tweaking the parameters to 'extreme' values will give a reversed image, yet it's somehow still 'cylindrical' due to the geom 3 setting.
Screenshot_6

(note: radius, tilt angle x and view distance)

I've had a quick look at the crt-royale-geometry-aa-last-pass files but I'm a bit lost if anyone has any pointers of where to look I'll gladly help out by experimenting with the values.

@hizzlekizzle
Copy link
Collaborator

I spoke with trogglemonkey briefly about this a few weeks ago and he said he'd try to take a look at it. He's been busy, though, apparently, so there's no ETA.

@ibm2431
Copy link

ibm2431 commented Sep 12, 2019

Found this via Google and was toying with this tonight: the only relevant setting to get the image to appear (albeit perfectly mirrored) while using Geometry Mode 3 is setting the Tilt Angle X to -1.57.

Which - coincidentally - is half of negative pi. So I suspect this could be an easier fix than initially imagined.

The other settings just seem to change the image as you'd expect. The defining setting determining if an image appears at all is Tilt Angle X.

Values lower than -1.57 will cause the image to "rotate" around a center Y axis to the left (as if you were spinning a real CRT) until it goes completely off screen (for me, around -2.23). It doesn't appear again, even at negative pi.

Values any higher than -1.57 will cause an outright black screen (without spinning to the right). Unfortunately, positive 1.57, or even pi itself (3.14), still result in a black screen.

edit: Tilt Angle X of -1.57 also determines if any sort of image appears for Geometry Mode 1 and 2 as well. But the appearance with modes 1 and 2 don't resemble anything recognizable (perhaps some really extreme cones), so I can't say if they're wonky due to this same issue, or just wonky in of themselves for a different reason.

edit 2: For a quick hack to get a curve when using crt-royale, you can set Tilt Angle X to -1.57, and then edit your shader directly to flip a couple values in the local_to_global construction (example is glsl):

https://github.com/libretro/glsl-shaders/blob/38b09e4e202ba7aea1384724adcc993ead236f7d/crt/shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl#L5377-L5380

To inverse the sign of some of the x values:

        const float3x3 local_to_global = float3x3(
            cos_tilt.x, sin_tilt.y* -sin_tilt.x, cos_tilt.y* -sin_tilt.x,
            0.0, cos_tilt.y, -sin_tilt.y,
            -sin_tilt.x, sin_tilt.y*cos_tilt.x, cos_tilt.y*cos_tilt.x);

Shaders are compiled by the GPU on load, so you don't need to worry about having to rebuild anything - just edit your file, save, and reload the shader/preset in RetroArch.

Then use Geometry Mode 3 and Tilt X of -1.57. Use default settings for Radius and View Distance at first (2.0), then play with them to size the image as you want:
curve
(Above pictured are my settings of Radius 1.70, View Distance 0.5, and a little bit of Overscan X/Y to better reach the border I'm using).

Play with it as I might, I can't seem to figure out how to get this behavior with a default tilt of 0. Different combinations of using sin/cos with the tilt angles would adjust the required "image visible" settings, but just result in it being broken in a different fashion. I was never able to achieve full working Tilt X control.

(I was also never able to achieve a perfect sphere for all Tilt X values in Geometry Mode 1. At some values of pi or half-pi it would instantly pop between being spherical and what appears might be an inverse sphere.)

Anyone wanting to play with this should be aware that sometimes in Geometry Mode 3 (and sometimes in 1), Radius results in a huge sphere (of which you're seeing a bisection) at small values. Using the default of 2 might result in a "black screen" (depending on how you're messing with the shader), but that's just because the bisection of your sphere is off the screen - try reducing Radius to almost zero to see if your image comes back.

@ibm2431
Copy link

ibm2431 commented Sep 14, 2019

Apologies if this is a second email notification, but I managed to get CRT-Royale to display a curved not mirrored image today.

But instead of making a new comment, I had instead edited my initial comment from two days ago - and I don't think notifications go out on those. So here's a ping~!

@hizzlekizzle
Copy link
Collaborator

hizzlekizzle commented Sep 15, 2019

Hey, the geom modes should be fixed now.

After reading your post, I spent a whole day troubleshooting GLSL and Cg/HLSL differences in matrix ordering, component-wise multiplication and UV orientation, but in the end it all came down to a mistake I made a long time ago with converting Cg/HLSL's atan2 to GLSL's atan. -_-

I'll try to update the glsl shader version soon, too. (EDIT: went ahead and did it, too)

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

No branches or pull requests

3 participants