Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have particle system, and I want to the individual particles to take the shape of a star. Which should be faster: Drawing the 10 polygons using a flat shader, or 2 polygons (a square) with a partially transparent texture?

share|improve this question
Any answer is going to vary so widely based on hardware, your particle code, and whether the room is hot or cold as to be useless. All you can do is create test cases and measure the performance on the hardware you want to support. (This is one reason why game devs LOVE consoles, you have exactly one hardware configuration to support and optimize these kinds of things for). –  Patrick Hughes Nov 21 '11 at 23:13
Agreed. Profile it and find out! –  Nathan Reed Nov 21 '11 at 23:33
@TrevorPowell That kinda depends on what kind of star he's drawing =) Also, depending on the number of particles, this question might be irrelevant, as both methods have rather low requirements per primitive. –  Jari Komppa Nov 22 '11 at 7:06
@Trevor if T-junctions are allowed, only four triangles are required. –  Sam Hocevar Nov 22 '11 at 11:23
@Sam I feel a little silly for not seeing the four triangle solution, before. Well spotted! xD –  Trevor Powell Nov 22 '11 at 20:15
show 3 more comments

3 Answers

up vote 3 down vote accepted

10 flat shaded polygons is pretty much guaranteed to be faster than the 2 transparent textures from a GPU pov. Especially true when you don't have unified shader architecture, as you'll almost always be bottlenecked by pixel shader throughput for particle systems. Unless you're doing anything fancy, your vertex shader in this case is likely fewer cycles than a single pixel, and that doesn't even account for the alpha blend.

share|improve this answer
add comment

Two polygons with a texture is faster.


Because it is the typical way to do things. If you're working in 2D then you can just use SpriteBatch. And for 3D, here is a sample that you could reuse (one of many you could find online). By reusing this existing method and perhaps code, you will save yourself a lot of time researching, designing, and implementing an alternative system.

You'll also be saving your artists time. Making a texture is much easier than making a model, even a simple one.

... oh you meant runtime performance ...

share|improve this answer
Runtime performance? Good luck with rolling something as heavily optimized as SpriteBatch. Your argument still holds. –  Jonathan Dickinson Nov 22 '11 at 11:21
Yeah, i guess I should have mentioned that I meant runtime performance when i said faster –  Mr Bell Nov 22 '11 at 23:34
Actually that was pretty clear... I figured the subtle sarcasm was a nice alternative to the usual rant about premature optimisation. –  Andrew Russell Nov 23 '11 at 2:18
add comment

I'm just going to chime in with my POV on this.

As you mentioned in a comment, there is a 4-triangle star,

4-poly star

Now the question is whether to use this 12-vertex, 4-face star (I wouldn't use an index buffer because that would only be a savings of 2 vertices/prim the way I've constructed it here), or to use a square polygon with 2 triangles and use a texture on top.

I'd bet your horses that untextured polys will give you much better performance. But going with the textured quad is probably a better idea for the reason of flexibility alone: Using a texture gives you additional flexibility to change your mind about the shape of the object, with no runtime performance change, if you were to change the texture.

You could also use your same particle engine with different textures to achieve different effects. For example, the traditional "ball-shaped" particle will plug into your texture-based particle engine quite easily without requiring you to make many changes. So using a texture makes your particle engine easier to reuse in that way.

Addendum: T-junctions

As Sam said, the triangle shown above infamous T-junctions. Look at the big triangle in the red-star. If you shade the leftmost vertex blue and the rightmost vertex green, what color could you shade the left/right vertices of the TOP triangle of the star? The gradient will look very wrong at the T-junctions, because you'd have to guess the interpolated color at the T-junctions, and that's not going to look good.

To eliminate T-junctions, you only need 8 triangles:

8-tri star

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.