Skip to main content
GameDev.net gamedev.net
🔒 Locked

Point sprites and batch rendering

Started by gabriele farina Jun 18, 2010 at 5:03 AM 1 replies 1.2k views
Original Post
gabriele farina
gabriele farina
Hi guys,

I've a quick question for you.

I'm building this simple 2D game where I've to render a few particles on the screen behind a few other polygons. What I'm doing now is using 4 vertexes for each particle; I render the background, then i switch texture and render the particles, then I switch texture again and render the topmost polygons.

Unfortunately, as long as I'm on a mobile device, when reaching 600/800 particles the system starts to slow down as long as I'm sending too many vertexes to the graphic card.

I was wondering if it could be helpful to switch to point sprite rendering for the particles, so that I have to submit less geometry. However, as I understood, this will break my batching as long as it will require me to change not only the texture, but also the blend function and a few other rendering options.

Do you think it makes sense to try out Point sprites or the cost of switching the "rendering mode" is not worth the lowering of the vertexes ?

Thanks!
TheAverageUser
TheAverageUser
Du you call glBegin before each particle and glEnd behind each one? Do you switch textures between particles? What state changes are there inbetween particles? Before considering to re-write the "backbone" of your particle system, you should check that there's nothing else to optimize.

For point sprites you'd need to write a shader for rotating them and I'm also not quite sure about the size limits of modern video cards and drivers.. you could possibly be stuck with a maximum particle size of 128x128 or something.
Geometrian
Geometrian
Hi,

I recommend point sprites for everything particlely. It will be complicated and tricky, but the performance enhancement will be worth it. My laptop does 1,048,576 particles at 30fps this way ('course that's with a full GPU implementation).

Whichever you choose, Fetze is right. Avoiding changes of state (particularly texture and shader bindings) between rendering calls is essential. You can even avoid setting and passing matrices in software by storing particle positions in a texture and setting the vertices' position in a vertex shader.

-Ian
[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.