Hardware Instancing vs BatchModel

Apr 20, 2009 at 4:04 PM
I'm looking to re-draw the same Model over and over again (a bunch of trees) and looking through the tutorials I'm guessing I want to use either Hardware Instancing (Tutorial 16) or the BatchModel (Tutorial 24) to get the best performance.  I was just wondering what the main difference between to two are and which one I should use for something like drawing a lot of static trees?

I've tried using the BatchModel to do it and it seems to affect the frame rate quite badly (unless I'm doing something wrong, which is highly possible!)

Thanks in advance.
Coordinator
Apr 20, 2009 at 11:28 PM
Edited Apr 20, 2009 at 11:41 PM
Internally BatchModel does use hardware instancing where possible. Provided you are drawing the BatchModel once per frame and each BatchModelInstance once, it should run efficiently.

However...

I have also noticed that certain combinations of rendering, on certain video cards (nvidia) can cause hardware instancing performance to go down significantly. I'm honestly not sure what is doing it.
The simplest way to get this to happen, is using the BatchModel tutorial. Move out to show all the models, turn on the debug overlay, rotate the camera till they are all offscreen, then rotate back - suddenly the frame rate will be less than half what it was. I honestly have no idea what is causing it. (It runs perfectly fine on the xbox)

Instancing works best with complex models. If you are only drawing two triangle trees, then there are more efficient ways to render (such as using shader instancing).