Compare commits

..

No commits in common. "c69340f7b9f7df41b4991e8c5a10424315e278d6" and "a596d199c20afc8c30a49d3047a9cd8ae8f3b258" have entirely different histories.

2 changed files with 56 additions and 55 deletions

View File

@ -3,23 +3,23 @@ Shader "Filter/crt-easymode"
{
Properties
{
BRIGHT_BOOST("BRIGHT_BOOST", Float) = 1.2
DILATION("DILATION", Float) = 1.0
GAMMA_INPUT("GAMMA_INPUT", Float) = 2.0
GAMMA_OUTPUT("GAMMA_OUTPUT", Float) = 1.8
MASK_SIZE("MASK_SIZE", Float) = 1.0
MASK_STAGGER("MASK_STAGGER", Float) = 0.0
MASK_STRENGTH("MASK_STRENGTH", Float) = 0.3
MASK_DOT_HEIGHT("MASK_DOT_HEIGHT", Float) = 1.0
MASK_DOT_WIDTH("MASK_DOT_WIDTH", Float) = 1.0
SCANLINE_CUTOFF("SCANLINE_CUTOFF", Float) = 400.0
SCANLINE_BEAM_WIDTH_MAX("SCANLINE_BEAM_WIDTH_MAX", Float) = 1.5
SCANLINE_BEAM_WIDTH_MIN("SCANLINE_BEAM_WIDTH_MIN", Float) = 1.5
SCANLINE_BRIGHT_MAX("SCANLINE_BRIGHT_MAX", Float) = 0.65
SCANLINE_BRIGHT_MIN("SCANLINE_BRIGHT_MIN", Float) = 0.35
SCANLINE_STRENGTH("SCANLINE_STRENGTH", Float) = 1.0
SHARPNESS_H("SHARPNESS_H", Float) = 0.5
SHARPNESS_V("SHARPNESS_V", Float) = 1.0
BRIGHT_BOOST("BRIGHT_BOOST",Float) = 1.2
DILATION("DILATION",Float) = 1.0
GAMMA_INPUT("GAMMA_INPUT",Float) = 2.0
GAMMA_OUTPUT("GAMMA_OUTPUT",Float) = 1.8
MASK_SIZE("MASK_SIZE",Float) = 1.0
MASK_STAGGER("MASK_STAGGER",Float) = 0.0
MASK_STRENGTH("MASK_STRENGTH",Float) = 0.3
MASK_DOT_HEIGHT("MASK_DOT_HEIGHT",Float) = 1.0
MASK_DOT_WIDTH("MASK_DOT_WIDTH",Float) = 1.0
SCANLINE_CUTOFF("SCANLINE_CUTOFF",Float) = 400.0
SCANLINE_BEAM_WIDTH_MAX("SCANLINE_BEAM_WIDTH_MAX",Float) = 1.5
SCANLINE_BEAM_WIDTH_MIN("SCANLINE_BEAM_WIDTH_MIN",Float) = 1.5
SCANLINE_BRIGHT_MAX("SCANLINE_BRIGHT_MAX",Float) = 0.65
SCANLINE_BRIGHT_MIN("SCANLINE_BRIGHT_MIN",Float) = 0.35
SCANLINE_STRENGTH("SCANLINE_STRENGTH",Float) = 1.0
SHARPNESS_H("SHARPNESS_H",Float) = 0.5
SHARPNESS_V("SHARPNESS_V",Float) = 1.0
}
SubShader
{
@ -60,7 +60,8 @@ Shader "Filter/crt-easymode"
vec4 dilate(vec4 col)
{
vec4 x = mix(vec4(1.0, 1.0, 1.0, 1.0), col, DILATION);
vec4 x = mix(vec4(1.0,1.0,1.0,1.0), col, DILATION);
return col * x;
}
@ -68,8 +69,8 @@ Shader "Filter/crt-easymode"
{
/*
apply half - circle s - curve to distance for sharper (more pixelated) interpolation
single line formula for Graph Toy :
apply half-circle s-curve to distance for sharper (more pixelated) interpolation
single line formula for Graph Toy:
0.5 - sqrt(0.25 - (x - step(0.5, x)) * (x - step(0.5, x))) * sign(0.5 - x)
*/
@ -81,13 +82,12 @@ Shader "Filter/crt-easymode"
mat4x4 get_color_matrix(vec2 co, vec2 dx)
{
return mat4x4(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx), TEX2D(co + 2.0 * dx));
}
vec3 filter_lanczos(vec4 coeffs, mat4x4 color_matrix)
{
vec4 col = mul(color_matrix, coeffs);
vec4 col = mul(color_matrix,coeffs);
vec4 sample_min = min(color_matrix[1], color_matrix[2]);
vec4 sample_max = max(color_matrix[1], color_matrix[2]);
@ -125,7 +125,7 @@ Shader "Filter/crt-easymode"
#endif
col = mix(col, col2, curve_distance(dist.y, SHARPNESS_V));
col = pow(col, vec3(GAMMA_INPUT / (DILATION + 1.0), GAMMA_INPUT / (DILATION + 1.0), GAMMA_INPUT / (DILATION + 1.0)));
col = pow(col, vec3(GAMMA_INPUT / (DILATION + 1.0),GAMMA_INPUT / (DILATION + 1.0),GAMMA_INPUT / (DILATION + 1.0)));
float luma = dot(vec3(0.2126, 0.7152, 0.0722), col);
float bright = (max(col.r, max(col.g, col.b)) + luma) * 0.5;
@ -146,12 +146,12 @@ Shader "Filter/crt-easymode"
scan_weight = 1.0;
col2 = col.rgb;
col *= vec3(scan_weight, scan_weight, scan_weight);
col *= vec3(scan_weight,scan_weight,scan_weight);
col = mix(col, col2, scan_bright);
col *= mask_weight;
col = pow(col, vec3(1.0 / GAMMA_OUTPUT, 1.0 / GAMMA_OUTPUT, 1.0 / GAMMA_OUTPUT));
col = pow(col, vec3(1.0 / GAMMA_OUTPUT,1.0 / GAMMA_OUTPUT,1.0 / GAMMA_OUTPUT));
col = col * BRIGHT_BOOST;
col = col* BRIGHT_BOOST;
vec4 FragColor = vec4(col, 1.0);
@ -161,3 +161,6 @@ Shader "Filter/crt-easymode"
}
}
}

View File

@ -9,9 +9,8 @@
"com.unity.ext.nunit": {
"version": "2.0.5",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.cn"
"source": "builtin",
"dependencies": {}
},
"com.unity.ide.visualstudio": {
"version": "2.0.22",
@ -20,7 +19,7 @@
"dependencies": {
"com.unity.test-framework": "1.1.9"
},
"url": "https://packages.unity.cn"
"url": "https://packages.unity.com"
},
"com.unity.inputsystem": {
"version": "1.11.2",
@ -29,14 +28,14 @@
"dependencies": {
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages.unity.cn"
"url": "https://packages.unity.com"
},
"com.unity.sysroot": {
"version": "2.0.10",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.cn"
"url": "https://packages.unity.com"
},
"com.unity.sysroot.linux-x86_64": {
"version": "2.0.9",
@ -45,18 +44,17 @@
"dependencies": {
"com.unity.sysroot": "2.0.10"
},
"url": "https://packages.unity.cn"
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.4.5",
"version": "1.5.1",
"depth": 0,
"source": "registry",
"source": "builtin",
"dependencies": {
"com.unity.ext.nunit": "2.0.3",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.cn"
}
},
"com.unity.toolchain.win-x86_64-linux-x86_64": {
"version": "2.0.10",
@ -66,7 +64,7 @@
"com.unity.sysroot": "2.0.10",
"com.unity.sysroot.linux-x86_64": "2.0.9"
},
"url": "https://packages.unity.cn"
"url": "https://packages.unity.com"
},
"com.unity.ugui": {
"version": "2.0.0",