fastest way to draw lots of simple mesh as possable

Hello, community.

I want to make “as many defined shapes (meshes) as possible” within the “scope of creative expression”.
All the meshes share a static texture.
(for example, star, hexagon, square, circle… etc)

Perhaps the answer I’m looking for is that in the pictures below, multiple meshes “do not care about each other’s area”.

What are the “ways” to implement this?

Have a look at “Instancing” meshes :wink: (drawinstancedprimitives)

If you want ot create this kind of atlas, I dunno if drawinstancedprimitives is the way to go.

1 Like

Hi Alkher, thanks for fast reply :smile:
ill try it <3

Instancing might be useful here, but it depends on what level of freedom you want and the scale of your levels. If you want to subdivide the image in the same way (same uv’s), but have different deformations you can use instancing to pass the uv’s only once and the specific data (positions) in another vertex buffer. That will only be good for performance if you draw a ton of one texture at a time though. I don’t think this will be very beneficial. If you want different subdivisions you can’t use instancing.

In that case there are no really tricks or shortcuts to get a performance boost out of this. Just fill up vertex and index buggers and call one of the DrawPrimitives methods in GraphicsDevice. One possible optimization you can do is to batch vertices for instances that use the same texture. That way you can reduce the number of draw calls a bit.

1 Like

thanks for reply!

What I want to create is 2D-based and has a close relationship with flat design and motion graphics.

so this always will use just one static texture.

thank for explain for this problem :smiley:

If you use a texture atlas hat’s even better, in that case you can batch all vertices together :slight_smile: