Archived

This topic is now archived and is closed to further replies.

NotTaxes

Simple Question on Point Sprites

Recommended Posts

I am using Point Sprites to handle a whole slew of special effects. I store the point sprite vertex data in a large Vertex Buffer with the VB being generated from an Array of data that controls the movements and appearance of each PS (i.e. I use an array to control the PS''s and then I push the array into a VB). The thing is... I have lots of different types of point sprites (blood splatters, dust clouds, weapon effects, etc). So, when I render the VB, I say: Set texture = xyz set pointsize = SomeSize Render first 100 VB points Set Texture = abc Set pointsize = AnotherSize Render second 100 VB points etc... Now, obviously I can''t store the texture information in the VB, but is there a way to store the Point Size info in it? I''ve taken a look at a couple of tuts and the help and there doesn''t seem to be a way. The reason I would want to do this, is that I would quite like to change the size of the particles over time (so that smoke particles expand and fade out, jelly stuff shrinks and disappears etc.), but having to set the point size in the render section for each individual sprite seems really slow. Ideally I would like to make the PointSize a part of the Vertex data in the VB, but how? But apart from that, is there a better way to handle all of this anyway? I am tempted to use billboards (since I can store their sizes in the VB anyhow), but they look like they''re going to be *Really* slow by comparison (have to rotate each one to face the camera, which is loads of slow code). I have plenty of talent and vision, I just don''''t give a damn.

Share this post


Link to post
Share on other sites
Unless you pretransform your vertices (ie, make them not 3D), i don''t think you can store size data individually. I may be wrong though, that''s just the impression I got from the SDK docs.

How expensive are SetRenderState calls anyway? (i''m not exactly a DX8 guru). You may just have to store m_size with your particle and set the size each particle?

Share this post


Link to post
Share on other sites
Personally I have found that I have better performance when using billboarded sprites for special effects/particles/etc. Getting the sprites to face the viewer (screen-aligned) doesn''t appear to have that big a performance hit and can be easily done using the inverse view matrix.

Hope this helps a little :-)
Cheers,
Sharky

Share this post


Link to post
Share on other sites
In my experience, Setting the size of a point sprite individually is EXPENSIVE. I could get a 650 particle snow system (no size change) running with no speed hit (yes, my card is really very slow...), while a fire system with size changing particles had a max of 7 particles. Use billboards =).

Z.

Share this post


Link to post
Share on other sites
I don''t use point sprites, I use bilboarding.

If you start using alpha-blending in a particlae system you need to order all the particales back to fron before rendering them so that the blending works corrctly. You can''t do this if you draw one size point sprite and then another size. Maybe at some point in the future HW will support multi-sized point sprites, but till then, I emulate in software. (and from what I can tell here is very little GPU/CPU hit, the frame rates stay about the same).

D.V.

Carpe Diem

Share this post


Link to post
Share on other sites
Straight from the SDK:
DirectX Graphics->Advanced Topics in DirectX Graphics->Point Sprites->Point Primitive Rendering Control

quote:

Microsoft® Direct3D® for Microsoft DirectX® 8.0 supports additional parameters to control the rendering of point sprites (point primitives). These parameters enable points to be of variable size and have a full texture map applied. The size of each point is determined by an application-specified size combined with a distance-based function computed by Direct3D. The application can specify point size either as per-vertex or by setting D3DRS_POINTSIZE, which applies to points without a per-vertex size.


I can''t see why you shouldn''t be able to do a per-sprite size with a minimal performance hit.

Moe''s Site

Share this post


Link to post
Share on other sites
I tried to use point sprites for particles but I gave up for the following reasons :

- A lot of drivers do NOT render the points at all.
- A lot of drivers do NOT render the points when using textures.
- A lot of drivers do NOT render the points when using PSIZE.
- Point Sprites are slow.
- Point sprites cannot be rotated.

I am now using billboarded, textured and rotating quads. It is simpler and faster.




Laurent - http://www.lafaqmfc.com/
My little game: http://www.lafaqmfc.com/home/play_starshooter.htm

Share this post


Link to post
Share on other sites