Welcome, Guest.
Username: Password: Remember me

TOPIC: New effect: Depth haze

New effect: Depth haze 1 year 10 months ago #1

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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: 1 year 10 months ago by OtisInf.
The administrator has disabled public write access.
The following user(s) said Thank You: crosire, JPulowski, Wicked Sick, NattyDread, SpinelessJelly, Ganossa, Constantine PC, Elimina, Tycholarfero, piltrafus and this user have 1 others thankyou

New effect: Depth haze 1 year 10 months ago #2

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: 1 year 10 months ago by SirArthurStreebGreebling.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #3

This sounds awesome.

This will tremendously help games like GTA V where the distant objects aren't too pretty.
I'm always learning.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #4

  • Wicked Sick
  • Wicked Sick's Avatar
  • Offline
  • Die young or suffer (Forgive my poor English)
  • Posts: 368
  • Thank you received: 106
I am going to try this tonight, thank you. Also, I loved your instructions hahah ^^
Finding relief somewhere between a tree's branch and its shade.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #5

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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: 1 year 10 months ago by OtisInf.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #6

  • Sh1nRa358
  • Sh1nRa358's Avatar
  • Offline
  • Posts: 144
  • Thank you received: 10
too difficult for me to see a difference :(
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #7

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #8

  • Sh1nRa358
  • Sh1nRa358's Avatar
  • Offline
  • Posts: 144
  • Thank you received: 10
I use ioxa's gaussian bloom shader with everything too. But I can't tell the differences in your screenies as well.
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #9

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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?
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #10

  • Sh1nRa358
  • Sh1nRa358's Avatar
  • Offline
  • Posts: 144
  • Thank you received: 10
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)?
The administrator has disabled public write access.

New effect: Depth haze 1 year 10 months ago #11

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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. :)
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #12

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! :)
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #13

The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #14

  • JPulowski
  • JPulowski's Avatar
  • Offline
  • Posts: 95
  • Thank you received: 87
Nice effect, Otis. :)

I have a question though: is there a negative or positive correlation between DEH_EffectStrength and DEH_EdgeBleedThreshold?
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #15

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
:)

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:



(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: 1 year 9 months ago by OtisInf.
The administrator has disabled public write access.
The following user(s) said Thank You: Pondural, GroinShooter

New effect: Depth haze 1 year 9 months ago #16

  • Mobeeuz
  • Mobeeuz's Avatar
  • Offline
  • Posts: 64
  • Thank you received: 16
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.
What is The Ashrealm?
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #17

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
Not sure what you mean, as they're there? github.com/crosire/reshade-shaders/blob/...r/ReShade/OtisFX.cfg
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #18

  • Mobeeuz
  • Mobeeuz's Avatar
  • Offline
  • Posts: 64
  • Thank you received: 16
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.
What is The Ashrealm?
Last Edit: 1 year 9 months ago by Mobeeuz.
The administrator has disabled public write access.
The following user(s) said Thank You: Ganossa

New effect: Depth haze 1 year 9 months ago #19

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 840
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 :)
The administrator has disabled public write access.

New effect: Depth haze 1 year 9 months ago #20

  • OtisInf
  • OtisInf's Avatar
  • Offline
  • Posts: 146
  • Thank you received: 67
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: 1 year 9 months ago by OtisInf.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2