Skip to content

Commit

Permalink
Added options to blur the depth map and updated documentation on why.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbienz committed Nov 2, 2021
1 parent 4483cae commit 6cefde3
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 14 deletions.
Binary file added Doc/Images/BlurSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Doc/Images/Config.png
Binary file not shown.
Binary file added Doc/Images/FaceBlur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/Images/FaceNoBlur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/Images/HairBlur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/Images/HairNoBlur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/Images/MainSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,47 @@ There are several reasons why [ReShade](https://reshade.me) was chosen:
1. Extract the `Shaders` folder from the zip file into the games `reshade-shaders` folder, merging with the `Shaders` folder that already exists.

## Usage

### Main Settings
Once installed, launch the game and press 'Home' on your keyboard to bring up the ReShade menu.

Check the box next to LookinGlass, then use the sliders to achieve the desired depth:

<img src="Doc/Images/Config.png" width=600>
<img src="Doc/Images/MainSettings.png" width=600>

- **Wide open shots like skylines:** Use large values for **Far Importance** (800+) and small values for **Multiplier** (1-2).
- **Narrow shots like selfies:** Use very small values for **Far Importance** (0.1 - 0.5) and large values for **Multiplier** (50-200).

### Blur Settings

The blur settings can be used to "smooth out" sharp differences in the depth map.

<img src="Doc/Images/BlurSettings.png" width=600>

There are three sliders that can be used to adjust the blur, but the defaults should work well for most screenshots.

#### Why blur the depth map at all?

The primary reason is to make life easier for HoloPlay Studio when recreating the scene.

In CyberPunk 2077, for example, the depth map often has holes and pixelation in areas like hair:

<img src="Doc/Images/HairNoBlur.png">

These wreak havoc when HoloPlay tries to recreate the 3D surface for the hair. Blurring the depth map fills in holes and smoothes out the pixelation.

<img src="Doc/Images/HairBlur.png">

It's also common in games for a subject to be close to the camera when the background is far away:

<img src="Doc/Images/FaceNoBlur.png">

This again is *very* difficult for HoloPlay Studio. The sharp contrast between things that are close and things that are far causes tearing in the image. This tearing is especially visible when you view the scene from the sides. Blurring the depth map "rounds off" these sharp edges and creates a smooth transition from close to far.

<img src="Doc/Images/FaceBlur.png">

Smooth transition means far less tearing.

## Compatibility
What if a game on the [compatibility list](https://reshade.me/compatibility) mentions depth buffer issues?

Expand Down Expand Up @@ -91,5 +123,9 @@ When troubleshooting it can be helpful to turn OFF the **LookingGlass** shader a

For additional help, watch this [ReShade Depth Tutorial](https://www.youtube.com/watch?v=52KZrMOo4Y8) by Daemon White.

## Thanks

Special thanks to Ioxa and Otakumouse for their [GaussianBlur shader](https://github.com/Otakumouse/stormshade/blob/master/v4.X/reshade-shaders/Shader%20Library/Recommended/GaussianBlur.fx), which was modified and embedded in this shader to enable blurring the depth map.

## Questions?
I'm not always online, but my user name is **eXntrc** on the [Looking Glass Discord](https://discord.com/invite/lookingglassfactory).
29 changes: 16 additions & 13 deletions Shaders/LookingGlass.fx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
LookingGlass by Jared Bienz. Based on the incredible DisplayDepth Fx originally
created by CeeJay.dk (with many updates and additions by the Reshade community)
created by CeeJay.dk (with many updates and additions by the Reshade community).
Version 1.1 also now leverages GaussianBlur by Ioxa to smooth out the depth map.
Thank you!
Visualizes color and depth in a format ready to be imported into HoloPlay Studio.
*/
Expand Down Expand Up @@ -82,27 +85,27 @@ uniform float fUIDepthMultiplier <
uniform int GaussianBlurRadius <
ui_type = "drag";
ui_label = "Blur Radius";
ui_tooltip = "Adjusts the blur radius. Higher values increase the radius";
ui_tooltip = "How many neighboring pixels influence the original pixel.";
ui_min = 0.0; ui_max = 4.0;
ui_step = 1.0;
> = 3;

uniform float GaussianBlurOffset <
ui_type = "drag";
ui_label = "Blur Offset";
ui_tooltip = "Additional adjustment for the blur radius. Values less than 1.00 will reduce the radius.";
ui_min = 0.00; ui_max = 1.00;
ui_step = 0.1;
> = 0.4;
> = 4;

uniform float GaussianBlurStrength <
ui_type = "drag";
ui_label = "Blur Strength";
ui_tooltip = "Adjusts the strength of the blur.";
ui_tooltip = "How strongly do neighboring pixels influence the original pixel.";
ui_min = 0.00; ui_max = 1.00;
ui_step = 0.1;
ui_step = 0.001;
> = 1.000;

uniform float GaussianBlurOffset <
ui_type = "drag";
ui_label = "Blur Offset";
ui_tooltip = "Can be used to fine-tune the 'crispness' of the edge.";
ui_min = 0.00; ui_max = 2.00;
ui_step = 0.001;
> = 0.5;

// -- Variables --

texture GaussianBlurTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
Expand Down

0 comments on commit 6cefde3

Please sign in to comment.