Tilt Shift test.
24mm f/5 focus at 0.85m
Tilt shift enable
rotate tilt shift axis
btw, focus depth shift is calculated by principal distance shift cause by lens tilting, not just simple multiplier.
New DoF with DSLR model [WIP] need help
- Author
- Message
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
-
Offline
- *blah-blah-blah maniac*
- Posts: 17562
- Joined: 27 Dec 2011, 08:53
- Location: Rather not to say
Re: New DoF with DSLR model [WIP] need help
Fov default is 65 for me. But probably it's because game set it for 4:3 display and for wide it's 75, which is silly.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
Boris, I gave up on relating FOV with focal length. A friend told me that it is hard to tell the FOV difference between 24 - 70mm for noobs like me.
Fix depth to SI unit
50mm f/5.6
Edit: I forgot FoV can be modified in console. will try if that makes any difference.
haven't fix bokeh artifacts.
50mm f/1.8 with proper FOV 39.6
also fix CoC Size (CoC is diameter, not radii)
Fix depth to SI unit
50mm f/5.6
Edit: I forgot FoV can be modified in console. will try if that makes any difference.
haven't fix bokeh artifacts.
50mm f/1.8 with proper FOV 39.6
also fix CoC Size (CoC is diameter, not radii)
-
Offline
- *sensei*
- Posts: 252
- Joined: 08 Nov 2013, 20:38
- Location: Greece
Re: New DoF with DSLR model [WIP] need help
Really interesting results you have here, hope you keep working on it.
_________________
/ Youtube Channel / Music Channel /
CPU: Intel Core i7-6850k @4.2GHz GPU: NVIDIA GeForce GTX 1060 Aorus OC 6gb vram RAM: Corsair DDR4 32gb Disk Drive: SSD Mushkin 120gb
/ Youtube Channel / Music Channel /
CPU: Intel Core i7-6850k @4.2GHz GPU: NVIDIA GeForce GTX 1060 Aorus OC 6gb vram RAM: Corsair DDR4 32gb Disk Drive: SSD Mushkin 120gb
-
Offline
- *sensei*
- Posts: 446
- Joined: 17 Apr 2014, 22:12
- Location: Schweden
Re: New DoF with DSLR model [WIP] need help
Boris
Huh I didn't know Skyrim changed FoV just because 4:3 ratio.
kingeric1992
Looks really great!
Huh I didn't know Skyrim changed FoV just because 4:3 ratio.
kingeric1992
Looks really great!
_________________
| i5 3350p @3.1 | 16 GB RAM | GTX1060 | Skyrim on SSD |
My Flickr
My Soundcloud
CGI ENB
| i5 3350p @3.1 | 16 GB RAM | GTX1060 | Skyrim on SSD |
My Flickr
My Soundcloud
CGI ENB
-
Offline
- *blah-blah-blah maniac*
- Posts: 506
- Joined: 02 Aug 2013, 23:06
- Location: New Hampshire, US
Re: New DoF with DSLR model [WIP] need help
My default FOV in vanilla game is also FOV 65.ENBSeries wrote:Fov default is 65 for me. But probably it's because game set it for 4:3 display and for wide it's 75, which is silly.
_________________
Intel Core i9-9900K CPU @ 3.6 GHz // GeForce RTX 2080 Ti VRAM 11GB // Win10 64 and 64GB Ram // Monitor 2560x1440@144
Intel Core i9-9900K CPU @ 3.6 GHz // GeForce RTX 2080 Ti VRAM 11GB // Win10 64 and 64GB Ram // Monitor 2560x1440@144
-
Offline
- *sensei*
- Posts: 373
- Joined: 07 Mar 2013, 10:14
Re: New DoF with DSLR model [WIP] need help
Interesting work to be sure.
Curious that you went with the SI unit for distance since converting the ingame depth distance to that made no sense to me when I did it. At least when comparing what I had with camera images etc.
In general when I made my DoF I found that using values that make sense in a photography theory sense, made no sense when applying them ingame. Hence I just converted to some arbitrary unit and then adjusted until it looked good.
I also gave up trying to link focal lenght to FoV... it just produced so many weird situations that I just did not feel it was worth the hassle.
Curious that you went with the SI unit for distance since converting the ingame depth distance to that made no sense to me when I did it. At least when comparing what I had with camera images etc.
In general when I made my DoF I found that using values that make sense in a photography theory sense, made no sense when applying them ingame. Hence I just converted to some arbitrary unit and then adjusted until it looked good.
I also gave up trying to link focal lenght to FoV... it just produced so many weird situations that I just did not feel it was worth the hassle.
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
Thanks for replies, the fov problem no longer bothers me, I just manually set them in console with focal length ref table( or using text display to show supposed fov like ENB Diagnostic tool by number6).
As Ayien said, the question now is to get proper(real) depth, otherwise the CoC won't be realistic.
Anyway, still having fun with tilt effect.
Here is CoC to Alpha PS
Here is linearizeDepth func
feel free to test these out. It should be compatible with most of the prepass file.
Edit: After further study, setting zF & zN incorrectly will also return incorrect depth.
As Ayien said, the question now is to get proper(real) depth, otherwise the CoC won't be realistic.
Anyway, still having fun with tilt effect.
Here is CoC to Alpha PS
Code: Select all
int MF <
string UIName="MF";
string UIWidget="Slider";
int UIMin=0;
int UIMax=1;
> = {0};
float FocalPlaneDepth <
string UIName="MF Focal Plane";
string UIWidget="Slider";
float UIMin=0.00;
float UIMax=1000.00;
> = {0.00};
float FocalLength <
string UIName="Focal Length (mm)";
string UIWidget="Slider";
float UIMin=0.00;
float UIMax=10000.00;
> = {84};
float F_Number <
string UIName="F_Number";
string UIWidget="Slider";
float UIMin=0.00;
float UIMax=10000.00;
> = {32};
float TS_Axis <
string UIName="TS_rotation";
string UIWidget="Slider";
float UIMin=0.00;
float UIMax=180;
float UIStep=1;
> = {0};
float TS_Angle <
string UIName="TS_angle";
string UIWidget="Slider";
float UIMin= -10;
float UIMax= 10;
> = {0};
float4 PS_ProcessPass1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float2 coord = IN.txcoord;
float4 res = tex2D(SamplerColor, coord);
float depth = linearizeDepth(tex2D(SamplerDepth, coord).x);
float FilmWide = 0.0359;//35mm film
float TS_Dist = ((coord.x - 0.5) * tan(TS_Axis * 0.0174533) - ScreenSize.z * ( coord.y - 0.5)) / length(float2( tan(TS_Axis * 0.0174533), ScreenSize.z)) * FilmWide;//in m
float CenterFocusDepth = lerp( tex2D(SamplerFocus, 0.5).x, FocalPlaneDepth, MF);//in m
float focallength = FocalLength / 1000;//in m
float PrincipalDist = CenterFocusDepth * focallength / (CenterFocusDepth - focallength);//in m
PrincipalDist += tan( TS_Angle * 0.0174533) * TS_Dist;//in m
float FocusDepth = PrincipalDist * focallength / (PrincipalDist - focallength);//in m
res.w = (focallength / F_Number ) * (abs(depth - FocusDepth) / depth) * (PrincipalDist / FocusDepth); //in m
res.w /= FilmWide;// % to screenx
return res;
}
Code: Select all
float linearizeDepth(float nonlinearDepth)// found in GP's file
{
float2 dofProj=float2(0.0509804, 3098.0392);
float2 dofDist=float2(0.0, 0.0509804);
float4 depth=nonlinearDepth;
depth.y=-dofProj.x + dofProj.y;
depth.y=1.0/depth.y;
depth.z=depth.y * dofProj.y;
depth.z=depth.z * -dofProj.x;
depth.x=dofProj.y * -depth.y + depth.x;
depth.x=1.0/depth.x;
depth.y=depth.z * depth.x;
depth.x=depth.z * depth.x - dofDist.y;
depth.x+=dofDist.x * -0.5;
depth.x=max(depth.x, 0.0);
return depth.x;
}
float linearizeDepth(float zB)// from here http://web.archive.org/web/20130416194336/http://olivers.posterous.com/linear-depth-in-glsl-for-real
{
return zF * zN / (zF + zB * ( zN - zF));
}
Edit: After further study, setting zF & zN incorrectly will also return incorrect depth.
-
Offline
- *sensei*
- Posts: 373
- Joined: 07 Mar 2013, 10:14
Re: New DoF with DSLR model [WIP] need help
Actually you never get incorrect depth.. you just move the focus plane distance when you adjust those values. Hence just put them at something where your CoC or focal lenght parameter behaves nicely and call it a day... at least that is what I did.
I saw no point in having 3 parameters that in theory should be there, but when you look at the math they all just adjust the same thing... ie move the focal plane distance.
I started out with like 20 parameters but in the end I only had this
------Camera------=false
CoC=0.03
Focal Length=1.0
Focus Point Hori=0.5
Focus Point Vert=0.5
------Bokeh Blur------=false
Bokeh Bias=0.5
Blur Distance=0.75
Blur Radial Fade=3.0
CoC and Focal lenght is almost the same thing as well.. but one was a factor 10 larger hence CoC is mainly just a fine tuning knob for the focal distance and the focal lenght the coarse.
Focus point is just that... The Bokeh Bias just determine if the bokeh effect is full or sparse. None of that weird thing other DoF files for ENB have going on where Bias is linked to a brightness multiplier...Does not behave like the effect should work in other games and applications from what I could tell.
Blur distance just control how strong the blur is... and the radial fade is what I found to work very wonderfully to make sure you do not get weapon blur but still manage to get screen egde blur on the area that is between the camera and the focal plane.
I found that worked much much MUCH better then how most others do it... simply remove it and then have a gaussian blur on top to mimic a weak blur... which then still blurs the weapon.
The code for doing it is also really simple so perhaps something you want to play with.
Basically just says that pixels should be blurred radially rather then linearly if the depth is less then the focus depth.
Since you do it via alpha then you most likely need to make some adjustments however.
I did not do it via alpha in my file because.... no need since I only use a single PS to do what I want.
I saw no point in having 3 parameters that in theory should be there, but when you look at the math they all just adjust the same thing... ie move the focal plane distance.
I started out with like 20 parameters but in the end I only had this
------Camera------=false
CoC=0.03
Focal Length=1.0
Focus Point Hori=0.5
Focus Point Vert=0.5
------Bokeh Blur------=false
Bokeh Bias=0.5
Blur Distance=0.75
Blur Radial Fade=3.0
CoC and Focal lenght is almost the same thing as well.. but one was a factor 10 larger hence CoC is mainly just a fine tuning knob for the focal distance and the focal lenght the coarse.
Focus point is just that... The Bokeh Bias just determine if the bokeh effect is full or sparse. None of that weird thing other DoF files for ENB have going on where Bias is linked to a brightness multiplier...Does not behave like the effect should work in other games and applications from what I could tell.
Blur distance just control how strong the blur is... and the radial fade is what I found to work very wonderfully to make sure you do not get weapon blur but still manage to get screen egde blur on the area that is between the camera and the focal plane.
I found that worked much much MUCH better then how most others do it... simply remove it and then have a gaussian blur on top to mimic a weak blur... which then still blurs the weapon.
The code for doing it is also really simple so perhaps something you want to play with.
Code: Select all
//Makes the near part of the DoF radial instead of a linear plane.
if(Depth < FDepth)
{
float BlurRadialDist = distance(IN.TexCoord.xy, float2(FocusX,FocusY));
BlurRadialDist = smoothstep(0.0, Blur + (1.0/BlurRadialFade), BlurRadialDist);
Blur *= clamp(BlurRadialDist,0.0,1.0);
}
Since you do it via alpha then you most likely need to make some adjustments however.
I did not do it via alpha in my file because.... no need since I only use a single PS to do what I want.
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
Aiyen
Not sure what you meant by never get incorrect depth? The whole coc calculation is based on DSLR(or lens) model, so that users can get similar result as real world in skyrim. In that case, units do matters, and for the same reason, what you said about radial fade is not a option.
Here is another approach. without FocusDepth in MF as it should be.
Edit: zF = 3000; zN = 0.15; seems to work with this
Not sure what you meant by never get incorrect depth? The whole coc calculation is based on DSLR(or lens) model, so that users can get similar result as real world in skyrim. In that case, units do matters, and for the same reason, what you said about radial fade is not a option.
Here is another approach. without FocusDepth in MF as it should be.
Code: Select all
float4 PS_ProcessPass1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float2 coord = IN.txcoord;
float4 res = tex2D(SamplerColor, coord);
float depth = linearizeDepth(tex2D(SamplerDepth, coord).x);
float FilmWide = 0.0359;
float TS_Dist = ((coord.x - 0.5) * tan(TS_Axis * 0.0174533) - ScreenSize.z * ( coord.y - 0.5)) / length(float2( tan(TS_Axis * 0.0174533), ScreenSize.z)) * FilmWide;//in m
//Base Focal Length = Focal length for Prime lens or minimum Focal length for Zoom lens, can be used to calculate minimum focus distance.
//Effective Focal Length(efl) = Distance from lens to film. (must > BFL)
float FocusDepth = tex2D(SamplerFocus, 0.5).x;//in m
float bfl = BaseFocalLength / 1000;
float efl = ( MF_MODE == true) ? (FocalLength / 1000) : FocusDepth * bfl / (FocusDepth - bfl);//in m
efl += tan( TS_Angle * 0.0174533) * TS_Dist;//in m
FocusDepth = efl * bfl / (efl - bfl);
res.w = (efl / F_Number ) * (abs(depth - FocusDepth) / depth) * (efl - bfl / bfl); //in m
res.w /= FilmWide;// in % to x
return res;
}
Code: Select all
float linearizeDepth(float zB)
{
return zF * zN / (zF + zB * ( zN - zF));
}