DevLog 02 - Model Loading
- Bobbie Kindt

- Sep 11
- 3 min read
Updated: Oct 19
Introduction
Before diving into deferred rendering and other modern Vulkan techniques, I realized I needed more complex test scenes. The simple viking room just isn’t enough to stress a renderer so I decided to bring in a larger scene with multiple meshes and materials.
What I Did
I’ve been playing around with Synchronization 2 and bindless rendering, but quickly noticed I couldn’t properly test them without a more complex scene. So I decided to go all in: load a proper environment with multiple meshes, textures, and materials.
VkPhysicalDeviceVulkan13Features features13{};
features13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
features13.pNext = nullptr;
features13.synchronization2 = VK_TRUE;
features13.dynamicRendering = VK_TRUE;
VkPhysicalDeviceVulkan12Features features12{};
features12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
features12.pNext = &features13;
VkPhysicalDeviceVulkan11Features features11{};
features11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
features11.pNext = &features12;
VkPhysicalDeviceFeatures2 deviceFeatures2{};
deviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
deviceFeatures2.pNext = &features11;
deviceFeatures2.features.samplerAnisotropy = VK_TRUE;After getting Synchronization 2 running, I decided to stash my bindless rendering work and focus purely on scene loading.
I found the McGuire Graphics Archive as an excellent source for test assets and chose the classic Sponza scene. To load in the scene, I settled on the glTF format and using Assimp library as my model loader. It took a lot of trial and error, but I eventually got the full scene to load at least with diffuse textures. (Normal and roughness maps are coming soon once I start adding lighting and shadows!)

Challenges & Fixes
I have to be honest that implementing this was quite the challange! I had never worked with GLTF files before, and also never had to load them in. I first did a lot of research on the library I wanted to use and then also did research on how to support multi-texture rendering. I made a lot of small mistakes which resulted in a lot of validation errors and a lot of broken models to fix. The first issues I had was not implementing my descriptor sets correctly, which resulted in not all textures being loaded in and instead of applying them to the correct mesh, being added to the whole scene.
A few examples:


1. Descriptor set issues
At first, textures weren’t being applied correctly. Instead of mapping to the right mesh, they were smeared across the entire scene. The culprit: my descriptor set wasn’t set up properly. The idea was to create a descriptor set with an array of image descriptors, but I kept:
Overloading the array
Duplicating images unnecessarily
Under-allocating the descriptor pool
Fixing these issues and messing around with descriptor sets more taught me a lot about how they actually work in Vulkan.
2. Model loading mistakes
The next set of issues came from my model loader and shaders. The shader bugs were easy enough to patch, but the real headache was my Vertex and Index Buffer logic. After a lot of messing around, I realized I wasn’t applying proper offsets, so every mesh in the scene was referencing the same chunk of vertices and indices. Once I finally caught that mistake, the Sponza scene rendered correctly and seeing it appear on screen for the first time was an awesome moment!

What's Next
Now that I can render a full, multi-mesh scene with textures, I’m ready to move forward with more advanced rendering techniques:
Deferred rendering
Vertex pulling
Bindless rendering
After that, I’ll shift focus to lighting and PBR shaders, which will really bring the Sponza scene to life.


Comments