Skip to main content
GameDev.net gamedev.net
🔒 Locked

Point sprites size

Started by outlawhacker Apr 26, 2006 at 4:51 AM 5 replies 1k views
Original Post
outlawhacker
outlawhacker
Hey Ok, so I got alpha going for my point sprites, but now the size gets crap. It's all ok until I get a bit close, when the camera is 3-4 units away from the sprite. When I get closer the sprite is scaled down. This is how i do it:


a_Device->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
a_Device->SetRenderState(D3DRS_POINTSCALEENABLE,  TRUE);
a_Device->SetRenderState(D3DRS_POINTSIZE,       FtoDW(m_Size));
a_Device->SetRenderState(D3DRS_POINTSIZE_MIN,   FtoDW(0.0f));
a_Device->SetRenderState(D3DRS_POINTSCALE_A,    FtoDW(0.0f));   // Default 1.0
a_Device->SetRenderState(D3DRS_POINTSCALE_B,	FtoDW(0.0f));   // Default 0.0
a_Device->SetRenderState(D3DRS_POINTSCALE_C,	FtoDW(1.0f));   // Default 0.0

// Use the particle size
// Example:
vertices->m_Size = particle->m_Size;

// Render...


Any suggestions on what could be wrong are greatly appreciated. Thanks in advance
jollyjeffers
jollyjeffers
What sort of values does m_Size contain? It should be a pixel/screen-space measurement iirc.

Also, have you verified that your hardware/drivers allow point-sprite scaling and that you're within any defined limit. My Gf6800 reports '8192' as the maximum point size, but some older hardware uses '1' or '0' to indicate limited/no support.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
domin
domin
Check for FVFCaps.PSIZE too - it must be 'YES' to manually (per vertex) scale point sprites. If you have 'NO' then turn off HVP.

programmer_tom
programmer_tom
ya, independent scaling (per vertex) isn't always supported through the FFP. do yourself a favor and write a shader so all cards can have this capability.

-programmer_tom
outlawhacker
outlawhacker
Hmm...I checked my card (Gf 6600) and it supports point sprites of size 8192 and it supports changing the size by sending D3DFVF_PSIZE with the FVF.

At some distance it looks fine but when I come close it stops scaling the sprite so that it looks smaller in the world, but same in screen space. I tried changing the size with respect of the camera distance but that did me no good.

Later on I'll check out shaders too.
domin
domin
When creating device with CreateDevice() pass 4 parameter as D3DCREATE_SOFTWARE_VERTEXPROCESSING. Point sprites should work correctly and you can check in this way that rest of your code works ok.
outlawhacker
outlawhacker
I tried out SVP but no luck with that either. I'll fiddle around with my program tomorrow and look for some weird stuff.

I tried out some examples on the net and none of them changes the size of the point sprite. Why? Is it generally hard to get it to work? A particle system looks so much better when the sprites changes size.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.