distortion correction - conformal perspective

  • WSH303
More
6 years 2 months ago #41 by WSH303 Replied by WSH303 on topic distortion correction - conformal perspective
Quick question, lets say I have a curved screen, do I still need this shared to correct perspective?

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 #42 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective

WSH303 wrote: Quick question, lets say I have a curved screen, do I still need this shared to correct perspective?

Try if it works for you :cheer:
But technically speaking Yes. More curved the display, more spatial sensation this perspective would give.
Like in this example:


To be correct, if projector would be behind your seat (like in that arcade) stereographic perspective is the right one for dome screen. This is extreme example. It gives VR-like experience.
Last edit: 6 years 2 months ago by Fu-Bama.

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

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

Martigen wrote:

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? :)


Soon. Next week.

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

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #44 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
Hello,
I just yesterday have found huge bug in perspective transformation formula. The perspective which this shader produce is not quite stereographic projection, but still much better than standard linear. Objects at the borders still get distorted, more noticeably in FOV higher than 100 degrees.
The issue is that I based the code on inverted vertex shader that transforms linear projection to stereographic, but pixel UV shaders are not transformational, but look up. Idea can get confusing :P :huh: . Basically they work the other way around. Its like a glass lens in front of a linear picture, but instead of multiplying the image by lens distortion, you have to go from the viewer eye, through "the lens" and guess where the "ray" hits the picture, as it's look-up based. And it's more complicated than I thought.
But I have good news too. I managed to make new formula that thankfully creates correct distortion correction. But there are still some things to invent.
Like simple UV scaling, for borders management, changes the distortion, because it's look up, not transform.
So tomorrow I will post the geometrical model scheme with detail, and maybe someone will be able to give some help :oops:
But hopefully I will be able to figure things out in coming days.
The following user(s) said Thank You: MaxG3D, Scorpio82CO

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

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #45 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
To introduce things out.
Space can be represented by a sphere, like a Google Street View, where 360 degree image is wrapped on a sphere and seen form inside.
To grab a portion of 3D space (sphere) and display it on a flat surface, like a monitor we have to map its coordinates on flat UV space.
Basically whole topic of map projections is about displaying sphere (world map) or its portion (e.g. city map) on a flat plane.
What we want to achieve here is mapping scaled Stereographic screen coordinates onto Linear image coordinates, since we are using game-texture UV-space lookup.
It has to be scaled at first since we want to adjust the borders size, and scaling (zooming) will change Stereographic screen FOV at the borders of the image.
Simple UV multiply changes the distortion.

Linear projection in cartography is Gnomonic projection.
And difference between linear projection and stereographic projection is simple point of view.
Linear projection looks from the center of the sphere:


Stereographic projection looks from the surface of the sphere:


Drawing shows flat view from above on the camera frustum.

Even doe it's 2D shader, we operate in 3D space and
only things that we know is UV position of current pixel being processed and in-game camera FOV which user enters in shader settings. That's 2D data, UV = XY, to get the third component Z (XYZ) we can use cotangent of 1/4 FOV.

To get the linear pixel coordinates, we "project" the point onto a sphere surface, then we "look at it" from the sphere center and finally we scale it down to the crosing of the image plane (projection plane).
Now if we scale (zoom) the final image, we also need to scale the Z component, or C component.
The [?=x'/x] is the thing by which we multiply the radial UV coordinates of the game texture.

One can ask, "if it's all cartography, why won't we use already existing formulas!" Well, they're all based on latitude and longitude coordinates which require a lot of trigonometry. We want to avoid that.
It's manageable through similar triangles, etc.
I haven't figure everything out yet, but I'll try. Optimistically I will be able to get new formula in few days, but if you do it faster, feel free.
The following user(s) said Thank You: MaxG3D

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 #46 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
Ok, I was able to get new formula for UV distortion.
But some things don't work, maybe somebody can give advice.

Things that work:
  • It shows proper stereographic projection. :lol:
  • You can choose between horizontal, diagonal and vertical FOV
  • Manual zooming without deformation :silly:
Issues:
  • Changing FOV type, changes distortion alignment, making automatic zoom a problem :silly:
Things that don't work:
  • Automatic zooming action to adjust borders
Beta code:
Warning: Spoiler!
Last edit: 6 years 2 months ago by Fu-Bama.
The following user(s) said Thank You: MaxG3D

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

  • Fu-Bama
  • Topic Author
More
6 years 2 months ago #47 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
I updated the shader with new formula. You can download it from the official package.
It seems that manual zooming is better in some cases, like some games use letter-boxing.
Also anti-aliasing works better when you zoom-out the image few pixels.

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

  • Nanoxo
More
6 years 2 months ago #48 by Nanoxo Replied by Nanoxo on topic distortion correction - conformal perspective
Amazing shader, this had make triple display gaming amazing as it can counter the famous fish eye effect
The following user(s) said Thank You: Fu-Bama

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

  • Nanoxo
More
6 years 2 months ago - 6 years 2 months ago #49 by Nanoxo Replied by Nanoxo on topic distortion correction - conformal perspective
I'm absolutely loving the effect that this shader had in most of my games while playing in a triple monitor setup, it almost disables the famous "triple screen fish eye effect" perception , but the problem is that the section in the center of the screen (the central monitor) looks a little pixellated and the visibility gets reduced as this section gets "zoomed in".

Would it be possible to add a slider to lower the effect intensity linearly from the edges to the center of the screen, in a way that we can keep the same intensity of the effect near the screen edges, but lower the effect intensity near the screen center.
Last edit: 6 years 2 months ago by Nanoxo.

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago - 6 years 1 month ago #50 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective

Nanoxo wrote: I'm absolutely loving the effect that this shader had in most of my games while playing in a triple monitor setup, it almost disables the famous "triple screen fish eye effect" perception , but the problem is that the section in the center of the screen (the central monitor) looks a little pixellated and the visibility gets reduced as this section gets "zoomed in".

Would it be possible to add a slider to lower the effect intensity linearly from the edges to the center of the screen, in a way that we can keep the same intensity of the effect near the screen edges, but lower the effect intensity near the screen center.


Zooming is unavoidable, as it is what linear perspective does.
It stretches center of the screen towards infinity when near 180 FOV.
Warning: Spoiler!

Warning: Spoiler!


It is possible to zoom out the center screen, but its borders won't be matching with the wing screens.
You would see 2x same things on the center and side monitors.
(...)
Last edit: 6 years 1 month ago by Fu-Bama.

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago #51 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
(...)
The pixelation comes from that. Even VR googles have to deal with it.
For example HTC vive renders game graphics internally at 140% resolution of the display, to compensate for the pixelation - this is one of the reasons why VR games run so slow.



(...)

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago - 6 years 1 month ago #52 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
(...)
Let's go deeper ;) using the occasion

Human can see 180° FOV or more,
we are definitely not using the linear perspective :) .


We even see the colors at different FOVs


And check this out:

Source: NASA - Chandra X-Ray Observatory

Cool right?
Last edit: 6 years 1 month ago by crosire.
The following user(s) said Thank You: SandyCheeks

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

  • Marty McFly
More
6 years 1 month ago - 6 years 1 month ago #53 by Marty McFly Replied by Marty McFly on topic distortion correction - conformal perspective
Is the precise data from the second diagram available somewhere? Would make for an interesting colored vignette filter. Is the the measured difference unidirectional or is it different in top/bottom/left/right?

EDIT: Voldemort's binocular vision cone is broader ;) no nose blocking the view
Last edit: 6 years 1 month ago by Marty McFly.

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago - 6 years 1 month ago #54 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective

Marty McFly wrote: Is the precise data from the second diagram available somewhere? Would make for an interesting colored vignette filter. Is the the measured difference unidirectional or is it different in top/bottom/left/right?

EDIT: Voldemort's binocular vision cone is broader ;) no nose blocking the view


Here's the source of the second diagram vr-lens-lab.com/field-of-view-for-virtual-reality-headsets/
Vignette filter like that would be cool. I think YUV space is most human-like. Should be easy to work it out in that space. :)
In VR, when there's no stationary thing in view, like nose, you get nausea. I wonder if he got some :D

...This thing would be perfect www.roadtovr.com/nvidia-perceptually-bas...-rendering-research/
if it was available in nvidia control panel
Last edit: 6 years 1 month ago by Fu-Bama.

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago - 6 years 1 month ago #55 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective

Tojkar wrote: (...) 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... (...)

I just updated the PerfectPerspective.fx to version 2.1.2 which addresses the borders issue.
It now features texture mirroring, Borders Color now has Alpha channel which blends the borders color with the borders image.



Mirroring borders ON (default) with some color tint works best for motion picture.
Mirroring OFF displays original image at the borders and works nice for screenshoots.

Warning: Spoiler!

Warning: Spoiler!


When borders are visible only at the corners, Mirroring ON and Alpha at Zero fixes that.

You can download the updated shader from the official package at github.com/crosire/reshade-shaders
Last edit: 6 years 1 month ago by Fu-Bama.
The following user(s) said Thank You: Tojkar, Rudy102

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

  • Fu-Bama
  • Topic Author
More
6 years 1 month ago #56 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
New update 2.2.1 has been added to the shader repository. github.com/crosire/reshade-shaders

It adds new feature, a vertical distortion amount slider. You can adjust how much vertical lines, like buildings, are distorted.
0 - shows cylindrical stereographic projection
1 - spherical stereographic projection (old behavior)
By default it's set to 0.618 which seems to look nice.

Images:
Warning: Spoiler!

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

  • Fu-Bama
  • Topic Author
More
5 years 11 months ago #57 by Fu-Bama Replied by Fu-Bama on topic distortion correction - conformal perspective
Just released update 2.2.6 adds new ui_category feature from ReShade 3.2.2 and anti-aliasing of image borders.
Available here github.com/crosire/reshade-shaders
The following user(s) said Thank You: Wicked Sick

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

  • Martigen
More
5 years 11 months ago #58 by Martigen Replied by Martigen on topic distortion correction - conformal perspective

Fu-Bama wrote: Just released update 2.2.6 adds new ui_category feature from ReShade 3.2.2 and anti-aliasing of image borders.
Available here github.com/crosire/reshade-shaders

Thank you! I use this all the time with Natural Selection 2 :)

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

  • ZapaL
More
5 years 6 months ago - 5 years 6 months ago #59 by ZapaL Replied by ZapaL on topic distortion correction - conformal perspective
Changed the shader a bit. Now there is no barrel distortion, the choice of the type of FOV works correctly ...
Try and write good or bad.

drive.google.com/open?id=1pRzO5U-NDB1yI8ht3raOjd6nDur_AHTK

https://photos.app.goo.gl/qsQ5Ke5Vq4rweDgz8

https://photos.app.goo.gl/UN75htGqtUFsQDdL9
Last edit: 5 years 6 months ago by ZapaL.
The following user(s) said Thank You: Wicked Sick, Sinclair, Mr. Smiley

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

  • Mr. Smiley
More
5 years 1 week ago #60 by Mr. Smiley Replied by Mr. Smiley on topic distortion correction - conformal perspective
I've been using this shader and it definitely makes playing some games a bit better, but I have an idea I would love to try out with this. Would it be possible to apply a sort of double circle effect magnification? Instead of perfect circles, make it two intersecting ellipticals that are angled towards a center point, and only apply magnification to things inside the ellipticals without touching the edges. This thought occurred to me after looking through this one project on github about field of view, and I was thinking how can someone apply a similar concept to a shader.

This is the project I was referring to: github.com/shaunlebron/blinky

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.