Skip to content

Commit

Permalink
Merge pull request #320 from Tzugimaa/patch-2
Browse files Browse the repository at this point in the history
Minimize LCAS.hlsl a bit
  • Loading branch information
Blinue authored Feb 22, 2022
2 parents 774c1ca + 90eb325 commit c519672
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Effects/LCAS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SamplerState sam;
float sharpness;

//!CONSTANT
//!DEFAULT 0.2
//!DEFAULT 0.1
//!MIN 0
//!MAX 1
float threshold;
Expand All @@ -45,7 +45,7 @@ float4 Pass1(float2 pos) {
float3 h = INPUT.Sample(sam, pos + float2(0, inputPtY)).rgb;

// Edge checker
float edge = length(abs(d - f) + abs(b - h)) / 2 + length(abs(d + b - f - h) + abs(b + f - h - d)) / 4;
float edge = length(abs(d - f) + abs(b - h)) / 2;

// Soft min and max.
// b
Expand All @@ -65,8 +65,8 @@ float4 Pass1(float2 pos) {
// w
// If is edge
if(edge >= threshold)
return float4(((((b + d) + (f + h)) * wRGB + (e * 2 - (b + d + f + h) * 0.25)) / (1.0 + 4.0 * wRGB)).rgb, 1);
return float4((((b + d + f + h) * wRGB + (e * 2 - (b + d + f + h) * 0.25)) / (1.0 + 4.0 * wRGB)).rgb, 1);
else
return float4(((((b + d) + (f + h)) * wRGB + e) / (1.0 + 4.0 * wRGB)).rgb, 1);
return float4((((b + d + f + h) * wRGB + e) / (1.0 + 4.0 * wRGB)).rgb, 1);
// If is not edge
}

0 comments on commit c519672

Please sign in to comment.