4. ShaderCache. For TimeShift, our shader guru Denis Sladkov developed a state of the art material and lighting system (one of the first fully supporting dynamic shadow maps). Its design started right at the beginning of last year's extension, and it was amazing.
For the first time we managed to bridge the gap between the shader programmers and technical artists. Evgeniy Davydenko, our most tech-savvy artist, was excited to be able to tweak shaders in realtime and see surface properties change in the engine.
As the engine side of the technology was slowly becoming available, the artists had to start working on textures and materials right away, using our previous-gen tools. The entire texture set for the game and supporting materials had to be reconverted many times to keep up with the changes the tech team was doing.
However when the system was finally ready and the supporting shaders were written another major problem arose. We could not play the game at reasonable framerates because we did not have a shader-precompilation system.
Because shaders were compiling at run-time, the game was chugging every other frame at any decent visual quality setting (it takes up to 30 seconds to compile an average shader in TimeShift on PC, and we had thousands of those shaders). In other words, all we could do was to switch to shaders 2.0, position the camera, then switch to shaders 3.0 -- and then after a five minute pause a beautiful picture appeared.
The problem was massive. We assigned Victor Streltsov, one of our most seasoned and creative programmers, to address the issue. We hired another senior programmer, dedicated to helping Victor with that assignment. Four months later, our ShaderCache tool was born.
Think of a huge distributed computation system which is installed on all 100+ workstations we have in the office, governed by a server-based app which farms out individual shader compile tasks to the clients. Even with a system like this it took us over 12 hours to build a complete shader database for all platforms (by the time we finished, it took no more than an hour to complete this task, thanks a number of optimizations we did).
While this system was being built, however, the life of texture artists was pretty miserable. They could work with test scenes just fine, but seeing the results of their work in the full scenes was nearly impossible.
Unfortunately, even once we were able to pre-compile all the shaders for our scenes, another pretty big issue emerged. We had a few thousand unique shaders per scene, and because they were very complex -- it took over five minutes to create them all during level loading on PC.
Obviously, having the user wait five minutes for a level load was unacceptable. Also, for some hardware configurations the game was crashing while creating all those shaders.
Our lead rendering engine designer Anton Krupkin was working out a solution with NVIDIA and ATI engineers. It was another external dependency which we identified pretty late in the process. Another set of custom builds had to be made and delivered via secure channels to the hardware vendors.
Some of the problems that we saw could never be reproduced on their end because we used some specific combination of graphics cards and the drivers -- so we brought their engineers to our New Jersey office. Ultimately, thanks to the unparalleled support of NVIDIA and ATI staff, the issue was resolved and driver updates were issued on time for the release of the game.