Thursday, October 20, 2016

directx - How should I setup my Minecraft-like world rendering for the best performance?


I want to know what technique will give me most fps in game. I have minecraft-like world and I need to display it. Now I have only one cube, created as VBO and if i need to display cube I just display it. But now I want to know what will be faster:



Create for each cube type VBO (even for each side of it) or to create new VBO each frame for whole mesh to display?


I am very new to subject so if there are other faster techniques let me know. Thanks in advance.



Answer



This is not a simple question - but the philosophy is simple - seek out like things and bundle them together so that the pipeline never starves for data nor stops to change gears.


Secondly, do NOT create the same thing again and again - if you have a cube, build the vertex buffer and index buffer once - use instancing, and use the world matrix to change location, size, and orientation of the cube.


If you have many cubes that never move, then preprocess them to incorporate their position in the world into their vertices proper - i.e., you are changing from project*camera*world to just project*camera


If you have many cubes that all have the same texture or material, consider bundling them all up into one vertex buffer - course this is assuming you're never going to fiddle with the geometry


Use constant buffers whenever you can - organize things so they change only when they have to - never load them with the same data all over again - sort things so that like comes through the pipeline with like


At the end of the day, your final techniques will likely be tuned to the nature of your application - you'll do what you need to do to keep those pipes flowing in the gpu as efficiently as possible


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...