- add: OldNeoInterface (#108)

* ebal

* setup gui

* AAAAAAAAAA EBLAN
This commit is contained in:
Valtos
2024-03-20 22:54:45 +03:00
committed by GitHub
parent 4a06c1509a
commit f6b107353a
178 changed files with 1370 additions and 696 deletions

View File

@@ -3,15 +3,15 @@ uniform sampler2D SCREEN_TEXTURE;
const highp float PI = 3.1415926535;
// ブラウン管のガラスの曲がり具合フラットなやつは0.0でいいかな)
const highp float crt_curve = 0.02;
const highp float crt_curve = -0.09;
// 走査線の濃さ
const highp float crt_scan_line_color = 0.348;
// 光量
const highp float aperture_grille_rate = 0.5;
const highp float aperture_grille_rate = 0.1;
// RFスイッチ的ブラー
const highp float rf_switch_esque_blur = 1.1;
const highp float rf_switch_esque_blur = 1.5;
// 白色ノイズ
const highp float white_noise_rate = 0.05;
const highp float white_noise_rate = 0.01;
highp float random( highp vec2 pos )
{

View File

@@ -0,0 +1,270 @@
highp mat2 mm2(in highp float a)
{
highp float c = cos(a), s = sin(a);
return mat2(c,s,-s,c);
}
highp vec3 objmov(highp vec3 p)
{
p.xz *= mm2(-TIME*3.4 + sin(TIME*1.11));
p.yz *= mm2(TIME*2.7 + cos(TIME*2.5));
return p;
}
highp float tri(in highp float x)
{
return abs(fract(x)-0.5)-0.25;
}
highp float trids(in highp vec3 p)
{
return max(tri(p.z),min(tri(p.x),tri(p.y)));
}
highp float tri2(in highp float x)
{
return abs(fract(x)-0.5);
}
highp vec3 tri3(in highp vec3 p)
{
return vec3( tri(p.z+tri(p.y*1.0)), tri(p.z+tri(p.x*1.05)), tri(p.y+tri(p.x*1.1)));
}
highp float triNoise3d(in highp vec3 p, in highp float spd)
{
highp float z = 1.45;
highp float rz = 0.0;
highp vec3 bp = p;
for (highp float i=0.0; i<4.0; i++ )
{
highp vec3 dg = tri3(bp);
p += (dg+TIME*spd+10.1);
bp *= 1.65;
z *= 1.5;
p *= 0.9;
p.xz*= mat2( 0.970, 0.242, -0.242, 0.970 );
rz+= (tri2(p.z+tri2(p.x+tri2(p.y))))/z;
bp += 0.9;
}
return rz;
}
highp float map(highp vec3 p)
{
p*= 1.5;
p = objmov(p);
highp float d = length(p)-1.0;
d -= trids(p*1.2)*0.7;
return d/1.5;
}
highp float map2(highp vec3 p)
{
p = objmov(p);
return length(p)-1.3;
}
highp float march(in highp vec3 ro, in highp vec3 rd)
{
highp float precis = 0.001;
highp float h=precis*2.0;
highp float d = 0.0;
for( highp int i=0; i<35; i++ )
{
if( abs(h)<precis || d>15 ) break;
d += h;
highp float res = map(ro+rd*d);
h = res;
}
return d;
}
highp vec3 normal(in highp vec3 p)
{
highp vec2 e = vec2(-1.0, 1.0)*0.04;
return normalize(e.yxx*map(p + e.yxx) + e.xxy*map(p + e.xxy) + e.xyx*map(p + e.xyx) + e.yyy*map(p + e.yyy) );
}
highp float gradm(in highp vec3 p)
{
highp float e = 0.06;
highp float d = map2(vec3(p.x,p.y-e,p.z))-map2(vec3(p.x,p.y+e,p.z));
d += map2(vec3(p.x-e,p.y,p.z))-map2(vec3(p.x+e,p.y,p.z));
d += map2(vec3(p.x,p.y,p.z-e))-map2(vec3(p.x,p.y,p.z+e));
return d;
}
//Main fireball
highp float mapVol(highp vec3 p, in highp float spd)
{
highp float f = smoothstep(0.0, 1.25, 1.7-(p.y + dot(p.xz,p.xz)*0.62));
highp float g = p.y;
p.y *= 0.27;
p.z += gradm(p*0.73)*3.5;
p.y += TIME*6.0;
highp float d = triNoise3d(p*vec3(0.3,0.27,0.3) - vec3(0,TIME*0.0,0),spd*0.7)*1.4 + 0.01;
d += max((g-0.0)*0.3,0.0);
d *= f;
return clamp(d,0.0,1.0);
}
highp vec3 marchVol( in highp vec3 ro, in highp vec3 rd, in highp float t, in highp float mt )
{
highp vec4 rz = vec4(0);
t -= (dot(rd, vec3(0,1,0))+1.0);
highp float tmt = t +15.0;
for(highp int i=0; i<25; i++)
{
if(rz.a > 0.99)break;
highp vec3 pos = ro + t*rd;
highp float r = mapVol( pos,0.1 );
highp float gr = clamp((r - mapVol(pos+ vec3(0.0,0.7,0.0),0.1))/0.3, 0.0, 1.0 );
highp vec3 lg = vec3(0.72,0.28,0.0)*1.2 + 1.3*vec3(0.55, 0.77, 0.9)*gr;
highp vec4 col = vec4(lg,r*r*r*2.5); //Could increase this to simulate entry
col *= smoothstep(t-0.0,t+0.2,mt);
pos.y *= 0.7;
pos.zx *= ((pos.y-5.0)*0.15 - 0.4);
highp float z2 = length(vec3(pos.x,pos.y*0.75 - 0.5,pos.z))-0.75;
col.a *= smoothstep(0.4,1.2,0.7-map2(vec3(pos.x,pos.y*0.17,pos.z)));
col.rgb *= col.a;
rz = rz + col*(1.0 - rz.a);
t += abs(z2)*0.1 + 0.12;
if (t>mt || t > tmt)break;
}
rz.g *= rz.w*0.9+0.12;
rz.r *= rz.w*0.5+0.48;
return clamp(rz.rgb, 0.0, 1.0);
}
// "Particles"
highp float mapVol2(highp vec3 p, in highp float spd)
{
p *= 1.3;
highp float f = smoothstep(0.2, 1.0, 1.3-(p.y+length(p.xz)*0.4));
p.y *= 0.05;
p.y += TIME*1.7;
highp float d = triNoise3d(p*1.1,spd);
d = clamp(d-0.15, 0.0, 0.75);
d *= d*d*d*d*47.0;
d *= f;
return d;
}
highp vec3 marchVol2( in highp vec3 ro, in highp vec3 rd, in highp float t, in highp float mt )
{
highp vec3 bpos = ro +rd*t;
t += length(vec3(bpos.x,bpos.y,bpos.z))-1.0;
t -= dot(rd, vec3(0,1,0));
highp vec4 rz = vec4(0);
highp float tmt = t +1.5;
for(highp int i=0; i<25; i++)
{
if(rz.a > 0.99)break;
highp vec3 pos = ro + t*rd;
highp float r = mapVol2( pos,0.01 );
highp vec3 lg = vec3(0.7,0.3,0.2)*1.5 + 2.0*vec3(1,1,1)*0.75;
highp vec4 col = vec4(lg,r*r*r*3.0);
col *= smoothstep(t-0.25,t+0.2,mt);
highp float z2 = length(vec3(pos.x,pos.y*0.9,pos.z))-0.9;
col.a *= smoothstep(0.7,1.7, 1.0-map2(vec3(pos.x*1.1,pos.y*0.4,pos.z*1.1)));
col.rgb *= col.a;
rz = rz + col*(1.0 - rz.a);
t += z2*0.015 + abs(0.35-r)*0.09;
if (t>mt || t > tmt)break;
}
return clamp(rz.rgb, 0.0, 1.0);
}
// MIT Licensed hash From Dave_Hoskins (https://www.shadertoy.com/view/4djSRW)
highp vec3 hash33(highp vec3 p)
{
p = fract(p * vec3(443.8975,397.2973, 491.1871));
p += dot(p.zxy, p.yxz+19.27);
return fract(vec3(p.x * p.y, p.z*p.x, p.y*p.z));
}
highp vec3 stars(in highp vec3 p)
{
highp vec3 c = vec3(0.0);
highp float res = UV.x*0.8;
for (highp float i=0.0;i<4.0;i++)
{
vec3 q = fract(p*(0.15*res))-0.5;
vec3 id = floor(p*(0.15*res));
vec2 rn = hash33(id).xy;
float c2 = 1.0-smoothstep(0.0,0.6,length(q));
c2 *= step(rn.x,0.0005+i*i*0.001);
c += c2*(mix(vec3(1.0,0.49,0.1),vec3(0.75,0.9,1.0),rn.y)*0.25+0.75);
p *= 1.4;
}
return c*c*0.65;
}
highp float curv(in highp vec3 p, in highp float w)
{
highp vec2 e = vec2(-1.0, 1.0)*w;
highp float t1 = map(p + e.yxx), t2 = map(p + e.xxy);
highp float t3 = map(p + e.xyx), t4 = map(p + e.yyy);
return 1.0/e.y *(t1 + t2 + t3 + t4 - 4.0 * map(p));
}
void fragment()
{
highp vec2 p = 2.0 * FRAGCOORD.xy / vec2(1024) - 1.0;
p.x*=UV.x/UV.y;
highp vec2 mo = vec2(0.5,0.5) / UV.xy-0.5;
mo = vec2(-0.27,0.31);
mo.x *= UV.x/UV.y;
highp float roz = 7.3;
highp vec3 ro = vec3(-1.5,0.5,roz);
highp vec3 rd = normalize(vec3(p,-1.5));
mo.x += sin(TIME*0.3 + sin(TIME*0.05))*0.03+0.03;
mo.y += sin(TIME*0.4 + sin(TIME*0.06))*0.03;
highp mat2 mx = mm2(mo.x*6.0);
highp mat2 my = mm2(mo.y*6.0);
ro.xz *= mx;rd.xz *= mx;
ro.xy *= my;rd.xy *= my;
float rz = march(ro,rd); //march geometry
highp vec3 col = stars(rd);
highp float maxT = rz;
if (rz > 15)
maxT = 25.0;
highp vec3 mv = marchVol(ro,rd, roz-1.5,maxT);
if ( rz < 15 )
{
highp vec3 pos = ro+rz*rd;
highp vec3 nor= normal( pos );
highp float crv = clamp(curv(pos, 0.3)*0.35,0.0,1.3);
highp vec3 col2 = vec3(1,0.1,0.02)*(crv*0.8+0.2)*0.5;
highp float frict = dot(pos, normalize(vec3(0.0,1.0,0.0)));
col = col2*(frict*0.3+0.7);
col += vec3(1,0.3,0.1)*(crv*0.7+0.3)*max((frict*0.5+0.5),0.0)*1.3;
col += vec3(0.8,0.8,0.5)*(crv*0.9+0.1)*pow(max(frict,0.0), 1.5)*1.9;
pos = objmov(pos);
col *= 1.2-mv;
col *= triNoise3d(pos*2.8,0.0)*0.25+0.45;
col = pow(col, vec3(1.5,1.2,1.2))*0.9;
}
col += mv;
col += marchVol2(ro,rd, roz-5.5,rz);
col = pow(col,vec3(1.4))*1.1;
COLOR = vec4( col, 1.0 );
}

View File

@@ -0,0 +1,78 @@
highp float hash11(highp float p)
{
p = fract(p * 0.1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
highp float hash12(highp vec2 p)
{
highp vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
////////////////////////////////////////
highp float noise11( in highp float f ) //gradient noise 1D
{
highp float i = floor( f );
f -= i;
highp float u = f*f*(3.0-2.0*f);
return mix(hash11( i ), hash11( i + 1.0 ) , u);
}
highp float noise12( in highp vec2 f ) //gradient noise 2D
{
highp vec2 i = floor( f );
f -= i;
highp vec2 u = f*f*(3.0-2.0*f);
return mix( mix( hash12( i + vec2(0,0) ),
hash12( i + vec2(1,0) ), u.x),
mix( hash12( i + vec2(0,1) ),
hash12( i + vec2(1,1) ), u.x), u.y);
}
void fragment()
{
highp vec2 r = FRAGCOORD.xy;
highp vec2 uv = UV * 4.0;
highp float xs = noise11 (floor(uv.y*20.0))*sin(floor(uv.y*0.5)+TIME); //x-shift for big horizontal stripes
xs*=xs*xs;
highp float x = (uv.x+xs*0.0)*20.0 //vertical stripes
, cl = floor(x); //stripe id
x -= cl; //stripe local x
highp float h = hash11(cl-1.0); //color of previous stripe
h = mix(hash11(cl),h,step(x,sin(TIME+h*10.0)*0.4+0.4)); //mixing color of current and previous stripe to draw moving stripes
h = sin(h*0.7-noise11(uv.x-TIME*1.2)*2.0)*0.5+0.5; //adding big moving noise for stripes color
highp vec3 C = (vec3(0.5,0.5,0.6)+vec3(0.6,0.6,0.7)*cos(6.28318*(vec3(0.8,0.8,0.9)*h+vec3(0.3,0.3,0.4))))*0.5-0.45; //define background color using palette function
C = C * (0.5 + sin(uv.y*600.0)*0.5); //add small horizontal strips (like on analog TV)
cl = noise11 (floor((uv.x+xs*0.05)*200.0)+TIME)*noise12(vec2(uv.x*5.0,TIME)); // adding cyan vertical stripes to background
C = mix (C, vec3(1,1,1),cl*cl*cl*0.6);
cl = noise11 (floor(uv.y*200.0)+TIME)*noise12(vec2(uv.y*10.0,0)+TIME); //adding orange horizontal stripes to background
cl*=cl*cl;
C = mix (C, vec3(0.8,0.8,0.9),cl);
highp vec2 xy = uv+vec2((xs-cl)*0.05+0.1,0); //define the coords for the logo with offsets on the horizontal wide stripes and thin orange ones
h = noise11(TIME); //adding periodical "block coding artifacts"
x = 50.0; //num of cells
h = h*h*h*noise12(floor(uv*x)); //noise strength
xy = ((xy*x-floor(xy*x))*(1.0-h*0.6)+floor(xy*x))/x; //scale cells
C *= (0.9 + sin(uv.y*600.0)*0.2); //add small horizontal strips (like on analog TV)
COLOR = vec4(C,1.0);
}

View File

@@ -0,0 +1,60 @@
const highp float PI = 3.14;
const highp float TARGET_COUNT = 15.0;
const highp float GRID_CELL_SIZE = 0.1;
highp vec2 getGridPosition(in highp vec2 uv) {
return vec2((uv.x / GRID_CELL_SIZE), (uv.y / GRID_CELL_SIZE));
}
void fragment() {
// Normalized frag coordinates
highp vec2 uv = 2.0 * FRAGCOORD.xy / vec2(1024) - 1.0;
highp vec2 gridBoundUV = getGridPosition(uv);
highp vec2 cellBoundUV = gridBoundUV - round(gridBoundUV);
highp float redIntensity = 0.0;
highp float blueIntensity = 0.0;
for (highp float targetIndex = 0.0; targetIndex < TARGET_COUNT; ++targetIndex)
{
highp float f_targetIndex = targetIndex;
highp float trigOffset = (PI / TARGET_COUNT) * f_targetIndex;
highp vec2 targetPosition = vec2(sin(TIME + trigOffset) * 0.51 + tan(f_targetIndex + trigOffset), cos(TIME + trigOffset) * 0.1 + sin(f_targetIndex + trigOffset));
highp vec2 gridBoundTargetPosition = getGridPosition(targetPosition);
highp vec2 edgeBoundPosition = vec2(gridBoundTargetPosition.x, gridBoundTargetPosition.y);
// change the op between the lengths to subtraction for some extreme strobe effects
highp float distanceToTarget = length(gridBoundUV - round(gridBoundTargetPosition)) + length((gridBoundUV) - (edgeBoundPosition));
redIntensity += length(GRID_CELL_SIZE / (distanceToTarget * 9.5) / cellBoundUV) * GRID_CELL_SIZE;
}
for (highp float targetIndex = 0.0; targetIndex < TARGET_COUNT; ++targetIndex)
{
highp float f_targetIndex = targetIndex;
highp float trigOffset = (PI / TARGET_COUNT) * f_targetIndex;
highp vec2 targetPosition = vec2(sin(TIME + trigOffset) * 0.51 + sin(f_targetIndex + trigOffset), tan(TIME + trigOffset) * 0.1 + sin(f_targetIndex + trigOffset));
highp vec2 gridBoundTargetPosition = getGridPosition(targetPosition);
highp vec2 edgeBoundPosition = vec2(gridBoundTargetPosition.x, gridBoundTargetPosition.y);
highp float distanceToTarget = length(gridBoundUV - round(gridBoundTargetPosition)) + distance(gridBoundUV, edgeBoundPosition);
blueIntensity += length(GRID_CELL_SIZE / (distanceToTarget * 15.5) / cellBoundUV) * GRID_CELL_SIZE;
}
highp vec3 col = vec3(smoothstep(0.2, 1.0, redIntensity + blueIntensity));
col += redIntensity * vec3(0.0,1.0,0.0);
col += blueIntensity * vec3(0.0,0.0,1.0);
// Output to screen
COLOR = vec4(col,1.0);
}

View File

@@ -0,0 +1,28 @@
highp float rand(highp float co) {
return fract(sin(co * (91.3458)) * 47453.5453);
}
void fragment()
{
highp vec2 uv = UV;
highp vec2 texel = 1.0 * SCREEN_PIXEL_SIZE.xy;
highp vec4 img = texture(TEXTURE, uv);
// modulate offset
highp float step_y = texel.y * (rand(uv.x) * 80) * (sin(sin(TIME * 0.5)) * 2.0 + 1.3);
// offset without modulation
//highp float step_y = texel.y*(rand(uv.x)*100.0);
// shake offset and modulate it
step_y += rand(uv.x * uv.y * TIME) * 0.025 * sin(TIME);
// more noisy spikes
step_y = mix(step_y, step_y * rand(uv.x * TIME) * 0.5, sin(TIME));
if (dot(img, vec4(0.299, 0.587, 0.114, 0.0)) > 1.2*(sin(TIME) * 0.325 + 0.50)) {
uv.y += step_y;
} else {
uv.y -= step_y;
}
COLOR = texture(TEXTURE, uv);
}

View File

@@ -0,0 +1,54 @@
uniform highp float pixel = 1.0;
uniform highp vec2 red_offset = vec2(0.0, 0.0);
uniform highp vec2 green_offset = vec2(0.0, 0.0);
uniform highp vec2 blue_offset = vec2(0.0, 0.0);
uniform highp float alpha = 1.0;
uniform highp float rand_strength = 1.0;
uniform highp vec4 affected = vec4(0.0, 0.0, 1.0, 1.0);
highp float Hash21(highp vec2 p) {
p = fract(p*vec2(123.34, 456.21));
p += dot(p, p+45.32);
return fract(p.x*p.y);
}
highp vec2 pixelize(highp vec2 uv) {
highp float mult = 5000.0 / (pixel * pixel);
uv.x = floor(uv.x * mult) / mult;
uv.y = floor(uv.y * mult) / mult;
return uv;
}
highp vec4 chroma(highp vec2 uv, sampler2D tex) {
highp vec4 col = texture(tex, uv);
if (abs(red_offset.x) + abs(red_offset.y) > 0.001) {
col.r = texture(tex, vec2(uv.x + red_offset.x, uv.y + red_offset.y)).r;
}
if (abs(green_offset.x) + abs(green_offset.y) > 0.001) {
col.g = texture(tex, vec2(uv.x + green_offset.x, uv.y + green_offset.y)).g;
}
if (abs(blue_offset.x) + abs(blue_offset.y) > 0.001) {
col.b = texture(tex, vec2(uv.x + blue_offset.x, uv.y + blue_offset.y)).b;
}
return col;
}
void fragment() {
highp vec2 normal_uv = UV;
highp vec4 normal_col = texture(TEXTURE, UV);
if (normal_uv.x < affected.x || normal_uv.y < affected.y || normal_uv.x > affected.x + affected.z || normal_uv.y > affected.y + affected.a) {
COLOR = normal_col;
}
else {
highp vec2 uv = pixelize(UV);
highp vec4 col = chroma(uv, TEXTURE);
col.a = col.a * alpha;
highp vec2 id = floor(uv * 10.0);
highp float alpha_rand = Hash21(id + floor(TIME*10.0));
col = col * ( alpha_rand + (rand_strength * (1.0-alpha_rand)) );
COLOR = col;
}
}

View File

@@ -0,0 +1,159 @@
const highp vec2 mouse = vec2(0.0);
const highp float time = 0.0;
const highp int iterations = 12;
const highp float formuparam2 = 0.79;
const highp float volsteps = 7.0;
const highp float stepsize = 0.290;
const highp float zoom = 0.5;
const highp float tile = 0.850;
const highp float speed2 = 0.1;
const highp float brightness = 0.0015;
const highp float darkmatter = 0.100;
const highp float distfading = 0.560;
const highp float saturation = 0.90;
const highp float transverseSpeed = 1.0; //zoom;
const highp float cloud = 0.06;
highp float triangle(highp float x, highp float a) {
highp float output2 = 2.0*abs( 3.0* ( (x/a) - floor( (x/a) + 0.5) ) ) - 1.0;
return output2;
}
highp float field(in highp vec3 p) {
highp float strength = 15.0 + 0.03 * log(0.0000001 + fract(sin(time) * 373.11));
highp float accum = 0.0;
highp float prev = 0.0;
highp float tw = 0.0;
for (highp float i = 0.0; i < 6.0; ++i) {
highp float mag = dot(p, p);
p = abs(p) / mag + vec3(-0.5, -0.8 + 0.1*sin(-time*0.1 + 2.0), -1.1+0.3*cos(time*0.3));
highp float w = exp(-i / 7.0);
accum += w * exp(-strength * pow(abs(mag - prev), 2.3));
tw += w;
prev = mag;
}
return max(0.0, 5.0 * accum / tw - 0.7);
}
void fragment() {
highp vec2 uv2 = 2.0 * FRAGCOORD.xy / vec2(1024) - 1.0;
highp vec2 uvs = uv2 * vec2(1024) / 1024.0;
highp float time = TIME * 0.01;
highp float time2 = time;
highp float speed = -speed2;
speed = 0.005 * cos(time2*0.02 + 3.1415926/4.0);
//speed = 0.0;
highp float formuparam = formuparam2;
//get coords and direction
highp vec2 uv = uvs;
//mouse rotation
highp float a_xz = 0.9;
highp float a_yz = -0.6;
highp float a_xy = 0.9 + time*0.08;
highp mat2 rot_xz = mat2(vec2(cos(a_xz),sin(a_xz)),vec2(-sin(a_xz),cos(a_xz)));
highp mat2 rot_yz = mat2(vec2(cos(a_yz),sin(a_yz)),vec2(-sin(a_yz),cos(a_yz)));
highp mat2 rot_xy = mat2(vec2(cos(a_xy),sin(a_xy)),vec2(-sin(a_xy),cos(a_xy)));
highp float v2 =1.0;
highp vec3 dir=vec3(uv*zoom,1.0);
highp vec3 from=vec3(0.0, 0.0,0.0);
// from.x = 0.5;
// from.y = 0.5;
highp vec3 forward = vec3(0.0,0.0,1.0);
from.x += transverseSpeed*(1.0)*cos(0.01*time) + 0.001*time;
from.y += transverseSpeed*(1.0)*sin(0.01*time) +0.001*time;
from.z += 0.003*time;
dir.xy*=rot_xy;
forward.xy *= rot_xy;
dir.xz*=rot_xz;
forward.xz *= rot_xz;
dir.yz*= rot_yz;
forward.yz *= rot_yz;
from.xy*=-1.0*rot_xy;
from.xz*=rot_xz;
from.yz*= rot_yz;
//zoom
highp float zooom = (time2-3311.0)*speed;
from += forward* zooom;
highp float sampleShift = mod( zooom, stepsize );
highp float zoffset = -sampleShift;
sampleShift /= stepsize; // make from 0 to 1
//volumetric rendering
highp float s=0.24;
highp float s3 = s + stepsize/2.0;
highp vec3 v=vec3(0.0);
highp float t3 = 0.0;
highp vec3 backCol2 = vec3(0.0);
for (highp float r=0.0; r<volsteps; r++) {
highp vec3 p2=from+(s+zoffset)*dir;// + vec3(0.0,0.0,zoffset);
highp vec3 p3=from+(s3+zoffset)*dir;// + vec3(0.0,0.0,zoffset);
p2 = abs(vec3(tile)-mod(p2,vec3(tile*2.0))); // tiling fold
p3 = abs(vec3(tile)-mod(p3,vec3(tile*2.0))); // tiling fold
// #ifdef cloud
t3 = field(p3);
highp float pa,a=pa=0.0;
for (highp int i=0; i<iterations; i++) {
p2=abs(p2)/dot(p2,p2)-formuparam; // the magic formula
//p=abs(p)/max(dot(p,p),0.005)-formuparam; // another interesting way to reduce noise
highp float D = abs(length(p2)-pa); // absolute sum of average change
a += i > 7 ? min( 12.0, D) : D;
pa=length(p2);
}
//float dm=max(0.0,darkmatter-a*a*0.001); //dark matter
a*=a*a; // add contrast
//if (r>3) fade*=1.0-dm; // dark matter, don't render near
// brightens stuff up a bit
highp float s1 = s+zoffset;
// need closed form expression for this, now that we shift samples
highp float fade = pow(distfading,max(0.0,r-sampleShift));
//t3 += fade;
v+=fade;
//backCol2 -= fade;
// fade out samples as they approach the camera
if( r == 0.0 )
fade *= (1.0 - (sampleShift));
// fade in samples as they approach from the distance
if( r == volsteps-1.0 )
fade *= sampleShift;
v+=vec3(s1,s1*s1,s1*s1*s1*s1)*a*brightness*fade; // coloring based on distance
backCol2 += mix(0.4, 1.0, v2) * vec3(1.8 * t3 * t3 * t3, 1.4 * t3 * t3, t3) * fade;
s+=stepsize;
s3 += stepsize;
}
v = mix(vec3(length(v)),v,saturation); //color adjust
highp vec4 forCol2 = vec4(v*0.001,1.0);
backCol2 *= cloud;
backCol2.b *= 1.3;
backCol2.r *= 0.05;
backCol2.b = 0.5*mix(backCol2.g, backCol2.b, 0.8);
backCol2.g = 0.0;
backCol2.bg = mix(backCol2.gb, backCol2.bg, 0.5*(cos(time*0.01) + 1.0));
COLOR = forCol2 + vec4(backCol2, 1.0);
}