diff options
Diffstat (limited to 'src/osd/modules/render')
-rw-r--r-- | src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc | 28 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.cpp | 8 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc index 77130d98d13..cfb7b487596 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc @@ -23,17 +23,23 @@ SAMPLER2D(s_tex, 0); void main() { - const vec2 Coord1Offset = vec2( 0.75, 0.50); - const vec2 Coord2Offset = vec2( 0.25, 1.00); - const vec2 Coord3Offset = vec2(-0.50, 0.75); - const vec2 Coord4Offset = vec2(-1.00, 0.25); - const vec2 Coord5Offset = vec2(-0.75, -0.50); - const vec2 Coord6Offset = vec2(-0.25, -1.00); - const vec2 Coord7Offset = vec2( 0.50, -0.75); - const vec2 Coord8Offset = vec2( 1.00, -0.25); - - vec2 DefocusTexelDims = u_defocus.xy / u_tex_size0.xy; - + // previously this pass was applied two times with offsets of 0.25, 0.5, 0.75, 1.0 + // now this pass is applied only once with offsets of 0.25, 0.55, 1.0, 1.6 to achieve the same appearance as before till a maximum defocus of 2.0 + // 0.075x² + 0.225x + 0.25 + const vec2 Coord1Offset = vec2(-1.60, 0.25); + const vec2 Coord2Offset = vec2(-1.00, -0.55); + const vec2 Coord3Offset = vec2(-0.55, 1.00); + const vec2 Coord4Offset = vec2(-0.25, -1.60); + const vec2 Coord5Offset = vec2( 0.25, 1.60); + const vec2 Coord6Offset = vec2( 0.55, -1.00); + const vec2 Coord7Offset = vec2( 1.00, 0.55); + const vec2 Coord8Offset = vec2( 1.60, -0.25); + + // imaginary texel dimensions independed from source and target dimension + vec2 TexelDims = vec2_splat(1.0 / 1024.0); + + vec2 DefocusTexelDims = u_defocus.xy * TexelDims.xy; + vec4 d0 = texture2D(s_tex, v_texcoord0); vec4 d1 = texture2D(s_tex, v_texcoord0 + Coord1Offset * DefocusTexelDims); vec4 d2 = texture2D(s_tex, v_texcoord0 + Coord2Offset * DefocusTexelDims); diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 3ea23ba5b04..cf454b92ecb 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -1350,8 +1350,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) next_index = color_convolution_pass(rt, next_index, poly, vertnum); // handled in bgfx next_index = prescale_pass(rt, next_index, poly, vertnum); // handled in bgfx next_index = deconverge_pass(rt, next_index, poly, vertnum); // handled in bgfx - next_index = defocus_pass(rt, next_index, poly, vertnum); // 1st pass - next_index = defocus_pass(rt, next_index, poly, vertnum); // 2nd pass + next_index = defocus_pass(rt, next_index, poly, vertnum); next_index = phosphor_pass(rt, next_index, poly, vertnum); // create bloom textures @@ -1430,8 +1429,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) next_index = vector_buffer_pass(rt, next_index, poly, vertnum); next_index = deconverge_pass(rt, next_index, poly, vertnum); - next_index = defocus_pass(rt, next_index, poly, vertnum); // 1st pass - next_index = defocus_pass(rt, next_index, poly, vertnum); // 2nd pass + next_index = defocus_pass(rt, next_index, poly, vertnum); next_index = phosphor_pass(rt, next_index, poly, vertnum); // create bloom textures @@ -2004,7 +2002,7 @@ slider_desc shaders::s_sliders[] = { "Scanline Brightness Offset", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_BRIGHT_OFFSET, 0.01f, "%1.2f", {} }, { "Scanline Jitter Amount", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_JITTER, 0.01f, "%1.2f", {} }, { "Hum Bar Amount", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_HUM_BAR_ALPHA, 0.01f, "%2.2f", {} }, - { "Defocus", 0, 0, 100, 1, SLIDER_VEC2, SLIDER_SCREEN_TYPE_ANY, SLIDER_DEFOCUS, 0.1f, "%2.1f", {} }, + { "Defocus", 0, 0, 20, 1, SLIDER_VEC2, SLIDER_SCREEN_TYPE_ANY, SLIDER_DEFOCUS, 0.1f, "%1.1f", {} }, { "Linear Convergence X,", -100, 0, 100, 1, SLIDER_COLOR, SLIDER_SCREEN_TYPE_ANY, SLIDER_CONVERGE_X, 0.1f, "%3.1f",{} }, { "Linear Convergence Y,", -100, 0, 100, 1, SLIDER_COLOR, SLIDER_SCREEN_TYPE_ANY, SLIDER_CONVERGE_Y, 0.1f, "%3.1f", {} }, { "Radial Convergence X,", -100, 0, 100, 1, SLIDER_COLOR, SLIDER_SCREEN_TYPE_ANY, SLIDER_RADIAL_CONVERGE_X, 0.1f, "%3.1f", {} }, |