From cd4dfca43e81533b6b204e37ec016dda924c004b Mon Sep 17 00:00:00 2001 From: ImJezze Date: Tue, 19 Apr 2016 21:18:16 +0200 Subject: [PATCH] Refactored BGFX distortion pass (nw) - also removed vector hack --- bgfx/chains/hlsl.json | 69 ++++++++------- bgfx/effects/hlsl/distortion.json | 23 ++--- .../dx11/chains/hlsl/fs_distortion.bin | Bin 3690 -> 3634 bytes .../shaders/dx9/chains/hlsl/fs_distortion.bin | Bin 2735 -> 2843 bytes .../gles/chains/hlsl/fs_distortion.bin | Bin 5408 -> 4939 bytes .../glsl/chains/hlsl/fs_distortion.bin | Bin 5164 -> 4707 bytes .../metal/chains/hlsl/fs_distortion.bin | Bin 5764 -> 5260 bytes hlsl/distortion.fx | 8 +- src/osd/modules/render/bgfx/chainentry.cpp | 15 ++++ src/osd/modules/render/bgfx/chainentry.h | 1 + .../bgfx/shaders/chains/hlsl/fs_distortion.sc | 80 ++++++++---------- 11 files changed, 107 insertions(+), 89 deletions(-) diff --git a/bgfx/chains/hlsl.json b/bgfx/chains/hlsl.json index 985a332ed9d..2b730966a47 100644 --- a/bgfx/chains/hlsl.json +++ b/bgfx/chains/hlsl.json @@ -9,11 +9,11 @@ // name (unused): This value should contain a suitable name for the screen chain. It is not read by MAME, though it is still suggested that it be put in any user-made chains. // type: string "name": "Classic D3D HLSL CRT Simulation", - + // author (unused): This value should contain a suitable name for this chain's author. Again, it is not read by MAME, but it is still advisable to have. // type: string "author": "Ryan Holtz & ImJezze", - + // sliders (optional): The list of sliders used by all of the entries in this chain. Can be omitted if no entries use any sliders. "sliders": [ // type (required): The sliders's conceptual type. Is it a list of string selections? Is it a single floating-point value? Does it require RGB values, or XY values? @@ -54,7 +54,7 @@ // // strings (optional): A list of strings to use with the "intenum" type, to select from a list of text options instead of simply numbers. // value: An array of 2 or more entries, with one entry per possible slider setting from "min" to "max" inclusive. - + { "type": "intenum", "name": "adjustments", "text": "Enable Adjustments", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] }, { "type": "intenum", "name": "ntsc", "text": "Enable NTSC", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] }, @@ -80,7 +80,7 @@ { "type": "vec2", "name": "converge_red", "text": "Red Convergence, ", "default": [ 5, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, { "type": "vec2", "name": "converge_green", "text": "Green Convergence, ", "default": [ 0, 5 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, { "type": "vec2", "name": "converge_blue", "text": "Blue Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, - + { "type": "vec2", "name": "radial_converge_red", "text": "Red Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, { "type": "vec2", "name": "radial_converge_green", "text": "Green Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, { "type": "vec2", "name": "radial_converge_blue", "text": "Blue Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" }, @@ -96,22 +96,27 @@ { "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "shadow_alpha", "text": "Shadow Mask Amount", "default": 20, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "vec2", "name": "shadow_uv_count", "text": "Shadow Mask Pixel Count ", "default": [ 12, 12 ], "max": [ 128, 128 ], "min": [ 1, 1 ], "step": 1, "scale": 1.0, "format": "%3f", "screen": "crt" }, { "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 500, 500 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, { "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0, 0 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" }, + { "type": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 5, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.7f", "screen": "crt" }, + { "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 5, 5, 5 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, { "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 80, 80, 80 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - - { "type": "float", "name": "curvature", "text": "Screen Curvature Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 5, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, - { "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" } + + { "type": "float", "name": "distortion", "text": "Screen Distortion Amount", "default": 20, "max": 200, "min": -200, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "cubic_distortion", "text": "Screen Cubic Distortion Amount", "default": 0, "max": 200, "min": -200, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "distort_corner", "text": "Distorted Corner Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 5, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }, + { "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" } ], - + // parameters (optional): A list of procedurally-generated parameters that can be bound to entry uniforms. "parameters": [ // name (required): The internal name of the parameter that will be used when binding to an entry uniform. @@ -128,11 +133,11 @@ // // limit (required by type "time"): The range of time across which to loop. 0.0 means run indefinitely. // value: Any numeric value. - + { "name": "jitter", "type": "frame", "period": 2 }, { "name": "time", "type": "time", "limit": 0.0 } ], - + // targets (optional): A list of all render targets that will be used by the chain entries in this chain. "targets": [ // name (required): The name of the target. Will be used to bind it as a texture and as an output in chain entries. @@ -177,7 +182,7 @@ "doublebuffer": true } ], - + // passes (required): The list of individual shaders to invoke, and any dynamic input parameters they need. "passes": [ { @@ -194,7 +199,7 @@ // clearcolor (optional): An array containing an RGBA quadruplet to which to clear the output target. // value: An array of four numeric values of the range 0.0 to 1.0. "clearcolor": [ 0.0, 0.0, 0.0, 0.0 ], - + // cleardepth (optional): A numeric value containing the depth value to which to clear the output target. // value: Any numeric value. "cleardepth": 1.0, @@ -231,7 +236,7 @@ { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, { "type": "slider", "condition": "equal", "combine": "or", "name": "ntsc", "value": 0 } ], - + // uniforms (optional): Non-sampler uniform bindings for this chain entry. "uniforms": [ // uniform (required): The name of the uniform, as it is referenced in the shader source code itself. @@ -247,7 +252,7 @@ // // value (optional): An array of numeric values that should be loaded into this uniform. // values: Should be an array containing anywhere from 1-16 numeric values, corresponding to the size of the uniform's type. - + { "uniform": "u_a_value", "slider": "a_value" }, { "uniform": "u_b_value", "slider": "b_value" }, { "uniform": "u_cc_value", "slider": "cc_value" }, @@ -256,7 +261,7 @@ { "uniform": "u_jitter_offset", "slider": "jitter_offset" }, { "uniform": "u_jitter_amount", "parameter": "jitter" } ], - + // inputs (optional): A list of samplers used by this entry, and their corresponding bindings. "input": [ // sampler (required): The name of the sampler, as it is referenced in the shader source code itself. @@ -278,7 +283,7 @@ // default: true { "sampler": "s_tex", "texture": "screen" } ], - + // output (required): The target to use as the output for this pass. Can be one of the named targets in "targets", or "output" // or "previous" for one of two automatically-generated targets. // value: Any valid ASCII string that names a target. @@ -468,19 +473,23 @@ { "effect": "hlsl/distortion", "name": "Distortion Pass", "disablewhen": [ - { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, - { "type": "slider", "condition": "equal", "combine": "and", "name": "curvature", "value": 0.0 }, - { "type": "slider", "condition": "equal", "combine": "and", "name": "round_corner", "value": 0.0 }, - { "type": "slider", "condition": "equal", "combine": "and", "name": "smooth_border", "value": 0.0 }, - { "type": "slider", "condition": "equal", "combine": "and", "name": "vignetting", "value": 0.0 }, - { "type": "slider", "condition": "equal", "combine": "and", "name": "reflection", "value": 0.0 } + { "type": "slider", "condition": "equal", "combine": "or", "name": "adjustments", "value": 0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "distortion", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "cubic_distortion", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "distort_corner", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "round_corner", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "smooth_border", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "vignetting", "value": 0.0 }, + { "type": "slider", "condition": "equal", "combine": "and", "name": "reflection", "value": 0.0 } ], "uniforms": [ - { "uniform": "u_curvature", "slider": "curvature" }, - { "uniform": "u_round_corner", "slider": "round_corner" }, - { "uniform": "u_smooth_border", "slider": "smooth_border" }, - { "uniform": "u_vignetting", "slider": "vignetting" }, - { "uniform": "u_reflection", "slider": "reflection" } + { "uniform": "u_distortion", "slider": "distortion" }, + { "uniform": "u_cubic_distortion", "slider": "cubic_distortion" }, + { "uniform": "u_distort_corner", "slider": "distort_corner" }, + { "uniform": "u_round_corner", "slider": "round_corner" }, + { "uniform": "u_smooth_border", "slider": "smooth_border" }, + { "uniform": "u_vignetting", "slider": "vignetting" }, + { "uniform": "u_reflection", "slider": "reflection" } ], "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/effects/hlsl/distortion.json b/bgfx/effects/hlsl/distortion.json index 42a43d95c65..14a7b79891a 100644 --- a/bgfx/effects/hlsl/distortion.json +++ b/bgfx/effects/hlsl/distortion.json @@ -25,16 +25,17 @@ "vertex": "chains/hlsl/vs_distortion", "fragment": "chains/hlsl/fs_distortion", "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, - { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, - { "name": "u_quad_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, - { "name": "u_rotation_type", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_prepare_vector", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_curvature", "type": "vec4", "values": [ 0.25, 0.0, 0.0, 0.0 ] }, - { "name": "u_round_corner", "type": "vec4", "values": [ 0.2, 0.0, 0.0, 0.0 ] }, - { "name": "u_smooth_border", "type": "vec4", "values": [ 0.05, 0.0, 0.0, 0.0 ] }, - { "name": "u_vignetting", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, - { "name": "u_reflection", "type": "vec4", "values": [ 0.30, 0.0, 0.0, 0.0 ] } + { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, + { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "u_target_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "u_quad_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "u_distortion", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_cubic_distortion", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_distort_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_round_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_smooth_border", "type": "vec4", "values": [ 0.05, 0.0, 0.0, 0.0 ] }, + { "name": "u_vignetting", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_reflection", "type": "vec4", "values": [ 0.30, 0.0, 0.0, 0.0 ] } ] } \ No newline at end of file diff --git a/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin b/bgfx/shaders/dx11/chains/hlsl/fs_distortion.bin index d5f7f3b16e21b8fa77f770e39d79ce90603167e0..2e2b1813c8a83997f078daf6aa55318625a8d0b4 100644 GIT binary patch literal 3634 zcmbVOJ#1T56h3}-oW^z=%MvI=NIa!m#83h%5v}5vKc^9)j*_%W5t17xP8z9=gJVOx zpw}QagkS)vh@n#kvN2Hx2%TGr0f`kBb|S&R#P{8M&-0Cwi7Q>-`_B2!?>*;USC+43 zQXe1xk(Yr^ZSTXi-P-*JB@s!<`A)69*4k>cYa845_DWI&E#IlV-&xymln|6c2OoRw zW~;s3+$qT=kV>7}dZ)g`lkoxv&?Z*8}DZzf>{LJdq^xxm# z`tFC+msh_T`gbM$Ahin?I3j7RuVOyN{1tP4dG7jMtfZgAT*Txco-~d@%=gUB{*X>S z>2*sozoZA4X>68n))uSF^DFb!>oQ$ks4mIM?CNy2x-=t)RoJ8t)IpmerVigGbgWD+ z&CRaJ;o3VtgIInVk5tic|f}oBBBF`9r@H z>-*~KcRD6im)e7zT6GC|*|6KBw`=cM*%hXeA3rw*6RSbWy;f{2J@@XR^Q88N=E z`mBy1!bftZ+?zV<=UEcRGvfMZ&g#GF`NMi4Pvd5N)}8%>yv5(l7UM}^IC^DC(^z~S zjph2V$@iKi}ZwRr%W#2jSpihLBPo4L`uP-`fNK$Q4L%n9x|7>DAu zA61TZRDv!JrRl17B6(WBtPjPbH4^Y4{s4J5jqPt>I~ zpt@AQwI@f;uBm~uB!0x@ z)sOeex8py*1ibQw9mdzMG}Xo4?Dfayrh8AQJfl#1o_yih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b?fe@GL_SlGg-2H+!+MUn!`nYJPXA0+i3C>l$95G9vriBUI2#FEMcZE$a9`l z_vo{B^Quer+uEL5yYW1!yz=PDJf&%BgS76tBkq<$LeBYXY@XU3^hcTB4&_t5YJ1o> z{m2aDY`-yIIU6HtP*D5KJ@M^y~=5B*zf1C!#$(<@B;imuk7yb zmVf#Adi-syU>A@FyDzVK)^7s;7wJ8RJM!o1c_k5N1~kmXz?Q{v_Yl@U@#B+u&pqng zlY2HDH)A@odenxATgtCv9GG9~Q@`jV>4o1fT?O6sisnIS$y_N-^`pmJFM81R%sg3t zsAJOF|Juf=eFY&$Q=Fcl)3$=#8*%r#d!fK z7lFHH%=)Z;>dD=sH0>GAqT-MfH;b$d?JFPSpS5~5hgzHYF8$5CD!&)dNBuwMzWGEl zc9(y(rTXE6^XIZJIoG2JJaec1tDN=gfA28%YQkphuhAWu{{+6Njm}ub{wLsf?#R-R R(|E?7N2&3FK}x@r{{ShzB3}Ri diff --git a/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin b/bgfx/shaders/dx9/chains/hlsl/fs_distortion.bin index 8ee4383d303ed0401edbe7233f91d72ef2e1e82c..b12b9d953cf34c5de77cc41c70f854170c97ab98 100644 GIT binary patch literal 2843 zcmb7FKWrOy6n=NM6UTP!#4sXZQIKenB1f%Iq)Iq#0~9F?G+06moYKTeEt)v^544Ek zXLW-Psl-yI3!^)*A$5T;BDGQnB!(^^d1#kPFqMVl``)|DIe>(Sa`x|i@Be$>@BGHv z#jJPZ_g{;W>jnMRwYn$bNp%ox3@*1fg3WfX-|6<-o!zRJg<@`yK*2_*yW8qky&T}u z5v-OOK*d4u(O`WO<~zNr=bKTtwRN?%Vc})~l?Oq$GuYic3N{6>G6;G*olgHsaJkdn zWQu8^GeAFC-wUo?uWE_2gP_0O-EQ^c44!59xV^pG>i65b+f^?QXsIBXDEc${OfI~8 z?)-Bi@-5tn74bz`Zi##Y>?vV9p7{LGzd3yS!p22jjIlF{vFj9jT`{(uVwV(S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K<6pKGjvctP=X$cmqetgjPaQam7! ze7u5d#EXW*kDP*gDz)F=Azm{4OY?IIyPwvGmw{ibJ-Pnm@uhXx$koY}uZdTHKl<}! z&E;w3+x4fFcTb5go1eAa-QBhCzuR0Z{CM%|OIV*Q9An##c!rxJ$yGueuzqfk7YVVA zM<0oJ_zQ5>CogfhsQet{Nw9E!jsva%ZVqgt5WZc^7uZ<<2O*tcJ0Le%pVd4j$$iEq&hPk|$i`5XTU-Fro)igoA6Rq3Te4{b* zU`)y`>Ry7LnDr(Htcgbg%Zq)8VPl-c4tM@PcC7LL>}GwF$DA48>WzX8$evWtzbKGg z6t0K|lX%Q|uosve>WITjV$GVZuY?{Yb3zZ5zaWc25jf-Wya2yAPwOtSe}^T=CAm3+ zHGw@JvL{w2d6UCDd=j%cxX2kfVy3P0KR8TFl!$ruTZ6O6VF`Yo8L zVGDY8O1Fr3v&I!}GnbwlrN5}!9LeDx&d#Tdo|e&vG)^2;P)`NE zp3}N5&b)pCeH^~3b75@jnSJ*P?tDCF%bf7*tT~pUD^Kk>Kk8;?9n8jA0+;vJIJ8fD zg8!-1-!ksFhdqNYoe{X0skr#hL-pvD-T}^!yTv<^`V(+$f0Fr{PVX`LISFm{loOtv wElxJ^ANN!NdjJ3c diff --git a/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin b/bgfx/shaders/gles/chains/hlsl/fs_distortion.bin index b3066b531703c8295e19fce1be8ce3781db0d47c..189ca2e97f5d44c666a1fe6fab992a7458848c03 100644 GIT binary patch literal 4939 zcmb7H+iu%N5S5Gep-yke7wjWtOSHJ6Zb+Snx(NE74msR-zDd6wJ+fL_sULGN@ zKCK=q17`oek-H^`N5Yyc6StdanlY zpxagCTGcx0RyB)XsU%LiWb&)Z*Sq}x=xL+p;^gMDVWxB}zsY?P4{i{H*IV)7*kuzQ z65O@fh?MP5()Aiz^^xG{OpQ@v0JAYG`v)-L*)`q*OebEj6LJ_?c>sDPy78f_u2uc! z=)DQ@2rN&@GFMB=r*3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fLU?SaKUw(iY0us^jnOW-q15Ir c8ZT9PD$L`1w@IDcnLXDuD%k5^FE2a)0n#ah;s5{u literal 5408 zcmb7IOK#&v5S4>u5hX~n$N_paAZaPA!#5#K>vc=35xJ%G}r+3 zT!e!m0h4y+O_k8pQZPjYo-#;R(w}{CA@t4>F3USdzfJQDHLsSS(crrQ3WmNfo?uJk zo}t-bFhmoK3M`!7M4EaQ>AFZ?rJ{+A3qiJpwlx7;#izW~wtb&Y_{tn!!|@WrRo4em z7MqDnz6FUl*~Sk>_V;pGq-7jX&BvH<7QrCG^7=?5 za;9oI9#jUM{tNbQZYTvfYF|=GniUU1Jj=U$O*vNW7nMu6Z`KW-d#!GV3Ju#LmmN>7 z(&9@^cnzN6^rApuaq503ZZd2PrG!Xkvg|Ez0Oqisn!wH_%vk38QIl=NMj&)z&?zEl zzu|J!XmQWznqUlI2%Msu5O4?Gv4*aC0i8CeDX-;6Q-y&-;6$~yQI~bTo7^2Kff^$X ze9+v0Y^daTqqAu^KygFotewu;DV?uzHqJBbY;CZ1wMJ)C-*eGjwWGT_MfVzK+vv2x zR%bg7yEv^?Z}s$)JuQP*de~`qq1!q`YMu7O2pGYE2KrCC4%IT7)T^qm92AD&EN(p9 z{AetrZfak@=X8pb{uws*Pk`Tt>R_H6gR0&wLC|hl@=^>Bn?3hQz-s0``9*d@Zjw$z z3`5lpbRCw*<5_RM-8U&-^2|1*<4n^YKJF+8xbAiNFvyvGv7}W$&IZd>ZrfX%h?Ra%m$8ErFsH@Jw8tBnU zJn#zi)gIUF5IU(3Ugno`bM~m>&I;&3$zP@*O<_^zl%jeFW1d5pyq9o&N#jjQDQ= diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin b/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin index b69a3712bb92dc46e4be79c79191bffe9fe05423..a4d54c9c932680cb6db3ac8a03be3fabf9c9b478 100644 GIT binary patch literal 4707 zcmb7H+j84B5LG(uL!I8g0FRU{(IRvo*LkQrn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$zVm0LSPN^lCd4Q^dDLs2huFFWw6eXIM)&h7`0hmiAj;2+h^ zUI&71!%-Juc-X4B%K=t9q^S?p$GF9L?MzDD%+&DL7zw0qENmxsY4GuaQ8r+ZMA*|= z7CS2WfZ9I{IrAxQN293~6(W6CS_#boOpj0&u)}MtAb^eJQ>`BfaV7yAwT<4`8sss2 zU8Kv(OgZ>+DTB*n4s}%-kD|$Vb~6Ahv)MG7On5MWOuQ12j3?6>wWKR}pVdN*b?{Sq z7e3@4L?B1=XdxGJAcEn-oi=355riYOy*?nAAad&(D`lGw^3UtK*S6~T!Fa&S%gSD9-xzOW89e>U#;;M#XK1(^lSbC*x+nJQV~q8YfSG{DtTX9>@59d4 ztg?;+(hT%+hUv*z7Ah_E)l>xH6#^=kx7Zj~>PepY_dQmYL>dILvL zPbi(Z5E(J;L0U)lf%-1)WB&yddoLhuX-IhnqtFlw61h^Po{BZ6=J4yIxzu`qfE`;r dnTm@KkT^1hz_G5c(|ArgrV$==>!*Id_df)5pJo66 diff --git a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin index 512262b52a78da8dd7b6ba5c7f2657c46c194ceb..22a66b575d2131530d71477d6bdf5d669e42d62d 100644 GIT binary patch literal 5260 zcmbVQOK;mo5O#r{eC`j}Q$Z#YO)jYy@;KB$&>n&wjGh96pe4!?Adw15B~lZg`b+y4 z`U^TUyR#39a?s}BNV_}l`M%lJySrb1{Nb;E{=T|;`swQG&~Bg# zzPfI^=CJI$kITAlR`ILrr(vPr4;@Q= zEVk=RJZ|%MP4ReJZ|mlw)F0JmT{k;xEE9*k{Zj1nV(fo2mqlb@XVwsSnj^XrtZLb@wrUfXwtnK5rhY zvg;t{zNT`$EtkqMNaPw4v@5G#{&gyKP2LxqN(2K1%6Hv1--r(%+OBvk^G$VsKN8Ej zg0FpzI?X=|k~x6P!(qKHn;;JF?;+BW5CTfv9hy?EUQ^ZIiWaL5NA(7s9f`Ks?YCt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V`wqR26io; zAi7A#v6I-g^4iQM!gHB7x2fV-VKE3>ZlStC5-6mEqS~sKA{YqmXsAvxAHgDHWQb%V zyDg8wbg2 zO=0=9J<{Squ&tm%>9KaDsbHJ$Y_}TR|=?6NQoV63SkjDR$1CE_m{aFrpaeO{h z_P&<_3%Y$~zOB1nkGyu% zYvf5h)X2f|u`M31;oY_k_xo*ITZtW752s+VomABi)suCH_F8k2Dn&d4GVu(~+}E_8 z%tgaAOxJ8@5-lX;TpO@0iR?E5#&JSxOGzpS4inGb=as;YpvuT`VfE*YSCuugFfi;9O zu2jWQs3BDYk9`d`_Vs5GB+)!xB#Q*5@$tf)l@b)Fgy{Lk8IjO<8jmtP9%Z4s4bLir zTL!v}*Ju&BkfHMk8MrWs79$0yR;8f3t&e%a?a>F5n}HUK@5c(iFBmR(pERQ5$RW4$ z6(rJ4N1MB-Wb|B+LZdF zw0xMju4@taEDH!Hy|O@P?2i+MM?V8QIhgvdmXuyC`syXzBcd6<+>cGD1YSrJ7&?av zVCq-Vl&UDOY7Q6m1dffFAjrca+om1|*#MQ|GFAY=Jy5NAJfyv8(`+3{ZlqMVYL#+g#&N(mJ9A z;18njcbe4eG^}Y%*$H#o7|R|(uM&2kouz)QPTg9qZF5@#DE#+VTbi0e)YI(LoO7?X l?hy+tR5)cnk+$x>@|}x#jQW35!pFs(%3k>X_x0l9$v 0 - ? CubicDistortionAmount * 1.1 // cubic distortion need to be a little higher to compensate the quartic distortion - : CubicDistortionAmount * 1.2; // negativ values even more + float cubicDistortionAmount = CubicDistortionAmount > 0.0f + ? CubicDistortionAmount * 1.1f // cubic distortion need to be a little higher to compensate the quartic distortion + : CubicDistortionAmount * 1.2f; // negativ values even more float2 TexelDims = 1.0f / TargetDims; diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp index c30139e17c4..156bc435f09 100644 --- a/src/osd/modules/render/bgfx/chainentry.cpp +++ b/src/osd/modules/render/bgfx/chainentry.cpp @@ -122,6 +122,20 @@ void bgfx_chain_entry::setup_sourcesize_uniform(render_primitive* prim) const } } +void bgfx_chain_entry::setup_targetsize_uniform(int32_t screen) const +{ + bgfx_uniform* target_dims = m_effect->uniform("u_target_dims"); + if (target_dims != nullptr) + { + bgfx_target* output = m_targets.target(screen, m_output); + if (output != nullptr) + { + float values[2] = { float(output->width()), float(output->height()) }; + target_dims->set(values, sizeof(float) * 2); + } + } +} + void bgfx_chain_entry::setup_rotationtype_uniform(uint32_t rotation_type) const { bgfx_uniform* rotation_type_uniform = m_effect->uniform("u_rotation_type"); @@ -166,6 +180,7 @@ void bgfx_chain_entry::setup_auto_uniforms(render_primitive* prim, texture_manag { setup_screensize_uniforms(textures, screen_width, screen_height, screen); setup_sourcesize_uniform(prim); + setup_targetsize_uniform(screen); setup_rotationtype_uniform(rotation_type); setup_swapxy_uniform(swap_xy); setup_quaddims_uniform(prim); diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h index eb102aaa059..e9e5112bf1b 100644 --- a/src/osd/modules/render/bgfx/chainentry.h +++ b/src/osd/modules/render/bgfx/chainentry.h @@ -47,6 +47,7 @@ private: void setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, int32_t screen); void setup_screensize_uniforms(texture_manager& textures, uint16_t screen_width, uint16_t screen_height, int32_t screen); void setup_sourcesize_uniform(render_primitive* prim) const; + void setup_targetsize_uniform(int32_t screen) const; void setup_rotationtype_uniform(uint32_t rotation_type) const; void setup_swapxy_uniform(bool swap_xy) const; void setup_quaddims_uniform(render_primitive* prim) const; diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc index 1547324f894..d7e1acf8494 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc @@ -11,12 +11,13 @@ $input v_color0, v_texcoord0 // Autos uniform vec4 u_swap_xy; uniform vec4 u_screen_dims; +uniform vec4 u_target_dims; uniform vec4 u_quad_dims; -uniform vec4 u_rotation_type; // User-supplied -uniform vec4 u_prepare_vector; -uniform vec4 u_curvature; +uniform vec4 u_distortion; +uniform vec4 u_cubic_distortion; +uniform vec4 u_distort_corner; uniform vec4 u_round_corner; uniform vec4 u_smooth_border; uniform vec4 u_vignetting; @@ -72,36 +73,15 @@ float GetVignetteFactor(vec2 coord, float amount) float GetSpotAddend(vec2 coord, float amount) { vec2 SpotCoord = coord; - - // hack for vector screen - if (u_prepare_vector.x > 0.0) - { - // upper right quadrant - vec2 spotOffset = vec2(-0.25, 0.25); // 0 degrees - if (u_rotation_type.x == 1.0) - spotOffset = vec2(-0.25, -0.25); // 90 degrees - if (u_rotation_type.x == 2.0) - spotOffset = vec2(0.25, -0.25); // 180 degrees - if (u_rotation_type.x == 3.0) - spotOffset = vec2(0.25, 0.25); // 270 degrees - - // normalized screen canvas ratio - vec2 CanvasRatio = ((u_swap_xy.x > 0.0) ? vec2(u_quad_dims.x / u_quad_dims.y, 1.0) : vec2(1.0, u_quad_dims.y / u_quad_dims.x)); - - SpotCoord += spotOffset; - SpotCoord *= CanvasRatio; - } - else - { - // upper right quadrant - vec2 spotOffset = vec2(-0.25, 0.25); - // normalized screen canvas ratio - vec2 CanvasRatio = ((u_swap_xy.x > 0.0) ? vec2(1.0, u_quad_dims.x / u_quad_dims.y) : vec2(1.0, u_quad_dims.y / u_quad_dims.x)); - - SpotCoord += spotOffset; - SpotCoord *= CanvasRatio; - } + // upper right quadrant + vec2 spotOffset = vec2(-0.25, 0.25); + + // normalized screen canvas ratio + vec2 CanvasRatio = ((u_swap_xy.x > 0.0) ? vec2(1.0, u_quad_dims.x / u_quad_dims.y) : vec2(1.0, u_quad_dims.y / u_quad_dims.x)); + + SpotCoord += spotOffset; + SpotCoord *= CanvasRatio; float SpotBlur = amount; @@ -122,7 +102,7 @@ float GetRoundCornerFactor(vec2 coord, float radiusAmount, float smoothAmount) // reduce smooth amount down to radius amount smoothAmount = min(smoothAmount, radiusAmount); - vec2 quadDims = (u_prepare_vector.x > 0.0 && u_swap_xy.x > 0.0) ? u_quad_dims.yx : u_quad_dims.xy; + vec2 quadDims = (u_swap_xy.x > 0.0) ? u_quad_dims.yx : u_quad_dims.xy; float range = min(quadDims.x, quadDims.y) * 0.5; float radius = range * max(radiusAmount, 0.0025); @@ -141,20 +121,20 @@ float GetRoundCornerFactor(vec2 coord, float radiusAmount, float smoothAmount) } // www.francois-tarlier.com/blog/cubic-lens-distortion-shader/ -vec2 GetDistortedCoords(vec2 centerCoord, float amount) +vec2 GetDistortedCoords(vec2 centerCoord, float amount, float amountCube) { // lens distortion coefficient float k = amount; // cubic distortion value - float kcube = amount * 2.0; + float kcube = amountCube; // compute cubic distortion factor float r2 = centerCoord.x * centerCoord.x + centerCoord.y * centerCoord.y; float f = kcube == 0.0 ? 1.0 + r2 * k : 1.0 + r2 * (k + kcube * sqrt(r2)); // fit screen bounds - f /= 1.0 + amount * 0.5; + f /= 1.0 + amount * 0.25 + amountCube * 0.125; // apply cubic distortion factor centerCoord *= f; @@ -162,13 +142,13 @@ vec2 GetDistortedCoords(vec2 centerCoord, float amount) return centerCoord; } -vec2 GetCoords(vec2 coord, float distortionAmount) +vec2 GetCoords(vec2 coord, float distortionAmount, float cubicDistortionAmount) { // center coordinates coord -= 0.5; // distort coordinates - coord = GetDistortedCoords(coord, distortionAmount); + coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount); // un-center coordinates coord += 0.5; @@ -180,24 +160,36 @@ vec2 GetCoords(vec2 coord, float distortionAmount) void main() { + float distortionAmount = u_distortion.x; + float cubicDistortionAmount = u_cubic_distortion.x > 0.0 + ? u_cubic_distortion.x * 1.1 // cubic distortion need to be a little higher to compensate the quartic distortion + : u_cubic_distortion.x * 1.2; // negativ values even more + + vec2 TexelDims = vec2(1.0 / u_target_dims.x, 1.0 / u_target_dims.y); + // Screen Curvature - vec2 BaseCoord = GetCoords(v_texcoord0, u_curvature.x * 0.25); // reduced amount + vec2 BaseCoord = GetCoords(v_texcoord0, distortionAmount, cubicDistortionAmount); + + // Corner Curvature + vec2 CornerCoord = GetCoords(v_texcoord0, u_distort_corner.x, 0.0); vec2 BaseCoordCentered = BaseCoord; BaseCoordCentered -= 0.5; + vec2 CornerCoordCentered = CornerCoord; + CornerCoordCentered -= 0.5; // Color vec4 BaseColor = texture2D(s_tex, BaseCoord); // Clamp - if (BaseCoord.x > 1.0 || BaseCoord.y > 1.0 || BaseCoord.x < 0.0 || BaseCoord.y < 0.0) + if (BaseCoord.x > 1.0 + TexelDims.x || BaseCoord.y > 1.0 + TexelDims.y || BaseCoord.x < 0.0 - TexelDims.x || BaseCoord.y < 0.0 - TexelDims.y) { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } else { // Vignetting Simulation - vec2 VignetteCoord = BaseCoordCentered; + vec2 VignetteCoord = CornerCoordCentered; float VignetteFactor = GetVignetteFactor(VignetteCoord, u_vignetting.x); BaseColor.rgb *= VignetteFactor; @@ -205,15 +197,15 @@ void main() // Light Reflection Simulation vec4 LightColor = vec4(1.0, 0.90, 0.80, 1.0); // color temperature 5.000 Kelvin - vec2 SpotCoord = BaseCoordCentered; - vec2 NoiseCoord = BaseCoordCentered; + vec2 SpotCoord = CornerCoordCentered; + vec2 NoiseCoord = CornerCoordCentered; float SpotAddend = GetSpotAddend(SpotCoord, u_reflection.x); float NoiseFactor = GetNoiseFactor(SpotAddend, rand(NoiseCoord)); BaseColor += SpotAddend * NoiseFactor * LightColor; // Round Corners Simulation - vec2 RoundCornerCoord = BaseCoordCentered; + vec2 RoundCornerCoord = CornerCoordCentered; float roundCornerFactor = GetRoundCornerFactor(RoundCornerCoord, u_round_corner.x, u_smooth_border.x); BaseColor.rgb *= roundCornerFactor;