Sign in to follow this  
Deathscythe

Help with ARB point Sprites

Recommended Posts

Deathscythe    139
My point sprits don't seem to be scaling down as thier distance from the camera increases. I think these two lines determine how it's supposed to be scaled: // This is how will our point sprite's size will be modified by // distance from the viewer float quadratic[] = { 1.0f, 0.0f, 0.01f }; glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic ); However, I can't find any documentation on what the coefficients should be and how they relates to scaling. Thanks in advance

Share this post


Link to post
Share on other sites
Forfaox    1217
This is explained in the GL specs, the final size of a point is:

clamp( size * sqrt(1/(a+b*d+c*d^2)) )

With size being the size specified for the point and d the distance from the eye. The clamp function clamps the size to whatever hardware limit there is. Finally, a, b and c are those three values you specify with glPointParameter.

Share this post


Link to post
Share on other sites
renderer    202
I had a similar problem when I started using point sprites, but my problem was that I couldn't get the point to be large enough when I was close. The largest point it would draw was somewhere around 57 pixels. I ended up doing the pixel size calculation inside a vertex shader. The problem with this is that there is no way to get correct perspective distortion, since you can only control the size at the center of the point sprite. The result is that the points appear to grow when they reach the edge of the screen!!

If anyone has an elloquent sollution to this, please post!

[Edited by - renderer on June 8, 2005 5:56:00 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this