Sign in to follow this  
Grain

Large amount of small shapes, drawing effecently

Recommended Posts

Grain    500

I have a large amount of very small shapes(most under 10 vertices) that are created and destroyed constantly.  Many of the shapes are just repeats and there are only a small number of shape types, but they all move and rotate independently. Think Geometry Wars style game.

 

Would Vertex/Index Buffers be most efficient way of handling this? Should I have 1 large buffer that points are added to and removed from constantly, and the objects simply hold a reference to the points to update their positions? Or have a smaller buffer with only one of each type of shape and each object can hold a different translation matrix for drawing the shape at the proper location and angle? Or should each object be given its own buffer from a pool of preexisting buffers. 

 

Are  Vertex/Index Buffers not even the best choice in this case?

Share this post


Link to post
Share on other sites

I'm in the same situation you are. As an example, I use cubes. I gather all vertices and indices from each cube and store them into a SINGLE vertex buffer. Doing this will help a lot with frame rate. I wouldn't use hardware instancing if you're going to be updating the objects frequently, but I'm only saying that based on my project. I don't know what kind of shapes you're using so it could be helpful. I've never used hardware instancing so don't take my word for it. In my opinion, storing everything in a single buffer is the way to go 

 

And as Norman said, brute force could work best for you. If objects go outside the screen, just remove them. Drawing each object individually would give you easier control over how each object is interacted with, but too many objects will kill your FPS. I had 30,000 vertices with 55-60 FPS. It all depends on how many objects you draw.

Edited by burnt_casadilla

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