Original Post
I've been searching and reading many threads that discuss about batching. The basic concept - group and draw things together that share the same render states - seems simple enough. But, I don't see how I can make this work. Hope someone here can shed some light on this. Let's say I have n objects I'm drawing individually (d3d drawprimitive calls, and this is really slowing down the frame rate a lot as n gets bigger). They're all shaded with the same shaders, and they all have the same textures. The only difference between each one is that they have a different world transform. The world transform, among other things, are passed into the shaders. I'd like to batch all these objects together and only call drawprimitive once, but the world transform alone is making this impossible (I think.) One possible way I see making this work is to factor out all the stuff that are not common to the objects. Do the calculation on the CPU, and then write the result (vertices) into the vertex buffer. But, this seems like a bad idea (?) since doing things on the CPU might be slower than actually calling drawprimitive many times. I'm also not really sure if the factorization is always possible. And, it just doesn't seem to make sense that I'd be forced to apply transforms to the objects in software rather than giving the transforms to the GPU to deal with. I'm really stumped. How is it possible to batch similar objects together when something fundamental like the world transform gets in the way? I think I'm missing some important idea that would make batching work.