From dab08fed810866b4a629c4bbcbad6b7008b385fc Mon Sep 17 00:00:00 2001 From: micuat Date: Tue, 20 Oct 2020 19:26:29 +0200 Subject: [PATCH] param --- zoneb/bin/data/shaders/particles/draw.frag | 2 +- zoneb/bin/data/shaders/particles/update.frag | 44 +++++++++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/zoneb/bin/data/shaders/particles/draw.frag b/zoneb/bin/data/shaders/particles/draw.frag index e734ee0..0bd2880 100755 --- a/zoneb/bin/data/shaders/particles/draw.frag +++ b/zoneb/bin/data/shaders/particles/draw.frag @@ -13,7 +13,7 @@ in float vAge; void main() { - fragColor = vec4(1);//vec4(texture(u_world, texCoordVarying.st).rgb,1); + // fragColor = vec4(1);//vec4(texture(u_world, texCoordVarying.st).rgb,1); // fragColor = vec4(texCoordVarying.st/100,1.0,1.0);//vec4(texture(u_world, texCoordVarying.st).rgb,1); // fragColor = vec4(texture(u_v4l2cam, texCoordVarying.st).rgb,1); fragColor = vec4(texture(imageTexture, vec2(vTemperature*1024, 0.5)).xyz,max(0, 1 - pow(vAge,4))); diff --git a/zoneb/bin/data/shaders/particles/update.frag b/zoneb/bin/data/shaders/particles/update.frag index 95fbbf6..d8aa649 100755 --- a/zoneb/bin/data/shaders/particles/update.frag +++ b/zoneb/bin/data/shaders/particles/update.frag @@ -104,9 +104,9 @@ float simplex3d_fractal(vec3 m) { } vec2 stToV4l2(vec2 v) { - v *= 1.5; - v.s -= 85; - v.t -= 130; + v *= 1.65; + v.s -= 115; + v.t -= 170; return v; } @@ -153,43 +153,59 @@ void main() age = 0; target.xyz = pos; } - else { - age += 0.02; + else if (target.w > 0) { + age += 0.001; thermo = misc.x; } + else { + age += 0.01; + thermo = misc.x; + } + + if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { + age += 0.03; + } vec3 force = vec3(0,0,0); float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001)); float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.002); - force.x += cos(th) * cos(phi); - force.y += sin(th) * cos(phi); - force.z += sin(phi); - force *= 100; + // force.x += cos(th) * cos(phi); + // force.y += sin(th) * cos(phi); + // force.z += sin(phi); + // force *= 100; if(age < 0.001) { target.w = 0; - if(random3(pos).x > length(v4l2st - uHottest0.st)/100) { + if(random3(pos).x > pow(length(v4l2st - uHottest0.st)/20,16)+0) { vec2 h = v4l2ToSt(uHottest1.st); vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0; vec3 H = vec3(hray.xy * hdepth, hdepth); - target.xyz = H; + target.xyz = H + random3(pos); target.w = 1; } - else if(random3(pos).x > length(v4l2st - uHottest1.st)/100) { + else if(random3(pos).x > pow(length(v4l2st - uHottest1.st)/50,16)+0) { vec2 h = v4l2ToSt(uHottest0.st); vec4 hray = texture(u_world, h); float hdepth = -depth * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0; vec3 H = vec3(hray.xy * hdepth, hdepth); - target.xyz = H; + target.xyz = H + random3(pos); target.w = 1; } } if(target.w > 0) { - force += (target.xyz - pos) * 0.5; + float th = atan(-pos.y + target.y, -pos.x + target.x); + float phi = atan(-pos.z + target.z, length(target.xy-pos.xy)); + th += 3.1415 / 2 * simplex3d_fractal(vec3(pos.xyz * 0.001)); + phi += 3.1415 / 2 * simplex3d_fractal(pos.xyz * 0.001); + force.x = cos(th) * cos(phi); + force.y = sin(th) * cos(phi); + force.z = sin(phi); + force *= 350; + // force += (target.xyz - pos) * 0.35; } // damping