From 49130533c689721f2407a2470c02c0af4dda6e78 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Thu, 28 Dec 2023 13:06:42 +0100 Subject: [PATCH] Further tweaks on the C64 shader --- neo/shaders/builtin/post/retro_c64.ps.hlsl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neo/shaders/builtin/post/retro_c64.ps.hlsl b/neo/shaders/builtin/post/retro_c64.ps.hlsl index 757c63fa..1c094d86 100644 --- a/neo/shaders/builtin/post/retro_c64.ps.hlsl +++ b/neo/shaders/builtin/post/retro_c64.ps.hlsl @@ -146,7 +146,6 @@ void main( PS_IN fragment, out PS_OUT result ) { float2 uv = ( fragment.texcoord0 ); float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR; - //float2 uvPixellated = fragment.position.xy; float4 color = t_BaseColor.Sample( samp0, uv ); @@ -157,8 +156,9 @@ void main( PS_IN fragment, out PS_OUT result ) color.rgb = dc; // add Bayer 8x8 dithering - float dither = DitherArray8x8( uvPixellated ); - color.rgb += ( float3( dither, dither, dither ) * quantizationPeriod ); + //float2 psxDitherScale = fragment.position.xy / ( RESOLUTION_DIVISOR / 2.0 ); + float dither = DitherArray8x8( uvPixellated ) - 0.5; + color.rgb += float3( dither, dither, dither ) * quantizationPeriod; // C64 colors http://unusedino.de/ec64/technical/misc/vic656x/colors/ @@ -205,6 +205,9 @@ void main( PS_IN fragment, out PS_OUT result ) }; #endif + // PSX color quantization + //color = floor( color * 32.0 ) / 32.0; + // find closest color match from C64 color palette color = LinearSearch( color.rgb, palette ); //color = float4( BinarySearch( color.rgb, palette ), 1.0 );