I am writing my own c++/DirectX engine. I've made the basic framework and here comes the time for optimizations.
I don't want to focus on optimizing the resources themselves right now (meshes, textures) or on instancing. I've also commented out shadows and normal mapping for that test. So it's just a "flat" problem of "how to speed up rendering that vertices?".
The meshes are fully static, loaded from files (no terrain generation involved).
I just have about 120.000 triangles with textures on scene (one shader, few models). And on my laptop I get about 20-40fps. I was able to increase fps with vsync and back-face a bit (note that camera is rotating and fps falls when all 120.000 triangles are within its range):
Still, other engines (Unity, Unreal) can render the same meshes faster on the same hardware (and Unreal does it even faster then Unity which still is better then my DirecX11/c++ implementation). How they do that? I know there are many "pro programmers" behind that engines, but they are no magicians. And some solutions should be possible to apply in my engine too (vsync was easy to apply yet it gave me a nice speed boost).
I use DirectX 11, c++. I use Visual Studio if it's important. There is very little logic involved in application, no physics, no searches etc. that could slow down the render loop.
So far I made just few optimizations:
- Dynamic/static vertex buffers where they are needed. Index buffer.
- Back-face culling.
- V-SYNC (more about removing bugs but also helped with fps a bit).
- Near/far clipping.
- Compressing textures into single texture atlas (I've not done it yet, but I am aware of that technique).
- Lowering the AA (e.g. MSAA) and resolution (but it has an big impact on render quality).
I know my hardware is capable of rendering such amount of triangles. But how to help it? My problem is that I don't know all the tricks & methods that can be used here.
If any part of the source code would be useful, just comment me (I'm not sure which parts should I post and I don't want to paste meaningless code listings). I will post the results of fps increase/decrease as I manage to incorporate new optimizations.