Sign in to follow this  
Medo Mex

Point Sprite Vertex Size

Recommended Posts

Medo Mex    891

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
MJP    19786

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
Medo Mex    891

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
MJP    19786

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
Medo Mex    891

@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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this