From 1a9560f064e73022eec7aec481dcc233773eac8e Mon Sep 17 00:00:00 2001 From: cgwg Date: Sun, 12 May 2019 22:53:37 +0200 Subject: [PATCH] Modified crt-geom-deluxe to track the power-law fall-off for longer (up to 1024 frames). Ensured that the intensity falls to zero afterward. Note that this is currently only compiled for GLSL. --- .../chains/crt-geom/fs_crt-geom-deluxe.bin | Bin 7140 -> 7142 bytes .../glsl/chains/crt-geom/fs_crt-geom.bin | Bin 6830 -> 6832 bytes .../glsl/chains/crt-geom/fs_gaussx.bin | Bin 1993 -> 1997 bytes .../glsl/chains/crt-geom/fs_gaussy.bin | Bin 1993 -> 1997 bytes .../chains/crt-geom/fs_phosphor_apply.bin | Bin 671 -> 741 bytes .../chains/crt-geom/fs_phosphor_update.bin | Bin 946 -> 1394 bytes .../glsl/chains/crt-geom/vs_crt-geom.bin | Bin 4707 -> 4706 bytes .../glsl/chains/crt-geom/vs_gaussx.bin | Bin 624 -> 628 bytes .../glsl/chains/crt-geom/vs_gaussy.bin | Bin 624 -> 628 bytes .../chains/crt-geom/vs_phosphor_apply.bin | Bin 304 -> 308 bytes .../chains/crt-geom/vs_phosphor_update.bin | Bin 304 -> 308 bytes .../chains/crt-geom/fs_phosphor_apply.sc | 5 ++++- .../chains/crt-geom/fs_phosphor_update.sc | 13 ++++++++++--- 13 files changed, 14 insertions(+), 4 deletions(-) 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 index 55dde80cc293f2ba02093a11ac100c43a8bf09de..c2beaf0a0bb0704e4dfc34712f7988ba65d435ad 100644 GIT binary patch delta 38 tcmaE2{>+@mE!cz2wD@s20}yQFkY;4uwONJn49Dh=oRTb?x%qDL0s!p+3&sEd delta 34 qcmaE6{=}TaE!czAwD@uOMjmNK#yy)g7|(EQ{>&-GvYChP7B2wV0t?Up diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin index cce09f22ca31dd1faa89f33fb2eeda79777d5e0b..d9bc7650ad06c7a6e2591f9cb771d784421ca60d 100644 GIT binary patch delta 37 rcmZ2yy1|skE!cz2wD@s20}xE)_{q3zGZSMD$L4%aPL|D;yr#SW*gOif delta 33 pcmdmBy3UltE!czAwD@uOM4q3FD>kz+=5TB-y_P~jez}5%hK7-;sh)v?mO@ExL0Mu^ zyrEvXrh>MD2A2XDq!lG5mjG44WvhTn!CEvG^c76>3^X+%Dzy|04UE8i9R*#D()fam f{9+(3iU(SgTBKK@304Rsbri}{lZ_{5F_{7Y`Y9DXA7@4)=e3gGnu9<>y?E+yNuUAMTvje9DLZE58}1h zrSi4zd%ua7Nl_%t+o!jdwN2zcTPgTTK=!2gpVFbD!9AjD-3d1nfO+ z$=Lxr^#p~l;4_C}1I07f;p**ju~6}5iw+}zJJs!}Zg|r8C-e|yIm}T5M@aKBy)3sv ze55q(4@U5X48z81+6X!-NHY=Rp(qdTFjr07!m}=OWTHmSF`TenBi8XE?gn8rsMdQd z8_^h)5BdXO0EBEDHavE(dfd3IEJoj(575ILcYIoD&p>mJzS0O&)lI65^-v?!qN37@ zY!v@34k{0L-Rf*$jQTsC90~LeVUr%*?1h~oZ89;Fh(5i5p>wGq|LKo*Ku2Pk$B!~u P-iutw&IJs|(YCEWE?A2c literal 946 zcmb7BO;5r=5UpR)^yJC&9Jfl=eu9MP1w*`hx2dpTP1|j@1*(J}roYbFEeoY^F=^B8 z%)U48y&1i}TzuaA{+t_EMOcglW0`Sc;A0kH{=o};MP0a_Zwq10mrR_hdzbTY7Nu!a zpWe<4V-bn3IGe$Oja^uTC98&XoXWvAiBYU8~I z-fQEvlLLlY(q^pRpzx7m!b>0+H4v?fR$t#83_v-gRaIHY$i^PAsoU>&z^1`NPktQ7 zx0J+P~EGgKLsl7c| vPZI5*D#X?WDN9?zL@=y|NVS%&hlU6>W-X~^NjMVGY{(NXc9SrzwP_lEK@cCD diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_crt-geom.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_crt-geom.bin index 0dc6e0f3bba27408c0869b65d50b3e1bf50715e7..828ca49984845d4219f556684e2c31d2a2a0d725 100644 GIT binary patch delta 47 zcmaE?@<@dvEZBpM0SG3t1Tivi41dPH*^VQbaq}Wh2gc2hxfGZ;v+&t6Zg%2VWCj33 C5)9V> delta 43 zcmaE)@>qo>EZBo}B1aG-$HwSq?3*1pQW!Tc=5%D-{FqCTc{4Mg9ph#PekEoAI28=! diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_gaussx.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_gaussx.bin index 362d112289e783b04a9e69442f0d255b79a62344..38b61d754ac9717fd6ce7e0509363a0c81c9ac8f 100644 GIT binary patch delta 17 Xcmeys@`Z&XEZBpM0SGp-4YNdN!< diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_update.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_update.bin index e37754bcb08cd0386fc59c57241e836ede55ef16..7e83a3fefbb45d6e3ee113a7478b556b17d5a38b 100644 GIT binary patch delta 17 XcmdnMw1tTyEZBpM0SGp-=r95RB)J1h delta 13 UcmdnOw1J5wEZBo}BZm$n02>4YNdN!< diff --git a/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_apply.sc b/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_apply.sc index e70036084ff..7244bef7f55 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_apply.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_apply.sc @@ -17,7 +17,10 @@ void main() vec3 cscrn = pow(screen.rgb, vec3_splat(u_gamma.x)); vec3 cphos = pow(phosphor.rgb, vec3_splat(u_gamma.x)); - cphos *= vec3_splat( u_phosphor_amplitude.x / pow(255.0*phosphor.a,u_phosphor_power.x) ); + // encode the upper 2 bits of the time elapsed in the lower 2 bits of b + float t = 255.0*phosphor.a + fract(phosphor.b*255.0/4.0)*1024.0; + + cphos *= vec3_splat( u_phosphor_amplitude.x * pow(t,-u_phosphor_power.x) ); vec3 col = pow(cscrn + cphos, vec3_splat(1.0/u_gamma.x)); diff --git a/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_update.sc b/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_update.sc index 5215054b0db..9057fbdbf83 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_update.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/crt-geom/fs_phosphor_update.sc @@ -17,8 +17,15 @@ void main() vec3 lum = vec3(0.299,0.587,0.114); float bscrn = dot(pow(screen.rgb,vec3_splat(u_gamma.x)),lum); float bphos = dot(pow(phosphor.rgb,vec3_splat(u_gamma.x)),lum); - //bscrn /= pow(1.0,u_phosphor_power.x); - bphos /= pow(1.0+255.0*phosphor.a,u_phosphor_power.x); - gl_FragColor = ( bscrn > bphos ? vec4(screen.rgb,1.0/255.0) : vec4(phosphor.rgb,phosphor.a+1.0/255.0) ); + // encode the upper 2 bits of the time elapsed in the lower 2 bits of b + float t = 1.0 + 255.0*phosphor.a + fract(phosphor.b*255.0/4.0)*1024.0; + + bphos = ( t > 1023.0 ? 0.0 : bphos*pow(t,-u_phosphor_power.x) ); + + gl_FragColor = ( bscrn >= bphos ? + vec4(screen.rg,floor(screen.b*255.0/4.0)*4.0/255.0,1.0/255.0) + : vec4(phosphor.rg, + (floor(phosphor.b*255.0/4.0)*4.0 + floor(t/256.0))/255.0, + fract(t/256.0)*256.0/255.0 ) ); }