Sun. Jul 12th, 2020

SVMAKERS.ORG

Shenango Valley Makers

Capturing the reality of space using ray tracing in Deliver Us The Moon

Though there are arguably as many styles as there are games, there is a clear tendency in part of the industry to create games that are increasingly realistic. The degree to which we can attain this goal greatly depends on the tools that are at our disposal. Unreal Engine 4 and NVIDIA’s latest real-time ray tracing technology usher in a new age of cinematic quality in games—even for small indie developers such as ourselves at KeokeN Interactive. Our debut game, Deliver Us The Moon, derives its realistic visuals in no small part from our use of RTX. Let’s take a look at its application and practicality. 

The technology behind RTX can be used for various purposes, but in its most common application, real-time ray tracing greatly enhances both shadows and reflections. By making light behave in-game as it would behave in reality, RTX introduces a new level of intricacy and credibility to the shadows and reflections that appear in-game. One of the most striking examples of this is how reflections are no longer restricted by screen-space. Sources of light that are well outside the player’s screen-space still reflect on surfaces. Though the lack thereof may not seem apparent at first, the difference is striking. It’s one of these things you didn’t know you missed until you’ve seen it.

The floor and glass materials reflect objects outside of screen space. The blue holographic image reflected in the window is actually in a room behind the astronaut. 

Similarly, RTX renders shadows in a manner that isn’t just a semblance, but an actual representation of how shadows behave in reality. The result is a greater level of realism and believability to your game. 

A big part of implementing ray tracing is about performance. Current hardware can do amazing things, but this is only the first generation of ray-tracing hardware, which means we couldn’t do crazy things like ray-traced shadows from all lights. When it comes to lighting, we tried to keep it subtle and focus on a few spotlights that actually benefit a lot from ray-traced shadows. One thing to keep in mind is that using any source radius, source length or soft source radius in a light makes it heavier than when it’s just a point. When it’s just a single point from which the shadows are cast, the renderer doesn’t need to denoise the shadow, and the frame takes less time to render. The sad part is that ray-traced shadows are the prettiest when their source isn’t just a single point, but an area from which light originates. The increasing softness made by area lights over the length of the shadow is one of the things that make ray-traced shadows stand out and look realistic. We also decided to have our directional lights cast ray traced shadows. This gave a huge boost to realism and seems to be the ideal application of ray-traced shadows for now. All objects get sharp contact shadows and become softer the further they are from the shadow casting object.
Tech_Blog_-DeliverUsTheMoon_005.jpg

Note the individual shadows on the radio knobs. 

Real-time ray tracing is a brand new tool for developers, and as with every tool, its success depends on not just the results you can achieve with it, but also its practicality. Especially for small indie developers like us, everyday reality and limited resources dictate time-efficient tools and methods. When RTX became publicly available for developers, Deliver Us The Moon was nearing the end of its polishing phase. The game’s realistic graphics are a major spearpoint, so we knew we wanted real-time ray tracing. But implementing this technology meant going back and potentially opening Pandora’s Box. Its risk and feasibility assessment came back positive in large part because of its integration in Unreal Engine. This was a decisive factor for us. 
Tech_Blog_-DeliverUsTheMoon_003.jpg

RTX demonstrated by the astronaut’s reflection in the window and the shadows of the handlebars to the left. 

Implementing RTX after your game is practically finished means you’ll have to adjust some Materials and lighting setups. With Deliver Us The Moon, we focused on reflections, since those have the most visual impact. 

The translucency reflections required some changes to the glass master Material. The biggest change comes from less roughness and less detailed normals. Before, we had glass with small speckles, which gave it a more industrial and worn look, but when that was rendered with ray tracing, it looked “off.” Adjusting the roughness and normals yielded the results we needed. A before and after comparison is shown below. Besides the fact that it looks better, it was also needed to improve performance. Having a detailed and strongly contrasting normal means the rays traced will diverge more, which means more rays are needed to get a decent image. This, together with roughness, determines the performance impact of translucent Materials. 

Tech_Blog_-DeliverUsTheMoon_008.jpg
Detailed normals on the window shader make the ray traced reflections too noisy.
Tech_Blog_-DeliverUsTheMoon_007.jpg
Simplified normals give a sharp translucent reflection and increases the performance.

Another thing we had to look at were the amount of refraction rays. This is the amount of times a ray can travel through translucent Materials. Ideally we would want this at three or four times, since we have many windows and particles that can overlap. Sadly, that was not great for performance, which meant we had to set it to one. Then, using the latest tech from NVIDIA’s Unreal Engine 4.23 RTX branch, we could enable Hybrid Translucency. This allows objects that we don’t need to be ray traced, such as small dust particles, to be rendered via regular rasterization. The downside is that those objects also won’t show in the ray-traced reflections. 

Across all opaque materials, there were a few things we did to improve performance. Just like in translucent Materials, a lot of details in the normal map and higher roughness values are bad for performance. The most important Material node is the RayTracingQualitySwitch. It lets you say how you want a Material to render regularly, and in ray-traced reflections. We opted to not use the normals when rendering in a ray-traced reflection. Besides that, we also used a mip bias in our texture samplers to use lower-res mips, lowering the needed VRAM bandwidth. 
Tech_Blog_-DeliverUsTheMoon_006.jpg
Since Unreal Engine 4.23, the ray-traced reflections can also fall back to the reflection sphere captures after the last reflection bounce. Before that, we had to use at least three bounces to get a decent result without showing too much black. This allowed us to set the maximum of reflection bounces to one without getting big black blocks of untraced reflections, while considerably improving performance. 

Implementing new technology can often be a time-consuming task because of stability issues and unknowns. You have to be willing to take the risk and prepare for worst-case scenarios. But even in Early Access, we went through the implementation process with relative ease. This was crucial for Deliver Us The Moon’s tight schedule, and we believe it represents a pivotal moment for RTX. Because of Unreal, ray tracing is not only accessible to a select group of high-budget industry titans, but also to small-sized teams with limited budgets and workforce. 
Tech_Blog_-DeliverUsTheMoon_001.jpg
In conclusion, we use ray tracing to support Deliver Us The Moon’s realistic graphics. Naturally behaving shadows and reflections allow us to further improve the realistic style that makes our players so enthusiastic. But it should be noted that the technology has similar benefits for games that don’t aim for realistic graphics per se. Whether your game is realistic, heavily stylized or comic-styled, the efficiency and ease-of-use of ray tracing allows you to set up a high-quality lighting scenario without having to bake everything down, freeing up time for you to focus on other parts of the game. Everybody wins when you need to spend less time getting better results. The technology yields incredible results and is bound to set the stage for many games to come. We are eager to put it to use in our next games. 
 

Go to Source
Author: KeokeN Interactive Technical Artist Daniel Torkar and Technical Level Designer Kevin van Schaijk