Jump to content
  • Advertisement
Sign in to follow this  
guyaton

Point Sprites

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I notice on alot of tutorials online (and the MSSDK) these renderstates are used:
pd3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_POINTSCALEENABLE,  TRUE );
pd3dDevice->SetRenderState( D3DRS_POINTSIZE,     FtoDW(0.08f) );
pd3dDevice->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(0.00f) );
pd3dDevice->SetRenderState( D3DRS_POINTSCALE_A,  FtoDW(0.00f) );
pd3dDevice->SetRenderState( D3DRS_POINTSCALE_B,  FtoDW(0.00f) );
pd3dDevice->SetRenderState( D3DRS_POINTSCALE_C,  FtoDW(1.00f) );

the only disadvantage is that this assumes a constant point size. I am trying to make the point sprites change in relation to the camera distance, so as the camera moves away, the sprites get smaller. I'm using the FVF "PSIZE" and my struct looks like this:
struct VertexPointSprite
{
	D3DXVECTOR3 vecVert;
	float fSize;
	DWORD dwColor;
	
	static const DWORD FVF;
};
const DWORD VertexPointSprite::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_PSIZE;

as of right now, the point sprite is always the same size irregardless and when i tried using the scale a, b, and c's the point sprite was the size of a few pixels, even when the size of the point sprite was 2000. thanks

Share this post


Link to post
Share on other sites
Advertisement
Try setting point scale C to 1.5. Pointscales are like the attenuation values for light sources. And if you still dont see any changes it might be because of lack of hw support. Try switching to software vertex processing and see if it works then.

On a similar note I've written a tutorial on pointsprites over here and the sample does change scale relative to camera distance, so you can compare that with your code and see what needs to be changed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!