# Point Sprite Size

This topic is 3552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

At the moment im using a fixed point sprite size by setting PSIZE to some value, which causes the problem of - Moving closer to the particle source, causes particles to get smaller - Moving away from the particle source, causes particles to get bigger so how do i resolve this? is it just a case of experimentation? such as u + vDistanceNear = SizeNear u + vDistanceFar = SizeFar and just calculate the u and v for the mapping formula?

##### Share on other sites
Look at:

D3DRS_POINTSCALE_A
D3DRS_POINTSCALE_B
D3DRS_POINTSCALE_C

##### Share on other sites
I would say it depends if you set the PSIZE @ the vertex, if so i think the values of D3DRS_POINTSCALE_A, 3DRS_POINTSCALE_B, D3DRS_POINTSCALE_C dont matter because you are overriding the size. if not you can tweak those values to your like.

##### Share on other sites
I saw those values in the documentation. But i dont see how that works. How is it working out the dustance from the camera to the point?

Quote:
 Point size is determined by D3DRS_POINTSCALEENABLE. If this value is set to FALSE, the application-specified point size is used as the screen-space (post-transformed) size. Vertices that are passed to Direct3D in screen space do not have point sizes computed; the specified point size is interpreted as screen-space size.If D3DRS_POINTSCALEENABLE is TRUE, Direct3D computes the screen-space point size according to the following formula. The application-specified point size is expressed in camera space units.S s = Vh * S i * sqrt(1/(A + B * D e + C *( D e2 )))In this formula, the input point size, S i, is either per-vertex or the value of the D3DRS_POINTSIZE render state. The point scale factors, D3DRS_POINTSCALE_A, D3DRS_POINTSCALE_B, and D3DRS_POINTSCALE_C, are represented by the points A, B, and C. The height of the viewport, V h, is the D3DVIEWPORT9 structure's Height member representing the viewport. D e, the distance from the eye to the position (the eye at the origin), is computed by taking the eye space position of the point (Xe, Ye, Ze) and performing the following operation.D e = sqrt (Xe2 + Y e2 + Z e2)

It says

"D e, the distance from the eye to the position (the eye at the origin), is computed by taking the eye space position of the point (Xe, Ye, Ze) and performing the following operation."

If its taking the distance from the origin, ( i assumed a better approach would be to take the distance from thr cam to the point), and the particle is moving slowly, but the camera moving away quickly, its not going to scale correctly.

could some one explain this?

##### Share on other sites
The distances are calculated in camera space. In camera/eye space, the camera position is the origin. So the points are transformed to camera space and their distance to the origin is found.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634113
• Total Posts
3015567
×