mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
glass - update
This commit is contained in:
parent
d425ae89f2
commit
7ee946ee62
|
@ -47,13 +47,13 @@ layout(push_constant) uniform Push
|
||||||
License: Public domain
|
License: Public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma parameter g_csize "Corner Size" 0.0 0.0 0.07 0.01
|
#pragma parameter g_csize "Corner Size" 0.02 0.0 0.07 0.01
|
||||||
#pragma parameter g_bsize "Border Smoothness" 600.0 100.0 600.0 25.0
|
#pragma parameter g_bsize "Border Smoothness" 600.0 100.0 600.0 25.0
|
||||||
#pragma parameter g_flicker "Screen Flicker" 0.25 0.0 1.0 0.01
|
#pragma parameter g_flicker "Screen Flicker" 0.25 0.0 1.0 0.01
|
||||||
#pragma parameter g_shaker "Screen Shake" 0.02 0.0 0.5 0.01
|
#pragma parameter g_shaker "Screen Shake" 0.02 0.0 0.5 0.01
|
||||||
#pragma parameter g_refltog "Reflection Toggle" 1.0 0.0 1.0 1.00
|
#pragma parameter g_refltog "Reflection Toggle" 1.0 0.0 1.0 1.00
|
||||||
#pragma parameter g_reflgrain "Refl. Deband Grain" 0.0 0.0 2.0 0.01
|
#pragma parameter g_reflgrain "Refl. Deband Grain" 0.0 0.0 2.0 0.01
|
||||||
#pragma parameter g_reflstr "Refl. Brightness" 0.25 0.0 1.0 0.01
|
#pragma parameter g_reflstr "Refl. Brightness" 0.15 0.0 1.0 0.01
|
||||||
#pragma parameter g_fresnel "Refl. Fresnel" 1.0 0.0 1.0 0.10
|
#pragma parameter g_fresnel "Refl. Fresnel" 1.0 0.0 1.0 0.10
|
||||||
#pragma parameter g_reflblur "Refl. Blur" 0.6 0.0 1.0 0.10
|
#pragma parameter g_reflblur "Refl. Blur" 0.6 0.0 1.0 0.10
|
||||||
#pragma parameter gz "Zoom" 1.2 1.0 1.5 0.01
|
#pragma parameter gz "Zoom" 1.2 1.0 1.5 0.01
|
||||||
|
@ -71,10 +71,10 @@ layout(push_constant) uniform Push
|
||||||
|
|
||||||
// https://www.desmos.com/calculator/1nfq4uubnx
|
// https://www.desmos.com/calculator/1nfq4uubnx
|
||||||
// PER = 2.0 for realistic (1.0 or less when using scanlines). Phosphor Index; it's the same as in the "grade" shader
|
// PER = 2.0 for realistic (1.0 or less when using scanlines). Phosphor Index; it's the same as in the "grade" shader
|
||||||
#pragma parameter TO "Afterglow OFF/ON" 1.0 0.0 1.0 1.0
|
#pragma parameter TO "Afterglow OFF/ON" 1.0 0.0 1.0 1.0
|
||||||
#pragma parameter PH "AG Phosphor (1:NTSC-U 2:NTSC-J 3:PAL)" 2.0 0.0 3.0 1.0
|
#pragma parameter PH "AG Phosphor (0:RGB 1:NTSC-U 2:NTSC-J 3:PAL)" 2.0 0.0 3.0 1.0
|
||||||
#pragma parameter ASAT "Afterglow Saturation" 0.20 0.0 1.0 0.01
|
#pragma parameter ASAT "Afterglow Saturation" 0.20 0.0 1.0 0.01
|
||||||
#pragma parameter PER "Persistence (more is less)" 0.75 0.5 2.0 0.1
|
#pragma parameter PER "Persistence (more is less)" 0.75 0.5 2.0 0.1
|
||||||
|
|
||||||
|
|
||||||
#define SW params.TO
|
#define SW params.TO
|
||||||
|
@ -188,7 +188,7 @@ vec3 afterglow(float Pho, vec3 decay)
|
||||||
if (Pho == 3.0) { p_in = PAL; }
|
if (Pho == 3.0) { p_in = PAL; }
|
||||||
|
|
||||||
// Phosphor Response / Cone Response
|
// Phosphor Response / Cone Response
|
||||||
vec3 p_res = (p_in / (vec3(0.21264933049678802, 0.71516913175582890, 0.07218152284622192)) / 10.0);
|
vec3 p_res = (p_in / (vec3(0.21259990334510803, 0.71517896652221680, 0.07222118973731995)) / 10.0);
|
||||||
|
|
||||||
float decr = clamp((log(1. / p_res.r) + 0.2) / (decay.r), 0., 1.);
|
float decr = clamp((log(1. / p_res.r) + 0.2) / (decay.r), 0., 1.);
|
||||||
float decg = clamp((log(1. / p_res.g) + 0.2) / (decay.g), 0., 1.);
|
float decg = clamp((log(1. / p_res.g) + 0.2) / (decay.g), 0., 1.);
|
||||||
|
@ -263,12 +263,10 @@ void main()
|
||||||
|
|
||||||
glow = normalize(pow(glow + vec3(0.001), vec3(sat)))*length(glow);
|
glow = normalize(pow(glow + vec3(0.001), vec3(sat)))*length(glow);
|
||||||
|
|
||||||
vec3 glowl = pow(glow, vec3(2.2));
|
float glowY = dot(pow(glow, vec3(2.2)), vec3(0.21260, 0.71518, 0.07222));
|
||||||
vec3 colorl = pow(color, vec3(2.2));
|
float colorY = dot(pow(color, vec3(2.2)), vec3(0.21260, 0.71518, 0.07222));
|
||||||
float glowY = glowl.r * 0.21265 + glowl.g * 0.71517 + glowl.b * 0.07218;
|
|
||||||
float colorY = colorl.r * 0.21265 + colorl.g * 0.71517 + colorl.b * 0.07218;
|
|
||||||
|
|
||||||
vec3 colormax = (colorY > glowY) ? color : glow;
|
vec3 colormax = (colorY > glowY) ? color : glow;
|
||||||
|
|
||||||
color = (SW == 0.0) ? color : clamp(colormax,0.0,1.0);
|
color = (SW == 0.0) ? color : clamp(colormax,0.0,1.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue