1
Fork 0

MariENB FO4 3.5.2

This commit is contained in:
Marisa the Magician 2019-11-18 12:23:17 +01:00
commit 049d7bbac2
14 changed files with 276 additions and 57 deletions

View file

@ -34,14 +34,14 @@
* \ \ | |\/| | / /_\ \ / /_\ \
* ----) | | | | | / _____ \ / _____ \
* |_______/ |__| |__| /__/ \__\ /__/ \__\
*
*
* E N H A N C E D
* S U B P I X E L M O R P H O L O G I C A L A N T I A L I A S I N G
*
* http://www.iryoku.com/smaa/
*
* Hi, welcome aboard!
*
*
* Here you'll find instructions to get the shader up and running as fast as
* possible.
*
@ -130,14 +130,14 @@
* this last pass are not possible, the technique will work anyway, but
* will perform antialiasing in gamma space.
*
* IMPORTANT: for best results the input read for the color/luma edge
* IMPORTANT: for best results the input read for the color/luma edge
* detection should *NOT* be sRGB.
*
* 6. Before including SMAA.h you'll have to setup the render target metrics,
* the target and any optional configuration defines. Optionally you can
* use a preset.
*
* You have the following targets available:
* You have the following targets available:
* SMAA_HLSL_3
* SMAA_HLSL_4
* SMAA_HLSL_4_1
@ -329,7 +329,7 @@
/**
* SMAA_THRESHOLD specifies the threshold or sensitivity to edges.
* Lowering this value you will be able to detect more edges at the expense of
* performance.
* performance.
*
* Range: [0, 0.5]
* 0.1 is a reasonable value, and allows to catch most visible edges.
@ -344,7 +344,7 @@
/**
* SMAA_DEPTH_THRESHOLD specifies the threshold for depth edge detection.
*
*
* Range: depends on the depth range of the scene.
*/
#ifndef SMAA_DEPTH_THRESHOLD
@ -372,7 +372,7 @@
*
* Range: [0, 20]
*
* On high-end machines it is cheap (between a 0.8x and 0.9x slower for 16
* On high-end machines it is cheap (between a 0.8x and 0.9x slower for 16
* steps), but it can have a significant impact on older machines.
*
* Define SMAA_DISABLE_DIAG_DETECTION to disable diagonal processing.
@ -414,16 +414,16 @@
* It locally decreases the luma or color threshold if an edge is found in an
* additional buffer (so the global threshold can be higher).
*
* This method was developed by Playstation EDGE MLAA team, and used in
* This method was developed by Playstation EDGE MLAA team, and used in
* Killzone 3, by using the light accumulation buffer. More information here:
* http://iryoku.com/aacourse/downloads/06-MLAA-on-PS3.pptx
* http://iryoku.com/aacourse/downloads/06-MLAA-on-PS3.pptx
*/
#ifndef SMAA_PREDICATION
#define SMAA_PREDICATION 0
#endif
/**
* Threshold to be used in the additional predication buffer.
* Threshold to be used in the additional predication buffer.
*
* Range: depends on the input, so you'll have to find the magic number that
* works for you.
@ -714,7 +714,8 @@ float2 SMAALumaEdgeDetectionPS(float2 texcoord,
// Then discard if there is no edge:
if (dot(edges, float2(1.0, 1.0)) == 0.0)
discard;
return float2(0.0, 0.0); // use of discard produces garbage data in ENB
// discard;
// Calculate right and bottom deltas:
float Lright = dot(SMAASamplePoint(colorTex, offset[1].xy).rgb, weights);
@ -776,7 +777,8 @@ float2 SMAAColorEdgeDetectionPS(float2 texcoord,
// Then discard if there is no edge:
if (dot(edges, float2(1.0, 1.0)) == 0.0)
discard;
return float2(0.0, 0.0); // use of discard produces garbage data in ENB
// discard;
// Calculate right and bottom deltas:
float3 Cright = SMAASamplePoint(colorTex, offset[1].xy).rgb;
@ -820,7 +822,8 @@ float2 SMAADepthEdgeDetectionPS(float2 texcoord,
float2 edges = step(SMAA_DEPTH_THRESHOLD, delta);
if (dot(edges, float2(1.0, 1.0)) == 0.0)
discard;
return float2(0.0, 0.0); // use of discard produces garbage data in ENB
// discard;
return edges;
}
@ -893,7 +896,7 @@ float2 SMAASearchDiag2(SMAATexture2D(edgesTex), float2 texcoord, float2 dir, out
return coord.zw;
}
/**
/**
* Similar to SMAAArea, this calculates the area corresponding to a certain
* diagonal distance and crossing edges 'e'.
*/
@ -990,7 +993,7 @@ float2 SMAACalculateDiagWeights(SMAATexture2D(edgesTex), SMAATexture2D(areaTex),
/**
* This allows to determine how much length should we add in the last step
* of the searches. It takes the bilinearly interpolated edge (see
* of the searches. It takes the bilinearly interpolated edge (see
* @PSEUDO_GATHER4), and adds 0, 1 or 2, depending on which edges and
* crossing edges are active.
*/
@ -1025,7 +1028,7 @@ float SMAASearchXLeft(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2
* which edges are active from the four fetched ones.
*/
float2 e = float2(0.0, 1.0);
while (texcoord.x > end &&
while (texcoord.x > end &&
e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0) { // Or is there a crossing edge that breaks the line?
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
@ -1050,7 +1053,7 @@ float SMAASearchXLeft(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2
float SMAASearchXRight(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {
float2 e = float2(0.0, 1.0);
while (texcoord.x < end &&
while (texcoord.x < end &&
e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0) { // Or is there a crossing edge that breaks the line?
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
@ -1062,7 +1065,7 @@ float SMAASearchXRight(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2
float SMAASearchYUp(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {
float2 e = float2(1.0, 0.0);
while (texcoord.y > end &&
while (texcoord.y > end &&
e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0) { // Or is there a crossing edge that breaks the line?
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
@ -1074,7 +1077,7 @@ float SMAASearchYUp(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 te
float SMAASearchYDown(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {
float2 e = float2(1.0, 0.0);
while (texcoord.y < end &&
while (texcoord.y < end &&
e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0) { // Or is there a crossing edge that breaks the line?
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
@ -1084,14 +1087,14 @@ float SMAASearchYDown(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2
return mad(-SMAA_RT_METRICS.y, offset, texcoord.y);
}
/**
/**
* Ok, we have the distance and both crossing edges. So, what are the areas
* at each side of current edge?
*/
float2 SMAAArea(SMAATexture2D(areaTex), float2 dist, float e1, float e2, float offset) {
// Rounding prevents precision errors of bilinear filtering:
float2 texcoord = mad(float2(SMAA_AREATEX_MAX_DISTANCE, SMAA_AREATEX_MAX_DISTANCE), round(4.0 * float2(e1, e2)), dist);
// We do a scale and bias for mapping to texel space:
texcoord = mad(SMAA_AREATEX_PIXEL_SIZE, texcoord, 0.5 * SMAA_AREATEX_PIXEL_SIZE);
@ -1160,7 +1163,7 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord,
// one of the boundaries is enough.
weights.rg = SMAACalculateDiagWeights(SMAATexturePass2D(edgesTex), SMAATexturePass2D(areaTex), texcoord, e, subsampleIndices);
// We give priority to diagonals, so if we find a diagonal we skip
// We give priority to diagonals, so if we find a diagonal we skip
// horizontal/vertical processing.
SMAA_BRANCH
if (weights.r == -weights.g) { // weights.r + weights.g == 0.0
@ -1228,7 +1231,7 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord,
// We want the distances to be in pixel units:
d = abs(round(mad(SMAA_RT_METRICS.ww, d, -pixcoord.yy)));
// SMAAArea below needs a sqrt, as the areas texture is compressed
// SMAAArea below needs a sqrt, as the areas texture is compressed
// quadratically:
float2 sqrt_d = sqrt(d);