This project is read-only.

PointSprites

May 16, 2009 at 12:03 AM

How do I enable PointSpritesEnabled on the graphics device through Xen?

May 16, 2009 at 12:09 AM

You'd do this by directly accessing the GraphicsDevice (using DrawState.BeginGetGraphicsDevice()).

However, if I were you, I wouldn't bother with point sprites.

They don't really provide much of a performance boost (you will almost always be fill limited, not setup limited), you can't rotate them, you can't pass data to their pixel shader via texture coords (all tex coords are autogenerated), different systems have different limits on their size, they are culled by their centre position on the xbox so can 'pop' into view, and to top it all off, older geforce SM2 cards don't support them at all.

I looked at using them for the particle system, but frankly it wasn't worth it. It really had no tangible advantage.
But don't let me stop you :-)

May 16, 2009 at 12:50 AM

How should I implement them then?  just standard quads?

May 16, 2009 at 1:01 AM

Yes.
What is it you are trying to draw?

If you only want 2D sprites, then the SpriteElement class would be your best bet. If you need 3D, then obviously there is the particle system (There are ways to override the particle displayer's to draw custom data without a particle system)

May 16, 2009 at 2:11 AM

Well, I was trying to do a Sun using a sample I found to do Sun overdraw on the world, but i can do it without point sprites.   Was more just trying to do a straight and easy conversion.  Thanks

May 16, 2009 at 3:46 AM

In that case some 2D elements will probably do just fine :-) Although I suppose it depends how complex the effect is.

Aug 1, 2009 at 10:07 PM
StatusUnknown wrote:

Yes.
What is it you are trying to draw?

If you only want 2D sprites, then the SpriteElement class would be your best bet. If you need 3D, then obviously there is the particle system (There are ways to override the particle displayer's to draw custom data without a particle system)

Hi,

I'm interested to know where to look to override the particle displayer you're talking about. I'm pretty new to Xen and I'd appreciate a nudge in the right direction :)
I need to create a 3D starfield to use as a background. I was trying to find out how to use pointsprites to accomplish this, when I hit this post.

Thank you

Aug 2, 2009 at 12:20 AM

Particle systems aren't really ideal for fixed effects like backgrounds, they are more for temporary, changing effects like smoke or the like. (There are hard limits in place to how long a particle can exist for...)

I would have a look what philippedasilva has managed, here: http://xen.codeplex.com/Thread/View.aspx?ThreadId=64170

Aug 2, 2009 at 3:09 PM

Hi Xcode,

That's exactly what I tried to achieve and I looked at both PointSprites and the Xen particle system to see if I could get a starfield I would be happy with.

But these two aren't a good option and it is largely better to use a list of custom Vertexes rendered using PointList as I explained in my thread mentioned by StatusUnknown.

The next steps however for me will be to update every frame how bright they are (I plan to use a simple texture using Photoshop generated clouds for noise) and I would like to add some sprite based big stars to get it fencier :p

StatusUnknown, for that last point, you mentionned using SpriteElements but I wonder what maths I should look at to place them on 3d as I would do with Quads or Billboards?

Thanks.

Aug 2, 2009 at 3:56 PM

Hi StatusUnknown and philippedasilva,

Great example, not exactly what I'm looking for, but it is the nudge in the right direction I needed. The example projects all stars in the same distance in a great sphere, a bit like a skybox. I need to see depth in it as I pan over it. I've got the depth in the meantime, but I would also like some stars to be bigger then other. Will I need SpriteElement for that? And how will I preserve depth with it, SpriteElement is only 2D?

Thanks.

Aug 3, 2009 at 1:40 PM

All the Element classes, such as SpriteElement should only really be used in 2D.

Point sprites would be ideal in this case, however you will find their support is inconsistent in older cards, for example nvidia FX cards don't support the SIZE output, which makes them practically useless unless you don't mind them all being the exact same size. Also you can't pass data to the pixel shader, except for colour, which *greatly* limits what you can do with them (all texture coods are auto-generated and anything output by the VS to tex is ignored)

Aug 3, 2009 at 5:54 PM

I see. Well, I'll figure something out. Perhaps creating a few billboards by myself :-), I just need a few for variation. These vertexpoints should do fine for mayority of the stars. Thanks for your help.

PS. I must say, Xen does indeed make life easy. Great job!