Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrRay committed Oct 23, 2018
1 parent 0b56044 commit 55fa058
Show file tree
Hide file tree
Showing 243 changed files with 23,691 additions and 1 deletion.
52 changes: 52 additions & 0 deletions ISF/3d Rotate.fs
@@ -0,0 +1,52 @@
/*{
"DESCRIPTION": "performs a 3d rotation",
"CREDIT": "by zoidberg",
"ISFVSN": "2",
"CATEGORIES": [
"Geometry Adjustment"
],
"INPUTS": [
{
"NAME": "inputImage",
"TYPE": "image"
},
{
"NAME": "xrot",
"LABEL": "X rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "yrot",
"LABEL": "Y rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "zrot",
"LABEL": "Z rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "zoom",
"LABEL": "Zoom Level",
"TYPE": "float",
"MIN": 0.0,
"MAX": 1.0,
"DEFAULT": 1.0
}
]
}*/


void main()
{
gl_FragColor = IMG_THIS_PIXEL(inputImage);
}
86 changes: 86 additions & 0 deletions ISF/3d Rotate.vs
@@ -0,0 +1,86 @@
float PI_CONST = 3.14159265359;


// with help from http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-3:-3D-transformation-and-projection.html
// and http://en.wikipedia.org/wiki/Rotation_matrix


mat4 view_frustum(
float angle_of_view,
float aspect_ratio,
float z_near,
float z_far
) {
return mat4(
vec4(1.0/tan(angle_of_view), 0.0, 0.0, 0.0),
vec4(0.0, aspect_ratio/tan(angle_of_view), 0.0, 0.0),
vec4(0.0, 0.0, (z_far+z_near)/(z_far-z_near), 1.0),
vec4(0.0, 0.0, -2.0*z_far*z_near/(z_far-z_near), 0.0)
);
}

mat4 scale(float x, float y, float z)
{
return mat4(
vec4(x, 0.0, 0.0, 0.0),
vec4(0.0, y, 0.0, 0.0),
vec4(0.0, 0.0, z, 0.0),
vec4(0.0, 0.0, 0.0, 1.0)
);
}

mat4 translate(float x, float y, float z)
{
return mat4(
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(x, y, z, 1.0)
);
}

mat4 rotate_x(float theta)
{
return mat4(
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, cos(theta*PI_CONST), sin(theta*PI_CONST), 0.0),
vec4(0.0, -sin(theta*PI_CONST), cos(theta*PI_CONST), 0.0),
vec4(0.0, 0.0, 0.0, 1.0)
);
}

mat4 rotate_y(float theta)
{
return mat4(
vec4(cos(theta*PI_CONST), 0.0, sin(theta*PI_CONST), 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(-sin(theta*PI_CONST), 0, cos(theta*PI_CONST), 0.0),
vec4(0.0, 0.0, 0.0, 1.0)
);
}

mat4 rotate_z(float theta)
{
return mat4(
vec4(cos(theta*PI_CONST), -sin(theta*PI_CONST), 0.0, 0.0),
vec4(sin(theta*PI_CONST), cos(theta*PI_CONST), 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 0.0, 1.0)
);
}

void main()
{
isf_vertShaderInit();

vec4 position = gl_Position;

gl_Position = view_frustum(radians(45.0), RENDERSIZE.x/RENDERSIZE.y, 0.0, 2.0)
* translate(0.0, 0.0, RENDERSIZE.x/RENDERSIZE.y)
* rotate_x(-xrot)
* rotate_y(yrot)
* rotate_z(-zrot)
* scale(zoom*RENDERSIZE.x/RENDERSIZE.y, zoom, zoom)
* position;

}
95 changes: 95 additions & 0 deletions ISF/ASCII Art.fs
@@ -0,0 +1,95 @@
/*{
"DESCRIPTION": "ASCII Art",
"CREDIT": "by VIDVOX (Ported from https://www.shadertoy.com/view/lssGDj)",
"ISFVSN": "2",
"CATEGORIES": [
"Stylize", "Retro"
],
"INPUTS": [
{
"NAME": "inputImage",
"TYPE": "image"
},
{
"NAME": "size",
"TYPE": "float",
"MIN": 0.0,
"MAX": 1.0,
"DEFAULT": 0.1
},
{
"NAME": "gamma",
"TYPE": "float",
"DEFAULT": 1.0,
"MIN": 0.5,
"MAX": 2.0
},
{
"NAME": "tint",
"TYPE": "float",
"MIN": 0.0,
"MAX": 1.0,
"DEFAULT": 1.0
},
{
"NAME": "tintColor",
"TYPE": "color",
"DEFAULT": [
0.0,
1.0,
0.0,
1.0
]
},
{
"NAME": "alphaMode",
"TYPE": "bool",
"DEFAULT": 0.0
}
]
}*/



float character(float n, vec2 p) // some compilers have the word "char" reserved
{
p = floor(p*vec2(4.0, -4.0) + 2.5);
if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)
{
if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;
}
return 0.0;
}



void main() {
float _size = size*36.0+8.0;
vec2 uv = gl_FragCoord.xy;
vec4 inputColor = IMG_NORM_PIXEL(inputImage, (floor(uv/_size)*_size/RENDERSIZE.xy));
vec3 col = inputColor.rgb;
float gray = (col.r + col.g + col.b)/3.0;
gray = pow(gray, gamma);
col = mix(tintColor.rgb, col.rgb, 1.0-tint);

float n = 65536.0; // .
if (gray > 0.2) n = 65600.0; // :
if (gray > 0.3) n = 332772.0; // *
if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.5) n = 23385164.0; // &
if (gray > 0.6) n = 15252014.0; // 8
if (gray > 0.7) n = 13199452.0; // @
if (gray > 0.8) n = 11512810.0; // #

vec2 p = mod(uv/(_size/2.0), 2.0) - vec2(1.0);
col = col*character(n, p);
float alpha = mix(tintColor.a * inputColor.a, inputColor.a, 1.0-tint);
if (alphaMode) {
alpha = (col.r + col.g + col.b)/3.0;
alpha = (alpha > 0.01) ? tintColor.a : alpha;
}

gl_FragColor = vec4(col,alpha);

}
20 changes: 20 additions & 0 deletions ISF/Apply Alpha.fs
@@ -0,0 +1,20 @@
/*{
"CREDIT": "by VIDVOX",
"ISFVSN": "2",
"CATEGORIES": [
"Color Adjustment"
],
"INPUTS": [
{
"NAME": "inputImage",
"TYPE": "image"
}
]
}*/

void main() {
vec4 srcPixel = IMG_THIS_PIXEL(inputImage);
srcPixel.rgb = srcPixel.rgb * srcPixel.a;
srcPixel.a = 1.0;
gl_FragColor = srcPixel;
}

0 comments on commit 55fa058

Please sign in to comment.