This commit is contained in:
micuat 2020-10-31 17:54:52 +01:00
parent fe9c40f859
commit a61e8d7cb0
2 changed files with 10 additions and 38 deletions

View file

@ -118,8 +118,8 @@ void main()
// if(vTemperature < 0.5) { // if(vTemperature < 0.5) {
// alpha *= vTemperature * 2; // alpha *= vTemperature * 2;
// } // }
// if(vTarget.w >1) { // if(vTarget.w >0.5) {
// alpha = 0.1; // alpha *= 2;
// } // }
if(vPos.z > -200) { if(vPos.z > -200) {

View file

@ -140,7 +140,7 @@ void main()
posWorld.z = -depth * 65535.0; // Remap to float range. posWorld.z = -depth * 65535.0; // Remap to float range.
posWorld.x = ray.x * posWorld.z; posWorld.x = ray.x * posWorld.z;
posWorld.y = ray.y * posWorld.z; posWorld.y = ray.y * posWorld.z;
// posWorld.xyz += random3(posWorld.xyz) * 2; posWorld.xyz += random3(posWorld.xyz) * 0.5;
float age = misc.y; float age = misc.y;
if(age > 1) { // reached target if(age > 1) { // reached target
@ -165,7 +165,7 @@ void main()
} }
if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived if(vValid == 1 && target.w > 0 && length(target.xy - pos.xy) < 100) { // arrived
age += 0.03; age += 0.1;
} }
// wandering // wandering
@ -189,59 +189,31 @@ void main()
if(age < 0.001) { // targetting if(age < 0.001) { // targetting
target.w = 0; target.w = 0;
if(random3(pos).x > 0.5*pow(length(texCoordVarying.st/fraction - uHottest0.st)/5,1)) { if(random3(pos).x > 2*pow(length(texCoordVarying.st/fraction - uHottest0.st)/15,1)) {
vec2 h = uHottest1.st; vec2 h = 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 + random3(pos); target.xyz = H + random3(pos) * 3;
target.w = 1; target.w = 1;
// vec3 H = uHottest3d0;
// H.x *= -1;
// H.z *= -1;
// target.xyz = H + random3(pos);
// target.w = 1;
} }
else if(random3(pos).x > 0.5*pow(length(texCoordVarying.st/fraction - uHottest1.st)/5,1)) { else if(random3(pos).x > 2*pow(length(texCoordVarying.st/fraction - uHottest1.st)/15,1)) {
vec2 h = uHottest0.st; vec2 h = 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 + random3(pos); target.xyz = H + random3(pos) * 3;
target.w = 1; target.w = 1;
// vec3 H = uHottest3d1;
// // H.x *= -1;
// // H.z *= -1;
// target.xyz = H + random3(pos);
// target.w = 1;
} }
// else if(random3(pos).x > pow(length(texCoordVarying.st - uColdest0.st)/20,16)+0) {
// vec2 h = uColdest1.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 + random3(pos);
// target.w = 1;
// }
// else if(random3(pos).x > pow(length(texCoordVarying.st - uColdest1.st)/20,16)+0) {
// vec2 h = uColdest0.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 + random3(pos);
// target.w = 1;
// }
} }
if(target.w > 0) { // go to target if(target.w > 0) { // go to target
float th = atan(-pos.y + target.y, -pos.x + target.x); float th = atan(-pos.y + target.y, -pos.x + target.x);
float phi = atan(-pos.z + target.z, length(target.xy-pos.xy)); float phi = atan(-pos.z + target.z, length(target.xy-pos.xy));
th += 3.1415 / 4 * simplex3d_fractal(vec3(pos.xyz * 0.001)); th += 3.1415 / 1 * simplex3d_fractal(vec3(pos.xyz * 0.01));
phi += 3.1415 / 4 * simplex3d_fractal(pos.xyz * 0.001); phi += 3.1415 / 1 * simplex3d_fractal(pos.xyz * 0.01);
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);