Ray Tracing in Games: A Story from The Other Side
Ray tracing's impact on visual art
Start your engines
At the start of both projects, a lot was unknown. During its development, the ray tracer was tested using a limited set of scenes, but none of these scenes were representative of actual game art. Scenes that explicitly make use of ray tracing features are hard to come by: Art is created either for offline rendering - and thus extremely complex - or real-time rendering, and thus lacking use of reflection and refraction. What we are striving for is scenery with typical game-level complexity, and subtle, yet relevant use of reflection, refraction, complex shadows and lighting.
The visual artists had to start with these somewhat vague guidelines. On top of that, they worked with an ever evolving engine that did not have a fully worked-out asset pipeline. Simple questions by the visual artists, like how many polygons can be used, and how many lights, are hard to answer. We simply had to try.
For both projects, a considerable amount of time was spent on preparing tools. The Outbound team added a scripting language, and integrated a physics and audio engine. The Let there be Light team worked on a lighting tool to make an artists life a little easier. Still, at the end of the project, the lack of proper tools was the biggest complaint.
Screenshot from Let There Be Light- Click to Enlarge
Screenshot from Let There Be Light- Click to Enlarge
In the past, there have been some experiments with real-time ray traced games. The most well-known project is probably Daniel Pohl’s port of Quake IV, which however does not include actual game play. Another project is Oasen, which is based on the OpenRT ray tracer. This game requires a cluster of PC’s for interactive frame rates, and is not publicly available. A version of Quake 2, rendered using real-time ray tracing, was shown by Carsten Wächter and Alexander Keller, during the Breakpoint 2005 demo party, running on a single laptop.
The aim of both Outbound and Let there be Light is to build games for consumer PC’s, using original art, and to release these for free, as ‘proof of concept’ games, showing what can be achieved right now. Let there be Light is designed to be playable on any dual core machine; fluent frame rates are achieved on a high-end consumer PC with a quad-core CPU. Rendering is done using the CPU alone; the performance of the GPU is therefore not relevant. In terms of graphical features, both games use anti-aliasing, normal mapping, bilinear filtered textures, reflection, refraction, emissive materials and a HDR rendering pipeline.
Impact on visual art
One of the reasons for starting projects based on ray tracing was the expectation that a ray tracer would require a different kind of art than a rasterizer, with different performance characteristics. In case ray tracing takes off in the near future, hands-on experience is valuable for students. This proved to be quite correct.
One thing that is different in a ray tracer is the relative insensitivity to polygonal detail. Outbound uses a scene consisting of more than one million triangles. The factor that really determines performance is the amount of screen space occupied by very detailed objects: It’s generally better to have a small, highly detailed object, than an even distribution of detail. The Let there be Light team designed low-poly scenery with some clustered detail. This resulted in very good frame rates. The Outbound team opted for unrestricted, detailed environments.
In a ray tracer, materials that require extra rays (reflections, refractions, basically everything that you want a ray tracer for in the first place) must be used with care: Large, complex reflecting objects that reflect complex scenery really drag down performance. We learned that the more ‘interesting’ objects generally should be placed in a relatively simple environment to counter this.
Light sources (or rather, shadows) also require extra rays. Arauna uses a custom lighting model, with a limited sphere of influence for each light. That way, a level may contain hundreds of light sources, as long as the overlap of light sources is kept to a minimum. And, if the shadows for a particular light source are of little importance, they can be disabled, making the light source effectively ‘free’.
Normal mapping is used heavily in both games. The reason is simple: In Arauna, the performance cost of normal mapping is virtually zero. In practice, representing some detail using normal maps instead of extra polygons actually improves performance.
Art under construction: Let there be Light: Roman Era - Click to Enlarge
Art under construction: Let there be Light: Game World Overview - Click to Enlarge
Getting a feel for what it is that makes a scene slow or fast in a ray tracer is a worthwhile experience. Designers learned (often by trial and error) that a reflective ceiling is a performance killer. Detail is OK, but not if it covers the entire screen. High resolution textures don’t hurt at all. Normal mapping should be used liberally. Dynamic lights should be used everywhere, but preferably, they should not overlap. Most designers found this experience somewhat painful, but all of them managed to deliver good art at the end of the project.