Dev Blog: Physical Based Rendering and making EVE look “Real”
The Old Problem
The fundamental question of any CGI programmer is: “What color is a given pixel on screen?” The more accurately the programmer answers that question, the higher the quality of the final picture. The essential tools for coming up with an accurate answer are of course real world physics and math. However, finding an exact formula that describes how the real world around us looks is impossible–at least with our current understanding of nature.
So what do we do in CGI? We simplify! And we have to because, at least in computer games, the images we need to calculate must be delivered in real time to fervent players desperately eager to watch “realistically” imaged spaceships explode. In such an environment, we must simplify for efficiency while maintaining as much of the realistic math as possible.
The Old Answer
In the past we determined pixel color using a formula named the “Phong Reflection Model,” which was so popular that it was built into the hardware of the first generation 3D-acceleration cards. Phong was part of the hard-wired pre-shader implementation known as the Fixed Function Pipeline. Have a look and guess why:
This model, despite being from 1973, still produces very good results. Countless games and movies have been made with it, including EVE Online.
Since its creation, many improvements have been made to the Phong model. Especially with the introduction of GPU shading languages to replace the fixed function, programmers have gained significant freedom in the generation of each pixel on the screen. But despite adding improvements like normal maps, specular intensity maps, cubemap reflections, et cetera, the end results still rely on the basic principles of the decades-old model.
The New Answer
For all its popularity, however, Phong Reflection shows its age. One of the most visible wrinkles is its complete ignorance of energy conservation, a fundamental principle of physics. This means that under certain lighting conditions a resulting pixel is much brighter than it could actually be given the amount of energy that hits it. This prevents us from showing our assets realistically.
Subsequently, we need a new and better formula to determine accurate pixel color. It should account for energy conservation and be more complicated and more realistic than the Phong Reflection Model because GPU cycles are made to be spent on better results!
In fact, we can replace the single formula with a collection of different ones, all using the same data (material properties), but with different levels of exactness/simplification. We get to pick and choose. This new collection of rendering models is called “Physical Based Rendering” or PBR.
For implementation in New Eden, we chose Schlick’s approximation for the Fresnel factor, a distribution model from Trowbridge and Reitz (also known as GGX), and a Schlick-Smith based visibility function. All in all, a pretty standard PBR cocktail when it comes to non-organic objects. To give you an idea about the new complexity of our calculations, here is just the formula for the specular.
Here are some of the results (the new PBR ship is always the one closest to the camera):
The New Problem
Having adjusted our math to emulate better the behavior of light and materials in the real world, we plug those equations into EVE and everything is suddenly perfect, right?
PBR shows the state of our assets far more accurately than the simple model we have been using up to now. We used to rely on the physically inaccurate numbers to avoid certain display problems, but now we have to tackle those issue directly. Accordingly, many assets will only be perfected through additional attention.
We are working to identify areas for improvement and determine the best courses of action to address them. In some cases we will rebake the normal maps. In some cases we will adjust the factional data. And in some cases, we will execute complete redesigns. With the implementation of PBR in EVE, we hope capsuleers across New Eden can contribute to these ongoing graphic developments while enjoying increased pixel accuracy.
Additionally, the new system allows for further improvement of our shaders. We could introduce a new material, apply dynamic dirt levels (older ships showing their age?), or generate ambient occlusion maps for sub-capital ships. And of course, there is always ship customization. By adopting a better system for determining the colors of our pixels, we have increased the options available for future feature work that realistically conveys the vision of EVE.
That is the true benefit of PBR, and the reason that we have worked to provide it in Rhea.
ISKMogul is a growing video game publication that got its start covering EVE Online, and has since expanded to cover a large number of topics and niches within the purview of gaming.