summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-05-22 14:32:08 +0200
committer ImJezze <jezze@gmx.net>2016-05-22 20:54:30 +0200
commit92c2bdf9170662274f0c2ca1e3a30357f02ca977 (patch)
tree4402619774e07d588ad97d0cdc245376b4ee0865
parentf89aa281def969410a3fad463cc81defa856189a (diff)
Normalized vector attenuation settings
- vector_length_ratio is now independent from screen size - changed vector_length_ratio range from [0.0, 1000.0] to [0.0, 1.0] - updated display name and description of vector_length_scale vector_length_ratio
-rw-r--r--docs/hlsl.txt56
-rw-r--r--hlsl/vector.fx28
-rw-r--r--ini/presets/vector-mono.ini4
-rw-r--r--ini/presets/vector.ini4
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp21
-rw-r--r--src/osd/windows/winmain.cpp22
6 files changed, 66 insertions, 69 deletions
diff --git a/docs/hlsl.txt b/docs/hlsl.txt
index 13382f97273..55a833d203a 100644
--- a/docs/hlsl.txt
+++ b/docs/hlsl.txt
@@ -60,13 +60,13 @@ saturation 0.0 to 4.0 This parameter defines the amount each c
oversaturated equally beyond that.
offset [r,g,b] These parameters define a value for each color channel
that is added to said channel after scaling and after
- matrix convolution. (-2.0 to 2.0)
+ matrix convolution. (-2.0 to 2.0)
scale [r,g,b] These parameters define a value for each color channel
that is multiplied with said channel after matrix
convolution. (-2.0 to 2.0)
power [r,g,b] These parameters define the exponent for each color
channel that is applied after scaling, offsetting,
- saturation and matrix convolution. (-4.0 to 4.0)
+ saturation and matrix convolution. (-4.0 to 4.0)
floor [r,g,b] These parameters define the lower limit of each final
color channel value; 0.05, for example, raises the
minimum to 0.05 but re-scales to leave the max at 1.0.
@@ -80,43 +80,43 @@ NTSC Processing Parameters
--------------------------
Name Default Values Description
-yiq_jitter 0.0 Jitter for the NTSC signal processing. (0.0 to 1.0)
-yiq_cc 3.57954545 Color Carrier frequency for NTSC signal processing. (0.0 to 6.0)
-yiq_a 0.5 A value for NTSC signal processing. (-1.0 to 1.0)
-yiq_b 0.5 B value for NTSC signal processing. (-1.0 to 1.0)
-yiq_o 0.0 Outgoing Color Carrier phase offset for NTSC signal processing. (-3.0 to 3.0)
-yiq_p 1.0 Incoming Pixel Clock scaling value for NTSC signal processing. (-3.0 to 3.0)
-yiq_n 1.0 Y filter notch width for NTSC signal processing. (0.0 to 6.0)
-yiq_y 6.0 Y filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
-yiq_i 1.2 I filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
-yiq_q 0.6 Q filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
-yiq_scan_time 52.6 Horizontal scanline duration for NTSC signal processing. (usec)
-yiq_phase_count 2 Phase Count value for NTSC signal processing. (3 for NES, else 2)
+yiq_jitter 0.0 Jitter for the NTSC signal processing. (0.0 to 1.0)
+yiq_cc 3.57954545 Color Carrier frequency for NTSC signal processing. (0.0 to 6.0)
+yiq_a 0.5 A value for NTSC signal processing. (-1.0 to 1.0)
+yiq_b 0.5 B value for NTSC signal processing. (-1.0 to 1.0)
+yiq_o 0.0 Outgoing Color Carrier phase offset for NTSC signal processing. (-3.0 to 3.0)
+yiq_p 1.0 Incoming Pixel Clock scaling value for NTSC signal processing. (-3.0 to 3.0)
+yiq_n 1.0 Y filter notch width for NTSC signal processing. (0.0 to 6.0)
+yiq_y 6.0 Y filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
+yiq_i 1.2 I filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
+yiq_q 0.6 Q filter cutoff frequency for NTSC signal processing. (0.0 to 6.0)
+yiq_scan_time 52.6 Horizontal scanline duration for NTSC signal processing. (usec)
+yiq_phase_count 2 Phase Count value for NTSC signal processing. (3 for NES, else 2)
Vector Post-Processing Options
------------------------------
Name Default Values Description
-vector_length_scale 0.8 How much length affects vector fade. (0.00-1.00)
-vector_length_ratio 500.0 Vector fade length (4.0 - vectors fade the most at and above 4
- pixels, etc.) (0.000 - 1000.000)
+vector_length_scale 0.5 The maximum vector attenuation. (0.00 to 1.00)
+vector_length_ratio 0.5 The minimum vector length (vector length to screen size ratio)
+ that is affected by the attenuation (0.000 to 1.000)
Bloom Post-Processing Options
-----------------------------
Name Default Values Description
bloom_blend_mode 0 or 1 0 for brighten blend mode or 1 for darken blend mode.
-bloom_scale 0.0 Bloom intensity factor. (0.000-2.000)
-bloom_overdrive 0.0,0.0,0.0 Bloom overdrive factor to bright full saturated colors. (0.000-2.000)
-bloom_lvl0_weight 1.00 Bloom level 0 (full-size target) weight. (0.00-1.00)
-bloom_lvl1_weight 0.64 Bloom level 1 (1/2-size target) weight. (0.00-1.00)
-bloom_lvl2_weight 0.32 Bloom level 2 (1/4-size target) weight. (0.00-1.00)
-bloom_lvl3_weight 0.16 Bloom level 3 (1/8-size target) weight. (0.00-1.00)
-bloom_lvl4_weight 0.08 Bloom level 4 (1/16-size target) weight. (0.00-1.00)
-bloom_lvl5_weight 0.06 Bloom level 5 (1/32-size target) weight. (0.00-1.00)
-bloom_lvl6_weight 0.04 Bloom level 6 (1/64-size target) weight. (0.00-1.00)
-bloom_lvl7_weight 0.02 Bloom level 7 (1/128-size target) weight. (0.00-1.00)
-bloom_lvl8_weight 0.01 Bloom level 8 (1/256-size target) weight. (0.00-1.00)
+bloom_scale 0.0 Bloom intensity factor. (0.000 to 2.000)
+bloom_overdrive 0.0,0.0,0.0 Bloom overdrive factor to bright full saturated colors. (0.000 to 2.000)
+bloom_lvl0_weight 1.00 Bloom level 0 weight. (full-size target) (0.00 to 1.00)
+bloom_lvl1_weight 0.64 Bloom level 1 weight. (1/4 smaller that level 0 target) (0.00 to 1.00)
+bloom_lvl2_weight 0.32 Bloom level 2 weight. (1/4 smaller that level 1 target) (0.00 to 1.00)
+bloom_lvl3_weight 0.16 Bloom level 3 weight. (1/4 smaller that level 2 target) (0.00 to 1.00)
+bloom_lvl4_weight 0.08 Bloom level 4 weight. (1/4 smaller that level 3 target) (0.00 to 1.00)
+bloom_lvl5_weight 0.06 Bloom level 5 weight. (1/4 smaller that level 4 target) (0.00 to 1.00)
+bloom_lvl6_weight 0.04 Bloom level 6 weight. (1/4 smaller that level 5 target) (0.00 to 1.00)
+bloom_lvl7_weight 0.02 Bloom level 7 weight. (1/4 smaller that level 6 target)
+bloom_lvl8_weight 0.01 Bloom level 8 weight. (1/4 smaller that level 7 target) (0.00 to 1.00)
Presets
diff --git a/hlsl/vector.fx b/hlsl/vector.fx
index d71b85ad0e1..95957d57c80 100644
--- a/hlsl/vector.fx
+++ b/hlsl/vector.fx
@@ -38,9 +38,6 @@ struct PS_INPUT
uniform float2 ScreenDims;
uniform float2 QuadDims;
-uniform float2 TimeParams;
-uniform float3 LengthParams;
-
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
@@ -52,11 +49,10 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position.xy *= 2.0f; // zoom
Output.TexCoord = Input.TexCoord;
+ Output.LineInfo = Input.LineInfo;
Output.Color = Input.Color;
- Output.LineInfo = Input.LineInfo;
-
return Output;
}
@@ -64,20 +60,22 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Vector Pixel Shader
//-----------------------------------------------------------------------------
-// TimeParams.x: Frame time of the vector
-// TimeParams.y: How much frame time affects the vector's fade
-// LengthParams.y: How much length affects the vector's fade
-// LengthParams.z: Size at which fade is maximum
+uniform float TimeRatio; // Frame time of the vector (not set)
+uniform float TimeScale; // How much frame time affects the vector's fade (not set)
+uniform float LengthRatio; // Size at which fade is maximum
+uniform float LengthScale; // How much length affects the vector's fade
+
float4 ps_main(PS_INPUT Input) : COLOR
{
- float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y);
+ float lineLength = Input.LineInfo.x / max(QuadDims.x, QuadDims.y); // normalize
+ float lineLengthRatio = LengthRatio;
+ float lineLengthScale = LengthScale;
- float lengthModulate = 1.0f - clamp(Input.LineInfo.x / LengthParams.z, 0.0f, 1.0f);
- float minLength = 2.0f - clamp(Input.LineInfo.x - 1.0f, 0.0f, 2.0f);
- lengthModulate = lerp(lengthModulate, 4.0f, minLength * 0.5f);
- lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y);
+ float timeModulate = lerp(1.0f, TimeRatio, TimeScale);
+ float lengthModulate = 1.0f - clamp(lineLength / lineLengthRatio, 0.0f, 1.0f);
+ float timeLengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthScale);
- float4 outColor = float4(lengthModulate, lengthModulate, lengthModulate, 1.0f);
+ float4 outColor = float4(timeLengthModulate, timeLengthModulate, timeLengthModulate, 1.0f);
outColor *= Input.Color;
return outColor;
diff --git a/ini/presets/vector-mono.ini b/ini/presets/vector-mono.ini
index 5ff73b66c21..1aa5f0915df 100644
--- a/ini/presets/vector-mono.ini
+++ b/ini/presets/vector-mono.ini
@@ -48,8 +48,8 @@ yiq_enable 0
#
# VECTOR POST-PROCESSING OPTIONS
#
-vector_length_scale 0.8
-vector_length_ratio 500.0
+vector_length_scale 0.5
+vector_length_ratio 0.5
#
# BLOOM POST-PROCESSING OPTIONS
diff --git a/ini/presets/vector.ini b/ini/presets/vector.ini
index fa52c7cace4..8422d816d8b 100644
--- a/ini/presets/vector.ini
+++ b/ini/presets/vector.ini
@@ -51,8 +51,8 @@ yiq_enable 0
#
# VECTOR POST-PROCESSING OPTIONS
#
-vector_length_scale 0.8
-vector_length_ratio 500.0
+vector_length_scale 0.5
+vector_length_ratio 0.5
#
# BLOOM POST-PROCESSING OPTIONS
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 79d3a55f64b..27718202ac4 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -1518,13 +1518,12 @@ int shaders::vector_pass(d3d_render_target *rt, int source_index, poly_info *pol
{
int next_index = source_index;
- float time_params[2] = { 0.0f, 0.0f };
- float length_params[3] = { poly->get_line_length(), options->vector_length_scale, options->vector_length_ratio };
-
curr_effect = vector_effect;
curr_effect->update_uniforms();
- curr_effect->set_vector("TimeParams", 2, time_params);
- curr_effect->set_vector("LengthParams", 3, length_params);
+ // curr_effect->set_float("TimeRatio", options->vector_time_ratio);
+ // curr_effect->set_float("TimeScale", options->vector_time_scale);
+ curr_effect->set_float("LengthRatio", options->vector_length_ratio);
+ curr_effect->set_float("LengthScale", options->vector_length_scale);
blit(rt->target_surface[next_index], true, poly->get_type(), vertnum, poly->get_count());
@@ -2283,8 +2282,8 @@ hlsl_options shaders::last_options = { false };
enum slider_option
{
- SLIDER_VECTOR_ATTENUATION = 0,
- SLIDER_VECTOR_LENGTH_MAX,
+ SLIDER_VECTOR_ATT_MAX = 0,
+ SLIDER_VECTOR_ATT_LEN_MIN,
SLIDER_SHADOW_MASK_TILE_MODE,
SLIDER_SHADOW_MASK_ALPHA,
SLIDER_SHADOW_MASK_X_COUNT,
@@ -2360,8 +2359,8 @@ enum slider_screen_type
slider_desc shaders::s_sliders[] =
{
- { "Vector Length Attenuation", 0, 50, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_VECTOR, SLIDER_VECTOR_ATTENUATION, 0.01f, "%1.2f", {} },
- { "Vector Attenuation Length Limit", 1, 500, 1000, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_VECTOR, SLIDER_VECTOR_LENGTH_MAX, 1.0f, "%4f", {} },
+ { "Vector Attenuation Maximum", 0, 50, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_VECTOR, SLIDER_VECTOR_ATT_MAX, 0.01f, "%1.2f", {} },
+ { "Vector Attenuation Length Minimum", 1, 500, 1000, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_VECTOR, SLIDER_VECTOR_ATT_LEN_MIN, 0.001f, "%1.3f", {} },
{ "Shadow Mask Tile Mode", 0, 0, 1, 1, SLIDER_INT_ENUM, SLIDER_SCREEN_TYPE_ANY, SLIDER_SHADOW_MASK_TILE_MODE, 0, "%s", { "Screen", "Source" } },
{ "Shadow Mask Amount", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_ANY, SLIDER_SHADOW_MASK_ALPHA, 0.01f, "%1.2f", {} },
{ "Shadow Mask Pixel X Count", 1, 1, 1024, 1, SLIDER_INT, SLIDER_SCREEN_TYPE_ANY, SLIDER_SHADOW_MASK_X_COUNT, 0, "%d", {} },
@@ -2431,8 +2430,8 @@ void *shaders::get_slider_option(int id, int index)
{
switch (id)
{
- case SLIDER_VECTOR_ATTENUATION: return &(options->vector_length_scale);
- case SLIDER_VECTOR_LENGTH_MAX: return &(options->vector_length_ratio);
+ case SLIDER_VECTOR_ATT_MAX: return &(options->vector_length_scale);
+ case SLIDER_VECTOR_ATT_LEN_MIN: return &(options->vector_length_ratio);
case SLIDER_SHADOW_MASK_TILE_MODE: return &(options->shadow_mask_tile_mode);
case SLIDER_SHADOW_MASK_ALPHA: return &(options->shadow_mask_alpha);
case SLIDER_SHADOW_MASK_X_COUNT: return &(options->shadow_mask_count_x);
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 8b30e0f9812..ab8e99b6038 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -217,22 +217,22 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_YIQ_PHASE_COUNT";yiqp", "2", OPTION_INTEGER, "Phase Count value for NTSC signal processing" },
/* Vector simulation below this line */
{ nullptr, nullptr, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" },
- { WINOPTION_VECTOR_LENGTH_SCALE";veclength", "0.5", OPTION_FLOAT, "How much length affects vector fade" },
- { WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "500.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" },
+ { WINOPTION_VECTOR_LENGTH_SCALE";vecscale", "0.5", OPTION_FLOAT, "The maximum vector attenuation" },
+ { WINOPTION_VECTOR_LENGTH_RATIO";vecratio", "0.5", OPTION_FLOAT, "The minimum vector length (vector length to screen size ratio) that is affected by the attenuation" },
/* Bloom below this line */
{ nullptr, nullptr, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" },
{ WINOPTION_BLOOM_BLEND_MODE, "0", OPTION_INTEGER, "bloom blend mode (0 for brighten, 1 for darken)" },
{ WINOPTION_BLOOM_SCALE, "0.0", OPTION_FLOAT, "Intensity factor for bloom" },
{ WINOPTION_BLOOM_OVERDRIVE, "1.0,1.0,1.0", OPTION_STRING, "Overdrive factor for bloom" },
- { WINOPTION_BLOOM_LEVEL0_WEIGHT, "1.0", OPTION_FLOAT, "Bloom level 0 (full-size target) weight" },
- { WINOPTION_BLOOM_LEVEL1_WEIGHT, "0.64", OPTION_FLOAT, "Bloom level 1 (1/2-size target) weight" },
- { WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.32", OPTION_FLOAT, "Bloom level 2 (1/4-size target) weight" },
- { WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.16", OPTION_FLOAT, "Bloom level 3 (1/8-size target) weight" },
- { WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.08", OPTION_FLOAT, "Bloom level 4 (1/16-size target) weight" },
- { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.06", OPTION_FLOAT, "Bloom level 5 (1/32-size target) weight" },
- { WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 6 (1/64-size target) weight" },
- { WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 7 (1/128-size target) weight" },
- { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 8 (1/256-size target) weight" },
+ { WINOPTION_BLOOM_LEVEL0_WEIGHT, "1.0", OPTION_FLOAT, "Bloom level 0 weight (full-size target)" },
+ { WINOPTION_BLOOM_LEVEL1_WEIGHT, "0.64", OPTION_FLOAT, "Bloom level 1 weight (1/4 smaller that level 0 target)" },
+ { WINOPTION_BLOOM_LEVEL2_WEIGHT, "0.32", OPTION_FLOAT, "Bloom level 2 weight (1/4 smaller that level 1 target)" },
+ { WINOPTION_BLOOM_LEVEL3_WEIGHT, "0.16", OPTION_FLOAT, "Bloom level 3 weight (1/4 smaller that level 2 target)" },
+ { WINOPTION_BLOOM_LEVEL4_WEIGHT, "0.08", OPTION_FLOAT, "Bloom level 4 weight (1/4 smaller that level 3 target)" },
+ { WINOPTION_BLOOM_LEVEL5_WEIGHT, "0.06", OPTION_FLOAT, "Bloom level 5 weight (1/4 smaller that level 4 target)" },
+ { WINOPTION_BLOOM_LEVEL6_WEIGHT, "0.04", OPTION_FLOAT, "Bloom level 6 weight (1/4 smaller that level 5 target)" },
+ { WINOPTION_BLOOM_LEVEL7_WEIGHT, "0.02", OPTION_FLOAT, "Bloom level 7 weight (1/4 smaller that level 6 target)" },
+ { WINOPTION_BLOOM_LEVEL8_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 8 weight (1/4 smaller that level 7 target)" },
// full screen options
{ nullptr, nullptr, OPTION_HEADER, "FULL SCREEN OPTIONS" },