Vertex shader point sprite size question

Hello everyone,

I wanted to make 2 shaders that could easily be used for showing particles for instance.

In the case where you want to use billboards, point sprites can be faster, but I would like to be able to switch between them without having to tweak anything.

Having inspired my shader heavily on Viktor Vicsek’s point sprite fx, it scales properly perspective-wise, but I am having trouble to get the same scale on every renderer. That is, the viewport size seems to influence the way it looks.

I attached a patch that shows this, and I was wondering if anyone knew how I could get rid of this viewport dependence (if at all possible).

point sprite size control.zip (5.2 kB)

pointsprite size is in pixels, and it is dependant on the size of the texture you are rendering it to (vertical resolution i think)
so, pass this value to your shader, and divide psize by it

For the interested:

I updated the example, and I guess it scales the way you would expect it now.

It has as the consequence that you need the shader twice, if you have 2 different renderers with different dimensions…

point sprite size control.zip (5.6 kB)