DOF extra & ALF effect 3/13 2015

share shaders here
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: DOF extra & ALF effect 3/13 2015

kingeric1992 wrote:Oyama,
try to add thresholds & multipliers in the desired effect, I don't want to make it more complicate than it already was.
;)
Okay. But you made it FAR more simple code-wise... and efficient.
Anyway, these are matter of 3 o/ 4 additional lines ;)
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: DOF extra & ALF effect 3/13 2015

Hey uhm I think I asked you for permissions to port your effects to numerous stuff already but better one time too much than one time too less. I'm working hard on MasterEffect for ReShade and since I combined all DOF shaders to use the same focusing etc (you basically just switch blurring and weighting algorithms, the rest is uniform like blur radius etc) I am struggling to find a proper bleed masking and yours happen to be way better than anything I can think of (mine uses dynamic branching and is slow as fuck because it forces loop to unroll) so I'd need to copy heavily from your code, is that OK? You're mentioned in the credits ofc.

EDIT: were you high when writing this? "// Gloable Varibles " :D

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: DOF extra & ALF effect 3/13 2015

Okay.
and no, just got a little bit too excited when wrapping up the file, combined with bad Enblish.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
Posts: 4
Joined: 23 Mar 2015, 11:57

Re: DOF extra & ALF effect 3/13 2015

Hi there.

I added / changed the following things in your great dof effect:
- a desaturation effect (controlled by the 'DES' parameters).
- optimized a bit in the tight loop in PS_DepthOfField: (CenterCoC + 1) * BS_Highlight; is constant throughout the loop, so I precalculated that and moved it outside the forloop.

The desaturation effect desaturates depth pixels, meaning the more depth, the more desaturated the pixels, so you can get even more emphasis on the sharp subject.

Parameters added:
- DES Mode: 0 is normal DoF, 1 is saturate to greyscale, 2 is saturate to DES Blend Color
- DES Blend Color: the color to blend with the greyscale pixels so you can desaturate to another color instead of b/w.
- DES Blend factor, the factor with which DES Blend Color is blended onto the b/w pixels.

I used the 3.14 update, if you have changes made to this file, I can update it for you.

https://gist.github.com/FransBouma/99f041880582d35a2a25

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: DOF extra & ALF effect 3/13 2015

Hi OtisInf, welcome.

I've actually notice your work a couple of days ago on another screenshot site when I was googling around trying to find any dof feedback.
I definitely love the idea, relating color effect to the blur amount.

Thanks for the optimization, it will surely be included in future update.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
Posts: 4
Joined: 23 Mar 2015, 11:57

Re: DOF extra & ALF effect 3/13 2015

Cool! Glad it's of any use :D

Offline
User avatar
*blah-blah-blah maniac*
Posts: 506
Joined: 02 Aug 2013, 23:06
Location: New Hampshire, US

Re: DOF extra & ALF effect 3/13 2015

Liking the DEF parameters - this is rather cool.

Mode 1:

Image

Mode 2: with RGB 0,0,0

Image

Already doing some neat stuff with it in game.
_________________
Intel Core i9-9900K CPU @ 3.6 GHz // GeForce RTX 2080 Ti VRAM 11GB // Win10 64 and 64GB Ram // Monitor 2560x1440@144

Offline
User avatar
*blah-blah-blah maniac*
Posts: 506
Joined: 02 Aug 2013, 23:06
Location: New Hampshire, US

Re: DOF extra & ALF effect 3/13 2015

Just one more cause I am having so much fun with it:

Image

EDIT: 3 samples (note I am using GS Jyggalag which is a somewhat desaturated sepia preset to begin with)

DES mode 0 (no desat)

Image

DES mode 1 (BW desat)

Image

DES mode 2 (RGB black with a mix of 0.6)

Image
_________________
Intel Core i9-9900K CPU @ 3.6 GHz // GeForce RTX 2080 Ti VRAM 11GB // Win10 64 and 64GB Ram // Monitor 2560x1440@144

Offline
User avatar
*blah-blah-blah maniac*
Posts: 506
Joined: 02 Aug 2013, 23:06
Location: New Hampshire, US

Re: DOF extra & ALF effect 3/13 2015

I had a question and apologies if a bit ignorant as I am not a shader coder. The DES gray scale, mode 1, is it possible to have a cap on the amount of desaturation? You wrote, "The desaturation effect desaturates depth pixels, meaning the more depth, the more desaturated the pixels" but it tends to make things BW when doing most close ups. I was wondering if there is a way to either set a max (say no more then 50% desaturation) or some other method that would prevent the out of focus area going purely BW.

if(DES_Mode > 0)
{
// grey scale blurred pixels based on depth.
float greyscaleAverage = (res.r + res.g + res.b) / 3.0;
float4 desColor = float4(greyscaleAverage, greyscaleAverage, greyscaleAverage, res.a);
if(DES_Mode==2)
{
desColor = lerp(desColor, float4(DES_BlendColor, res.a), DES_BlendFactor);
}
res = lerp(res, desColor, res.a);
}

I looked at the function but while I understand basic program flow I am not familiar with the functions or color processing. I could also just be missing something obvious to do this but thought I would ask at least.
_________________
Intel Core i9-9900K CPU @ 3.6 GHz // GeForce RTX 2080 Ti VRAM 11GB // Win10 64 and 64GB Ram // Monitor 2560x1440@144

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: DOF extra & ALF effect 3/13 2015

in the last line:

Code: Select all

res = lerp(res, desColor, staturate(res.a * DES_Level));
add this at the UI part

Code: Select all

float DES_Level = <string UIName="DES Level";   float UIMin=0.0;  float UIMax=100;  float UIStep=0.001; > = {0}; 

you can also read res.a in enbeffect.fx and mix it with prod's coloring effects.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube
Post Reply