From 773e35d79ba2919d8538fe6b41de2a2df77d2071 Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Mon, 30 May 2011 21:40:25 +0000 Subject: [PATCH] Moved "color floor" functionality to occur after scanlines but before shadow mask. Scanlines look much better and no longer cut black lines through the shadow mask. No whatsnew. --- hlsl/color.fx | 3 --- hlsl/post.fx | 7 +++++++ src/osd/windows/drawd3d.c | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hlsl/color.fx b/hlsl/color.fx index 5f12ed95c19..e4aa954e8b5 100644 --- a/hlsl/color.fx +++ b/hlsl/color.fx @@ -130,9 +130,6 @@ float4 ps_main(PS_INPUT Input) : COLOR OutRGB.g = pow(Saturated.g, GrnPower); OutRGB.b = pow(Saturated.b, BluPower); - // -- Color Compression (increasing the floor of the signal without affecting the ceiling) -- - OutRGB = float3(RedFloor + (1.0f - RedFloor) * OutRGB.r, GrnFloor + (1.0f - GrnFloor) * OutRGB.g, BluFloor + (1.0f - BluFloor) * OutRGB.b); - return float4(OutRGB, BaseTexel.a); } diff --git a/hlsl/post.fx b/hlsl/post.fx index 69ececd4249..d55e6a14ced 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -112,6 +112,10 @@ uniform float ShadowV = 0.375f; uniform float ShadowWidth = 8.0f; uniform float ShadowHeight = 8.0f; +uniform float RedFloor = 0.0f; +uniform float GrnFloor = 0.0f; +uniform float BluFloor = 0.0f; + float4 ps_main(PS_INPUT Input) : COLOR { float2 Ratios = float2(WidthRatio, HeightRatio); @@ -160,6 +164,9 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 ScanBrightness = lerp(1.0f, pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f, ScanlineAmount); float3 Scanned = BaseTexel.rgb * ScanBrightness; + // -- Color Compression (increasing the floor of the signal without affecting the ceiling) -- + Scanned = float3(RedFloor + (1.0f - RedFloor) * Scanned.r, GrnFloor + (1.0f - GrnFloor) * Scanned.g, BluFloor + (1.0f - BluFloor) * Scanned.b); + float2 ShadowDims = float2(ShadowWidth, ShadowHeight); float2 ShadowUV = float2(ShadowU, ShadowV); float2 ShadowMaskSize = float2(ShadowMaskSizeX, ShadowMaskSizeY); diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index d2bf7ed4a64..7bd4dad57dd 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -2973,6 +2973,9 @@ static void primitive_flush_pending(d3d_info *d3d) (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); + (*d3dintf->effect.set_float)(curr_effect, "RedFloor", options->screen_red_floor); + (*d3dintf->effect.set_float)(curr_effect, "GrnFloor", options->screen_green_floor); + (*d3dintf->effect.set_float)(curr_effect, "BluFloor", options->screen_blue_floor); (*d3dintf->effect.set_float)(curr_effect, "PincushionAmount", options->screen_pincushion); (*d3dintf->effect.set_float)(curr_effect, "CurvatureAmount", options->screen_curvature); (*d3dintf->effect.set_float)(curr_effect, "UseShadow", d3d->shadow_texture == NULL ? 0.0f : 1.0f); @@ -3125,9 +3128,6 @@ static void primitive_flush_pending(d3d_info *d3d) (*d3dintf->effect.set_float)(curr_effect, "RedPower", options->screen_red_power); (*d3dintf->effect.set_float)(curr_effect, "GrnPower", options->screen_green_power); (*d3dintf->effect.set_float)(curr_effect, "BluPower", options->screen_blue_power); - (*d3dintf->effect.set_float)(curr_effect, "RedFloor", options->screen_red_floor); - (*d3dintf->effect.set_float)(curr_effect, "GrnFloor", options->screen_green_floor); - (*d3dintf->effect.set_float)(curr_effect, "BluFloor", options->screen_blue_floor); (*d3dintf->effect.set_float)(curr_effect, "Saturation", options->screen_saturation); result = (*d3dintf->device.set_render_target)(d3d->device, 0, d3d->hlslsmalltarget0[poly->texture->target_index]);