0
\$\begingroup\$

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?

\$\endgroup\$
1
\$\begingroup\$

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: https://learnopengl.com/#!Advanced-OpenGL/Instancing

If you want a Vulkan specific example Sascha Willems on Github has a code sample but it doesn't have the in-depth explanation as the previous link: https://github.com/SaschaWillems/Vulkan/tree/master/instancing

\$\endgroup\$
  • \$\begingroup\$ Thank you very much, I will take a look at this now and see how I get on \$\endgroup\$ – 0xen Jul 19 '17 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\$ – 0xen Jul 20 '17 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.