Hi everyone,
I'm working on a new enbprepass.fx featuring DSLR model and separable Bokeh.
Currently, the CoC calculation uses focal length which is also related to field of view. I use FOV to calculate focal length, makeing it more consistent to real world, but it also limits the lens choice and CoC size will also be limited by this wide-angled, short focal length (around 24mm with FOV 75~80) lens.
So the question is, is it ok to manually set focal length regardless to FOV?
This is what I got atm. I've add F-number which also related to CoC. Is there anything else I need to consider for DSLR model? Thanks.
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
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: New DoF with DSLR model [WIP] need help
Going to love the crap out of you (does that sound wrong? I guess it sure does).
PS. I found a nice way to port loopcount on a for() loop to GUI so you can drop the number of iterations for your loops straight into GUI instead of dealing with directives set on shader compilation. And performance scales with it, so it's not some unroll thingy. Gotta love that stuff. Interested?
If you look for comment on the picture... I think blur should scale with distance of pixel from focal plane... it does (I think) but imo not strong enough to reflect DSLR... I shoot a lot with 28, 50 and 90mm lenses and I definitely get more blur in a situation like yours on f5.6... but depends how you relate f number to FOV...
Edit: I read now FOV 75 relates to ~24mm lens, then f5.6 is about right for the blur. Oops. Missed that whole sentence.
PS. I found a nice way to port loopcount on a for() loop to GUI so you can drop the number of iterations for your loops straight into GUI instead of dealing with directives set on shader compilation. And performance scales with it, so it's not some unroll thingy. Gotta love that stuff. Interested?
If you look for comment on the picture... I think blur should scale with distance of pixel from focal plane... it does (I think) but imo not strong enough to reflect DSLR... I shoot a lot with 28, 50 and 90mm lenses and I definitely get more blur in a situation like yours on f5.6... but depends how you relate f number to FOV...
Edit: I read now FOV 75 relates to ~24mm lens, then f5.6 is about right for the blur. Oops. Missed that whole sentence.
Last edited by prod80 on 06 Sep 2014, 20:51, edited 1 time in total.
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
cool! that is definitely useful. probably a good way to increase performance by dynamic loop count based on CoC.
Again, the bokeh res is 65x65 or 4225 tabs, and I'm still get a decent framrate.
Again, the bokeh res is 65x65 or 4225 tabs, and I'm still get a decent framrate.
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
That is what I'm saying.
Anyway, I'll just add different lens options, including FOV generated and force focal length. I'm also adding Tilt-Shift.
all the math is based on wiki pages.
Anyway, I'll just add different lens options, including FOV generated and force focal length. I'm also adding Tilt-Shift.
all the math is based on wiki pages.
-
Offline
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: New DoF with DSLR model [WIP] need help
The whole trick is basically to drop tex2D and replace it with tex2Dlod and set mip level to 0 (still full texture). For some reason this allows to set a dynamic variable in the for statement next to a fixed one so it doesn't fail compilation.
Simple example:
This will execute just 6 times, and not 50. And sum is free to be connected to anything you like (GUI, some calculation based on something in GUI, whatever you want)
Let me know if this is enough explanation. I have a WIP bloom shader with this, if you wanna see in live the scaling of performance and how I implemented it.
Edit: sorry small correction in for statement, need && not ||
Simple example:
Code: Select all
#define UPPERLIMIT 50
float sum = 0;
for( i=0, i < UPPERLIMIT && sum < 6, ++i) {
color +=tex2Dlod(Sampler, float4(txcoord.xy + float2(offset.x, offset.y), 0, 0));
sum += 1;
}
Let me know if this is enough explanation. I have a WIP bloom shader with this, if you wanna see in live the scaling of performance and how I implemented it.
Edit: sorry small correction in for statement, need && not ||
-
Offline
- *blah-blah-blah maniac*
- Posts: 530
- Joined: 30 Jan 2012, 13:18
Re: New DoF with DSLR model [WIP] need help
Boris told me that small trick, it also reduces compiling time. Here you can see it in action:
https://www.youtube.com/watch?v=r_U-ccmGsrI
But how can you get so many taps? My own DOF shader almost executes my graphics card at 400 taps, even 100+ are unplayable..
https://www.youtube.com/watch?v=r_U-ccmGsrI
But how can you get so many taps? My own DOF shader almost executes my graphics card at 400 taps, even 100+ are unplayable..
-
Offline
- *sensei*
- Posts: 372
- Joined: 28 Jul 2013, 23:26
Re: New DoF with DSLR model [WIP] need help
both say tap is something else. First figure out what one person think is a tab and the other
kingeric1992 refers to taps the resolution of his blur (65*65=4225) you refer to taps the width of blur in pixels doing horizontal and vertical pass (or both in one). My bloom shader crashes on 150 tabs + and - or 301 pixel wide blur (which is insane and unusable but w/e) using kingeric's logic that would be 90601 taps.
PS. post the trick, the more code the better or its same?
kingeric1992 refers to taps the resolution of his blur (65*65=4225) you refer to taps the width of blur in pixels doing horizontal and vertical pass (or both in one). My bloom shader crashes on 150 tabs + and - or 301 pixel wide blur (which is insane and unusable but w/e) using kingeric's logic that would be 90601 taps.
PS. post the trick, the more code the better or its same?
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: New DoF with DSLR model [WIP] need help
Sorry for causing confusion. Just like what Prod said, I'm comparing it with 2D tabs which most bokeh dof used, that's why I specified 65x65.
The method is rather easy, it basically do two box blur with different angle and combine them with min() or max(). so it will has the performance of a gaussian but still has the aperture shape.
I'm just using split screen for extra texture which will lose half res, probably move them to alpha in the future.
ref: http://ivizlab.sfu.ca/papers/cgf2012.pdf
circle can be achieved by weighted complex gaussian which didn't mention in the paper.
The method is rather easy, it basically do two box blur with different angle and combine them with min() or max(). so it will has the performance of a gaussian but still has the aperture shape.
I'm just using split screen for extra texture which will lose half res, probably move them to alpha in the future.
ref: http://ivizlab.sfu.ca/papers/cgf2012.pdf
circle can be achieved by weighted complex gaussian which didn't mention in the paper.
-
Offline
- *blah-blah-blah maniac*
- Posts: 17564
- Joined: 27 Dec 2011, 08:53
- Location: Rather not to say
Re: New DoF with DSLR model [WIP] need help
Yes. But game default fov is 65, which is 28 mm full frame cameras.I read now FOV 75 relates to ~24mm lens
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
-
Offline
- *sensei*
- Posts: 446
- Joined: 17 Apr 2014, 22:12
- Location: Schweden
Re: New DoF with DSLR model [WIP] need help
Im pretty sure default fov is 75.
You can test this by manually setting it on unedited Skyrim inis.
You can test this by manually setting it on unedited Skyrim inis.
_________________
| 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