mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
- [Pixel Expand] Fix scan artifact.
This commit is contained in:
parent
9712d785ae
commit
b2953cfb7c
14 changed files with 316 additions and 88 deletions
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 18:54:03
|
||||
// 2024-04-27 16:12:22
|
||||
function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constructor { #region
|
||||
name = _name;
|
||||
spr = _spr;
|
||||
|
@ -566,6 +566,7 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Shape Blur", s_node_shape_blur, "Node_Blur_Shape", [1, Node_Blur_Shape]).setVersion(11650);
|
||||
addNodeObject(filter, "Average", s_node_average, "Node_Average", [1, Node_Average],, "Average color of every pixels in the image.").setVersion(1110);
|
||||
addNodeObject(filter, "Smear", s_node_smear, "Node_Smear", [1, Node_Smear]).setVersion(11670);
|
||||
addNodeObject(filter, "Kuwahara", s_node_kuwahara, "Node_Kuwahara", [1, Node_Kuwahara]).setVersion(11660);
|
||||
|
||||
ds_list_add(filter, "Warps");
|
||||
addNodeObject(filter, "Mirror", s_node_mirror, "Node_Mirror", [1, Node_Mirror],, "Reflect the image along a reflection line.").setVersion(1070);
|
||||
|
@ -600,8 +601,6 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Chromatic Aberration", s_node_chromatic_abarration, "Node_Chromatic_Aberration", [1, Node_Chromatic_Aberration],, "Apply chromatic aberration effect to the image.");
|
||||
addNodeObject(filter, "Vignette", s_node_vignette, "Node_Vignette", [1, Node_Vignette],, "Apply vignette effect to the border.").setVersion(11630);
|
||||
addNodeObject(filter, "FXAA", s_node_FXAA, "Node_FXAA", [1, Node_FXAA],, "Apply fast approximate anti-aliasing to the image.");
|
||||
addNodeObject(filter, "Kuwahara", s_node_kuwahara, "Node_Kuwahara", [1, Node_Kuwahara]).setVersion(11660);
|
||||
//addNodeObject(filter, "Rim", s_node_kuwahara, "Node_Rim", [1, Node_Rim]).setVersion(11690);
|
||||
//addNodeObject(filter, "Blend Edge", s_node_FXAA, "Node_Blend_Edge", [1, Node_Blend_Edge]).setVersion(11640);
|
||||
|
||||
ds_list_add(filter, "Colors");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-22 18:54:02
|
||||
// 2024-04-22 18:54:03
|
||||
function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constructor { #region
|
||||
name = _name;
|
||||
spr = _spr;
|
||||
|
@ -845,7 +845,7 @@ function __initNodes() {
|
|||
addNodeObject(values, "Array Convolute", s_node_array_convolute, "Node_Array_Convolute", [1, Node_Array_Convolute]).setVersion(11540);
|
||||
addNodeObject(values, "Array Composite", s_node_array_composite, "Node_Array_Composite", [1, Node_Array_Composite]).setVersion(11540);
|
||||
addNodeObject(values, "Array Sample", s_node_array_sample, "Node_Array_Sample", [1, Node_Array_Sample]).setVersion(11540);
|
||||
addNodeObject(values, "Sort Array", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).setVersion(1120);
|
||||
addNodeObject(values, "Sort Array", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).setVersion(1120);
|
||||
addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).setVersion(1120);
|
||||
addNodeObject(values, "Loop Array", s_node_loop_array, "Node_Iterate_Each_Inline", [1, Node_Iterate_Each_Inline], ["iterate each", "for each", "array loop"], "Create group that iterate to each member in an array.");
|
||||
addNodeObject(values, "Filter Array", s_node_filter_array, "Node_Iterate_Filter_Inline", [1, Node_Iterate_Filter_Inline],, "Filter array using condition.").setVersion(1140);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// 2024-04-18 08:42:38
|
||||
// 2024-04-27 16:30:10
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
|
||||
#define TAU 6.283185307179586
|
||||
#define distance_sample 64.
|
||||
|
||||
void main() {
|
||||
vec2 tx = 1. / dimension;
|
||||
|
@ -14,11 +15,11 @@ void main() {
|
|||
if(col.a == 1.)
|
||||
return;
|
||||
|
||||
for(float i = 1.; i <= 64.; i++) {
|
||||
for(float i = 1.; i <= distance_sample; i++) {
|
||||
float base = 1.;
|
||||
float top = 0.;
|
||||
|
||||
for(float j = 0.; j <= 64.; j++) {
|
||||
for(float j = 0.; j <= 128.; j++) {
|
||||
float ang = top / base * TAU;
|
||||
top += 2.;
|
||||
if(top >= base) {
|
||||
|
@ -26,8 +27,8 @@ void main() {
|
|||
base *= 2.;
|
||||
}
|
||||
|
||||
vec2 pxs = v_vTexcoord + vec2( cos(ang), sin(ang)) * i * tx;
|
||||
vec4 sam = texture2D( gm_BaseTexture, pxs );
|
||||
vec2 pxs = v_vTexcoord + vec2( cos(ang), sin(ang)) * i * tx;
|
||||
vec4 sam = texture2D( gm_BaseTexture, pxs );
|
||||
|
||||
if(sam.a < 1.) continue;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-18 08:42:35
|
||||
// 2024-04-18 08:42:38
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
@ -26,8 +26,8 @@ void main() {
|
|||
base *= 2.;
|
||||
}
|
||||
|
||||
vec2 pxs = v_vTexcoord + vec2( cos(ang), sin(ang)) * i * tx;
|
||||
vec4 sam = texture2D( gm_BaseTexture, pxs );
|
||||
vec2 pxs = v_vTexcoord + vec2( cos(ang), sin(ang)) * i * tx;
|
||||
vec4 sam = texture2D( gm_BaseTexture, pxs );
|
||||
|
||||
if(sam.a < 1.) continue;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-18 08:38:57
|
||||
// 2024-04-27 16:52:46
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
@ -11,38 +11,28 @@ void main() {
|
|||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
gl_FragColor = col;
|
||||
|
||||
if(col.a == 1.)
|
||||
return;
|
||||
if(col.a > 0.) return;
|
||||
|
||||
float _min, _cmp;
|
||||
vec2 _str, _axs;
|
||||
float amo;
|
||||
vec2 _axs;
|
||||
vec4 ss;
|
||||
|
||||
if(axis == 0) {
|
||||
_min = dimension.x;
|
||||
_cmp = _min * v_vTexcoord.x;
|
||||
|
||||
_str = vec2(0., v_vTexcoord.y);
|
||||
amo = dimension.x;
|
||||
_axs = vec2(tx.x, 0.);
|
||||
|
||||
} else {
|
||||
_min = dimension.y;
|
||||
_cmp = _min * v_vTexcoord.y;
|
||||
|
||||
_str = vec2(v_vTexcoord.x, 0.);
|
||||
amo = dimension.y;
|
||||
_axs = vec2(0., tx.y);
|
||||
|
||||
}
|
||||
|
||||
for(float i = 1.; i < 2048.; i++) {
|
||||
if(i > iteration) break;
|
||||
for(float i = 1.; i < amo; i++) {
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord + _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
|
||||
vec2 sx = _str + _axs * i;
|
||||
vec4 ss = texture2D( gm_BaseTexture, sx );
|
||||
|
||||
if(ss.a == 1. && abs(i - _cmp) < _min) {
|
||||
_min = abs(i - _cmp);
|
||||
col = ss;
|
||||
}
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord - _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-18 08:38:57
|
||||
// 2024-04-27 16:52:31
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
@ -11,38 +11,28 @@ void main() {
|
|||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
gl_FragColor = col;
|
||||
|
||||
if(col.a == 1.)
|
||||
return;
|
||||
if(col.a > 0.) return;
|
||||
|
||||
float _min, _cmp;
|
||||
vec2 _str, _axs;
|
||||
float amo;
|
||||
vec2 _axs;
|
||||
vec4 ss;
|
||||
|
||||
if(axis == 0) {
|
||||
_min = dimension.x;
|
||||
_cmp = _min * v_vTexcoord.x;
|
||||
|
||||
_str = vec2(0., v_vTexcoord.y);
|
||||
amo = dimension.x;
|
||||
_axs = vec2(tx.x, 0.);
|
||||
|
||||
} else {
|
||||
_min = dimension.y;
|
||||
_cmp = _min * v_vTexcoord.y;
|
||||
|
||||
_str = vec2(v_vTexcoord.x, 0.);
|
||||
amo = dimension.y;
|
||||
_axs = vec2(0., tx.y);
|
||||
|
||||
}
|
||||
|
||||
for(float i = 1.; i < 2048.; i++) {
|
||||
if(i > iteration) break;
|
||||
for(float i = 1.; i < amo; i++) {
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord + _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
|
||||
vec2 sx = _str + _axs * i;
|
||||
vec4 ss = texture2D( gm_BaseTexture, sx );
|
||||
|
||||
if(ss.a == 1. && abs(i - _cmp) < _min) {
|
||||
_min = abs(i - _cmp);
|
||||
col = ss;
|
||||
}
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord - _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
|
|
124
#backups/shaders/sh_blur_radial/sh_blur_radial.fsh.backup0
Normal file
124
#backups/shaders/sh_blur_radial/sh_blur_radial.fsh.backup0
Normal file
|
@ -0,0 +1,124 @@
|
|||
// 2024-04-27 16:03:31
|
||||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 center;
|
||||
uniform vec2 dimension;
|
||||
uniform int sampleMode;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
#define ITERATION 64.
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
uniform vec2 sampleDimension;
|
||||
|
||||
const int RSIN_RADIUS = 1;
|
||||
|
||||
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
|
||||
|
||||
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
|
||||
vec2 tx = 1.0 / sampleDimension;
|
||||
vec2 p = uv * sampleDimension - vec2(0.5);
|
||||
|
||||
vec4 sum = vec4(0.0);
|
||||
float weights = 0.;
|
||||
|
||||
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
|
||||
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
|
||||
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
|
||||
if(a > 1.) continue;
|
||||
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
|
||||
vec2 offset = vec2(float(x), float(y)) * tx;
|
||||
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
|
||||
sum += w * sample;
|
||||
weights += w;
|
||||
}
|
||||
|
||||
return sum / weights;
|
||||
}
|
||||
|
||||
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
|
||||
uv = uv * sampleDimension + 0.5;
|
||||
vec2 iuv = floor( uv );
|
||||
vec2 fuv = fract( uv );
|
||||
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
|
||||
uv = (uv - 0.5) / sampleDimension;
|
||||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
||||
if(interpolation == 2) return texture2D_bicubic( texture, uv );
|
||||
else if(interpolation == 3) return texture2D_rsin( texture, uv );
|
||||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2Dintp(gm_BaseTexture, pos);
|
||||
|
||||
if(sampleMode == 0)
|
||||
return vec4(0.);
|
||||
|
||||
else if(sampleMode == 1)
|
||||
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
|
||||
|
||||
else if(sampleMode == 2)
|
||||
return texture2Dintp(gm_BaseTexture, fract(pos));
|
||||
|
||||
else if(sampleMode == 3)
|
||||
return vec4(vec3(0.), 1.);
|
||||
|
||||
return vec4(0.);
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float str = strength.x;
|
||||
float strMax = max(strength.x, strength.y);
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pxPos = v_vTexcoord * dimension;
|
||||
vec2 pxCen = center * dimension;
|
||||
vec2 vecPc = pxPos - pxCen;
|
||||
|
||||
float angle = atan(vecPc.y, vecPc.x);
|
||||
float dist = length(vecPc);
|
||||
vec4 clr = vec4(0.);
|
||||
vec4 res = vec4(0.);
|
||||
float weight = 0.;
|
||||
float maxBright = 0.;
|
||||
|
||||
for(float i = -strMax; i <= strMax; i++) {
|
||||
if(i < -str) continue;
|
||||
if(i > str) break;
|
||||
|
||||
float ang = angle + i / 100.;
|
||||
vec4 col = sampleTexture((pxCen + vec2(cos(ang), sin(ang)) * dist) / dimension);
|
||||
|
||||
// float bright = (col.r + col.g + col.b) / 3. * col.a;
|
||||
|
||||
clr += col;
|
||||
weight += col.a;
|
||||
|
||||
// if(bright > maxBright) {
|
||||
// maxBright = bright;
|
||||
// res = col;
|
||||
// }
|
||||
}
|
||||
|
||||
gl_FragColor = clr / weight;
|
||||
// gl_FragColor = res;
|
||||
}
|
124
#backups/shaders/sh_blur_radial/sh_blur_radial.fsh.backup1
Normal file
124
#backups/shaders/sh_blur_radial/sh_blur_radial.fsh.backup1
Normal file
|
@ -0,0 +1,124 @@
|
|||
// 2024-04-27 16:03:28
|
||||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 center;
|
||||
uniform vec2 dimension;
|
||||
uniform int sampleMode;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
#define ITERATION 64.
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
uniform vec2 sampleDimension;
|
||||
|
||||
const int RSIN_RADIUS = 1;
|
||||
|
||||
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
|
||||
|
||||
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
|
||||
vec2 tx = 1.0 / sampleDimension;
|
||||
vec2 p = uv * sampleDimension - vec2(0.5);
|
||||
|
||||
vec4 sum = vec4(0.0);
|
||||
float weights = 0.;
|
||||
|
||||
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
|
||||
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
|
||||
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
|
||||
if(a > 1.) continue;
|
||||
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
|
||||
vec2 offset = vec2(float(x), float(y)) * tx;
|
||||
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
|
||||
sum += w * sample;
|
||||
weights += w;
|
||||
}
|
||||
|
||||
return sum / weights;
|
||||
}
|
||||
|
||||
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
|
||||
uv = uv * sampleDimension + 0.5;
|
||||
vec2 iuv = floor( uv );
|
||||
vec2 fuv = fract( uv );
|
||||
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
|
||||
uv = (uv - 0.5) / sampleDimension;
|
||||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
||||
if(interpolation == 2) return texture2D_bicubic( texture, uv );
|
||||
else if(interpolation == 3) return texture2D_rsin( texture, uv );
|
||||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2Dintp(gm_BaseTexture, pos);
|
||||
|
||||
if(sampleMode == 0)
|
||||
return vec4(0.);
|
||||
|
||||
else if(sampleMode == 1)
|
||||
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
|
||||
|
||||
else if(sampleMode == 2)
|
||||
return texture2Dintp(gm_BaseTexture, fract(pos));
|
||||
|
||||
else if(sampleMode == 3)
|
||||
return vec4(vec3(0.), 1.);
|
||||
|
||||
return vec4(0.);
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float str = strength.x;
|
||||
float strMax = max(strength.x, strength.y);
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pxPos = v_vTexcoord * dimension;
|
||||
vec2 pxCen = center * dimension;
|
||||
vec2 vecPc = pxPos - pxCen;
|
||||
|
||||
float angle = atan(vecPc.y, vecPc.x);
|
||||
float dist = length(vecPc);
|
||||
vec4 clr = vec4(0.);
|
||||
vec4 res = vec4(0.);
|
||||
float weight = 0.;
|
||||
float maxBright = 0.;
|
||||
|
||||
for(float i = -strMax; i <= strMax; i++) {
|
||||
if(i < -str) continue;
|
||||
if(i > str) break;
|
||||
|
||||
float ang = angle + i / 100.;
|
||||
vec4 col = sampleTexture((pxCen + vec2(cos(ang), sin(ang)) * dist) / dimension);
|
||||
|
||||
// float bright = (col.r + col.g + col.b) / 3. * col.a;
|
||||
|
||||
clr += col;
|
||||
weight += col.a;
|
||||
|
||||
// if(bright > maxBright) {
|
||||
// maxBright = bright;
|
||||
// res = col;
|
||||
// }
|
||||
}
|
||||
|
||||
gl_FragColor = clr / weight;
|
||||
// gl_FragColor = res;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-27 15:33:04
|
||||
// 2024-04-27 16:00:25
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2024-04-27 15:33:00
|
||||
// 2024-04-27 15:45:59
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
|
@ -57,6 +57,8 @@ vec4 smear(vec2 angle) { #region
|
|||
maxBright = bright;
|
||||
res = col;
|
||||
}
|
||||
|
||||
//if(col.a > 0.) res = col;
|
||||
}
|
||||
|
||||
if(modulateStr == 1) {
|
||||
|
|
|
@ -565,6 +565,7 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Shape Blur", s_node_shape_blur, "Node_Blur_Shape", [1, Node_Blur_Shape]).setVersion(11650);
|
||||
addNodeObject(filter, "Average", s_node_average, "Node_Average", [1, Node_Average],, "Average color of every pixels in the image.").setVersion(1110);
|
||||
addNodeObject(filter, "Smear", s_node_smear, "Node_Smear", [1, Node_Smear]).setVersion(11670);
|
||||
addNodeObject(filter, "Kuwahara", s_node_kuwahara, "Node_Kuwahara", [1, Node_Kuwahara]).setVersion(11660);
|
||||
|
||||
ds_list_add(filter, "Warps");
|
||||
addNodeObject(filter, "Mirror", s_node_mirror, "Node_Mirror", [1, Node_Mirror],, "Reflect the image along a reflection line.").setVersion(1070);
|
||||
|
@ -599,8 +600,6 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Chromatic Aberration", s_node_chromatic_abarration, "Node_Chromatic_Aberration", [1, Node_Chromatic_Aberration],, "Apply chromatic aberration effect to the image.");
|
||||
addNodeObject(filter, "Vignette", s_node_vignette, "Node_Vignette", [1, Node_Vignette],, "Apply vignette effect to the border.").setVersion(11630);
|
||||
addNodeObject(filter, "FXAA", s_node_FXAA, "Node_FXAA", [1, Node_FXAA],, "Apply fast approximate anti-aliasing to the image.");
|
||||
addNodeObject(filter, "Kuwahara", s_node_kuwahara, "Node_Kuwahara", [1, Node_Kuwahara]).setVersion(11660);
|
||||
//addNodeObject(filter, "Rim", s_node_kuwahara, "Node_Rim", [1, Node_Rim]).setVersion(11690);
|
||||
//addNodeObject(filter, "Blend Edge", s_node_FXAA, "Node_Blend_Edge", [1, Node_Blend_Edge]).setVersion(11640);
|
||||
|
||||
ds_list_add(filter, "Colors");
|
||||
|
|
|
@ -18,7 +18,7 @@ void main() {
|
|||
float base = 1.;
|
||||
float top = 0.;
|
||||
|
||||
for(float j = 0.; j <= 64.; j++) {
|
||||
for(float j = 0.; j <= 128.; j++) {
|
||||
float ang = top / base * TAU;
|
||||
top += 2.;
|
||||
if(top >= base) {
|
||||
|
|
|
@ -10,38 +10,28 @@ void main() {
|
|||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
gl_FragColor = col;
|
||||
|
||||
if(col.a > 0.)
|
||||
return;
|
||||
if(col.a > 0.) return;
|
||||
|
||||
float _min, _cmp;
|
||||
vec2 _str, _axs;
|
||||
float amo;
|
||||
vec2 _axs;
|
||||
vec4 ss;
|
||||
|
||||
if(axis == 0) {
|
||||
_min = dimension.x;
|
||||
_cmp = _min * v_vTexcoord.x;
|
||||
|
||||
_str = vec2(0., v_vTexcoord.y);
|
||||
amo = dimension.x;
|
||||
_axs = vec2(tx.x, 0.);
|
||||
|
||||
} else {
|
||||
_min = dimension.y;
|
||||
_cmp = _min * v_vTexcoord.y;
|
||||
|
||||
_str = vec2(v_vTexcoord.x, 0.);
|
||||
amo = dimension.y;
|
||||
_axs = vec2(0., tx.y);
|
||||
|
||||
}
|
||||
|
||||
for(float i = 1.; i < 2048.; i++) {
|
||||
if(i > iteration) break;
|
||||
for(float i = 1.; i < amo; i++) {
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord + _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
|
||||
vec2 sx = _str + _axs * i;
|
||||
vec4 ss = texture2D( gm_BaseTexture, sx);
|
||||
|
||||
if(ss.a > 0. && abs(i - _cmp) < _min) {
|
||||
_min = abs(i - _cmp);
|
||||
col = ss;
|
||||
}
|
||||
ss = texture2D( gm_BaseTexture, v_vTexcoord - _axs * i);
|
||||
if(ss.a > 0.) { col = ss; break; }
|
||||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
|
|
|
@ -12,7 +12,6 @@ uniform vec2 strength;
|
|||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
|
||||
#define ITERATION 64.
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
@ -92,12 +91,14 @@ void main() {
|
|||
|
||||
vec2 pxPos = v_vTexcoord * dimension;
|
||||
vec2 pxCen = center * dimension;
|
||||
vec2 vecPc = pxPos - pxCen;
|
||||
vec2 vecPc = pxPos - pxCen;
|
||||
|
||||
float angle = atan(vecPc.y, vecPc.x);
|
||||
float dist = length(vecPc);
|
||||
vec4 clr = vec4(0.);
|
||||
float angle = atan(vecPc.y, vecPc.x);
|
||||
float dist = length(vecPc);
|
||||
vec4 clr = vec4(0.);
|
||||
vec4 res = vec4(0.);
|
||||
float weight = 0.;
|
||||
float maxBright = 0.;
|
||||
|
||||
for(float i = -strMax; i <= strMax; i++) {
|
||||
if(i < -str) continue;
|
||||
|
@ -106,9 +107,17 @@ void main() {
|
|||
float ang = angle + i / 100.;
|
||||
vec4 col = sampleTexture((pxCen + vec2(cos(ang), sin(ang)) * dist) / dimension);
|
||||
|
||||
// float bright = (col.r + col.g + col.b) / 3. * col.a;
|
||||
|
||||
clr += col;
|
||||
weight += col.a;
|
||||
|
||||
// if(bright > maxBright) {
|
||||
// maxBright = bright;
|
||||
// res = col;
|
||||
// }
|
||||
}
|
||||
|
||||
gl_FragColor = clr / weight;
|
||||
// gl_FragColor = res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue