diff options
| author | 2021-03-19 16:38:07 +0100 | |
|---|---|---|
| committer | 2021-03-20 02:38:07 +1100 | |
| commit | 931f85ee2709b8630c571c53be10e280fd4ed3bb (patch) | |
| tree | 90a3df91f3720265678d780b99058ce6fcac006a /bgfx | |
| parent | f15e301557c99f7e763dd933c0d47fa349bbd229 (diff) | |
bgfx: crt-geom and crt-geom-deluxe enhancements (#7872)
* Made spot size parameters adjustable also increased samples from 2 to 3 scanlines for crt-geom-deluxe.
* Made horizontal interpolation adjustable.
* bgfx crt-geom-deluxe: Made phosphor decay smoothly to zero at specified cutoff time.
* bgfx crt-geom-deluxe: Added lowpass filter.
Diffstat (limited to 'bgfx')
31 files changed, 174 insertions, 13 deletions
diff --git a/bgfx/chains/crt-geom-deluxe.json b/bgfx/chains/crt-geom-deluxe.json index 0eabc4ac399..9c9dd18505b 100644 --- a/bgfx/chains/crt-geom-deluxe.json +++ b/bgfx/chains/crt-geom-deluxe.json @@ -21,6 +21,61 @@ "format": "%1.2f", "screen": "raster" }, { "type": "float", + "name": "spot_size", + "text": "Spot size minimum", + "default": 0.3, + "max" : 0.5, + "min" : 0.1, + "step" : 0.01, + "format": "%1.2f", + "screen": "raster" }, + { "type": "float", + "name": "spot_growth", + "text": "Spot size dilation", + "default": 0.1, + "max" : 0.4, + "min" : 0.0, + "step" : 0.01, + "format": "%1.2f", + "screen": "raster" }, + { "type": "float", + "name": "spot_growth_power", + "text": "Spot dilation onset power", + "default": 3.0, + "max" : 4.0, + "min" : 0.2, + "step" : 0.1, + "format": "%1.1f", + "screen": "raster" }, + { "type": "float", + "name": "lowpass_cutoff", + "text": "Lowpass cutoff pixels/scanline", + "default": 200.0, + "max" :1000.0, + "min" : 100.0, + "step" : 10.0, + "format": "%1.0f", + "screen": "raster" }, + { "type": "float", + "name": "lowpass_width", + "text": "Lowpass width", + "default": 80.0, + "max" : 300.0, + "min" : 0.0, + "step" : 10.0, + "format": "%1.0f", + "screen": "raster" }, + { "type": "intenum", + "name": "x_interpolation", + "text": "Horizontal interpolation", + "default": 2, + "max" : 5, + "min" : 0, + "step" : 1, + "format": "%s", + "strings": [ "box", "linear", "Lanczos", "Catmull-Rom", "Mitchell-Netravali", "B-spline" ], + "screen": "raster" }, + { "type": "float", "name": "phosphor_power", "text": "Phosphor decay power", "default": 1.2, @@ -30,6 +85,15 @@ "format": "%1.2f", "screen": "raster" }, { "type": "float", + "name": "phosphor_cutoff", + "text": "Phosphor decay cutoff frames", + "default": 300.0, + "max" : 1000.0, + "min" : 10.0, + "step" : 10.0, + "format": "%1.0f", + "screen": "raster" }, + { "type": "float", "name": "phosphor_amplitude", "text": "Phosphor persistence amplitude", "default": 0.04, @@ -184,19 +248,16 @@ ], "passes": [ { - "effect": "crt-geom/phosphor_apply", - "applytint": true, - "name": "phosphor apply", + "effect": "crt-geom/lowpass", + "name": "lowpass", "uniforms": [ - { "uniform": "u_phosphor_power", "slider": "phosphor_power" }, - { "uniform": "u_phosphor_amplitude","slider": "phosphor_amplitude" }, - { "uniform": "u_gamma", "slider": "CRTgamma" } + { "uniform": "u_lowpass_cutoff", "slider": "lowpass_cutoff" }, + { "uniform": "u_lowpass_width", "slider": "lowpass_width" } ], "input": [ - { "sampler": "s_screen", "target": "screen" }, - { "sampler": "s_phosphor", "target": "phosphor" } + { "sampler": "s_screen", "target": "screen" } ], - "output": "internal1" + "output": "internal2" }, { "effect": "crt-geom/mipmap8", @@ -205,21 +266,38 @@ { "uniform": "u_smooth", "slider": "rasterbloom_smooth" } ], "input": [ - { "sampler": "s_screen", "target": "internal1" }, + { "sampler": "s_screen", "target": "internal2" }, { "sampler": "s_mipmap", "target": "mipmap" } ], "output": "mipmap" }, { + "effect": "crt-geom/phosphor_apply", + "applytint": true, + "name": "phosphor apply", + "uniforms": [ + { "uniform": "u_phosphor_power", "slider": "phosphor_power" }, + { "uniform": "u_phosphor_amplitude","slider": "phosphor_amplitude" }, + { "uniform": "u_phosphor_cutoff", "slider": "phosphor_cutoff" }, + { "uniform": "u_gamma", "slider": "CRTgamma" } + ], + "input": [ + { "sampler": "s_screen", "target": "internal2" }, + { "sampler": "s_phosphor", "target": "phosphor" } + ], + "output": "internal1" + }, + { "effect": "crt-geom/phosphor_update", "name": "phosphor update", "uniforms": [ { "uniform": "u_phosphor_power", "slider": "phosphor_power" }, { "uniform": "u_phosphor_amplitude","slider": "phosphor_amplitude" }, + { "uniform": "u_phosphor_cutoff", "slider": "phosphor_cutoff" }, { "uniform": "u_gamma", "slider": "CRTgamma" } ], "input": [ - { "sampler": "s_screen", "target": "screen" }, + { "sampler": "s_screen", "target": "internal2" }, { "sampler": "s_phosphor", "target": "phosphor" } ], "output": "phosphor" @@ -266,6 +344,10 @@ { "uniform": "monitorgamma","slider": "monitorgamma" }, { "uniform": "aperture_strength","slider": "aperture_strength" }, { "uniform": "aperture_brightboost","slider": "aperture_brightboost" }, + { "uniform": "spot_size", "slider": "spot_size" }, + { "uniform": "spot_growth", "slider": "spot_growth" }, + { "uniform": "spot_growth_power", "slider": "spot_growth_power" }, + { "uniform": "u_interp", "slider": "x_interpolation" }, { "uniform": "halation", "slider": "halation" }, { "uniform": "blurwidth", "slider": "blurwidth" }, { "uniform": "rasterbloom", "slider": "rasterbloom" } diff --git a/bgfx/chains/crt-geom.json b/bgfx/chains/crt-geom.json index c8d852e1b9a..fae003f5c9c 100644 --- a/bgfx/chains/crt-geom.json +++ b/bgfx/chains/crt-geom.json @@ -21,6 +21,43 @@ "format": "%1.2f", "screen": "raster" }, { "type": "float", + "name": "spot_size", + "text": "Spot size minimum", + "default": 0.3, + "max" : 0.5, + "min" : 0.1, + "step" : 0.01, + "format": "%1.2f", + "screen": "raster" }, + { "type": "float", + "name": "spot_growth", + "text": "Spot size dilation", + "default": 0.1, + "max" : 0.4, + "min" : 0.0, + "step" : 0.01, + "format": "%1.2f", + "screen": "raster" }, + { "type": "float", + "name": "spot_growth_power", + "text": "Spot dilation onset power", + "default": 3.0, + "max" : 4.0, + "min" : 0.2, + "step" : 0.1, + "format": "%1.1f", + "screen": "raster" }, + { "type": "intenum", + "name": "x_interpolation", + "text": "Horizontal interpolation", + "default": 2, + "max" : 5, + "min" : 0, + "step" : 1, + "format": "%s", + "strings": [ "box", "linear", "Lanczos", "Catmull-Rom", "Mitchell-Netravali", "B-spline" ], + "screen": "raster" }, + { "type": "float", "name": "curvature", "text": "Enable curvature", "default": 1.0, @@ -130,7 +167,11 @@ { "uniform": "CRTgamma", "slider": "CRTgamma" }, { "uniform": "monitorgamma","slider": "monitorgamma" }, { "uniform": "aperture_strength", "slider": "aperture_strength" }, - { "uniform": "aperture_brightboost","slider": "aperture_brightboost" } + { "uniform": "aperture_brightboost","slider": "aperture_brightboost" }, + { "uniform": "spot_size", "slider": "spot_size" }, + { "uniform": "spot_growth", "slider": "spot_growth" }, + { "uniform": "spot_growth_power", "slider": "spot_growth_power" }, + { "uniform": "u_interp", "slider": "x_interpolation" } ], "input": [ { "sampler": "mpass_texture", "target": "screen" }, diff --git a/bgfx/effects/crt-geom/crt-geom-deluxe.json b/bgfx/effects/crt-geom/crt-geom-deluxe.json index c561db7a9c5..10f87874a4d 100644 --- a/bgfx/effects/crt-geom/crt-geom-deluxe.json +++ b/bgfx/effects/crt-geom/crt-geom-deluxe.json @@ -40,6 +40,10 @@ { "name": "cornersmooth", "type": "vec4", "values": [ 1000.0,0.0,0.0,0.0 ] }, { "name": "aperture_strength", "type": "vec4", "values": [ 0.25,0.0,0.0,0.0 ] }, { "name": "aperture_brightboost","type": "vec4", "values": [ 0.25,0.0,0.0,0.0 ] }, + { "name": "spot_size", "type": "vec4", "values": [ 0.3,0.0,0.0,0.0 ] }, + { "name": "spot_growth","type": "vec4", "values": [ 0.1,0.0,0.0,0.0 ] }, + { "name": "spot_growth_power", "type": "vec4", "values": [ 3.0,0.0,0.0,0.0 ] }, + { "name": "u_interp", "type": "vec4", "values": [ 2.0,0.0,0.0,0.0 ] }, { "name": "halation", "type": "vec4", "values": [ 0.1,0.0,0.0,0.0 ] }, { "name": "blurwidth", "type": "vec4", "values": [ 2.0,0.0,0.0,0.0 ] }, { "name": "rasterbloom","type": "vec4", "values": [ 0.01,0.0,0.0,0.0 ] } diff --git a/bgfx/effects/crt-geom/crt-geom.json b/bgfx/effects/crt-geom/crt-geom.json index 12624942fe7..5b2e1b6730e 100644 --- a/bgfx/effects/crt-geom/crt-geom.json +++ b/bgfx/effects/crt-geom/crt-geom.json @@ -37,6 +37,10 @@ { "name": "cornersize", "type": "vec4", "values": [ 0.01,0.0, 0.0, 0.0 ] }, { "name": "cornersmooth", "type": "vec4", "values": [ 1000.0,0.0,0.0,0.0 ] }, { "name": "aperture_strength", "type": "vec4", "values": [ 0.25,0.0,0.0,0.0 ] }, - { "name": "aperture_brightboost","type": "vec4", "values": [ 0.25,0.0,0.0,0.0 ] } + { "name": "aperture_brightboost","type": "vec4", "values": [ 0.25,0.0,0.0,0.0 ] }, + { "name": "spot_size", "type": "vec4", "values": [ 0.3,0.0,0.0,0.0 ] }, + { "name": "spot_growth","type": "vec4", "values": [ 0.1,0.0,0.0,0.0 ] }, + { "name": "spot_growth_power", "type": "vec4", "values": [ 3.0,0.0,0.0,0.0 ] }, + { "name": "u_interp", "type": "vec4", "values": [ 2.0,0.0,0.0,0.0 ] } ] } diff --git a/bgfx/effects/crt-geom/lowpass.json b/bgfx/effects/crt-geom/lowpass.json new file mode 100644 index 00000000000..7115e2112be --- /dev/null +++ b/bgfx/effects/crt-geom/lowpass.json @@ -0,0 +1,28 @@ +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/crt-geom/vs_lowpass", + "fragment": "chains/crt-geom/fs_lowpass", + "uniforms": [ + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "u_lowpass_cutoff","type": "vec4", "values": [ 200.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_lowpass_width", "type": "vec4", "values": [ 80.0, 0.0, 0.0, 0.0 ] }, + { "name": "s_screen", "type": "int", "values": [ 0 ] } + ] +} diff --git a/bgfx/effects/crt-geom/phosphor_apply.json b/bgfx/effects/crt-geom/phosphor_apply.json index 6b073d53a44..dc6dfcb34b5 100644 --- a/bgfx/effects/crt-geom/phosphor_apply.json +++ b/bgfx/effects/crt-geom/phosphor_apply.json @@ -24,6 +24,7 @@ { "name": "s_phosphor", "type": "int", "values": [ 1 ] }, { "name": "u_phosphor_power", "type": "vec4", "values": [ 1.3, 0.0, 0.0, 0.0 ] }, { "name": "u_phosphor_amplitude","type": "vec4", "values": [ 0.2, 0.0, 0.0, 0.0 ] }, + { "name": "u_phosphor_cutoff", "type": "vec4", "values": [300.0,0.0, 0.0, 0.0 ] }, { "name": "u_gamma", "type": "vec4", "values": [ 2.2, 0.0, 0.0, 0.0 ] } ] } diff --git a/bgfx/effects/crt-geom/phosphor_update.json b/bgfx/effects/crt-geom/phosphor_update.json index 8895fef7656..50cde93b69a 100644 --- a/bgfx/effects/crt-geom/phosphor_update.json +++ b/bgfx/effects/crt-geom/phosphor_update.json @@ -24,6 +24,7 @@ { "name": "s_phosphor", "type": "int", "values": [ 1 ] }, { "name": "u_phosphor_power", "type": "vec4", "values": [ 1.3, 0.0, 0.0, 0.0 ] }, { "name": "u_phosphor_amplitude","type": "vec4", "values": [ 0.2, 0.0, 0.0, 0.0 ] }, + { "name": "u_phosphor_cutoff", "type": "vec4", "values": [300.0,0.0, 0.0, 0.0 ] }, { "name": "u_gamma", "type": "vec4", "values": [ 2.2, 0.0, 0.0, 0.0 ] } ] } diff --git a/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex f014a53a5d7..49973286faa 100644 --- a/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin Binary files differindex 48f65710391..0c866f28963 100644 --- a/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/fs_lowpass.bin b/bgfx/shaders/essl/chains/crt-geom/fs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..e390298a362 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/fs_lowpass.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex 3630cfaaa7b..381479e4b9a 100644 --- a/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 78cef4dfa16..b7809db5436 100644 --- a/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/vs_lowpass.bin b/bgfx/shaders/essl/chains/crt-geom/vs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..a29c3521088 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/vs_lowpass.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex 0f7b8478413..d24da626966 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin Binary files differindex b10938c0365..9176a6fd8c4 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_lowpass.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..ca184aef7dc --- /dev/null +++ b/bgfx/shaders/glsl/chains/crt-geom/fs_lowpass.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex 8feb7c80209..1877cf0c63f 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 8a48edead09..2caaa822395 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_lowpass.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..88ebb214e32 --- /dev/null +++ b/bgfx/shaders/glsl/chains/crt-geom/vs_lowpass.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex caf03a5cb5b..0817f98f581 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin Binary files differindex b915543f27b..698f6fc1961 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_lowpass.bin b/bgfx/shaders/metal/chains/crt-geom/fs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..40b8ff0bc04 --- /dev/null +++ b/bgfx/shaders/metal/chains/crt-geom/fs_lowpass.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex 3f4453b1490..57f35520720 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 73e77aba016..28f86d01a15 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_lowpass.bin b/bgfx/shaders/metal/chains/crt-geom/vs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..7f16cc81cbc --- /dev/null +++ b/bgfx/shaders/metal/chains/crt-geom/vs_lowpass.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex 11396bc2297..fda6f08f24a 100644 --- a/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom.bin Binary files differindex 56c3783cf70..d94eef4c1c1 100644 --- a/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/spirv/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/fs_lowpass.bin b/bgfx/shaders/spirv/chains/crt-geom/fs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..4f8f994820d --- /dev/null +++ b/bgfx/shaders/spirv/chains/crt-geom/fs_lowpass.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex ac7b3373b36..2520a4347a7 100644 --- a/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 20771f50017..cafea940d70 100644 --- a/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/spirv/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/spirv/chains/crt-geom/vs_lowpass.bin b/bgfx/shaders/spirv/chains/crt-geom/vs_lowpass.bin Binary files differnew file mode 100644 index 00000000000..318f409621b --- /dev/null +++ b/bgfx/shaders/spirv/chains/crt-geom/vs_lowpass.bin |
