distortion correction - conformal perspective

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago - 6 years 2 months ago #1 by Fu-Bama distortion correction - conformal perspective was created by Fu-Bama
Linear perspective was designed by painters in 15th century to reproduce sill images on a canvas.
Interestingly, people of those times described linear perspective as an Italian stylization, as they did not
seen it realistic. Noticeably, even its first practitioners (e.g. Piero Della Francesca) reported that it leads
to numerous, incommodious distortions in the image, especially when a larger angle of view is
required. Leonardo da Vinci, after some unsuccessful attempts at solving this problem, decided that
composition should be fitted in a relatively narrow angle of view.
Linear Projection is mathematically limited to 179° camera view. There is no tangent of 90°.
But human eye can see the world at 180° or more. If you stretch your hands sideways, in a well lit room, you
should be able to see your fingers moving in your peripheral vision.
But at 179° linear perspective distorts image to such extent that it’s unrecognizable, objects are
distorted towards infinity in the center of the screen. Appearance of distortion is even bigger when
a wide angle picture is in motion. Driven by this distortion, a motion-sickness effect appears.
What technique should be used instead? Perfect solution would be as less distracting as possible, so
viewer attention would focus on presented virtual world space, rather then the image appearance.
One kind of perspective provides such sensation, a stereographic perspective.
It has most natural appearing motion, it preserves angles and proportions.
What it means is that face in the corner of the screen doesn't get stretched, due to conformal nature of this perspective.

Shader that I'm presenting here transforms linear perspective image to stereographic.
I can't imagine going back to old perspective.

github.com/Fubaxiusz/reshade-shaders/blo...erfectPerspective.fx

*edit
Perfect Perspective is now part of the official shaders package. Just download reshade-shaders when prompted.
Last edit: 6 years 2 months ago by Fu-Bama. Reason: info on official package
The following user(s) said Thank You: Marty McFly, brussell, Rudy102, Jesped

Please Log in or Create an account to join the conversation.

  • lowenz
More
6 years 2 months ago - 6 years 2 months ago #2 by lowenz Replied by lowenz on topic distortion correction - conformal perspective
Good idea, but the stereographic distorsion isn't perfect too :D
NOLF2+4:3 resolution, looking below:

[img


See the curved wood plank :P
Last edit: 6 years 2 months ago by lowenz.

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago - 6 years 2 months ago #3 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
It's not perfect, there always will be some sacrifice since creating image of a 3D world is representing portion of a sphere onto flat monitor plane.
Same issues apply to map making. Linear perspective in cartography is known as Gnomonic projection. It preserves distances, one can draw straight line with ruler and it will be shortest path from point A to B. But you sacrifice proportions and angles. For motion picture it adds artificial movement to the edges of the screen, thus driving eyes there instead to center of the screen where crosshair is.

:P hint
do these streets cross at a right angle or at an acute angle?

example of not preserving angles



example of not preserving proportions (RAGE)
Last edit: 6 years 2 months ago by Fu-Bama.

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #4 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
Stereographic perspective preserves angles and proportions, but horizontal and vertical lines are not straight. For motion picture, motion is even in every part of the screen, thus every part of the image is equally important.




The biggest difference is in the movement. But you have to put right FOV in shader settings.

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago - 6 years 2 months ago #5 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
I bet you know this movie ;)
Warning: Spoiler!
Last edit: 6 years 2 months ago by Fu-Bama.

Please Log in or Create an account to join the conversation.

  • lowenz
More
6 years 2 months ago - 6 years 2 months ago #6 by lowenz Replied by lowenz on topic distortion correction - conformal perspective
I know I know :D

My intension was only to show the limit of this kind of perspective, so a ReShade user can see the main (absolutely natural) issue of it ;)
Last edit: 6 years 2 months ago by lowenz.

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #7 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
I know your intention :)
You have good point. I posted informations so that everyone can learn something about the topic. ;)

Please Log in or Create an account to join the conversation.

  • WSH303
More
6 years 2 months ago #8 by WSH303 Replied by WSH303 on topic distortion correction - conformal perspective
Stuff is nice, but the drawback of it is that the shared blurs the image a bit, I think its because of added distortion.

Please Log in or Create an account to join the conversation.

  • lowenz
More
6 years 2 months ago - 6 years 2 months ago #9 by lowenz Replied by lowenz on topic distortion correction - conformal perspective
Blurring?

This is a linear perspective (that's the one who causes *geometric* distortion) alternative.
Last edit: 6 years 2 months ago by lowenz.

Please Log in or Create an account to join the conversation.

  • WSH303
More
6 years 2 months ago #10 by WSH303 Replied by WSH303 on topic distortion correction - conformal perspective
Yup, blurring. The shader zooms the picture, so it gets blurred.

Please Log in or Create an account to join the conversation.

  • Martigen
More
6 years 2 months ago #11 by Martigen Replied by Martigen on topic distortion correction - conformal perspective
Interesting. So, uh, when do we use a shader like this?

Just FPS games? and what are the pros/cons?

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
6 years 2 months ago #12 by Marty McFly Replied by Marty McFly on topic distortion correction - conformal perspective
You could apply automatic zoom to perfectly cover the screen corners. Separately compute scaling amount for screen corner and scale texcoord by before/after ratio.

Please Log in or Create an account to join the conversation.

  • lowenz
More
6 years 2 months ago - 6 years 2 months ago #13 by lowenz Replied by lowenz on topic distortion correction - conformal perspective

Martigen wrote: Interesting. So, uh, when do we use a shader like this?

Just FPS games? and what are the pros/cons?

Every "hi-FOV" game, 'cause the high FOV introduces an heavy perspective distortion @borders.
It's why today we use a narrow-ER FOV on widescreen resolutions too (67° vs 90° of 'the 90s and their good old 4:3 resolutions :D)
Last edit: 6 years 2 months ago by lowenz.

Please Log in or Create an account to join the conversation.

  • Rudy102
More
6 years 2 months ago - 6 years 2 months ago #14 by Rudy102 Replied by Rudy102 on topic distortion correction - conformal perspective
DOOM 2016 - "Hi-FOV" game, FOV is set in game, by default, to 90 degrees. Three galleries with this shader :

DOOM 01
DOOM 02
DOOM 03

Dzięki wielkie :)
Last edit: 6 years 2 months ago by Rudy102.
The following user(s) said Thank You: jas01

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #15 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
@WSH303, it blurs the image a bit in two out of 3 modes; Horizontal (when borders are touching right and left edge of the screen) and Diagonal (when image fills the screen without borders; this is kind of mode that @Marty McFly mentions). But in Vertical mode image gets contracted, thus more sharp, showing whole field of view, but with the biggest borders. Use Luma Sharpen fx form base effects, it does the trick.
You can see what the shader does by dragging the Strength slider in the configurator.

@Martigen, @lowenz has good point. FPP, TPP games tend to have high-fov and a lot of movement.
It also works with some sculpting or modeling software, when you need nail the proportions.

@Rudy102 Nice Doom gallery :cheer:

Please Log in or Create an account to join the conversation.

  • matsilagi
More
6 years 2 months ago #16 by matsilagi Replied by matsilagi on topic distortion correction - conformal perspective
Boy,i've never needed this shader until i tested it.

Decided to put it in test on Quake (Which suffers a lot from the high fov, especially for me that plays in 100 for more view of the stuff around), and when i used that, it felt like i got more view of the stuff around without the distortion of the 100 fov.

Nice work on it, its a small shader that makes a difference.

Please Log in or Create an account to join the conversation.

  • Martigen
More
6 years 2 months ago #17 by Martigen Replied by Martigen on topic distortion correction - conformal perspective

lowenz wrote:

Martigen wrote: Interesting. So, uh, when do we use a shader like this?

Just FPS games? and what are the pros/cons?

Every "hi-FOV" game, 'cause the high FOV introduces an heavy perspective distortion @borders.
It's why today we use a narrow-ER FOV on widescreen resolutions too (67° vs 90° of 'the 90s and their good old 4:3 resolutions :D)

I've got a 21:9 so, yeah, some games are quite 'wide' :)

So this is a good shader especially for playing first-person games on widesreen? Should you set the in-game FOV or or lower as a result of using this shader?

I did try it out, the change in perspective was... different. But the edges had black corners where the image was bent in and left empty space.

Please Log in or Create an account to join the conversation.

  • lowenz
More
6 years 2 months ago - 6 years 2 months ago #18 by lowenz Replied by lowenz on topic distortion correction - conformal perspective
The bending is a necessary consequence of the maths :D

It's a *correction* technique (with its side effects).
Last edit: 6 years 2 months ago by lowenz.

Please Log in or Create an account to join the conversation.

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago - 6 years 2 months ago #19 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective

Martigen wrote: Should you set the in-game FOV or or lower as a result of using this shader?


Shader FOV setting should mach your in-game horizontal FOV. Some games provide option to adjust FOV angle and sometimes it's vertical FOV (Battlefield) or diagonal (RAGE) and sometimes it's weird value (MIND: Path to Thalamus Enhanced Edition).
Basically if you see mustache-like bulging of the image, while moving the camera, Shader FOV is too high.
If image looks right, but spherical objects at the corners of the screen get stretched, Shader FOV is too low.
Right setting should give smooth barrel bending and preserve proportions at the corners.

Skyrim has horizontal FOV setting and looks right if you want to check some reference.

[strike]Otherwise this link or table may come in handy:[/strike]
*edit
New version has drop down menu to choose what kind of FOV is used in-game (horizontal/diagonal/vertical)

[strike] themetalmuncher.github.io/fov-calc/ [/strike]

Warning: Spoiler!

Martigen wrote: I did try it out, the change in perspective was... different. But the edges had black corners where the image was bent in and left empty space.


Perfect Perspective FX has drop down menu where you can choose 3 modes. [strike]Diagonal[/strike] aligns the image to the corners of the screen, leaving no black space.
*edit
New update setting is more descriptive and shows options "Optimal Borders", "No Borders", "Full View".

PS:
To test your 21:9 setup I wrote simple letterboxing.fx, some can find it useful:
Warning: Spoiler!
Last edit: 6 years 2 months ago by Fu-Bama.
The following user(s) said Thank You: Rudy102

Please Log in or Create an account to join the conversation.

  • Martigen
More
6 years 2 months ago #20 by Martigen Replied by Martigen on topic distortion correction - conformal perspective
Thanks Fu-Bama.

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.

But I have a suggested solution: If you can read keyboard input, allow the user to set say up to three 'Inventory' or 'menu' keys. Three or so should account for different menus/inventory options in a game. When these keys are pressed and in-game for example the inventory pops up, the StereoGraphic shader disables itself. Pressing it again enables it. So it's a toggle, just like assigning a key to the shader itself -- but this is limited to one key, hence providing more options. Eg for the game Subnautica, I'd assign 'Esc' for the menus and 'Tab' for the inventory, and pressing either toggles the shader off and then back on again when the key is pressed to close the menu/inventory. It won't always be perfect, many UI elements can be exited in more than one way, but if you remember to always use the same key it will appear seamless.

Anyway, just an idea!

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.