-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to render multiple objects to one image #38
Comments
Hello and nice to meet you! First of all, remember that I'm not an expert in Vulkan, so if you need help or want to learn more, consider joining the Vulkan Discord Server or the Vulkan Discord Server. I suppose you're new to Vulkan and that you did or saw a tutorial that only render a single mesh, so I'll try to explain how to render more than one mesh. The light rendering is a more advanced topic, that I still don't know well, and you probably want to study how to implement a Forward Rendering or a Deferred Rendering structure. So, first of all, everything that you want the GPU to draw must be in a Command Buffer. The Command Buffer (I'll call it CB) contains commands that can be submitted to a Queue (and so to the GPU). The example you have seen probably has a small CB, that's built only one time and load only one mesh. This because if you want to add/remove stuff to draw, you must rebuild the CB. It's completely up to you when or how frequently rebuilt the CB, depending of what you need to achieve, because remember that's an heavy operation. So, about my engine: the parts you want to see are probably these:
Remember that mine is like Remember also that you need to call CB functions such as Hope this helped you, please tell me if you have more questions about this. Summary of important things:
(See the Vulkan Doc page to read more...) |
Thanks you reply! There is my understanding about how to render multiple objects from your code:
And the gui render, i found you are using |
HHello again! So, about the main CB:
The UI is a bit different, because again, when the UI change the Command Buffer may change. If you want to note how it works, this Sascha example contains the minimal stuff to draw the UI, and you can see stuff better in there. That example use a single CB and rebuild it every frame, my engine use a third CD that's rebuilt on background (in a thread) every frame (see wiki). The basic concept is this, for every frame:
Then, as i said, i use three CB: two for the meshes and one for the GUI, so for one frame i submit both the meshes-CB and the UI-CB to the Queue. Again, this is totally up to you, you can use a single CB for everything or 100 different CB. The example i linked above for the UI (that i really suggest you to look at) use a single CB but do exactly the same steps mentioned above here. Hope this helps you to understand the basics, do not make too many steps at time because it's very confusing, do small things every steps and you will understand better. |
Thanks again! i'm creating my own game engine now for understand the vulkan, maybe we can talking on the telegram or icq, because my phone cannot register the Discord : ( |
Sorry but i don't provide personal support on Telegram or similar 😅 |
all right, but thanks, i will do more learning.By the way, maybe you can provide a cmake version : ) |
Good luck then! I know, sorry, i don't know cmake well enough to move the project to cmake but that's something i could do sooner or later ^^ |
I'm a newbie to vulkan, i read your code, but there is so many jump between the functions. The most one i cannot understand is that how to render multiple objects to one image, such as skybox,ball and the light.
The text was updated successfully, but these errors were encountered: