Lighting, lighting, lighting. Almost all of this week’s development focused around the implementation of our customized 2D lighting system and painstakingly debugging pixel shaders. We’ve known for months how essential the lighting system is in constructing the aesthetic and mood of SOS, and the development of a flexible, powerful and fast system that can operate well in our 2D/3D hybrid world was always going to pose a challenge.
The first thing that we looked at was deferred vs. forward shading, which are two different methods for lighting a scene through multipass rendering with distinct advantages and disadvantages. A quick wiki gives you the general idea, but deferred lighting became the obvious choice for us due to the necessity for lots of point and spot lights and a lack of 3D materials.
Then came shader debugging. You would think after so many years of realised potential for a shader’s functionality, there would be easier methods for developers to be able to debug their HLSL code, but as we’ve learned it is an incredibly difficult and/or tedious task. I suppose we’ve been spoiled with Visual Studio’s extensive debugging capabilities for C#, but trying to write shaders without the ability to breakpoint or output variables is like coding blind… on a Dvorak keyboard!
Both nVidia and AMD have free developer software that requires registration to use for their respective graphics cards (which is a pain as our studio uses a combination of both manufacturer’s cards), but upon trying the nVidia solution, we discovered that it required a master-slave setup so that the code and program could be run on separate graphics cards, so that was a no. AMD’s solution proved equally as difficult. Visual Studio 2013 now comes with inbuilt HLSL debugging capabilities, so we downloaded a trial edition to see if it would work (trying to ignore the multi-thousand dollar price tag if it did), but ran into another dead end when trying to use half of its features resulted in crashes (which could be attributed to the 7 year old GTX 260 we were using, but who can afford to keep 3 desktops up to date now anyway?). PIX for Windows was another standalone program that the Visual Studio 2013 Graphics Debugger was attempting to outmode, but trying to find PIX online became strangely difficult, and it seems to have disappeared without a trace since the introduction of DirectX 10. We probably gave up on the implementation of all of these competitors too quickly.
In the end, we constructed some really primitive debugging that allowed outputting different colours to different corners of the screen using the shader and gleaning our insights based on that. Hopefully we manage to find a better solution for our future shaders which will undoubtedly grow more complex.