Path Traced Vulkan Engine
- 14 Devlogs
- 79 Total hours
A redone version of a vulkan engine, this time made following a tutorial so I actually know what I’m doing!
A redone version of a vulkan engine, this time made following a tutorial so I actually know what I’m doing!
Thought I might as well push one final public update. I’ve been adding features such as planets, stars, glass, NEE, and improved performance by as much as 95% in the worst case. I am starting to use this engine hopefully for my own game, so I may update it as I fix stuff, but other than that, this will probably be my final log.
Made tracing run faster and optimizing denoiser. Ngl I kinda forgot what I spent four hours doing other than this. I think I also spent a bit of time trying to fix metals but I’m not exactly 100% sure it fixed it so…
Path tracing anyone? I still have to fix a bunch of bugs with jittering that are there and there is an animation bug, but that will be fixed with time. I also don’t know why the noise is so bad in some places, I have 1024 samples setup to accumulate. This is actually a good approach for me since this all runs at 3k fps, so almost instantly it converges to be near noiseless.
Optimized the tracing a ton. Basically, what I did was instead of making a BLAS for each model and letting the TLAS sort everything out, I moved to three blases since that removed most of the tlas overhead. In doing that, I created three types of objects, static (terrain), semi-dynamic, and dynamic (animated). So now with this smarter system in place stuff can be loaded/used easier than before with higher performance! The initial setup didn’t take too long for this, but it was a debugging nightmare since the blases kept moving/being stale so shadows would dupe or models were cutout and stuff.
Got dynamic scenes (mostly) working! Now while the code is running, models can be loaded and added. Probably will have to add blas merging for the future since each model having its own is a linear compared to logarithmic cost of combining them. Combining similar shouldn’t be hard since that is actually just modifying the root of of the animation framework. I might have like a cap of 5-10 with one being static geometry and the rest clumps of models. Still have to get removal working which shouldn’t be too bad. The hardest part was lining up all of my Vec<_>s so what I might do is combine it into a struct to organize, but I’ll leave it for now since that will probably conflict with the merging. Also, I’m planning on adding multithreading for the future so fingers crossed!
Got a bunch of PBR added to the shaders. Now has a lot of stuff so if you export more complex materials from blender or something it can parse and render them. I do still have to get transparency working, but that is much more complex than just solids tbh. For some reason my model’s animations kinda broke and only play like 60% of the animation before looping, but that isn’t the engines fault, I probably just need to make blender behave better.
Got models working!! Fully rigged and animated! I setup the framework to auto load any anims, and then they can be played from lets say the main with something like this: app.scene.animations[2].play(“Chop_Tree RT.001”);, so that works pretty well! I also implemented a pause/play/stop and fuzzy search since some of the anim names can be weird. Thanks to mesh2motion’s huge animation library and stuff. This model is custom textured by me, so I do own it. However, you may feel free to use it (with credit!) wherever. His name is Xenon btw
Got dynamic transforms working!!! You can’t see it, but that truck on the bottom is actually spinning so helicopter. This took a bit to add in, but thanks to the model system, I just had to add a transformation matrix for each one, which is done easier than said. I did have a bunch of issues with the multi bvh setup, but now that its done updating the matrices only takes about 0.02ms with the two. Might end up being more in the future with more, but definitely not bad in the slightest.
Got something really nice working: Instancing!! Basically now, when you want to start the scene up, you just call Scene::new() and then if you want to load a model into memory, just use load_model_into_memory() and you can stamp that out without reloading the model from the disc each time. Plus I added dedicated scale/transform functions that you just call on a specific model’s id (like for the first truck I loaded, I moved and scaled it with its id of 0). Basically loading models and transforming them is near effortless. Dynamic transforms next and then probably rigging!
Got a ton done towards an actual engine!! Added more model formats (glb files) and the ability to load more than one at a time! Also, textures have been introduced so if you look closely you can actually see the truck has a duramax engine label (boo! cummins is better). Shadows have been improved even more, although this screenshot doesn’t really show it too much. Next thing I have to add is dynamic vertices at runtime, which will allow me to actually change geometry without restarting the engine, and then after that, model rigs! There are a couple validation errors still (so a potential memory leak), but they only appear every couple of times the program is ran, and I really couldn’t find it, so thats a later problem.
Got some stuff done with the engine. Improved lighting with smooth normals and stuff. Also I added atmospheric scattering from one of my other shaders. Currently, the model that is loaded (although it may look not the greatest, I don’t have textures setup yet) has 8.5 million triangles and 16 million vertices. In 1440p, everything is currently running 1300 fps, with the majority of the hit coming from the scatterer as without it its a bit closer to 2300 fps.
Got a lot more done involving obj files and refinement! Now I can change the vertices on the fly, have decent indexing of them, and have raytraced shadows. Currently, on my rtx5070, in 1440p, this 408k triangle model runs around 1500fps, so pretty decent for now. I hope to lower that soon…
I had a nice devlog wrote, but it didn’t fully upload QwQ. Basically, I had to lean into AI to implement RT instead of raster due to a lack of rust tutorials for that. Spent most of the time debugging a slight misordering error that produce zero errors that caused nothing to render.
Got a triangle showing! Definately took me a while, but now I fully understand (ok like 90%) the pipeline! Also, now since I worked on my minecraft shader in the past, this will definitely look pretty good in the end. My goal of doing this engine is just because when I made my shader, I was running into performance issues due to minecraft and opengl, so this way I can bypass it all and have hardware vulkan support.