Distance scaled point sprites

Hello everybody,

I am using point sprites for a simple particle system. In the GLSL shader I set the point size so that particles can have different sizes. The problem is now that the size is fixed and doensn’t take into account the distance from the viewer. How can I calculate the point size depending on the modelview/projection matrix?

Thanks in advance!

google is your friend:

gl_PointSize = pixels_per_radian * point_diameter / distance( camera, pointcenter );

Thanks gigadude!
I couldn’t find that information when I did my google search before asking that question.

It is working but the problem is that the size of the point sprites is limited to ridiculous 64 pixels on my GF6600. Is there any trick I am missing to get larger point sprites?

unfortunately not, you will need to make your own billboards.
but pointsprites also have the problem that if center isnt visible, they are discarded in total, which may make them pop in all of a sudden, when entering frustum