Help with ARB point Sprites
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
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.
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.
try something like (off the top of my head) to see it most apparent
float quadratic[] = { 0.0f, 0.1f, 0.0f };
float quadratic[] = { 0.0f, 0.1f, 0.0f };
Is there any what to find out what that d value is at any given time? My particle's size doesn't seem to be decreasing as a function of distance.
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]
If anyone has an elloquent sollution to this, please post!
[Edited by - renderer on June 8, 2005 5:56:00 PM]
Is this project by any chance for the games class (ICS 187)?
[Edited by - renderer on June 8, 2005 5:09:41 PM]
[Edited by - renderer on June 8, 2005 5:09:41 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement