unique uniform buffer for each model

Hey guys, I’ve been a few posts on the topic of getting unique uniform buffers for models but I’ve been left with more questions than answers. I’m wanting to pass a unique model matrix for each object being drawn but am stuck.

From what I have seen people recommend using two uniform matixs. One for the view and projection, then the third for the model matrix. So I have done that. But that will only apply one model matrix to all models so I now need to pass multiple model matrix’s at once and use some push_constant (not sure what this is) as a index ID to get the correct matrix on the shader side…but I don’t know how to do this.

Could someone clarify how to pass multiple matrices’s via the uniform buffer, and then how to get the correct corresponding one on the shader side?

Thank you for reading.

P.S. This is my first forum post so if I am lacking in clarity or have not followed a guideline correctly please inform me and I will fix it.

have managed to solve this issue using two uniform buffers, one for static data (data that does not change per frame like the projection matrix and the view matrix) and one for dynamic data (this is the model matrix).

I ended up using this small guide as the backbone of the solution.https://github.com/SaschaWillems/Vulkan/blob/master/dynamicuniformbuffer/README.md