PDA

View Full Version : Distance scaled point sprites



LaBasX2
03-14-2007, 09:44 AM
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!

gigadude
03-15-2007, 05:54 AM
google is your friend:

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

LaBasX2
03-15-2007, 12:48 PM
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?

CrazyButcher
03-15-2007, 01:57 PM
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