[SLE / SSE / FO4] Depth of Field

share shaders here
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Skyrim SE Advanced Depth of Field

ExtremeElementz: So this only happens with Tilt Shift...are you sure you fixed the code part right? Please show me how this code part looks for you.

Offline
User avatar
Posts: 18
Joined: 01 Dec 2016, 13:57

Re: Skyrim SE Advanced Depth of Field

@MartyMcFly
Ok, I will get you a screenshot tonight what mine looks like, stupid work is getting in my way of game time again... :lol:

Offline
User avatar
Posts: 18
Joined: 01 Dec 2016, 13:57

Re: Skyrim SE Advanced Depth of Field

I am assuming this is what you wanted me to post?
This was the only line I changed, and disabled Tilt Shift.
#define iADOF_FocusMode 0 //[0 to 1] 0: gp65cj04/Marty McFly focusing | 1: Tilt Shift

Code: Select all

//Non UI-able vars (actually possible but requires dynamic branching which wastes resources even when effects are not used)
#define bADOF_ShapeWeightEnable 	1	//[0 or 1] Enables bokeh shape weight bias and shifts color to the shape borders.
#define bADOF_ShapeChromaEnable 	1	//[0 or 1] Enables chromatic aberration at bokeh shape borders. This means 3 times more samples = less performance.
#define iADOF_ShapeChromaMode 		1	//[1 to 6] Switches through the possible R G B shifts.
#define iADOF_FocusMode                 0       //[0 to 1] 0: gp65cj04/Marty McFly focusing | 1: Tilt Shift

//UI vars
#if(iADOF_FocusMode == 0)//Marty McFly (gp65cj04 modified) Focusing
bool    bADOF_AutofocusEnable 		< string UIName="DOF: Enable Autofocus";															> = {true};
float2	fADOF_AutofocusCenter 		< string UIName="DOF: Autofocus sample center"; 	string UIWidget="Spinner"; 	float UIStep=0.01; 	float UIMin=0.00; 	float UIMax=1.00;	> = {0.5,0.5};
int	iADOF_AutofocusSamples		< string UIName="DOF: Autofocus sample count";  	string UIWidget="spinner"; 				int UIMin=0; 		int UIMax=10; 		> = {6};
float	fADOF_AutofocusRadius		< string UIName="DOF: Autofocus sample radius";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=0.50;	> = {0.05};
float	fADOF_ManualfocusDepth		< string UIName="DOF: Manual focus depth";		string UIWidget="Spinner";	float UIStep=0.001;	float UIMin=0.00;	float UIMax=1.0;	> = {0.05};
float	fADOF_NearBlurCurve		< string UIName="DOF: Near blur curve";			string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=20.0;	> = {1.0};
float	fADOF_FarBlurCurve		< string UIName="DOF: Far blur curve";			string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=20.0;	> = {1.0};
float	fADOF_NearBlurMult		< string UIName="DOF: Near blur mult";			string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=1.0;	> = {1.0};
float	fADOF_FarBlurMult		< string UIName="DOF: Far blur mult";			string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=1.0;	> = {1.0};
float	fADOF_InfiniteFocus		< string UIName="DOF: Infinite depth distance";		string UIWidget="Spinner";	float UIStep=0.001;	float UIMin=0.00;	float UIMax=1.0;	> = {1.0};
#endif
#if(iADOF_FocusMode == 1)//Marty McFly Tilt Shift
float	fADOF_TiltShiftPosition		< string UIName="DOF: Tilt Shift Axis Position";	string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=-1.0;	float UIMax=1.0;	> = {0.0};
float	fADOF_TiltShiftWidth		< string UIName="DOF: Tilt Shift Focus Width";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.0;	float UIMax=1.0;	> = {0.0};
float	fADOF_TiltShiftRotation		< string UIName="DOF: Tilt Shift Axis Rotation (\xB0)"; string UIWidget="Spinner";	float UIStep=1.00;	float UIMin=0.0;	float UIMax=180.0;	> = {0.0};
float	fADOF_TiltShiftBlurCurve	< string UIName="DOF: Tilt Shift Blur Curve";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.01;	float UIMax=10.0;	> = {2.0};
#endif
float	fADOF_BokehCurve		< string UIName="DOF: Bokeh Intensity";			string UIWidget="Spinner";	float UIStep=0.1;	float UIMin=0.1;	float UIMax=10.0;	> = {4.0};
float	fADOF_ShapeRadius		< string UIName="DOF: Bokeh shape max size";		string UIWidget="Spinner";	float UIStep=0.1;	float UIMin=0.0;	float UIMax=50.0;	> = {12.0};
int	iADOF_ShapeVertices		< string UIName="DOF: Bokeh shape vertices";		string UIWidget="spinner";				int UIMin=3;		int UIMax=9;		> = {6};
int	iADOF_ShapeQuality		< string UIName="DOF: Bokeh shape quality";		string UIWidget="spinner";				int UIMin=2;		int UIMax=25;		> = {9};
float	fADOF_ShapeCurvatureAmount	< string UIName="DOF: Bokeh shape curvature";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.1;	float UIMax=1.0;	> = {1.0};
float	fADOF_ShapeRotation		< string UIName="DOF: Bokeh shape rotation (\xB0)";	string UIWidget="Spinner";	float UIStep=1;		float UIMin=0;		float UIMax=360;	> = {15};
float	fADOF_ShapeAnamorphRatio	< string UIName="DOF: Bokeh shape aspect ratio";	string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.0;	float UIMax=1.0;	> = {1.0};
#if(bADOF_ShapeWeightEnable != 0)
 float	fADOF_ShapeWeightCurve		< string UIName="DOF: Bokeh shape weight curve";	string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.50;	float UIMax=8.0;	> = {1.0};
 float	fADOF_ShapeWeightAmount		< string UIName="DOF: Bokeh shape weight amount";	string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=1.0;	> = {1.0};
#endif
#if(bADOF_ShapeChromaEnable != 0)
 float	fADOF_ShapeChromaAmount		< string UIName="DOF: Shape chroma amount";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.00;	float UIMax=0.50;	> = {0.15};
#endif
float	fADOF_RenderResolutionMult	< string UIName="DOF: Blur render res mult";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.5;	float UIMax=1.0;	> = {0.7};
float	fADOF_SmootheningAmount		< string UIName="DOF: Gaussian postblur width";		string UIWidget="Spinner";	float UIStep=0.01;	float UIMin=0.1;	float UIMax=5.0;	> = {1.0};

Offline
User avatar
Posts: 36
Joined: 07 Dec 2016, 03:47
Location: LA

Re: Skyrim SE Advanced Depth of Field

Note: I am using MXAO (Framework 2.0)

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

Re: Skyrim SE Advanced Depth of Field

ExtremeElementz: So you didn't actually apply the fix I wrote?

EDIT: Might've derived a smoothing func to remove the hysteresis of the focusing. Not possible mathematically to create an actual function for that but I might've mimiced its behaviour.

Offline
User avatar
Posts: 18
Joined: 01 Dec 2016, 13:57

Re: Skyrim SE Advanced Depth of Field

So Marty I wasn't paying attention at the above posts were you let us know about the fix... my bad. So I tried the fix tonight and it fixed it perfectly thanks. I know NOTHING about the code you're using for this shader stuff but damn did it make me feel like a hacker by adding what you told me to! 8-) Pretty sweet! Tested the one line you showed us and it worked so I deleted it and added what you specified and tested it again and still working as it should. Can you check my code to make sure everything is in it's place.

Code: Select all

                float4 tap = TextureColor.SampleLevel(Sampler1, texcoord.xy + actualoffset,0);
                float tapblurAmount = abs(tap.w * 2.0 - 1.0);
                //weight *= (tapblurAmount >= blurAmount*0.2) ? 1.0 : 0.0;
                #if(iADOF_FocusMode == 1)
				weight *= smoothstep(-0.0001,0.0,tapblurAmount-blurAmount);
                #endif
                scenecolor.xyz += tap.xyz * weight;
                scenecolor.w += weight;


Thanks again for assisting us. Is this written in C++

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

Re: Skyrim SE Advanced Depth of Field

Yes, that is correct. Strangely, I don't get this bug even with the default code. But if this fixes it, alrighty then.
Did a lot of tests for some function to minimize the hysteresis of focusing and I think I got it. Will push update soonTM.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Skyrim SE Advanced Depth of Field

While you're at it, would it be possible to make the Tilt-Shift an addition to the existing focus mode rather than an alternative ?
Don't know if I'm clear here...
_________________
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: Skyrim SE Advanced Depth of Field

How would you do that?? I mean, tilt shift blurs image and doesn't care about focus. It's the exact opposite to any depth based focusing.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Skyrim SE Advanced Depth of Field

I don't know. I haven't got 1% of your skills, but didn't GPC did that thing in his DoF, merging a tilt-shift effect in the DoF method ? Was it simply applying blur on blur ?
_________________
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
Post Reply