Home

Awesome

zig-gamedev dev repo

The original repo spawned in July 2021 by Michal Ziulek. This is the main development repo for the zig-gamedev libraries and sample applications.

Zig is still in development. Our main branch aims to track zig nightly-ish. See .zigversion for the last known compatible Zig version for any revision.

Libraries now live in their own repositories and are consumed using Zig's package manager. Git submodules are also included in this repo for developer convenience but are not required to build. Users that wish to use the submodules instead of remote packages can replace build.zig.zon with dev.build.zig.zon.

Build and run the Samples

To get started on Windows/Linux/macOS try out physically based rendering (wgpu) sample:

zig build physically_based_rendering_wgpu-run

To get a list of all available build steps:

zig build -l

Sample applications (native wgpu)

Some of the sample applications are listed below. More can be found in samples directory.

  1. physically based rendering (wgpu): This sample implements physically-based rendering (PBR) and image-based lighting (IBL) to achive realistic looking rendering results.<br />zig build physically_based_rendering_wgpu-run

    <a href="samples/physically_based_rendering_wgpu"><img src="samples/physically_based_rendering_wgpu/screenshot0.jpg" alt="physically based rendering (wgpu)" height="200"></a>

  2. audio experiments (wgpu): This sample lets the user experiment with audio and observe data that feeds the hardware.<br />zig build audio_experiments_wgpu-run

    <a href="samples/audio_experiments_wgpu"><img src="samples/audio_experiments_wgpu/screenshot.png" alt="audio experiments (wgpu)" height="200"></a>

  3. bullet physics test (wgpu): This sample application demonstrates how to use full 3D physics engine in your Zig programs.<br />zig build bullet_physics_test_wgpu-run

    <a href="samples/bullet_physics_test_wgpu"><img src="samples/bullet_physics_test_wgpu/screenshot.jpg" alt="bullet physics test (wgpu)" height="200"></a>

  4. procedural mesh (wgpu): This sample shows how to efficiently draw several procedurally generated meshes.<br />zig build procedural_mesh_wgpu-run

    <a href="samples/procedural_mesh_wgpu"><img src="samples/procedural_mesh_wgpu/screenshot.png" alt="procedural mesh (wgpu)" height="200"></a>

  5. gui test (wgpu): This sample shows how to use our zgui library.<br />zig build gui_test_wgpu-run

    <a href="samples/gui_test_wgpu"><img src="samples/gui_test_wgpu/screenshot.png" alt="gui test (wgpu)" height="200"></a>

Sample applications (DirectX 12)

Some of the sample applications are listed below. More can be found in samples directory. They can be built and run on Windows and Linux (Wine + VKD3D-Proton 2.8+):

  1. bindless: This sample implements physically based shading and image based lighting to achieve realistic looking rendering results. It uses bindless textures and HLSL 6.6 dynamic resources.<br />zig build bindless-run

    <a href="samples/bindless"><img src="samples/bindless/screenshot.png" alt="bindless" height="200"></a>

  2. rasterization: This sample application shows how GPU rasterizes triangles in slow motion.<br />zig build rasterization-run

    <a href="samples/rasterization"><img src="samples/rasterization/screenshot.png" alt="rasterization" height="200"></a>

  3. simple raytracer: This sample implements basic hybrid renderer. It uses rasterization to resolve primary rays and raytracing (DXR) for shadow rays.<br />zig build simple_raytracer-run

    <a href="samples/simple_raytracer"><img src="samples/simple_raytracer/screenshot.png" alt="simple raytracer" height="200"></a>

  4. mesh shader test: This sample shows how to use DirectX 12 Mesh Shader.<br />zig build mesh_shader_test-run

    <a href="samples/mesh_shader_test"><img src="samples/mesh_shader_test/screenshot.png" alt="mesh shader test" height="200"></a>