Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

Different sized point sprites in one buffer

This topic is 4897 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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
One drawback to point-sprites is that the point-size vertex attribute is rarely supported under hardware vertex-processing. Which, quite frankly, sucks :)

Share this post


Link to post
Share on other sites
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?

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!