Jump to content
  • Advertisement
Sign in to follow this  
Medo Mex

Point Sprite Vertex Size

This topic is 1920 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'm creating multiple point sprites per draw, for example: 1000 point sprite per draw.

 

I can set all the point sprites size by setting D3DRS_POINTSIZE in device->SetRenderState()

 

How do I set different size for EACH point sprite?

Share this post


Link to post
Share on other sites
Advertisement

You can output a float from your vertex shader with the PSIZE semantic. This will override what you specify for D3DRS_POINTSIZE.

Share this post


Link to post
Share on other sites

Why? There's no performance advantage to using fixed-function, since it's just going to be emulated in a shader (which may well be slower than a vertex shader that you've authored).

Anyway if you really don't want to use a vertex shader, I think you can use PSIZE as a vertex element.

Share this post


Link to post
Share on other sites

The reason is that I'm creating Particle Editor and I will be setting this value in the emitter properties.

 

How can I change the following to add PSIZE?

 

struct CUSTOM_PARTICLE_VERTEX
{
       D3DXVECTOR3 p;
       D3DCOLOR color;
};

Also, what FVF should I use for rendering?

Share this post


Link to post
Share on other sites

What does a value being in the emitter properties have to do with using shaders?

I'm going to be blunt here: fixed function is a waste of time. All available hardware supports shaders, and uses shaders under the hood to implement the fixed-function feature set from DX9 and earlier. There's absolutely no reason to learn it, and there's no reason to use it in any new project. Anything you can do in fixed-function can be done in shaders, and probably more efficiently since you can tailor it to your exact needs.

FVF codes are outdated cruft from the pre-DX9 era. If you're set on using DX9 then you should at least use vertex declarations. They completely replace FVF codes, and offer functionality that can't be used with FVF codes (for instance, the aforementioned PSIZE). In your case you would add an additional float to your struct for storing the point size, and then you would specify a D3DVERTEXELEMENT9 with D3DDECLUSAGE_PSIZE

Share this post


Link to post
Share on other sites

@MJP: The problem is that I don't have experience with shaders, I'm not even sure if I should write shader codes myself or use a software to generate shader file.

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!