I'm wanting to render multiple objects on a screen and in some cases several of each object. I'm not sure what the best method of doing this is and was wanting some advice. The only way I can think of doing this is having X Command Buffers for each model I want to render and store all draw requests for that model inside, then submit them when I require the draws.... Would this work or is there a better solution?
1 Answer
Submitting Command Buffers is not a bad thing to do in Vulkan. So long as you're submitting them in logical batches together you'll find that it's plenty fast to submit tons of commands. However if you need more speed, "geometry instancing" can be very fast for drawing lots of objects. Note that you may not need to in the first place since submitting lots of command buffers is totally fine; profile first and optimize later.
Regarding instancing here are some resources:
This reference here is for OpenGL but the principles still apply.
If you want a Vulkan specific example Sascha Willems has a code sample on Github but it doesn't have the in-depth explanation as the previous link.
-
\$\begingroup\$ Thank you very much, I will take a look at this now and see how I get on \$\endgroup\$– 0xenJul 19, 2017 at 21:51
-
\$\begingroup\$ These articles are very helpful, thank you, I've managed to achieve the desired effect of rendering many models by queuing up all the draw calls in a single command buffer and using a dynamic uniform buffer to pass the required model mat4 data to the shader. \$\endgroup\$– 0xenJul 20, 2017 at 1:12