This commit is contained in:
micuat 2020-10-31 20:24:50 +01:00
parent 5726baafe0
commit c45f50c439
3 changed files with 23 additions and 18 deletions

View file

@ -104,6 +104,7 @@ float simplex3d_fractal(vec3 m) {
void main()
{
if(gAge >= 1) discard;
vec2 palette = vec2(gTemperature*3425, 0.5);
vec3 remapedColorW = texture(warm1, palette).xyz;
vec3 remapedColorC = texture(cold2, palette).xyz;
@ -113,7 +114,7 @@ void main()
float rate = 1-smoothstep(D - d, D + d, length(gPos.x + uBetween.x) + n);
rate *= uAreThereTwoPeopleTween;
vec3 remapedColor = mix(remapedColorC, remapedColorW, rate);
float alpha = max(0, 1 - pow(gAge,4)) * .03;
float alpha = max(0, 1 - pow(gAge,4)) * 0.1;
// if(vTemperature < 0.5) {
// alpha *= vTemperature * 2;

View file

@ -1,7 +1,7 @@
layout (points) in;
layout (triangle_strip) out;
layout (max_vertices = 4) out;
layout (line_strip) out;
layout (max_vertices = 16) out;
// OF handled uniforms and attributes.
uniform mat4 projectionMatrix;
@ -39,29 +39,32 @@ void main()
gTemperature = vTemperature[0];
gAge = vAge[0];
if(gAge >= 1) return;
for (int i = 0; i < gl_in.length(); ++i)
{
vec3 vOffset = (vPrevPosition[i].xyz - vPosition[i].xyz) * 4;
vOffset += normalize(vOffset) * 10;
vec3 vOffset = (vPrevPosition[i].xyz - vPosition[i].xyz) * (gAge * 5);
vOffset += normalize(vOffset) * 5;
// if(length(vOffset) < 4) {
// vOffset = normalize(vOffset) * 4;
// }
vec4 shiftPos = vec4(vOffset, 1) + vPosition[i];
vec4 shiftPos = vec4(vOffset, 0) + vPosition[i];
gl_Position = projectionMatrix * (vPosition[i] + vec4(0.0, 1.0, 0.0, 0.0) * uSpriteSize);
gl_Position = projectionMatrix * (vPosition[i] + vec4(0.0, 0.0, 0.0, 0.0) * uSpriteSize);
EmitVertex();
if (u_time > 10) { // hack
gl_Position = projectionMatrix * (shiftPos + vec4(0.0, 1.0, 0.0, 0.0) * uSpriteSize);
gl_Position = projectionMatrix * (shiftPos + vec4(0.0, 0.0, 0.0, 0.0) * uSpriteSize);
EmitVertex();
gl_Position = projectionMatrix * (vPosition[i] + vec4(0.0, -1.0, 0.0, 0.0) * uSpriteSize);
if(gAge > 0 && gTarget.w > 0) {
for(int j = 0; j < 3; j++) {
gl_Position = projectionMatrix * (vPosition[i] + vec4(0.0, float(j+1), 0.0, 0.0) * uSpriteSize);
EmitVertex();
gl_Position = projectionMatrix * (shiftPos + vec4(0.0, -1.0, 0.0, 0.0) * uSpriteSize);
gl_Position = projectionMatrix * (shiftPos + vec4(0.0, float(j+1), 0.0, 0.0) * uSpriteSize);
EmitVertex();
}
}
}
EndPrimitive();

View file

@ -17,6 +17,7 @@ uniform ivec2 uDepthFrameSize;
uniform vec3 mouse;
uniform float radiusSquared;
uniform float elapsed;
uniform float u_time;
uniform vec3 uHottest0;
uniform vec3 uHottest1;
@ -163,7 +164,7 @@ void main()
thermo = misc.x;
}
else { // wandering
age += 0.02;
age += 01.02;
thermo = misc.x;
}
@ -192,7 +193,7 @@ void main()
if(age < 0.001) { // targetting
target.w = 0;
if(random3(pos).x > 2*pow(length(texCoordVarying.st/fraction - uHottest0.st)/15,1)) {
if(random3(pos + vec3(u_time, 0, 0)).x > 2*pow(length(texCoordVarying.st/fraction - uHottest0.st)/25,0.5)) {
vec2 h = uHottest1.st;
vec4 hray = texture(u_world, h);
float hdepth = -depth * 65535.0;
@ -201,7 +202,7 @@ void main()
target.xyz = H + random3(pos) * 3;
target.w = 1;
}
else if(random3(pos).x > 2*pow(length(texCoordVarying.st/fraction - uHottest1.st)/15,1)) {
else if(random3(pos + vec3(u_time, 0, 0)).x > 2*pow(length(texCoordVarying.st/fraction - uHottest1.st)/25,0.5)) {
vec2 h = uHottest0.st;
vec4 hray = texture(u_world, h);
float hdepth = -depth * 65535.0;
@ -220,7 +221,7 @@ void main()
force.x = cos(th) * cos(phi);
force.y = sin(th) * cos(phi);
force.z = sin(phi);
force *= 200 + 200 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
force *= 100 + 200 * simplex3d_fractal(vec3(texCoordVarying, 0.0));
}
// damping