particles are even nicer now.

This commit is contained in:
Andreas Ortmann 2016-09-30 22:04:14 +02:00
parent 3a30a20043
commit c950d6a54d
5 changed files with 13 additions and 15 deletions

View file

@ -15,7 +15,6 @@ vec3 hsv2rgb(vec3 c)
void main()
{
gl_FragColor = vec4(0.5+0.5*vertex.x, 0.5+0.5*vertex.y, 0.0, 1.0);
float r = length(vertex);
if (r > 1.0) {
discard;
@ -26,8 +25,6 @@ void main()
float v = max(0.0, (1.0-log(d)));
float s = max(0.0, min(30.0 * sqrt(decay) * explCenterDist, 1.0));
//v /= decay * 10.0*length(vertex-explCenter);
//v /= 1.0+2.0*length(vertex-explCenter);
//v /= 1.0 + max(0.0, min(35.0*(decay-0.2), 1.0)) + 10.0 * explCenterDist;
v /= 1.0 + 10.0 * explCenterDist;

View file

@ -22,11 +22,11 @@ void main()
decay = age / halfAge;
// faster particles are smaller
//float s = size * (1.0-length(in_velocity)/maxVelocity);
float s = size;
float speedScale = (1.0 - 0.8*length(in_velocity)/maxVelocity);
float finalSize = size * speedScale;
vec2 base = in_vertex;
vec3 p = s*vec3(base, 0.0);
vec3 offset = (0.1*age + log(1.0+age*5.0)) * in_velocity + in_position;
vec3 p = finalSize*vec3(base, 0.0);
vec3 offset = (0.2*age + log(1.0+age*5.0)) * in_velocity + in_position;
p += offset;
gl_Position = vec4(p, 1.0);