mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Add flicker effect to chrome (replaces zooms)
This commit is contained in:
@@ -19,7 +19,11 @@ float3 SamplePixel(int2 texCoord)
|
||||
SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
||||
{
|
||||
SDrawQuadPixelOutput result;
|
||||
result.color = float4(SamplePixel(int2(floor(input.texCoord.xy))), 1.0) * constants_Modulation;
|
||||
int2 pixelCoordinate = int2(floor(input.texCoord.xy));
|
||||
result.color = ApplyFlicker(pixelCoordinate, float4(SamplePixel(int2(floor(input.texCoord.xy))), 1.0) * constants_Modulation);
|
||||
|
||||
if (result.color.a <= 0.0)
|
||||
discard;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
cbuffer SDrawQuadPixelConstants : register(b0)
|
||||
{
|
||||
float4 constants_Modulation;
|
||||
|
||||
int2 constants_FlickerAxis;
|
||||
int constants_FlickerStartThreshold;
|
||||
int constants_FlickerEndThreshold;
|
||||
};
|
||||
|
||||
float4 ApplyFlicker(int2 coordinate, float4 color)
|
||||
{
|
||||
int flickerTotal = dot(constants_FlickerAxis, coordinate);
|
||||
if (flickerTotal < constants_FlickerStartThreshold)
|
||||
return float4(0, 0, 0, 0);
|
||||
else if (flickerTotal >= constants_FlickerEndThreshold)
|
||||
return color;
|
||||
else
|
||||
return float4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user