kingeric1992
its definitely your's. i've copied both files from here... maybe the tweaking i did
DOF extra & ALF effect 3/13 2015
- Author
- Message
-
Offline
- *blah-blah-blah maniac*
- Posts: 1034
- Joined: 15 Mar 2013, 10:24
- Location: Earth
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
Ohkay
probably, but enbbloom.fx can also have the ALF effect, and there are scenes where two angled flares and both vertical and horizontal flares are presented.
Apologize if I'm overreact, but the reason I make this ALF is because Masto's flare doesn't stay at the bright spot.
probably, but enbbloom.fx can also have the ALF effect, and there are scenes where two angled flares and both vertical and horizontal flares are presented.
Apologize if I'm overreact, but the reason I make this ALF is because Masto's flare doesn't stay at the bright spot.
-
Offline
- *master*
- Posts: 229
- Joined: 21 Feb 2013, 03:21
- Location: Los Angeles, CA
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
Hi,
Thanks for sharing this great file! I have also been playing with the enbeffectpreprocess.fx file for the last week or so and trying to understand it while adding annotations for in game. I had posted another thread in this category about DOF just a few days ago. I am currently trying to understand the focusing code. I am looking at this code in your file:
What do you make of these lines?
Doesn't that seem odd to assign uvsrc to itself? The line below it would seem to indicate that uvsrc is continually offset from it's starting point of (FPx, FPy). Do you know if this PS_ReadFocus code is targeting the 4x4 texture in SamplerCurr and SamplerPrev?
Thanks for any help and great job!!
Thanks for sharing this great file! I have also been playing with the enbeffectpreprocess.fx file for the last week or so and trying to understand it while adding annotations for in game. I had posted another thread in this category about DOF just a few days ago. I am currently trying to understand the focusing code. I am looking at this code in your file:
Code: Select all
float4 PS_ReadFocus(VS_OUTPUT_POST IN) : COLOR
{
float2 uvsrc;
uvsrc.x = FPx;
uvsrc.y = FPy;
float2 pixelSize=ScreenSize.y;
pixelSize.y*=ScreenSize.z;
const float2 offset[4]=
{
float2(0.0, 1.0),
float2(0.0, -1.0),
float2(1.0, 0.0),
float2(-1.0, 0.0)
};
float res=linearlizeDepth(tex2D(SamplerDepth, uvsrc.xy).x);
for (int i=0; i<4; i++)
{
uvsrc.xy=uvsrc.xy;
uvsrc.xy+=offset[i] * pixelSize.xy * FocusSampleRange;
#ifdef NOT_BLURRING_SKY_MODE
res+=linearlizeDepth(tex2D(SamplerDepth, uvsrc).x);
#else
res+=min(linearlizeDepth(tex2D(SamplerDepth, uvsrc).x), DepthClip);
#endif
}
res*=0.2;
return res;
}
Code: Select all
uvsrc.xy=uvsrc.xy;
uvsrc.xy+=offset[i] * pixelSize.xy * FocusSampleRange;
Thanks for any help and great job!!
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
Hi, number6
I didn't write the focusing code, but this is what I thik:
It calculate the average depth of offset points and original point. I don't know how SamplerCurr and SamplerPerv are generated, but result of ReadFocus probably goes to SamplerCurr first than pass to SamplerPrev at next cycle.
I didn't write the focusing code, but this is what I thik:
Code: Select all
float res=linearlizeDepth(tex2D(SamplerDepth, uvsrc.xy).x); //get depth at specified uvsrc coordinate.
for (int i=0; i<4; i++)
{
uvsrc.xy=uvsrc.xy; // I think I add this because compiler error.... .
uvsrc.xy+=offset[i] * pixelSize.xy * FocusSampleRange;// offset uvsrc.
#ifdef NOT_BLURRING_SKY_MODE
res+=linearlizeDepth(tex2D(SamplerDepth, uvsrc).x);//combine depth at offset uvsrc with previous result.
#else
res+=min(linearlizeDepth(tex2D(SamplerDepth, uvsrc).x), DepthClip);//combine depth at offset uvsrc with previous result with threshold.
#endif
}
res*=0.2; //average depth of uvsrc and 4 offset uvsrc.
It calculate the average depth of offset points and original point. I don't know how SamplerCurr and SamplerPerv are generated, but result of ReadFocus probably goes to SamplerCurr first than pass to SamplerPrev at next cycle.
-
Offline
- *master*
- Posts: 229
- Joined: 21 Feb 2013, 03:21
- Location: Los Angeles, CA
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
Did you add that? I ask because it is also in the file that I started from. I think it originates here:uvsrc.xy=uvsrc.xy; // I think I add this because compiler error.... .
http://www.nexusmods.com/skyrim/mods/24024
That still seems weird to assign uvsrc to itself which essentially does nothing right? What kind of compiler error did you get?
The next line:
uvsrc.xy+=offset * pixelSize.xy * FocusSampleRange;// offset uvsrc.
This seems strange also. Instead of resetting uvsrc to (FPx, FPy) every iteration and offsetting from there, it is offset from it's previous loop value using +=.
If we use the values from the offset[] array (previously posted), this means that, since uvsrc is not reset, it has the following offsets in the loop (not accounting for pixelSize and FocusSampleRange):
(0.0, 1.0) + (0.0, -1.0) =
(0.0, 0.0) + (1.0, 0.0) =
(1.0, 0.0) + (-1.0, 0.0) =
(0.0, 0.0)
Instead, consider the below code which offsets from your FP point:
Code: Select all
uvsrc.xy = float2(FPx, FPy) + offset[i] * pixelSize.xy * FocusSampleRange;
The other part I find strange is that the offset is multiplied by pixelSize. This means that, unless the FocusSampleRange is huge, the offsets are only a few pixel from each other. This is why I think the difference between the original and my change above is not noticable since FocusSampleRange is typically set to 1.0. Contrast this to Boris' version of the loop code from the default version of the file:
Code: Select all
float2 tdir=offset[i].xy;
coord.xy=IN.txcoord.xy+tdir.xy*invscreensize;
1. He uses = and not += for the coord.xy so it is not updating, but resetting each iteration
2. Instead of offsetting from a single input point (i.e . FP) he is offsetting from each input uv coordinate (i.e. IN.txcoord)
3. He is not multiplying by pixelSize (only invscreensize to correct for aspect ratio). So the offsets are much larger since they are in uv space and not pixel space.
So, it seems like this version would return blurred depth values for each region of the screen as opposed to the above versions that return the blurred depth values for a very small region around the FP point, which would typically be set to the center of the screen (0.5, 0.5).
Maybe a nice compromise is something like this?
Code: Select all
uvsrc.xy = float2(FPx, FPy) + offset[i] * FocusSampleRange;
I'd be interested to hear anyone's thoughts on this. Thanks for reading!
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
-
Offline
- *blah-blah-blah maniac*
- Posts: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
ok, I thought something like uvsrc.xy=uvsrc.xy is not from the original file, apparently I'was wrong. And I think you are right about the offset calculation, while gp65cj04's original intend is unknown, you can probably do some adjustment.
-
Offline
- *master*
- Posts: 229
- Joined: 21 Feb 2013, 03:21
- Location: Los Angeles, CA
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
Thanks for the response. I'm going to keep working with the code and I'll update with any findings.
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
-
Offline
- *sensei*
- Posts: 446
- Joined: 17 Apr 2014, 22:12
- Location: Schweden
Re: enbeffectprepass.fx extra GUI & enblens.fx ALF effect
The DoF is just wonderful! Manual focusing really creates some cool images.
_________________
| 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: 565
- Joined: 05 Apr 2014, 10:29
- Location: Taiwan
Re: DOF extra & ALF effect 7/9 update
7/9 update
add custom bokeh shape [WIP]
add custom bokeh shape [WIP]
-
Offline
- *sensei*
- Posts: 446
- Joined: 17 Apr 2014, 22:12
- Location: Schweden
Re: DOF extra & ALF effect 7/9 update
Thanks for update!
Can this work?
Perhaps I'm shooting in dark here, with a blindfold, hanging upside down, with a BB gun at 200 meters. But.....kingeric1992 wrote: Is there anyway to add custom texture file instead of using enbpalette??
Can this work?
Code: Select all
texture2D texExampleTexture
<
string ResourceName="ExampleTexture.tga";
>;
sampler2D SamplerExampleTexture = sampler_state
{
Texture = <texExampleTexture>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = Wrap;
AddressV = Wrap;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};
_________________
| 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