Welcome, Guest.
Username: Password: Remember me

TOPIC: distortion correction - conformal perspective

distortion correction - conformal perspective 1 year 2 months ago #21

Fu-Bama wrote:
Perfect Perspective FX has drop down menu where you can choose 3 modes. Diagonal aligns the image to the corners of the screen, leaving no black space.
Would it be possible to add a fourth mode, which removes the curvature effect but makes the distances smaller towards the edges? Similar to the Photoshop effect spherize distortion added both horizontally and vertically.

Image for clarification of what I mean: www.dropbox.com/s/y49408xvixm7nsm/Untitled-1.png?dl=0
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #22

Tojkar wrote:
Would it be possible to add a fourth mode, which removes the curvature effect but makes the distances smaller towards the edges? Similar to the Photoshop effect spherize distortion added both horizontally and vertically.

Image for clarification of what I mean: www.dropbox.com/s/y49408xvixm7nsm/Untitled-1.png?dl=0
Same effect applied to diagonal checker gives curved distortion (just rotate image 45 degrees and apply effect). Also it does not fix proportions, but makes objects disproportional in XY axis. Look at the squares at the edges, they are not smaller but rectangular.
Last Edit: 1 year 2 months ago by Fu-Bama.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #23

You are right, it distorts the objects on the edge by stretching them, but the actual size of the object remains correct if set properly. I have no sources for this as I base my info just for my own testing. However, there are countless of games that won't allow adjusting hud's distance from the screen border and for those games this solution would eliminate black corners and/or borders.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #24

@Tojkar Then have a test:
Warning: Spoiler! [ Click to expand ]
The administrator has disabled public write access.
The following user(s) said Thank You: Tojkar

distortion correction - conformal perspective 1 year 2 months ago #25

Works great but there's one problem. It stretches the image way too much on the center axis. The strength should start minimally on the center and increase gradually towards edges. However, the corners are already good and wery nice looking when using small values.

Again, image for clarification. The first is in-game shader with value 1.0 where you can clearly see the extreme stretching on the center. Next is edited in PS. Here you can see the strenth of the effect gradually increases and the center is quite clean looking despite using max values and applying the effect multiple times. Third one shown unedited picture for reference. The lines are nearly the same as in the screenshot. www.dropbox.com/s/9ja7br3w7zm2q6m/GRW%20...%2012-32-20.png?dl=0
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #26

@Tojkar It's weird AF in movement. :blink:
Verticals and Horizontals are straight, but Diagonals are stretched. It does not work.
here's proof:
Warning: Spoiler! [ Click to expand ]
Last Edit: 1 year 2 months ago by Fu-Bama.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #27

Fu-Bama wrote:
@Tojkar It's wierd AF in movement. :blink:
Verticals and Horizontals are straight, but Diagonals are stretched. It does not work.
here's proof
I am fully aware of that and wasn't trying to argue. Also, one reason which I didn't state yet for this request is that I love the old lo-fi monitors, which curves the picture due to their physical properties, but I equally hate the black borders and corners. I was trying to modify some existing shaders which has the fisheye effect included, but I never managed to succeed. That being said...

...now I see what my mistake was. I meant to say that the edges need very strong compressing but the strength quickly falls off so that instead of stretching the middle axises unrecognizeably.

I have hard time finding a way to explain this in my own laguage, so again I must resort to pictures. The upper half is what I'm trying to explain and lower half is what your shader currently does. The stretching curve is linear in your shader versus logarithmic/expotential in the upper half. www.dropbox.com/s/y49408xvixm7nsm/Untitled-1.png?dl=0

Also, my request might not completely be in the scope of your plans, so if you wan't I could make a new thread for this. Just say so. ;)
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #28

Marty McFly made a fisheye lens shader a few years ago, I ported it and split it into two versions: horizontal and vertical (no idea if the terms are correct).
But with these I can get perspective correction like in those Star Wars pictures, or like in Resident Evil 7. It will however make the centre a bit blurry depending on the zoom settings, but that's unavoidable. I don't know if this might be something you are interested in, but I figured you might want to check it out nevertheless.

Fisheye Horizontal
Warning: Spoiler! [ Click to expand ]

Fisheye Vertical
Warning: Spoiler! [ Click to expand ]


Example pics with the shaders:
Warning: Spoiler! [ Click to expand ]
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

distortion correction - conformal perspective 1 year 2 months ago #29

I never wrote this shader, ported it from some blog. IIRC it follows standard lens correction model, so it's not viable to use it for this purpose.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #30

@Insomnia you have good eye.
Star Wars pictures were made with Panavision anamorphic lenses which tend to bend horizontal lines more than vertical.
This comes out from very specific reason. Dominant movement in movies is camera pan and its mostly level to the ground, so vertical distortion is not needed so much.
In games there's also a lot of camera panning, when you look at horizon and turn mouse left and right. But when you look up or down there's camera roll movement.
Which in panini-like distortion looks unpleasant. In movies, they would switch to spherical lenses in such case, with even vertical and horizontal distortion.
Unfortunately without access to camera direction vector in world space, it's impossible to adjust vertical distortion on the fly.
I experimented a lot with this and stereographic distortion is best suited for this case.

Beside, Panavision lenses do much more then that. They have breathing effect when changing focus, thus driving viewer attention on focused objects.
vimeo.com/167045643

Duble vision blur which makes out of focus objects unrecognizable.
vimeo.com/167050590

And famous horizontal lens flares.
vimeo.com/167045648
Last Edit: 1 year 2 months ago by Fu-Bama.
The administrator has disabled public write access.
The following user(s) said Thank You: Rudy102

distortion correction - conformal perspective 1 year 2 months ago #31

Marty McFly wrote:
I never wrote this shader, ported it from some blog. IIRC it follows standard lens correction model, so it's not viable to use it for this purpose.

Sorry. I did noticed the name Icelaglace in the credits though. You want me to change the credits info?
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #32

Doubt it'll make a difference, haven't heard from icelaglace in years + I think he was not the original author, not sure though. Either way, it cannot really be used for the application here.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #33

Martigen wrote:
This is a really awesome shader :) Just one problem: as it bends the whole screen, when interacting with in-game menus or game inventories the visible button for a is of course now off-center, making it sometimes impossible to use menus or inventories, as where you click for the corrected perspective is of course not where the game is needing to register the click on screen. It can't be helped really, as we're bending the image without considering the interface. (...)
I made another workaround for games that don't draw their own cursor.
Cursor.fx that you can put before perspective correction

drive.google.com/file/d/1n8bPOvnYhxjY95x...5mn/view?usp=sharing
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #34

Fu-Bama wrote:
Martigen wrote:
This is a really awesome shader :) Just one problem: as it bends the whole screen, when interacting with in-game menus or game inventories the visible button for a is of course now off-center, making it sometimes impossible to use menus or inventories, as where you click for the corrected perspective is of course not where the game is needing to register the click on screen. It can't be helped really, as we're bending the image without considering the interface. (...)
I made another workaround for games that don't draw their own cursor.
Cursor.fx that you can put before perspective correction

drive.google.com/file/d/1n8bPOvnYhxjY95x...5mn/view?usp=sharing
Great I'll try this!
Thanks :)
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #35

Fu-Bama wrote:
Martigen wrote:
This is a really awesome shader :) Just one problem: as it bends the whole screen, when interacting with in-game menus or game inventories the visible button for a is of course now off-center, making it sometimes impossible to use menus or inventories, as where you click for the corrected perspective is of course not where the game is needing to register the click on screen. It can't be helped really, as we're bending the image without considering the interface. (...)
I made another workaround for games that don't draw their own cursor.
Cursor.fx that you can put before perspective correction

drive.google.com/file/d/1n8bPOvnYhxjY95x...5mn/view?usp=sharing
So this works perfectly, the cursor is exactly aligned with the curved interface. Great!

Not so great, the cursor is always visible :) So it's there on screen moving around when playing -- example:
steamcommunity.com/sharedfiles/filedetails/?id=1293415498

I guess we can assign a hotkey to cursor.fx. Ideally, this should be the key that brings up the interface. One problem here: this key for a lot of games is ESC, but Reshade won't let you assign ESC as a key for a shader. I think it would have to be coded in, but it will differ for different games. Also, there may be multiple interfaces -- main menu, inventory, skill tree etc depending on the game, needing multiple keys... I don't think there's an easy solution, except intercepting the UI and not having it curved. I don't think this is possible with Reshade unless we have a way to easily determine the injection point on each game.
But thankyou for your work!
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #36

Martigen wrote:
One problem here: this key for a lot of games is ESC, but Reshade won't let you assign ESC as a key for a shader. I think it would have to be coded in, but it will differ for different games.
Haven't tried this, but technically ESC should work. You just can't bind it via the in-game UI, but have to manually set it in the preset file. The keycode for ESC is 27.
Cheers, crosire =)
Last Edit: 1 year 2 months ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: Qsimil

distortion correction - conformal perspective 1 year 2 months ago #37

@Martigen

I've written a shader that toggles effects depending on HUD visibility. It's not really sophisticated though, but it gets the job done. It just checks if certain pixels on the screen matches with that from a hud layer. I will post it here soon. Maybe it's useful for you too.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #38

brussell wrote:
@Martigen

I've written a shader that toggles effects depending on HUD visibility. It's not really sophisticated though, but it gets the job done. It just checks if certain pixels on the screen matches with that from a hud layer. I will post it here soon. Maybe it's useful for you too.
That does sound useful, thank you.

Does it handle multiple 'huds' - i.e difference between a main menu or an in-game inventory? I imagine it depends on the layout of the hud and recognised pixels.
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #39

Martigen wrote:
Does it handle multiple 'huds' - i.e difference between a main menu or an in-game inventory? I imagine it depends on the layout of the hud and recognised pixels.
Yes. In short: HudDetected == (Hud1Pixel1 && Hud1Pixel2) || (Hud2Pixel1 && Hud2Pixel2 && Hud2Pixel3 && ...) || ...
The administrator has disabled public write access.

distortion correction - conformal perspective 1 year 2 months ago #40

brussell wrote:
Martigen wrote:
Does it handle multiple 'huds' - i.e difference between a main menu or an in-game inventory? I imagine it depends on the layout of the hud and recognised pixels.
Yes. In short: HudDetected == (Hud1Pixel1 && Hud1Pixel2) || (Hud2Pixel1 && Hud2Pixel2 && Hud2Pixel3 && ...) || ...
Nice! Where's the shader? :)
The administrator has disabled public write access.