New effect: Depth haze

  • OtisInf
  • Topic Author
More
8 years 4 months ago - 8 years 4 months ago #1 by OtisInf New effect: Depth haze was created by OtisInf
When playing The Witcher 3, I noticed they had some kind of depth of field which worked only in the distance (so not a lens effect, but a depth effect). This effect is rather nice, as it makes objects in the distance like a tower look slightly blurred, which is needed to avoid sharp pixel edges and thus ugly images.

You can see this effect here: (Check the tower in the distance).
abload.de/image.php?img=witcher32015-11-1718-lapih.png

However, in freecam this is disabled:
abload.de/image.php?img=witcher32015-11-1718-b1ol3.png

Which is of course annoying if you want to make proper screenshots. So I created this effect for reshade. It's called depth haze and it makes the above picture look cool again:
abload.de/image.php?img=witcher32015-11-1718-tqpus.png

It works by blending a blurred version of the screenbuffer onto the screenbuffer based on depth. It prevents edge bleed to avoid shimmering due to the blur when sharp edges are present.

Code: github.com/FransBouma/OtisFX

I'll try to create a PR for reshade on github to add my effects. I'll clean up my config file a bit so everything is properly commented and has range values for mediator.

Hope it's useful! :)

(the blurring and edge bleed threshold is configurable. Of course if I made a glorious error somewhere, please let me know!)
Last edit: 8 years 4 months ago by OtisInf.
The following user(s) said Thank You: crosire, JPulowski, Wicked Sick, NattyDread, SpinelessJelly, Ganossa, Constantine PC, Elimina, Tycholarfero, piltrafus and 2 other people also said thanks.

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

  • SirArthurStreebGreebling
More
8 years 4 months ago - 8 years 4 months ago #2 by SirArthurStreebGreebling Replied by SirArthurStreebGreebling on topic New effect: Depth haze
I was just thinking about how it would be nice if this was added to reshade earlier..thanks.

I'm getting an undeclared identifier "RFX_pixelsize" error in the depthhaze.h file. Not sure whats causing that but this isn't the first time I've had it using third party shaders, am i doing something wrong?

Nevermind, fixed it. The line was taken out of the reshadefx file in 1.1 i think. You just need to paste this line into reshade.fx

#define RFX_pixelSize RFX_PixelSize
Last edit: 8 years 4 months ago by SirArthurStreebGreebling.

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

  • Constantine PC
More
8 years 4 months ago #3 by Constantine PC Replied by Constantine PC on topic New effect: Depth haze
This sounds awesome.

This will tremendously help games like GTA V where the distant objects aren't too pretty.

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

  • Wicked Sick
More
8 years 4 months ago #4 by Wicked Sick Replied by Wicked Sick on topic New effect: Depth haze
I am going to try this tonight, thank you. Also, I loved your instructions hahah ^^

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago - 8 years 4 months ago #5 by OtisInf Replied by OtisInf on topic New effect: Depth haze
Thanks all!

SirArthurStreebGreebling wrote: I was just thinking about how it would be nice if this was added to reshade earlier..thanks.

I'm getting an undeclared identifier "RFX_pixelsize" error in the depthhaze.h file. Not sure whats causing that but this isn't the first time I've had it using third party shaders, am i doing something wrong?

Nevermind, fixed it. The line was taken out of the reshadefx file in 1.1 i think. You just need to paste this line into reshade.fx

#define RFX_pixelSize RFX_PixelSize

:oops:
Thanks for that! Indeed I used 1.0. I've corrected depthhaze.h on github, so the version there now has the right casing and should work with 1.1! (so the line you copy/pasted in can be removed)
Last edit: 8 years 4 months ago by OtisInf.

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

  • Sh1nRa358
More
8 years 4 months ago #6 by Sh1nRa358 Replied by Sh1nRa358 on topic New effect: Depth haze
too difficult for me to see a difference :(

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago #7 by OtisInf Replied by OtisInf on topic New effect: Depth haze
It should be noticeable if you press F4. At startup do you see 'OtisFX' in the list of names? Did you add the include line to Pipeline.cfg? It might be your game doesn't use a depth buffer though, in that case it isn't going to work.

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

  • Sh1nRa358
More
8 years 4 months ago #8 by Sh1nRa358 Replied by Sh1nRa358 on topic New effect: Depth haze
I use ioxa's gaussian bloom shader with everything too. But I can't tell the differences in your screenies as well.

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago #9 by OtisInf Replied by OtisInf on topic New effect: Depth haze
Look at the tower in the distance. The in-game one is (slightly) blurred, the effect one is too (slightly), the one with just freecam on isn't (it's crisp). You need to expand the pictures by clicking on them. Gaussian bloom is a 2D effect, not using the depth buffer, so if that one works it isn't a guarantee depth buffer based effects work. Does DoF work?

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

  • Sh1nRa358
More
8 years 4 months ago #10 by Sh1nRa358 Replied by Sh1nRa358 on topic New effect: Depth haze
Yes, dof works. I see I had to press F4 to see the effect because it doesn't happen automatically.
Btw, there's a yellow line of text onscreen when enabling Emphasize. It says: State of Decay [Year-One Survival Edition]\Shader@0x18448718(178,28): warning X3206: '__tex2D': implicit truncation of vector type

Can you allow for the blur to be stronger and can you allow to bring the blur closer to the center (character)?

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago #11 by OtisInf Replied by OtisInf on topic New effect: Depth haze
The warning is likely not from my code, but I'll double check (I've checked for the warning yesterday and couldn't find it).

the blur can be stronger, just increase the DEH_EffectStrength value in otisfx.cfg. 1.0 is the max, and will make a lot very blurry.
I think increasing the value will already answer your second question as well :) (as it works on the depth buffer, which starts immediately at the character. :)

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

  • Alastre
More
8 years 4 months ago #12 by Alastre Replied by Alastre on topic New effect: Depth haze
Hi everybody,

I'm new here and totally newbie about this software...hope this is the right thread to join! Fact is, I've found this "mod" (actualy a reshade preset) on nexus for Witcher 3:

www.nexusmods.com/witcher3/mods/152/ ?

I've spent a few days trying to make it works than I realized it only works with old reshade version. I Think it's an Amazing preset (except too dark and warm\satured...plus kill GPU and I'm playing 4K native with 980ti SLI). Due to the fact it's impossible to contact the autor, I'd like to know if possibile what kind of effect he used to give the game this kind of effect...everything looks more detailed and like being Whole part of the world, like being in a bubble...everything looks rounded...is that bloom, depth of field or what? Could it be this depth haze? Really don't know how to explain...but look here the difference:

i.imgur.com/4y8jDND.jpg
i.imgur.com/OImoBod.jpg

I was wondering if anybody here was able to edit this preset to make it less dark and with colder colors...and lighter for gpu...or at least explain me how to add this particolar effect to the preset i'm using now...thank you very much in advance! :)

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

  • Alastre
More
  • JPulowski
More
8 years 4 months ago #14 by JPulowski Replied by JPulowski on topic New effect: Depth haze
Nice effect, Otis. :)

I have a question though: is there a negative or positive correlation between DEH_EffectStrength and DEH_EdgeBleedThreshold?

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago - 8 years 4 months ago #15 by OtisInf Replied by OtisInf on topic New effect: Depth haze
:)

the threshold simply doesn't allow a neighbor pixel to be taken into account for the blur if the contrast is over the bleed threshold (so a sharp edge of a branch in front of a sky doesn't bleed into the pixels of the sky and vice versa). effect strength therefore doesn't affect it.

This didn't feel right with me, it felt like a hack. So I rewrote the effect: I now use weighted blurring: weight of a pixel is based on distance to the pixel to blur (in screenspace), its depth difference and its actual depth. This automatically prevents edge bleed entirely. In the latest version I therefore removed the edgebleed setting. Now looks like this:

[img


(this is fairly strong effect strength (0.6). Smooth progress of the slight blur, no edge bleed of sharp edges of treebranches etc.)

I've created a Pull request to get it merged into the reshade framework.

(edit) now merged with reshade shader framework: github.com/crosire/reshade-shaders .
Last edit: 8 years 4 months ago by OtisInf.
The following user(s) said Thank You: Pondural, GroinShooter

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

  • Mobeeuz
More
8 years 4 months ago #16 by Mobeeuz Replied by Mobeeuz on topic New effect: Depth haze

OtisInf wrote: :)(edit) now merged with reshade shader framework

It's slightly broken, you forgot to add //??? Settings<\\ markers in the OtisFX.cfg. Mediator has no settings to display.

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago #17 by OtisInf Replied by OtisInf on topic New effect: Depth haze
Not sure what you mean, as they're there? github.com/crosire/reshade-shaders/blob/...r/ReShade/OtisFX.cfg

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

  • Mobeeuz
More
8 years 4 months ago - 8 years 4 months ago #18 by Mobeeuz Replied by Mobeeuz on topic New effect: Depth haze

OtisInf wrote: Not sure what you mean, as they're there?

There are no settings to manipulate via mediator. Case and point, with the vanilla cfg:
////-------------------//
/// **GOLDEN RATIO**  ///
//-------------------////
#define USE_GOLDENRATIO 0 //[GoldenRatio] //-Golden Ratio : This simple effect renders 4 golden ratio spirals (fibonacci) on the screen to make it easier to take perfect screenshots by making it easier to perfect the composition. Requires the game to have an active depth buffer.

#define GOR_Opacity 0.3 //[0.00:1.00] //-Opacity of overlay. 0 is invisible, 1 is opaque lines.
#define GOR_ResizeMode 1 //[0:1] //-Resize mode: 0 is clamp to screen (so resizing of overlay, no golden ratio by definition), 1: resize to either full with or full height while keeping aspect ratio: golden ratio by definition in lined area.
#define GOR_ToggleKey RFX_ToggleKey //[undef] //-Key to toggle the overlay on or off.
You get this:

Now if you change the code to the following:
////-------------------//
/// **GOLDEN RATIO**  ///
//-------------------////
#define USE_GOLDENRATIO 0 //[GoldenRatio] //-Golden Ratio : This simple effect renders 4 golden ratio spirals (fibonacci) on the screen to make it easier to take perfect screenshots by making it easier to perfect the composition. Requires the game to have an active depth buffer.

//>Golden Ratio Settings<\\
#define GOR_Opacity 0.3 //[0.00:1.00] //-Opacity of overlay. 0 is invisible, 1 is opaque lines.
#define GOR_ResizeMode 1 //[0:1] //-Resize mode: 0 is clamp to screen (so resizing of overlay, no golden ratio by definition), 1: resize to either full with or full height while keeping aspect ratio: golden ratio by definition in lined area.
#define GOR_ToggleKey RFX_ToggleKey //[undef] //-Key to toggle the overlay on or off.
You get this:

Obviously, that screenshot includes //>Depth Haze Settings<\\ and //>Emphasize Settings<\\ settings as well.
Last edit: 8 years 4 months ago by Mobeeuz.
The following user(s) said Thank You: Ganossa

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

  • Ganossa
More
8 years 4 months ago #19 by Ganossa Replied by Ganossa on topic New effect: Depth haze
Thanks Mobeeuz for pointing that out, I did not see that either.

I quickly added the category names in Otis, hope you do not mind :)

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

  • OtisInf
  • Topic Author
More
8 years 4 months ago - 8 years 4 months ago #20 by OtisInf Replied by OtisInf on topic New effect: Depth haze
Oh! I didn't know the category name had to be above the settings, I assumed it simply then displayed the settings there in the top category. My bad! Thanks for fixing ;)
Last edit: 8 years 4 months ago by OtisInf.

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.