distortion correction - conformal perspective

4 years 6 months ago - 4 years 6 months ago #1 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.

*edit
Last edit: 4 years 6 months ago by Fu-Bama. Reason: info on official package
The following user(s) said Thank You: Marty McFly, brussell, Rudy102, Jesped

4 years 6 months ago - 4 years 6 months ago #2 by lowenz
Good idea, but the stereographic distorsion isn't perfect too
NOLF2+4:3 resolution, looking below:

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

4 years 6 months ago - 4 years 6 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.

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: 4 years 6 months ago by Fu-Bama.

4 years 6 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.

4 years 6 months ago - 4 years 6 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: 4 years 6 months ago by Fu-Bama.

4 years 6 months ago - 4 years 6 months ago #6 by lowenz
I know I know

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: 4 years 6 months ago by lowenz.

4 years 6 months ago #7 by Fu-Bama
Replied by Fu-Bama on topic distortion correction - conformal perspective
You have good point. I posted informations so that everyone can learn something about the topic.

4 years 6 months ago #8 by WSH303
Stuff is nice, but the drawback of it is that the shared blurs the image a bit, I think its because of added distortion.

4 years 6 months ago - 4 years 6 months ago #9 by lowenz
Blurring?

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

4 years 6 months ago #10 by WSH303
Yup, blurring. The shader zooms the picture, so it gets blurred.

4 years 6 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?

4 years 6 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.

4 years 6 months ago - 4 years 6 months ago #13 by lowenz

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 )
Last edit: 4 years 6 months ago by lowenz.

4 years 6 months ago - 4 years 6 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: 4 years 6 months ago by Rudy102.
The following user(s) said Thank You: jas01

4 years 6 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

4 years 6 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.

4 years 6 months ago #17 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?

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 )

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.

4 years 6 months ago - 4 years 6 months ago #18 by lowenz
The bending is a necessary consequence of the maths

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

4 years 6 months ago - 4 years 5 months ago #19 by Fu-Bama
Replied by Fu-Bama on topic distortion correction - conformal perspective

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.

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

themetalmuncher.github.io/fov-calc/

Warning: Spoiler!

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. Diagonal 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: 4 years 5 months ago by Fu-Bama.
The following user(s) said Thank You: Rudy102