forked from fms-cat/nightbird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
440 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,69 @@ | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
uniform vec2 resolution; | ||
uniform float time; | ||
uniform float param0; | ||
uniform sampler2D texture0; | ||
|
||
#define t time | ||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
#define v vec2( 0., 1. ) | ||
|
||
float f( vec3 p ) | ||
{ | ||
float tt = t; | ||
p.xy = p.xy*mat2( cos(t), -sin(t), sin(t), cos(t) ); | ||
tt = sin( t ); | ||
p.zx = p.zx*mat2( cos(tt), -sin(tt), sin(tt), cos(tt) ); | ||
tt = 2.*time; | ||
p.yz = p.yz*mat2( cos(tt), -sin(tt), sin(tt), cos(tt) ); | ||
float r = .1+param0*.4; | ||
float k = .3+param0*.1; | ||
float d = length( p+v.yxx*k )-r; | ||
d = min( d, length( p-v.yxx*k )-r); | ||
d = min( d, length( p+v.xyx*k )-r); | ||
d = min( d, length( p-v.xyx*k )-r); | ||
d = min( d, length( p+v.xxy*k )-r); | ||
d = min( d, length( p-v.xxy*k )-r); | ||
return d; | ||
} | ||
|
||
vec3 n( vec3 p ) | ||
{ | ||
vec2 d = v*.01; | ||
return normalize( vec3( f( p+d.yxx )-f( p-d.yxx ), f( p+d.xyx )-f( p-d.xyx ), f( p+d.xxy )-f( p-d.xxy ) ) ); | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = c/r; | ||
vec2 p = (c*2.-r)/r.x; | ||
vec3 ray = normalize( vec3( p.x, p.y, -1. ) ); | ||
|
||
float minL = 1E-3; | ||
float maxL = 1E4; | ||
float rL = 0.; | ||
float rD = minL*2.; | ||
vec3 rP = v.xxy; | ||
for( int i=0; i<16; i++ ) | ||
{ | ||
if( abs(rD)<minL || maxL<rL )break; | ||
rD = f( rP ); | ||
rL += rD; | ||
rP = v.xxy+ray*rL; | ||
} | ||
|
||
vec4 col = v.xxxx; | ||
if( rD < 1E-2 ) | ||
{ | ||
vec2 texp = vec2( .5+n(rP).xy/r*min( r.x, r.y )*.5 ); | ||
col.xyz = texture2D( texture0, vec2( texp.x, 1.-texp.y ) ).xyz * ( .1/rL*n(rP).z+.9 ); | ||
col.w = 1.; | ||
} | ||
gl_FragColor = col; | ||
} | ||
#version 300 es | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
out vec4 color; | ||
uniform vec2 resolution; | ||
uniform float time; | ||
uniform float param0; | ||
uniform sampler2D texture0; | ||
|
||
#define t time | ||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
#define v vec2( 0., 1. ) | ||
|
||
float f( vec3 p ) | ||
{ | ||
float tt = t; | ||
p.xy = p.xy*mat2( cos(t), -sin(t), sin(t), cos(t) ); | ||
tt = sin( t ); | ||
p.zx = p.zx*mat2( cos(tt), -sin(tt), sin(tt), cos(tt) ); | ||
tt = 2.*time; | ||
p.yz = p.yz*mat2( cos(tt), -sin(tt), sin(tt), cos(tt) ); | ||
float r = .1+param0*.4; | ||
float k = .3+param0*.1; | ||
float d = length( p+v.yxx*k )-r; | ||
d = min( d, length( p-v.yxx*k )-r); | ||
d = min( d, length( p+v.xyx*k )-r); | ||
d = min( d, length( p-v.xyx*k )-r); | ||
d = min( d, length( p+v.xxy*k )-r); | ||
d = min( d, length( p-v.xxy*k )-r); | ||
return d; | ||
} | ||
|
||
vec3 n( vec3 p ) | ||
{ | ||
vec2 d = v*.01; | ||
return normalize( vec3( f( p+d.yxx )-f( p-d.yxx ), f( p+d.xyx )-f( p-d.xyx ), f( p+d.xxy )-f( p-d.xxy ) ) ); | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = c/r; | ||
vec2 p = (c*2.-r)/r.x; | ||
vec3 ray = normalize( vec3( p.x, p.y, -1. ) ); | ||
|
||
float minL = 1E-3; | ||
float maxL = 1E4; | ||
float rL = 0.; | ||
float rD = minL*2.; | ||
vec3 rP = v.xxy; | ||
for( int i=0; i<16; i++ ) | ||
{ | ||
if( abs(rD)<minL || maxL<rL )break; | ||
rD = f( rP ); | ||
rL += rD; | ||
rP = v.xxy+ray*rL; | ||
} | ||
|
||
vec4 col = v.xxxx; | ||
if( rD < 1E-2 ) | ||
{ | ||
vec2 texp = vec2( .5+n(rP).xy/r*min( r.x, r.y )*.5 ); | ||
col.xyz = texture( texture0, vec2( texp.x, 1.-texp.y ) ).xyz * ( .1/rL*n(rP).z+.9 ); | ||
col.w = 1.; | ||
} | ||
color = col; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
uniform vec2 resolution; | ||
uniform sampler2D texture0; | ||
|
||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
|
||
float gray( vec3 _i ) | ||
{ | ||
return (_i.x+_i.y+_i.z)/3.; | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = floor( c/6. ) * 6./r + vec2( 3. )/r; | ||
vec2 pos = mod( c, 6. ); | ||
vec4 tex = texture2D( texture0, vec2( uv.x, 1.-uv.y ) ); | ||
gl_FragColor = vec4( clamp( vec3( gray( tex.xyz )*3. - length( pos-vec2(3.) )*1. ), 0., 1. )*tex.xyz, 1. ); | ||
} | ||
#version 300 es | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
out vec4 color; | ||
uniform vec2 resolution; | ||
uniform sampler2D texture0; | ||
|
||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
|
||
float gray( vec3 _i ) | ||
{ | ||
return (_i.x+_i.y+_i.z)/3.; | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = floor( c/6. ) * 6./r + vec2( 3. )/r; | ||
vec2 pos = mod( c, 6. ); | ||
vec4 tex = texture( texture0, vec2( uv.x, 1.-uv.y ) ); | ||
color = vec4( clamp( vec3( gray( tex.xyz )*3. - length( pos-vec2(3.) )*1. ), 0., 1. )*tex.xyz, 1. ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
uniform vec2 resolution; | ||
uniform sampler2D texture0; | ||
uniform float param0; | ||
|
||
#define PI 3.1415926 | ||
|
||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
#define v vec2(0.,1.) | ||
|
||
vec3 barrel( float _amp, vec2 _uv ) | ||
{ | ||
vec2 uv = _uv; | ||
float corn = length( v.yy*.5 ); | ||
float amp = min( _amp*3., PI*corn ); | ||
float zoom = corn/(tan(corn*amp)+corn); | ||
vec2 p = clamp( (uv+normalize(uv-.5)*tan(length(uv-.5)*amp))*zoom + .5*(1.-zoom), 0., 1. ); | ||
return texture2D( texture0, vec2( p.x, 1.-p.y ) ).xyz; | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = c/r; | ||
vec3 col = v.xxx; | ||
float amp = clamp( param0, 0., 1. ); | ||
col.x += barrel( amp, uv ).x*.4; | ||
col.x += barrel( amp*1.005, uv ).x*.4; | ||
col.x += barrel( amp*1.01, uv ).x*.4; | ||
col.y += barrel( amp*1.03, uv ).y*.4; | ||
col.y += barrel( amp*1.035, uv ).y*.4; | ||
col.y += barrel( amp*1.04, uv ).y*.4; | ||
col.z += barrel( amp*1.06, uv ).z*.4; | ||
col.z += barrel( amp*1.065, uv ).z*.4; | ||
col.z += barrel( amp*1.07, uv ).z*.4; | ||
gl_FragColor = vec4( col, 1. ); | ||
} | ||
#version 300 es | ||
#ifdef GL_ES | ||
precision mediump float; | ||
#endif | ||
|
||
out vec4 color; | ||
uniform vec2 resolution; | ||
uniform sampler2D texture0; | ||
uniform float param0; | ||
|
||
#define PI 3.1415926 | ||
|
||
#define r resolution | ||
#define c gl_FragCoord.xy | ||
#define v vec2(0.,1.) | ||
|
||
vec3 barrel( float _amp, vec2 _uv ) | ||
{ | ||
vec2 uv = _uv; | ||
float corn = length( v.yy*.5 ); | ||
float amp = min( _amp*3., PI*corn ); | ||
float zoom = corn/(tan(corn*amp)+corn); | ||
vec2 p = clamp( (uv+normalize(uv-.5)*tan(length(uv-.5)*amp))*zoom + .5*(1.-zoom), 0., 1. ); | ||
return texture( texture0, vec2( p.x, 1.-p.y ) ).xyz; | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = c/r; | ||
vec3 col = v.xxx; | ||
float amp = clamp( param0, 0., 1. ); | ||
col.x += barrel( amp, uv ).x*.4; | ||
col.x += barrel( amp*1.005, uv ).x*.4; | ||
col.x += barrel( amp*1.01, uv ).x*.4; | ||
col.y += barrel( amp*1.03, uv ).y*.4; | ||
col.y += barrel( amp*1.035, uv ).y*.4; | ||
col.y += barrel( amp*1.04, uv ).y*.4; | ||
col.z += barrel( amp*1.06, uv ).z*.4; | ||
col.z += barrel( amp*1.065, uv ).z*.4; | ||
col.z += barrel( amp*1.07, uv ).z*.4; | ||
color = vec4( col, 1. ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.