Skip to content

Commit

Permalink
Update cColorBand.fx
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Dec 8, 2023
1 parent 2b8188f commit 062c498
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions shaders/cColorBand.fx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "shared/cGraphics.fxh"
#include "shared/cImageProcessing.fxh"

/*
[Shader Options]
Expand All @@ -11,16 +12,28 @@ uniform int3 _Range <
ui_max = 32.0;
> = 8;

uniform bool _Dither <
ui_label = "Dither";
ui_type = "radio";
> = true;

/*
[Pixel Shaders]
*/

float4 PS_Color(VS2PS_Quad Input) : SV_TARGET0
{
float4 Color = tex2D(CShade_SampleGammaTex, Input.Tex0);
Color.rgb = floor(Color.rgb * _Range) / (_Range);
float Dither = GetHash1(Input.HPos.xy, 0.0);
float4 ColorMap = tex2D(CShade_SampleGammaTex, Input.Tex0);

if (_Dither)
{
ColorMap += (Dither / _Range);
}

ColorMap.rgb = floor(ColorMap.rgb * _Range) / (_Range);

return Color;
return ColorMap;
}

technique CShade_ColorBand
Expand Down

0 comments on commit 062c498

Please sign in to comment.