It has been a long time since my last post here. Many things have changed, most notably the language in which this devlog is written. I considered switching to English a few months ago, when my blog was still active, but I didn't found enough reasons for that.
Now, the situation is different. In September I joined FreeSpace Source Code Project. The main goal of this project is to keep FreeSpace, almost 10-year-old game, up to date, by improving every aspect of the game. It wouldn't be possible if Volition, Inc., the studio that created FreeSpace, hadn't given fans the whole source code in 2002. Since then, it is an open source project, not completely free (it can't be sold or used commercially in any other way), though. The website of SCP is a bit outdated, but you may find many interesting things on one of the biggest FreeSpace forum: HardLight.net or on the Polish FreeSpace website: FreeSpace.pl.
I've started contributing to SCP by improving the way in which shaders source code was stored and managed. There were dozens of *.sdr files containing shaders with different features implemented. The ones with normal mapping, the ones with environment mapping, the ones with glow maps, etc. Each possible combination of feature had to be in a separate file, that's why SCP developers ended up with over 60 (if I recognize correctly) shaders, which shared very much with each other.
I decided to introduce subtractive shader. This technique consists in creating one shader (one vertex shader and one fragment shader to be exact) with all the features implemented. Then according to the current needs parts of the code can be enabled or disabled using GLSL preprocessor instructions #define and #ifdef.
. It was easy to implement in the rendering engine and only a bit harder to create one unified shader. I don't want to describe here in details how shaders are managed in FSO, because it is also improved by my next patch which I will describe soon in my next post.