Point sprites distance and size

Hello community,

I use point sprites. They appear correctly except that when the camera is far,
they look bigger and when the camera is near them, they are small…


ps = gl::GlslProg::create(gl::GlslProg::Format().vertex(CI_GLSL(150,

uniform mat4 ciModelViewProjection;
in vec4 ciPosition;
in vec4 ciColor;
in float vSize;

out vec4 color;

void main(void)
	gl_Position = ciModelViewProjection * ciPosition;
	gl_PointSize = vSize;
	color = ciColor;


uniform sampler2D uTexture;
in vec4 color;

out vec4 oColor;

void main(void)
	oColor = color * texture(uTexture, gl_PointCoord);


Any answer welcome,


there’s probably something wrong with the way you calculate vSize, but you didn’t provide that code so it’s just a guess.

The size of the point sprite should change with its distance to the camera. One way to obtain this distance is as follows:
float cameraDist = length( vec3( ciModelView * ciPosition ) )

There’s a lot of ways to then calculate an appropriate size, e.g. using log or sqrt, but a simple formula can be found here. See also this post.