• Stars
    star
    4,753
  • Rank 8,884 (Top 0.2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ’ก Experimental real-time global illumination renderer ๐Ÿฆ€

๐Ÿ’ก kajiya

Experimental real-time global illumination renderer made with Rust and Vulkan

Embark Embark dependency status Build status

Its general goal is to get as close as possible to path-traced reference at real-time rates in dynamic scenes, without any precomputed light transport, or manually placed light probes.

kajiya does not currently aim to be a fully-featured renderer used to ship games, support all sorts of scenes, lighting phenomena, or a wide range of hardware. It's a hobby project, takes a lot of shortcuts, and is perpetually a work in progress.

For more context, check out our announcement article on Embark's Medium. You'll also get to learn how kajiya connects to our rendering work, and the rust-gpu project!

image (5) Ruins environment rendered in kajiya. Scene by Crebotoly

Features

  • Hybrid rendering using a mixture of raster, compute, and ray-tracing
  • Dynamic global illumination
    • Fully dynamic geometry and lighting without precomputation
    • Volumetric temporally-recurrent irradiance cache for "infinite" bounces
    • Ray-traced diffuse final gather for high-frequency details
    • Ray-traced specular, falling back to diffuse after the first hit
  • Sun with ray-traced soft shadows
  • Standard PBR with GGX and roughness/metalness
    • Energy-preserving multi-scattering BRDF
  • Reference path-tracing mode
  • Temporal super-resolution and anti-aliasing
  • Natural tone mapping
  • Physically-based glare
  • Basic motion blur
  • Contrast-adaptive sharpening
  • Optional DLSS support
  • glTF mesh loading (no animations yet)
  • A render graph running it all

Technical details

Primary platforms

kajiya currently works on a limited range of operating systems and hardware.

Hardware:

  • Nvidia RTX series
  • Nvidia GTX 1060 and newer with 6+ GB of VRAM (slow: driver-emulated ray-tracing)
  • AMD Radeon RX 6000 series

Operating systems:

  • Windows
  • Linux

Secondary Platforms

kajiya has a rudimentary "RTX Off" mode which runs on a wider range of systems, but most of its visual features are disabled.

Hardware:

  • Older GPUs with support for Vulkan 1.2

Operating systems:

  • macOS

Dependencies

(Some) Linux dependencies

(Some) MacOS dependencies

  • ossp-uuid (brew install ossp-uuid)

Building and running

To build kajiya you need Rust.

Once Rust is installed, open a command prompt in the project folder, then build and run the viewer app via:

cargo run --bin view --release

This will compile a binary in the target/release folder, and then run it.

For a list of supported command-line switches see --help. In order to pass it through cargo to the renderer, you need to separate the cargo arguments from view arguments using -- e.g.:

cargo run --bin view --release -- --help

Loading assets

kajiya supports meshes in the glTF 2.0 format, and also has its own tiny RON-based scene format which can refer to multiple glTF 2.0 meshes.

To load either, simply drag-n-drop the .gltf, .glb, or .ron file onto the window of the view app. See the assets/ folder for a few bundled examples.

The first time a mesh is loaded, it is converted to a runtime format: the vertices are packed, and textures are compressed. The next time the same mesh is used, it's loaded from the cache/ folder.

Please note that only the roughness-metalness workflow in glTF is supported. In Blender that corresponds to Principled BSDF.

kajiya can also load image-based lights (examples). To do so, drag-n-drop an .exr or .hdr file onto window of the view app.

The loaded assets can be manipulated in the Scene section of the UI. The app state is persisted in view_state.ron.

Controls in the view app

  • WSAD, QE - movement
  • Mouse + RMB - rotate the camera
  • Mouse + LMB - rotate the sun
  • Shift - move faster
  • Ctrl - move slower
  • Space - switch to reference path tracing
  • Tab - show/hide the UI

Resolution scaling

DPI

For the view app, DPI scaling in the operating system affects the physical number of pixels of the rendering output. The --width and --height parameters correspond to logical window size and the internal rendering resolution. Suppose the OS uses DPI scaling of 1.5, and the app is launched with --width 1000, the actual physical width of the window will be 1500 px. Rendering will still happen at 1000 px, with upscaling to 1500 px at the very end, via a Catmull-Rom kernel.

Temporal upsampling

kajiya can also render at a reduced internal resolution, and reconstruct a larger image via temporal upsampling, trading quality for performance. A custom temporal super-resolution algorithm is used by default, and DLSS is supported on some platforms. Both approaches result in better quality than what could be achieved by simply spatially scaling up the image at the end.

For example, --width 1920 --height 1080 --temporal-upsampling 1.5 will produce a 1920x1080 image by upsampling by a factor of 1.5 from 1280x720. Most of the rendering will then happen with 1.5 * 1.5 = 2.25 times fewer pixels, resulting in an almost 2x speedup.

Technical guides

Known issues

  • Vulkan API usage is extremely basic. Resources are usually not released, and barriers aren't optimal.
  • There are hard limit on mesh data and instance counts. Exceeding those limits will result in panics and Vulkan validation errors / driver crashes.
  • Window (framebuffer) resizing is not yet implemented.
  • Denoising needs more work (always).

Acknowledgments

This project is made possible by the awesome open source Rust community, and benefits from a multitude of crates ๐Ÿ’–๐Ÿฆ€

Special shout-outs go to:

  • Felix Westin for his MinimalAtmosphere, which this project uses for sky rendering.
  • AMD, especially Dominik Baumeister and Guillaume Boissรฉ for the FidelityFX Shadow Denoiser, which forms the basis of shadow denoising in kajiya.
  • Maik Klein for the Vulkan wrapper ash, making it easy for kajiya to talk to the GPU.
  • Traverse Research and Jasper Bekkers for a number of highly relevant crates:
  • Troy Sobotka for guidance and mind-bending discussions about color.

Contribution

Contributor Covenant

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started. Please also read our Contributor Terms before you make any contributions.

Any contribution intentionally submitted for inclusion in an Embark Studios project, shall comply with the Rust standard licensing model (MIT OR Apache 2.0) and therefore be dual licensed as described below, without any additional terms or conditions:

License

This contribution is dual licensed under EITHER OF

at your option.

For clarity, "your" refers to Embark or any other licensee/user of the contribution.

More Repositories

1

rust-gpu

๐Ÿ‰ Making Rust a first-class language and ecosystem for GPU shaders ๐Ÿšง
Rust
6,796
star
2

wg-ui

WireGuard Web UI for self-serve client configurations, with optional auth.
Go
1,468
star
3

cargo-deny

โŒ Cargo plugin for linting your dependencies ๐Ÿฆ€
Rust
1,254
star
4

puffin

๐Ÿฆ Friendly little instrumentation profiler for Rust ๐Ÿฆ€
Rust
973
star
5

rust-ecosystem

Rust wants & tracking for Embark ๐Ÿฆ€
Rust
843
star
6

physx-rs

๐ŸŽณ Rust binding for NVIDIA PhysX ๐Ÿฆ€
Rust
646
star
7

blender-tools

๐Ÿต Embark Addon for Blender
Python
411
star
8

cargo-about

๐Ÿ“œ Cargo plugin to generate list of all licenses for a crate ๐Ÿฆ€
Rust
320
star
9

tryhard

๐Ÿ’ซ Easily retry futures ๐Ÿฆ€
Rust
200
star
10

presser

A crate to help you copy things into raw buffers without invoking spooky action at a distance (undefined behavior).
Rust
157
star
11

crash-handling

Collection of crates to deal with crashes
Rust
135
star
12

poll-promise

A Rust promise for games and immediate mode GUIs
Rust
127
star
13

rpmalloc-rs

๐Ÿ rpmalloc global memory allocator for Rust ๐Ÿฆ€
Rust
126
star
14

discord-sdk

An open implementation of the Discord Game SDK in Rust
Rust
108
star
15

skyhook

Simple Python communication system for DCC's and Game Engines
Python
104
star
16

spirt

SPIR-๐Ÿ‡น: shader-focused IR to target, transform and translate from ๐Ÿฆ€
Rust
103
star
17

superluminal-perf-rs

๐Ÿ”† Superluminal Performance profiler Rust API ๐Ÿฆ€
Rust
94
star
18

ash-molten

๐ŸŒ‹ Statically linked MoltenVK for Vulkan on Mac using Ash ๐Ÿฆ€
Rust
91
star
19

cargo-deny-action

โŒ GitHub Action for cargo-deny ๐Ÿฆ€
Shell
89
star
20

cargo-fetcher

๐ŸŽ cargo plugin for quickly fetching dependencies ๐Ÿฆ€
Rust
83
star
21

mirror-mirror

๐Ÿชž Powerful reflection library for Rust
Rust
79
star
22

relnotes

Automatic GitHub Release Notes
Rust
77
star
23

opensource-template

๐ŸŒป Template for creating new repositories
74
star
24

tame-oauth

๐Ÿ” Small OAuth crate that follows the sans-io approach ๐Ÿฆ€
Rust
68
star
25

tiny-bench

A tiny benchmarking library
Rust
59
star
26

k8s-buildkite-plugin

Run any buildkite build step as a Kubernetes Job
Jsonnet
49
star
27

krates

๐Ÿ“ฆ Creates graphs of crates from cargo metadata ๐Ÿฆ€
Rust
45
star
28

opensource

Open source processes, policies, and info
Rust
42
star
29

cervo

Utility wrappers for tract
Rust
40
star
30

tracing-logfmt

A logfmt formatter for tracing subscriber logs
Rust
38
star
31

tame-gcs

๐Ÿ“‚ A small library with a limited set of Google Cloud Storage operations ๐Ÿฆ€
Rust
37
star
32

octobors

Rust program for automerging PRs based on a few rules
Rust
35
star
33

server-framework

Framework for running network services, opinions included
Rust
35
star
34

nfd2

OS native dialogs for Windows, MacOS, and Linux
Rust
32
star
35

cfg-expr

A parser and evaluator for Rust cfg() expressions. Targets as of Rust 1.58.0 are supported.
Rust
32
star
36

pdm-plugin-torch

A tool for managing torch-variants with PDM.
Python
31
star
37

opa-policies

Contains OPA Policies for Dockerfiles, Kubernetes YAMLs, Terraform, etc
Open Policy Agent
29
star
38

gsutil

Minimal gsutil replacement
Rust
27
star
39

spdx

๐Ÿ†” Helper crate for SPDX expressions. ๐Ÿฆ€
Rust
27
star
40

tame-index

Small crate for interacting with cargo registry indices
Rust
23
star
41

fsr-rs

Rust bindings for AMD FidelityFXโ„ข Super Resolution
C
22
star
42

opensource-website

๐ŸŒ Hub for Embark's open source efforts
HTML
22
star
43

buildkite-jobify

๐Ÿ‘ท Kubekite, but in Rust, using configuration from your repos ๐Ÿฆ€
Rust
21
star
44

spirv-tools-rs

๐Ÿ›  Wrapper crate for SPIRV-Tools ๐Ÿฆ€
C++
20
star
45

emote

Reinforcement learning library from Embark Studios
Python
19
star
46

proto-gen

A protobuf generation runner/cli using tonic build
Rust
18
star
47

rymder

Unofficial agones client SDK
Rust
17
star
48

sentry-contrib-rust

Integrates crashdump reporting with Sentry
Rust
15
star
49

tame-oidc

๐Ÿงฌ Small OAuth crate that follows the sans-io approach ๐Ÿฆ€
Rust
11
star
50

tame-webpurify

๐Ÿ’ฉ Small HTTP client for the Webpurify API following the sans-io approach ๐Ÿฆ€
Rust
9
star
51

cloud-dns

A wrapper for the Google Cloud DNS API (https://cloud.google.com/dns)
Rust
7
star
52

boh

Rust
5
star
53

tracing-ext-ffi-subscriber

Simple subscriber for forwarding tracing spans to a C or C++ profiling API.
Rust
4
star
54

server-code-exciser

A program that contains grammars and functionality to remove server only code from code bases.
C#
4
star
55

gke-accelerated-xorg-example

Example project for running remote rendering on GKE
Dockerfile
3
star
56

helix-oidc

๐Ÿงฌ Helix Perforce OIDC validator
Go
3
star
57

cassini

Topology-aware distributed cache
Go
2
star
58

minwin

Rust
2
star
59

container-packer-qemu

๐Ÿ“ฆ Dockerized packer with qemu
Dockerfile
1
star
60

rustc-compile-time-regress

Rust
1
star
61

missing-symbols

Rust
1
star
62

.github

Default community health files for GitHub (https://help.github.com/en/github/building-a-strong-community/creating-a-default-community-health-file-for-your-organization)
1
star
63

toml-span

Span preserving toml deserializer
Rust
1
star