Jump to content

  • Log In with Google      Sign In   
  • Create Account


Large amount of small shapes, drawing effecently


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
3 replies to this topic

#1 Grain   Members   -  Reputation: 431

Like
0Likes
Like

Posted 27 July 2013 - 01:54 PM

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?



Sponsor:

#2 BigGiantHead   Members   -  Reputation: 177

Like
1Likes
Like

Posted 27 July 2013 - 02:06 PM

You should look into hardware instancing in Xna. You'll find a huge ammount of tutorials online.

Co-Founder of Tesseract Interactive.

Check out our project Excubitor on http://excubitorgame.com and http://www.indiedb.com/games/excubitor


#3 Norman Barrows   Crossbones+   -  Reputation: 1968

Like
1Likes
Like

Posted 28 July 2013 - 08:18 AM

start with brute force (just draw them all), and if its not fast enough switch to hardware instancing, unless you already know brute force won't be fast enough.


Norm Barrows

Rockland Software Productions

"Building PC games since 1988"

 

rocklandsoftware.net

 


#4 burnt_casadilla   Members   -  Reputation: 423

Like
0Likes
Like

Posted 29 July 2013 - 08:22 PM

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, 29 July 2013 - 08:25 PM.

If you see a post from me, you can safely assume its C# and XNA :)





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