Why does sprite size affect performance in OpenGL ES 2.0/3.0?

2020-03-26 java android opengl-es

There is a particle system for an explosion: enter image description here Vertex shader:

#version 300 es
uniform float u_lastTimeExplosion; // time elapsed since the explosion
// explosion center (particle coordinates are set relative to this center
uniform vec3 u_centerPosition; 
uniform float u_sizeSprite;
layout(location = 0) in float a_lifeTime; // particle lifetime in seconds
// initial position of the particle at the time of the explosion
layout(location = 1) in vec3 a_startPosition;
layout(location = 2) in vec3 a_endPosition; // final position of the particle
out float v_lifeTime; // remaining particle lifetime
void main()
    gl_Position.xyz = a_startPosition + (u_lastTimeExplosion * a_endPosition);
    gl_Position.xyz += u_centerPosition;
    gl_Position.w = 1.0;
    // calculate the remaining particle lifetime
    v_lifeTime = 1.0 - (u_lastTimeExplosion / a_lifeTime);
    v_lifeTime = clamp(v_lifeTime, 0.0, 1.0);
    // calculate sprite size based on remaining life time
    gl_PointSize = pow(v_lifeTime, 5.0) * u_sizeSprite;

Fragment shader:

#version 300 es
precision lowp float;
in float v_lifeTime;
uniform vec4 u_color;
out vec4 fragColor;
uniform sampler2D s_texture;
void main()
    vec4 texColor = texture(s_texture, gl_PointCoord);
    fragColor = u_color * texColor;
    fragColor.a *= v_lifeTime; // increase sprite transparency

If the size of the sprite is less than 10, then everything is fine:

GLES20.glUniform1f(sizeSpriteLink, 10f);

If the size of the sprite increases, then is a slowdown in rendering (FPS reduction):

GLES20.glUniform1f(sizeSpriteLink, 150f);

Strangely - the number of sprites affects performance less than their size.

Question: Why does sprite size affect performance? Would be grateful for any anwer/comment.

Note: mipmap for particle texture used.


Not sure, but it seems that increasing the size of the sprite greatly affects the consumption of graphic memory resources. Maybe someone knows about this?

It is also better to use this type of filtering to increase performance:

// one value is taken from the nearest pyramid level