Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Jun 3, 2023
1 parent 4f3fa4d commit f9bb580
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
5 changes: 0 additions & 5 deletions shaders/cCircles.fx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ uniform float _TileRadius <
ui_max = 0.5;
> = 0.45;

float GetMod(float X, float Y)
{
return X - Y * floor(X / Y);
}

float2 GetTiles(float2 Tex)
{
Tex *= _TileAmount;
Expand Down
2 changes: 2 additions & 0 deletions shaders/cDiscBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ namespace cDiscBlur

/*
Pixel shaders
---
Repurposed Wojciech Sterna's shadow sampling code as a screen-space convolution
---
http://maxest.gct-game.net/content/chss.pdf
*/

Expand Down
10 changes: 2 additions & 8 deletions shaders/cFilmGrain.fx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "shared/cGraphics.fxh"
#include "shared/cImageProcessing.fxh"

/*
Construct options
Expand All @@ -25,19 +26,12 @@ uniform float _Intensity <
// "Well ill believe it when i see it."
// Yoinked code by Luluco250 (RIP) [https://www.shadertoy.com/view/4t2fRz] [MIT]

float GaussianWeights(float x, float Sigma)
{
const float Pi = 3.14159265359;
Sigma = Sigma * Sigma;
return rsqrt(Pi * Sigma) * exp(-((x * x) / (2.0 * Sigma)));
}

float4 PS_FilmGrain(VS2PS_Quad Input) : SV_TARGET0
{
float Time = rcp(1e+3 / _Time) * _Speed;
float Seed = dot(Input.HPos.xy, float2(12.9898, 78.233));
float Noise = frac(sin(Seed) * 43758.5453 + Time);
return GaussianWeights(Noise, _Variance) * _Intensity;
return GetGaussianWeight(Noise, _Variance) * _Intensity;
}

technique CShade_FilmGrain
Expand Down
2 changes: 1 addition & 1 deletion shaders/cMatrixTransforms.fx → shaders/cTransform.fx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ float4 PS_Matrix(VS2PS_Quad Input) : SV_TARGET0
return tex2D(CShade_SampleColorTex, Input.Tex0);
}

technique CShade_MatrixTransforms
technique CShade_Transform
{
pass
{
Expand Down
5 changes: 5 additions & 0 deletions shaders/shared/cGraphics.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@
{
return tex2D(SampleSource, Input.Tex0);
}

float GetMod(float X, float Y)
{
return X - Y * floor(X / Y);
}
#endif
2 changes: 1 addition & 1 deletion shaders/shared/cMacros.fxh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#if !defined(CMACROS_FXH)
/*
Macros and macro
Macros and macro accessories
---
https://graphics.stanford.edu/~seander/bithacks.html
*/
Expand Down

0 comments on commit f9bb580

Please sign in to comment.