This is my third attempt to make something in Vulkan. I think I've accumulated enough knowledge and wherewithal to make something worthwhile.
This is a renderer that has Vulkan first as it's backend that I want to keep relatively low level. I think it'll expose a lot at first, and slowly begin wrapping this again in another wrapper I'll call "Shran", another Star Trek character.
Shran wrapper. Get it?
As a library just include the crate and install the vulkan SDK (need it for shader compilation via glslc and validation layers).
- Make sure the VulkanSDK/VERSION/Bin folder is in your path if this wasn't handled by a package manager (if you downloaded from LunarG's site!).
- Also remember to set up libshaderc path as described in shaderc-sys, which involves setting the path for SHADERC_LIB_DIR.
Examples require one extra step: I used to use LFS, but its expensive once people started cloning and using my max bandwidth. If i weren't sharing this I'd use Azure Devops or something, but it's on github, so I hosted the assets in gcs.
I would really appreciate that you didn't use git LFS to pull down the files. I'm not going to renew the upped bandwidth, so please use the setup if you want the asset files :).
So now you need to run setup.sh which just curls the zip and unzips it. If you're on windows use git bash or mingw to run it or something (like I did).
This readme is minimal. Cargo doc is your friend. This is far from done.
The most up to date documentation/usage you'll get is by checkout out the examples (later is better).
Sarekt can load arbitrary models, textures, and uniforms and display them.
Textures can be any image format supported by the image crate and will be converted
Only one pipeline and render pass type.
See the dependencies of this project. Seriously the Rust community is just fantastic.
- ash Rediculously good vulkan bindings with builders and rock solid velocity.
- vk-mem Solid rust wrapper around an amazing allocation library so I dont have to make GPU malloc all by myself and can get to writing Vulkan code! I fixed a bug and somehow become a contributor to this one
- vk-shader-macros Shader macros that compile GLSL to SPIR-V and include the bytes for me. Juicy.
- log Abstract at compile time logging.
- winit Platform agnostic window and vulkan context creation.
- slotmap A great generational index store, useful for handles
- wavefront_obj Model loader for obj
- gltf Model loader for GlTf
- image Loading image data.
There are more but these ones I rely on the most, please check them all out.
"Sarek" is the Vulcan father of the character "Spok" of Star Trek. The added t also makes it a portmanteu with rect(angle).
I know and I'm sorry.
All the examples that are straightforward with no params have no section here, just run'em with cargo run --example NAME
Those that have arguments just pass them like so:
cargo run --example 06_textures -- colors
This is where things finally start to get fun,there's a param to enable color mixing with the texture.
Starting with this example, the application coordinate space is right handed y up for simplicity, the ultraviolet library perspective functions correct it for the appropriate backend.
arguments:
- colors - turns on the color mixing from raw colors, a simple multiplicative color mix in the default forward shader
Here we can see the depth buffer working in action. Camera moves so you an see the 3d effect.
Flags:
- fps -- display fps
Load a real 3d model (PreBaked lighting only)
Flags:
- glb -- load glb version of the model.
- fps -- show fps
Enable mip mapping.
Enable MSAA. Does 2 by default
Flags:
- 2x -- 2x MSAA
- 4x -- 4x MSAA
- 8x -- 8x MSAA
- noaa -- turn off antialiasing.