Jump to content

  • Log In with Google      Sign In   
  • Create Account

Point Sprite Vertex Size


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 12 April 2013 - 05:25 PM

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?



Sponsor:

#2 MJP   Moderators   -  Reputation: 11367

Like
1Likes
Like

Posted 12 April 2013 - 05:33 PM

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



#3 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 12 April 2013 - 06:46 PM

@MJP: I want to do it without using Vertex Shader.



#4 MJP   Moderators   -  Reputation: 11367

Like
1Likes
Like

Posted 13 April 2013 - 12:21 AM

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.



#5 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 13 April 2013 - 12:45 PM

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?



#6 MJP   Moderators   -  Reputation: 11367

Like
2Likes
Like

Posted 14 April 2013 - 12:22 AM

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



#7 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 14 April 2013 - 01:02 AM

@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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS