Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Jul 5, 2023
1 parent 5891340 commit 391f4c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
7 changes: 1 addition & 6 deletions shaders/cMotionBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ namespace cMotionBlur
return float4(GetPixelBlur(Input, SampleTempTex2a, false).rg, 0.0, 1.0);
}

float Noise(float2 Pos)
{
return frac(52.9829189 * frac(dot(Pos, float2(0.06711056, 0.00583715))));
}

float4 PS_MotionBlur(VS2PS_Quad Input) : SV_TARGET0
{
float4 OutputColor = 0.0;
Expand All @@ -151,7 +146,7 @@ namespace cMotionBlur
[unroll]
for (int k = 0; k < Samples; ++k)
{
float Random = (Noise(Input.HPos.xy + k) * 2.0) - 1.0;
float Random = (GetGradientNoise(Input.HPos.xy + k) * 2.0) - 1.0;
float2 RandomTex = Input.Tex0.xy + (ScaledVelocity * Random);
OutputColor += tex2D(CShade_SampleColorTex, RandomTex);
}
Expand Down
8 changes: 1 addition & 7 deletions shaders/cNoiseBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,13 @@ uniform int _Samples <
[Pixel Shaders]
*/

float GradientNoise(float2 Position)
{
const float3 Numbers = float3(0.06711056f, 0.00583715f, 52.9829189f);
return frac(Numbers.z * frac(dot(Position.xy, Numbers.xy)));
}

float4 PS_NoiseBlur(VS2PS_Quad Input) : SV_TARGET0
{
float4 OutputColor = 0.0;

const float Pi = acos(-1.0);
const float2 PixelSize = 1.0 / int2(BUFFER_WIDTH, BUFFER_HEIGHT);
float Noise = 2.0 * Pi * GradientNoise(Input.HPos.xy);
float Noise = 2.0 * Pi * GetGradientNoise(Input.HPos.xy);

float2 Rotation = 0.0;
sincos(Noise, Rotation.y, Rotation.x);
Expand Down
8 changes: 7 additions & 1 deletion shaders/shared/cImageProcessing.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@
---
http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx
*/

float GetGradientNoise(float2 Position)
{
return frac(52.9829189 * frac(dot(Position, float2(0.06711056, 0.00583715))));
}

float3 GetDither(float2 Position)
{
return frac(52.9829189 * frac(dot(Position, float2(0.06711056, 0.00583715)))) / 255.0;
return GetGradientNoise(Position) / 255.0;
}

/*
Expand Down

0 comments on commit 391f4c1

Please sign in to comment.