Different sized point sprites in one buffer

Started by
5 comments, last by Halsafar 18 years, 10 months ago
The subject really says it all. I can adjust the size of a mass of point sprites which need rendering but I was curious if there is anyway to include size into the pipeline. If not then the solution will be to order the sprites depending on size, but then the rendering length would rise linear to the number of different sizes which when using random numbers will be a lot.
Advertisement
One of the possible declaration usages is point size. I have not done this myself, but you should be able to set the size in each vertex, if the usage index is 0 (and the rest of your states are set up right) the fixed function pipeline should pick this up and resize roue sprites acordingly.

If you are using the programmable pipeline you can output the PSIZE semantic from your vertex shader and it should do the same thing as the PointSize vertex data, but you could claculate it in your shader. I have not used point sprites myself, but I seem to recall from my readings that there are some limitations on the valid ranges of these variables, but I don't know the details.

hope this helps.
If you have the D3DFVFCAPS_PSIZE flag set in D3DCAPS9::FVFCaps, then you can use either the D3DRS_POINTSIZE renderstate or per-vertex point size data. You want the latter.

The MaxPointSize member of the caps is the one you're looking for.
Anyone know why it's limited?

On my old FF card the limit was 512, but now on my NV GeForce 5200 the limit is 8192! That's much bigger than the likely screen resolutions so everything should be fine with the programmable graphics cards! [grin]
Well the struct I use looks like this:
struct ParticleVertex {
D3DXVECTOR3 vPos;
D3DCOLOR dwColor;

enum FVF
{
FVF_Flags = D3DFVF_XYZ|D3DFVF_DIFFUSE
};
};

Can I add size into anywhere and declare it with the FVF?
My card does support using the following:
lpDevice3D->SetRenderState( D3DRS_POINTSIZE, FtoDW(1.0) );
lpDevice3D->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(1.0f) );
lpDevice3D->SetRenderState( D3DRS_POINTSCALE_A, FtoDW(0.0f) );
lpDevice3D->SetRenderState( D3DRS_POINTSCALE_B, FtoDW(0.0f) );
lpDevice3D->SetRenderState( D3DRS_POINTSCALE_C, FtoDW(1.0f) );

This is how I am doing it so far but then each particle must be rendered one at a time to allow different sizes of particles within one system.
One drawback to point-sprites is that the point-size vertex attribute is rarely supported under hardware vertex-processing. Which, quite frankly, sucks :)
-Scoot
Well thanks again guys!
This place is so very helpful.

D3DFVF_PSIZE, use a float, and bam I can have dynamically sized particles in one big VBuffer.

Although I had a few problems at first cause I kept declaring the D3DFVF_PSIZE flag after the D3DFVF_DIFFUSE flag. It seems that DIFFUSE must always be last since I've had a problem before where it was all messed up cause of DIFFUSE not being last.

Thanks
Halsafar


How can I tell if hardware supports it?
My D3DCAPS9 tells me it is supported, but does that mean software supports it?

This topic is closed to new replies.

Advertisement