Small fixes

- fixed defocus strength with difference prescales
- removed default screen ratio of 4:3, ratio is now based on the screen
quad size
- reverted some space to tab changes
This commit is contained in:
ImJezze 2015-10-04 15:57:07 +02:00
parent 062e6e0383
commit 5addcdd2da
3 changed files with 86 additions and 94 deletions

View File

@ -112,8 +112,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Post-Processing Pixel Shader
//-----------------------------------------------------------------------------
uniform float2 DefaultScreenRatio = float2(1.0f, 3.0f / 4.0f); // normalized screen ratio (defalt ratio of 4:3)
uniform float CurvatureAmount = 0.0f;
uniform float RoundCornerAmount = 0.0f;
uniform float SmoothBorderAmount = 0.5f;
@ -159,9 +157,8 @@ float GetSpotAddend(float2 coord, float amount)
{
float2 RatioCorrection = GetRatioCorrecton();
float2 defaultScreenRatio = xor(OrientationSwapXY, RotationSwapXY)
? DefaultScreenRatio.yx
: DefaultScreenRatio.xy;
// normalized screen quad ratio
float2 QuadRatio = float2 (1.0f, QuadDims.y / QuadDims.x);
// upper right quadrant
float2 spotOffset =
@ -174,7 +171,9 @@ float GetSpotAddend(float2 coord, float amount)
: float2(-0.25f, 0.25f);
float2 SpotCoord = coord;
SpotCoord += spotOffset * defaultScreenRatio * RatioCorrection;
SpotCoord += spotOffset * RatioCorrection;
SpotCoord *= QuadRatio;
SpotCoord /= RatioCorrection;
float SpotBlur = amount;
@ -274,13 +273,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
// // BaseCoord.x += (TexCoord.x > 0.5f ? +0.5f : 0.0f);
// BaseCoord.y += (TexCoord.y > 0.5 ? +0.5f : 0.0f);
float2 defaultScreenRatio = xor(OrientationSwapXY, RotationSwapXY)
? DefaultScreenRatio.yx
: DefaultScreenRatio.xy;
float2 BaseRatioCoordCentered = BaseCoordCentered;
BaseRatioCoordCentered *= defaultScreenRatio;
// Color
float4 BaseColor = tex2D(DiffuseSampler, BaseCoord);
BaseColor.a = 1.0f;
@ -294,8 +286,8 @@ float4 ps_main(PS_INPUT Input) : COLOR
// Light Reflection Simulation
float3 LightColor = float3(1.0f, 0.90f, 0.80f);
float2 SpotCoord = BaseRatioCoordCentered;
float2 NoiseCoord = BaseRatioCoordCentered;
float2 SpotCoord = BaseCoordCentered;
float2 NoiseCoord = BaseCoordCentered;
float SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount);
float NoiseFactor = GetNoiseFactor(SpotAddend, random(NoiseCoord));

View File

@ -76,7 +76,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
float2 TargetTexelDims = 1.0f / TargetDims;
float2 ScreenTexelDims = 1.0f / ScreenDims;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
@ -88,13 +88,13 @@ VS_OUTPUT vs_main(VS_INPUT Input)
TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)
Output.TexCoord0 = TexCoord;
Output.TexCoord1 = TexCoord + Coord1Offset * TargetTexelDims * Defocus;
Output.TexCoord2 = TexCoord + Coord2Offset * TargetTexelDims * Defocus;
Output.TexCoord3 = TexCoord + Coord3Offset * TargetTexelDims * Defocus;
Output.TexCoord4 = TexCoord + Coord4Offset * TargetTexelDims * Defocus;
Output.TexCoord5 = TexCoord + Coord5Offset * TargetTexelDims * Defocus;
Output.TexCoord6 = TexCoord + Coord6Offset * TargetTexelDims * Defocus;
Output.TexCoord7 = TexCoord + Coord7Offset * TargetTexelDims * Defocus;
Output.TexCoord1 = TexCoord + Coord1Offset * ScreenTexelDims * Defocus;
Output.TexCoord2 = TexCoord + Coord2Offset * ScreenTexelDims * Defocus;
Output.TexCoord3 = TexCoord + Coord3Offset * ScreenTexelDims * Defocus;
Output.TexCoord4 = TexCoord + Coord4Offset * ScreenTexelDims * Defocus;
Output.TexCoord5 = TexCoord + Coord5Offset * ScreenTexelDims * Defocus;
Output.TexCoord6 = TexCoord + Coord6Offset * ScreenTexelDims * Defocus;
Output.TexCoord7 = TexCoord + Coord7Offset * ScreenTexelDims * Defocus;
Output.Color = Input.Color;

View File

@ -2734,77 +2734,77 @@ static INT32 slider_bloom_lvl10_scale(running_machine &machine, void *arg, std::
shaders::slider_desc shaders::s_sliders[] =
{
{ "Shadow Mask Darkness", 0, 0, 100, 1, slider_shadow_mask_alpha },
{ "Shadow Mask X Count", 1, 6, 1024, 1, slider_shadow_mask_x_count },
{ "Shadow Mask Y Count", 1, 6, 1024, 1, slider_shadow_mask_y_count },
{ "Shadow Mask Pixel Count X", 1, 6, 64, 1, slider_shadow_mask_usize },
{ "Shadow Mask Pixel Count Y", 1, 6, 64, 1, slider_shadow_mask_vsize },
{ "Shadow Mask Offset X", -100, 0, 100, 1, slider_shadow_mask_uoffset },
{ "Shadow Mask Offset Y", -100, 0, 100, 1, slider_shadow_mask_voffset },
{ "Screen Curvature", 0, 3, 100, 1, slider_curvature },
{ "Screen Round Corner", 0, 3, 100, 1, slider_round_corner },
{ "Screen Reflection", 0, 3, 100, 1, slider_reflection },
{ "Image Vignetting", 0, 3, 100, 1, slider_vignetting },
{ "Scanline Darkness", 0, 100, 100, 1, slider_scanline_alpha },
{ "Scanline Screen Height", 1, 20, 80, 1, slider_scanline_scale },
{ "Scanline Indiv. Height", 1, 20, 80, 1, slider_scanline_height },
{ "Scanline Brightness", 0, 20, 40, 1, slider_scanline_bright_scale },
{ "Scanline Brightness Overdrive", 0, 0, 20, 1, slider_scanline_bright_offset },
{ "Scanline Jitter", 0, 0, 40, 1, slider_scanline_offset },
{ "Defocus X", 0, 0, 64, 1, slider_defocus_x },
{ "Defocus Y", 0, 0, 64, 1, slider_defocus_y },
{ "Red Position Offset X", -1500, 3, 1500, 1, slider_red_converge_x },
{ "Red Position Offset Y", -1500, 0, 1500, 1, slider_red_converge_y },
{ "Green Position Offset X", -1500, 0, 1500, 1, slider_green_converge_x },
{ "Green Position Offset Y", -1500, 3, 1500, 1, slider_green_converge_y },
{ "Blue Position Offset X", -1500, 3, 1500, 1, slider_blue_converge_x },
{ "Blue Position Offset Y", -1500, 3, 1500, 1, slider_blue_converge_y },
{ "Red Convergence X", -1500, 0, 1500, 1, slider_red_radial_converge_x },
{ "Red Convergence Y", -1500, 0, 1500, 1, slider_red_radial_converge_y },
{ "Green Convergence X", -1500, 0, 1500, 1, slider_green_radial_converge_x },
{ "Green Convergence Y", -1500, 0, 1500, 1, slider_green_radial_converge_y },
{ "Blue Convergence X", -1500, 0, 1500, 1, slider_blue_radial_converge_x },
{ "Blue Convergence Y", -1500, 0, 1500, 1, slider_blue_radial_converge_y },
{ "Red Output from Red Input", -400, 0, 400, 5, slider_red_from_r },
{ "Red Output from Green Input", -400, 0, 400, 5, slider_red_from_g },
{ "Red Output from Blue Input", -400, 0, 400, 5, slider_red_from_b },
{ "Green Output from Red Input", -400, 0, 400, 5, slider_green_from_r },
{ "Green Output from Green Input", -400, 0, 400, 5, slider_green_from_g },
{ "Green Output from Blue Input", -400, 0, 400, 5, slider_green_from_b },
{ "Blue Output from Red Input", -400, 0, 400, 5, slider_blue_from_r },
{ "Blue Output from Green Input", -400, 0, 400, 5, slider_blue_from_g },
{ "Blue Output from Blue Input", -400, 0, 400, 5, slider_blue_from_b },
{ "Saturation", 0, 140, 400, 1, slider_saturation },
{ "Red DC Offset", -100, 0, 100, 1, slider_red_offset },
{ "Green DC Offset", -100, 0, 100, 1, slider_green_offset },
{ "Blue DC Offset", -100, 0, 100, 1, slider_blue_offset },
{ "Red Scale", -200, 95, 200, 1, slider_red_scale },
{ "Green Scale", -200, 95, 200, 1, slider_green_scale },
{ "Blue Scale", -200, 95, 200, 1, slider_blue_scale },
{ "Red Gamma", -80, 16, 80, 1, slider_red_power },
{ "Green Gamma", -80, 16, 80, 1, slider_green_power },
{ "Blue Gamma", -80, 16, 80, 1, slider_blue_power },
{ "Red Floor", 0, 5, 100, 1, slider_red_floor },
{ "Green Floor", 0, 5, 100, 1, slider_green_floor },
{ "Blue Floor", 0, 5, 100, 1, slider_blue_floor },
{ "Red Phosphor Life", 0, 40, 100, 1, slider_red_phosphor_life },
{ "Green Phosphor Life", 0, 40, 100, 1, slider_green_phosphor_life },
{ "Blue Phosphor Life", 0, 40, 100, 1, slider_blue_phosphor_life },
{ "Vector Length Attenuation", 0, 80, 100, 1, slider_vector_attenuation },
{ "Vector Attenuation Length Limit", 1, 500, 1000, 1, slider_vector_length_max },
{ "Vector Bloom Scale", 0, 300, 1000, 5, slider_vector_bloom_scale },
{ "Raster Bloom Scale", 0, 225, 1000, 5, slider_raster_bloom_scale },
{ "Bloom Level 0 Scale", 0, 100, 100, 1, slider_bloom_lvl0_scale },
{ "Bloom Level 1 Scale", 0, 21, 100, 1, slider_bloom_lvl1_scale },
{ "Bloom Level 2 Scale", 0, 19, 100, 1, slider_bloom_lvl2_scale },
{ "Bloom Level 3 Scale", 0, 17, 100, 1, slider_bloom_lvl3_scale },
{ "Bloom Level 4 Scale", 0, 15, 100, 1, slider_bloom_lvl4_scale },
{ "Bloom Level 5 Scale", 0, 14, 100, 1, slider_bloom_lvl5_scale },
{ "Bloom Level 6 Scale", 0, 13, 100, 1, slider_bloom_lvl6_scale },
{ "Bloom Level 7 Scale", 0, 12, 100, 1, slider_bloom_lvl7_scale },
{ "Bloom Level 8 Scale", 0, 11, 100, 1, slider_bloom_lvl8_scale },
{ "Bloom Level 9 Scale", 0, 10, 100, 1, slider_bloom_lvl9_scale },
{ "Bloom Level 10 Scale", 0, 9, 100, 1, slider_bloom_lvl10_scale },
{ "Shadow Mask Darkness", 0, 0, 100, 1, slider_shadow_mask_alpha },
{ "Shadow Mask X Count", 1, 6, 1024, 1, slider_shadow_mask_x_count },
{ "Shadow Mask Y Count", 1, 6, 1024, 1, slider_shadow_mask_y_count },
{ "Shadow Mask Pixel Count X", 1, 6, 64, 1, slider_shadow_mask_usize },
{ "Shadow Mask Pixel Count Y", 1, 6, 64, 1, slider_shadow_mask_vsize },
{ "Shadow Mask Offset X", -100, 0, 100, 1, slider_shadow_mask_uoffset },
{ "Shadow Mask Offset Y", -100, 0, 100, 1, slider_shadow_mask_voffset },
{ "Screen Curvature", 0, 3, 100, 1, slider_curvature },
{ "Screen Round Corner", 0, 3, 100, 1, slider_round_corner },
{ "Screen Reflection", 0, 3, 100, 1, slider_reflection },
{ "Image Vignetting", 0, 3, 100, 1, slider_vignetting },
{ "Scanline Darkness", 0, 100, 100, 1, slider_scanline_alpha },
{ "Scanline Screen Height", 1, 20, 80, 1, slider_scanline_scale },
{ "Scanline Indiv. Height", 1, 20, 80, 1, slider_scanline_height },
{ "Scanline Brightness", 0, 20, 40, 1, slider_scanline_bright_scale },
{ "Scanline Brightness Overdrive", 0, 0, 20, 1, slider_scanline_bright_offset },
{ "Scanline Jitter", 0, 0, 40, 1, slider_scanline_offset },
{ "Defocus X", 0, 0, 64, 1, slider_defocus_x },
{ "Defocus Y", 0, 0, 64, 1, slider_defocus_y },
{ "Red Position Offset X", -1500, 3, 1500, 1, slider_red_converge_x },
{ "Red Position Offset Y", -1500, 0, 1500, 1, slider_red_converge_y },
{ "Green Position Offset X", -1500, 0, 1500, 1, slider_green_converge_x },
{ "Green Position Offset Y", -1500, 3, 1500, 1, slider_green_converge_y },
{ "Blue Position Offset X", -1500, 3, 1500, 1, slider_blue_converge_x },
{ "Blue Position Offset Y", -1500, 3, 1500, 1, slider_blue_converge_y },
{ "Red Convergence X", -1500, 0, 1500, 1, slider_red_radial_converge_x },
{ "Red Convergence Y", -1500, 0, 1500, 1, slider_red_radial_converge_y },
{ "Green Convergence X", -1500, 0, 1500, 1, slider_green_radial_converge_x },
{ "Green Convergence Y", -1500, 0, 1500, 1, slider_green_radial_converge_y },
{ "Blue Convergence X", -1500, 0, 1500, 1, slider_blue_radial_converge_x },
{ "Blue Convergence Y", -1500, 0, 1500, 1, slider_blue_radial_converge_y },
{ "Red Output from Red Input", -400, 0, 400, 5, slider_red_from_r },
{ "Red Output from Green Input", -400, 0, 400, 5, slider_red_from_g },
{ "Red Output from Blue Input", -400, 0, 400, 5, slider_red_from_b },
{ "Green Output from Red Input", -400, 0, 400, 5, slider_green_from_r },
{ "Green Output from Green Input", -400, 0, 400, 5, slider_green_from_g },
{ "Green Output from Blue Input", -400, 0, 400, 5, slider_green_from_b },
{ "Blue Output from Red Input", -400, 0, 400, 5, slider_blue_from_r },
{ "Blue Output from Green Input", -400, 0, 400, 5, slider_blue_from_g },
{ "Blue Output from Blue Input", -400, 0, 400, 5, slider_blue_from_b },
{ "Saturation", 0, 140, 400, 1, slider_saturation },
{ "Red DC Offset", -100, 0, 100, 1, slider_red_offset },
{ "Green DC Offset", -100, 0, 100, 1, slider_green_offset },
{ "Blue DC Offset", -100, 0, 100, 1, slider_blue_offset },
{ "Red Scale", -200, 95, 200, 1, slider_red_scale },
{ "Green Scale", -200, 95, 200, 1, slider_green_scale },
{ "Blue Scale", -200, 95, 200, 1, slider_blue_scale },
{ "Red Gamma", -80, 16, 80, 1, slider_red_power },
{ "Green Gamma", -80, 16, 80, 1, slider_green_power },
{ "Blue Gamma", -80, 16, 80, 1, slider_blue_power },
{ "Red Floor", 0, 5, 100, 1, slider_red_floor },
{ "Green Floor", 0, 5, 100, 1, slider_green_floor },
{ "Blue Floor", 0, 5, 100, 1, slider_blue_floor },
{ "Red Phosphor Life", 0, 40, 100, 1, slider_red_phosphor_life },
{ "Green Phosphor Life", 0, 40, 100, 1, slider_green_phosphor_life },
{ "Blue Phosphor Life", 0, 40, 100, 1, slider_blue_phosphor_life },
{ "Vector Length Attenuation", 0, 80, 100, 1, slider_vector_attenuation },
{ "Vector Attenuation Length Limit", 1, 500, 1000, 1, slider_vector_length_max },
{ "Vector Bloom Scale", 0, 300, 1000, 5, slider_vector_bloom_scale },
{ "Raster Bloom Scale", 0, 225, 1000, 5, slider_raster_bloom_scale },
{ "Bloom Level 0 Scale", 0, 100, 100, 1, slider_bloom_lvl0_scale },
{ "Bloom Level 1 Scale", 0, 21, 100, 1, slider_bloom_lvl1_scale },
{ "Bloom Level 2 Scale", 0, 19, 100, 1, slider_bloom_lvl2_scale },
{ "Bloom Level 3 Scale", 0, 17, 100, 1, slider_bloom_lvl3_scale },
{ "Bloom Level 4 Scale", 0, 15, 100, 1, slider_bloom_lvl4_scale },
{ "Bloom Level 5 Scale", 0, 14, 100, 1, slider_bloom_lvl5_scale },
{ "Bloom Level 6 Scale", 0, 13, 100, 1, slider_bloom_lvl6_scale },
{ "Bloom Level 7 Scale", 0, 12, 100, 1, slider_bloom_lvl7_scale },
{ "Bloom Level 8 Scale", 0, 11, 100, 1, slider_bloom_lvl8_scale },
{ "Bloom Level 9 Scale", 0, 10, 100, 1, slider_bloom_lvl9_scale },
{ "Bloom Level 10 Scale", 0, 9, 100, 1, slider_bloom_lvl10_scale },
{ NULL, 0, 0, 0, 0, NULL },
};