From 062c498c1af5d86b72e0162cb0c37989e0d72e59 Mon Sep 17 00:00:00 2001 From: papadanku Date: Thu, 7 Dec 2023 21:19:28 -0700 Subject: [PATCH] Update cColorBand.fx --- shaders/cColorBand.fx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/shaders/cColorBand.fx b/shaders/cColorBand.fx index 5a1f7a8..aa13729 100644 --- a/shaders/cColorBand.fx +++ b/shaders/cColorBand.fx @@ -1,4 +1,5 @@ #include "shared/cGraphics.fxh" +#include "shared/cImageProcessing.fxh" /* [Shader Options] @@ -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