DirectX and Batching Primitives
I have this city scene where I have 28 materials. What I used to do was call D3DXMesh->DrawSubset(n) for all 28 materials. This mesh buffer has an attribute, index, & vertex buffer of course. Anyway, last night I get this bright idea to do my own batching. I assumed I'd get much better performance. Problem is- there's nothing to really batch in my scene atm because the mesh data is spread across 28 materials (textures). So thats 28 different primitives thats not taking advantage of DIP I guess. Sizes of each DIP vary anywhere from like 300 vertices to thousands.
My coworker recommends I look into texture Atlas to merge all my materials to batch together primitives which sounds good.
But I wonder- why is D3DXMesh->DrawSubset() so fast then? Was it because everything was in 1 vertex/index/attribute buffer- not spread out across 28 materials. I 'assumed' they were doing the samething I was doing, calling SetStreamSource, SetIndexBuffer, SetVertexBuffer, and DrawIndexedPrimitive (DIP) using traingle lists. I can post my source code later but as you imagine nothing really wrong with it. But my FPS has took a serious dive. I am baffled how D3DXMesh->DRawSubset() could achieve so much better performance. I am hoping I just need to reboot my computer and run the city scene again but I'm fairly certain thats not it heh.
It was probably fast because you were rendering only a few vertices. How many triangles are you rendering per frame?
Dave
Dave
66,000 triangles is getting fired off to the video card every frame. These triangles are now divided across 28 materials now though. So now I have 28 different vertex/index buffers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement