Embark Studios
Published in

Embark Studios

Homegrown rendering with Rust

If you’ve followed what we do at Embark, you may know that beyond our games, we’re also working on a creative platform. It’s a project focused fully on user-created content, and enabling players to build their own worlds and interactive experiences.

Our creative platform in the making; rendered in real time in our engine built with the Rust language on CPU and GPU!
User-created scene with automatic ray-traced reflections and multi-bounce diffuse lighting

Great visuals for everyone

Our Rust project has different requirements than a video game. It’s a platform that will enable everyone — not just professional game makers — to build new small interactive experiences. For rendering, this means working with user-generated content, and not requiring expert game developer knowledge to achieve stunning results.

Open-sourcing kajiya

A simple scene rendered with kajiya. Car model by Rust Shake.

Our production renderer

Of course, there’s a big difference between a prototype and something usable in the real world. For the renderer to be useful in production, it needs to run on devices without ray-tracing features, and support numerous gameplay-specific features. That has been an ongoing effort by Henrik Rydgård, Viktor Zoutman, and Gray Olson on our platform rendering team.

Post-process depth of field seals the deal

The technical details

When we set out to build our shiny new renderers, we wanted access to cutting-edge features offered by the latest graphics hardware. That’s where we take a different approach from what’s currently popular in the Rust community — instead of going for maximum portability, we choose to target only the Vulkan API. This still allows us to run on a wide range of hardware, without compromising on functionality.

OK, giant reflective puddles are possible too

Renderer structure

The rendering needs for our creative platform are pretty straightforward. With relatively tame scenes, we’re able to push geometry to the GPU with as little as basic frustum culling. Thanks to an uncomplicated material system, objects can be rendered efficiently with almost no state shuffling in between.

Render graph usage in a motion blur algorithm

Shaders

Thanks to our rust-gpu project, we’re able to use Rust not only on the CPU, but also for programming the GPU as well. Traditionally, GPU code is written in simplified shading (or compute) languages. While these have their advantages, the finesse of modern GPU code is increasing to the point where advanced language features begin to matter.

Unit testing a rust-gpu shader
Ruins environment rendered in kajiya. Scene by Crebotoly

The future

We hope that our efforts will shine a positive light on Rust as a viable platform for graphics, on the CPU and GPU alike. We envision a future where Rust’s accessibility, its fantastic community, and spirit of sharing make it a popular target for graphics and games, with a rich ecosystem of crates upon which to build.

--

--

Embark Studios is a Stockholm-based games studio, on a mission to blur the line between playing and making. https://embark.games/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store