This commit is contained in:
micuat 2020-10-20 19:26:29 +02:00
parent f06e113f3d
commit dab08fed81
2 changed files with 31 additions and 15 deletions

View file

@ -13,7 +13,7 @@ in float vAge;
void main() 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(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(u_v4l2cam, texCoordVarying.st).rgb,1);
fragColor = vec4(texture(imageTexture, vec2(vTemperature*1024, 0.5)).xyz,max(0, 1 - pow(vAge,4))); fragColor = vec4(texture(imageTexture, vec2(vTemperature*1024, 0.5)).xyz,max(0, 1 - pow(vAge,4)));

View file

@ -104,9 +104,9 @@ float simplex3d_fractal(vec3 m) {
} }
vec2 stToV4l2(vec2 v) { vec2 stToV4l2(vec2 v) {
v *= 1.5; v *= 1.65;
v.s -= 85; v.s -= 115;
v.t -= 130; v.t -= 170;
return v; return v;
} }
@ -153,43 +153,59 @@ void main()
age = 0; age = 0;
target.xyz = pos; target.xyz = pos;
} }
else { else if (target.w > 0) {
age += 0.02; age += 0.001;
thermo = misc.x; 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); vec3 force = vec3(0,0,0);
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001)); float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001));
float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.002); float phi = 3.1415 * simplex3d_fractal(pos.xyz * 0.002);
force.x += cos(th) * cos(phi); // force.x += cos(th) * cos(phi);
force.y += sin(th) * cos(phi); // force.y += sin(th) * cos(phi);
force.z += sin(phi); // force.z += sin(phi);
force *= 100; // force *= 100;
if(age < 0.001) { if(age < 0.001) {
target.w = 0; 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); vec2 h = v4l2ToSt(uHottest1.st);
vec4 hray = texture(u_world, h); vec4 hray = texture(u_world, h);
float hdepth = -depth * 65535.0; float hdepth = -depth * 65535.0;
if(hdepth == 0) hdepth = -0.01 * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0;
vec3 H = vec3(hray.xy * hdepth, hdepth); vec3 H = vec3(hray.xy * hdepth, hdepth);
target.xyz = H; target.xyz = H + random3(pos);
target.w = 1; 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); vec2 h = v4l2ToSt(uHottest0.st);
vec4 hray = texture(u_world, h); vec4 hray = texture(u_world, h);
float hdepth = -depth * 65535.0; float hdepth = -depth * 65535.0;
if(hdepth == 0) hdepth = -0.01 * 65535.0; if(hdepth == 0) hdepth = -0.01 * 65535.0;
vec3 H = vec3(hray.xy * hdepth, hdepth); vec3 H = vec3(hray.xy * hdepth, hdepth);
target.xyz = H; target.xyz = H + random3(pos);
target.w = 1; target.w = 1;
} }
} }
if(target.w > 0) { 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 // damping