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
This commit is contained in:
ImJezze 2016-05-22 14:32:08 +02:00
parent f89aa281de
commit 92c2bdf917
6 changed files with 66 additions and 69 deletions

View File

@ -97,26 +97,26 @@ yiq_phase_count 2 Phase Count value for NTSC signal proces
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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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" },