I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights.

Does my GPU speed up if I only draw one mesh over and over again? Or is only the material switching and uniform setting the main problem?

So: Should I consider going to only one mesh a 1000 times, or is it ok to have a lot of different meshes with only the same material?


3 Answers 3


If you are using OpenGL, you can use DrawInstanced. This is useful for cases, where you have one model and want to draw it many times (for example grass). In vertex shader you will get unique ID, and according to this ID you can set per model transformation (for example take it from big array of transformation).

It's really fast and useful. I think in DirectX there will be something similar.

If you want to draw separate (but similar) models with different materials, it will slow your application down. Material switching is not too cheap operation (again - I'm talking about OpenGL).

  • \$\begingroup\$ @zachamarz: I'm using jMonkeyEngine, which uses LWJGL, which uses OpenGL. I'm not sure if I can call this function. \$\endgroup\$
    – Marnix
    Jun 5, 2011 at 19:46
  • \$\begingroup\$ @Marnix: It likely encapsulates the call for you. \$\endgroup\$
    – DeadMG
    Jun 5, 2011 at 19:58
  • \$\begingroup\$ Another option, which may perform even better (given some benchmarks I've seen of how poorly both the ATI and NVIDIA drivers handle instancing in OpenGL) is to just stream all the grass meshes into a single streaming vertex buffer, and making a single draw call. That method will have higher CPU load and more pressure on bus, but may be faster none the less. As always, profile and test any optimization techniques you try. :) \$\endgroup\$ Jun 6, 2011 at 21:08
  • \$\begingroup\$ If you will try to render lot of meshes in one draw call, you can split these meshes with primitive restart index. It's really easy to use. It's also more effective than lot of drawElements commands. (but I don't know if you can use it with jmonkeyengine :( ) \$\endgroup\$
    – zacharmarz
    Jun 6, 2011 at 21:21

You should re-use the same geometry wherever possible. GPUs have hardware support for re-drawing the same meshes with different parameters. Re-using the same geometry means that you don't have to, for example, move the new geometry into the hardware registers, and that sort of thing, and it fundamentally reduces the number of calls to the GPU, which is a big bonus.


I'm not sure how it's done but I know you can send material data once for GPU and then ask GPU to draw multiple mesh using it. I know this because GameEngines usually have a flag or group which you can spicify every thing under that group has same texture and this speeds up your game(I'm saying this as written inside the manual) since you pass the material data once for as you say 1000 objects and it seems to be faster.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .