PerfectPerspective - Fubaxiusz/fubax-shaders GitHub Wiki

Metro Exodus, with vertical FOV at 83 Perfect Perspective shader in Metro Exodus, with vertical FOV at 83

Example of Perfect Perspective at 83° vertical FOV in Metro Exodus, original on the left, shader on the right. PANTOMORPHIC_MODE 1, k-horizontal 0.5, k-vertical 0.88

Guide to Perfect Perspective

How to find game FOV?

It is important to set the Perfect Perspective FOV value to match the one selected in-game for beautiful results. Sometimes this is a straightforward number, sometimes it can be estimated, and in extreme cases, additional software can be used to determine the in-game FOV.

What steps I take to determine the FOV?

  1. Check the game settings for an adjustable FOV value:
    • Usually located in the "Game Options" or "Display Settings".
    • If it's small (60-80), it's most likely vertical FOV.
    • If it's bigger (80-110), it's probably horizontal FOV.
  2. PC-Gaming Wiki website has game-specific information on FOV:
    • Tells the location of the configuration file where you can edit the FOV.
    • You can find out there if FOV is horizontal/vertical.
  3. Manually test FOV (always recommended):
    • Find out if the game FOV is horizontal/vertical or 4:3, etc.
    • For a raw value, this method is prone to errors.
  4. Use the fSpy software to determine the FOV value the hard way:
    • This is the best option if none of the above works.
    • Simply take a screenshot and open it in fSpy software to analyze.

How to manually test the FOV value?

  1. Look for a round object facing you:

Round object at the center

  1. Rotate the camera so that the object is in the corner:

Round object at the corner

  1. Enable Perfect Perspective and set all k values to 0.5:

Round object perfectly round

  1. The object should appear exactly round:
    • If it's squeezed too much, try changing FOV type to horizontal/diagonal.
    • If it's elongated too much, try changing FOV type to vertical/4:3.
    • Tilt your head to see better.

How to find FOV with fSpy?

The fSpy software is a great tool for finding an unknown FOV, but it will only provide an approximate value, like 65.125 vertical and 97.251 horizontal, which likely means the real game FOV is 65° vertical.

You can download the fSpy software here.

What distortion values to set?

Here are some generic presets for games:

  • Manual FOV testing, set all k values to 0.5.
  • Racing: PANTOMORPHIC_MODE 2; k-top 0.5; k-horizontal -0.5; k-bottom 0.0.
  • First-person perspective (FPP): PANTOMORPHIC_MODE 1; k-horizontal 0.5; k-vertical 0.88.

How to undistort UI?

You may have noticed that Perfect Perspective also affects the UI, like the mini-map, health bar, etc. With the add-on ReshadeEffectShaderToggler by 4lex4nder, you can render the distortion shader beneath the UI and other game elements.

  1. Download ReShade with full add-on support from https://reshade.me/.
  2. Install ReShade with full add-on support.
  3. Download the ReshadeEffectShaderToggler.addon v1.2.3 from GitHub.
  4. Copy the ReshadeEffectShaderToggler.addon to the game folder where ReShade is installed.
  5. Launch the game and open ReShade UI, move the UI window somewhere to the right.
  6. Enable Perfect Perspective.
  7. In the Add-ons tab, select Reshade Effect Shader Toggler > List of Toggle Groups > New.
  8. Tick the Active checkbox.
  9. Click Change effects and select PerfectPerspective from the list.
  10. Click Done in the Add-ons tab.
  11. To render the shader under the UI, click on the Change shaders button.
  12. Hit 1 on the numpad until the UI is undistorted and the game is distorted.
  13. When done, hit 3 on the numpad to set things as they are.
  14. Then click Done in the Add-ons tab and click Save all Toggle Groups so the settings will persist on the next launch.

How to get distortion of a real camera?

It is possible to closely match distortion parameters of an existing lens, like, for example, an on-board camera of an F1 bolid. The best way is to follow these steps:

  1. Enable Calibration mode within Perfect Perspective.
  2. Set Calibration mode to Calibration grid.
  3. Enable Image.fx shader and place it above PerfectPerspective.fx in the ReShade techniques window.
  4. Load the reference image in Image.fx by providing the image file path and resolution in Preprocessor definitions.
  5. Adjust distortion parameters until the Calibration grid aligns with the reference image.

How to sharpen the image center?

Perfect perspective shader enlarges the center of the screen, which may lead to a blurry picture. To avoid that, you can take one of these solutions:

  • Use FilmicSharpen.fx and enable the Sharpen only center option.
  • Enable DLSS sharpening in the Nvidia Control Panel per-game basis.
  • Run the game at a higher resolution than your monitor outputs.
    • You may need to enable Dynamic Super Resolution scalar in the Nvidia Control Panel.
    • Perfect Perspective's Calibration mode can help you find the proper value for the super resolution scale.

Unfortunately, blurriness is unavoidable without compromises, like black borders. The perfect fix would be to path-trace the whole game with distortion baked into ray directions or by using dynamic sampling resolution, but that requires in-engine implementation.