Doom 3 Enhance the Experience Pt2

It is, of course, a well known fact that Doom 3 is a game which performs best when using boards by nVidia. This has left ATI fans frustrated and eager for a driver update or some other fix. Since ATI has not yet responded, a way of improving the way Doom 3 handles on ATI cards has been posted on the Beyond3D forums. According to the author, the performance increase can increase frame rate from 34fps in 1280x1024 to 48fps. Changes would, of course, depend on each individual set-up. A further suggestion from the forum is that the fix really kicks-in if vsync is enabled. Please feel free to post your experience with the fix on the MegaGames Forums.

The fix involves changing some code which can be found in the Doom 3 pak000.pk4 file. For those not interested in the technical side of the fix, an already changed file is available by following the download tab above. Extract so that the shader file goes under doom3baseglprogs. This replaces a dependent texture read with equivalent math, which runs better on ATI cards, but seems to run slower on NV boards, so only apply this if you got an ATI card.

...this should be good enough proof that ATI hardware can run Doom3 just as good if not better than nVidia, and that we can pass on all the "ATI suck in OpenGL", "ATI's drivers suck" etc. into the trashcan where it belongs.

The full, do-it-yourself, fix is as follows:

I picked up Doom3 today and let be begin by saying it's a kickass game so far. A few minuses like weapon reload (which I find add nothing to a game, except annoyance, so I don't know why many devs keep adding it to their games), but overall much above my expectations.

Anyway, to the fun part, exploring the technology.
I think I've found the source of why this game runs comparably slow on ATI hardware vs. nVidia at the moment, and found a solution to the problem.

First, open your doom3base folder. Doubleclick on the pak000.pk4 file. In the "window can't open this file .. .bla bla" dialog, go on and associate the file with an app like WinRar. With this file open in WinRar, go to the glprogs directory in the file. In there you'll find the shaders. The interaction.vfp file seems to be the main rendering shader. Altering this shader to output a constant color turns most objects into that constant color, except for stuff like computer screens etc.

So doubleclick the interaction.vfp file to open it (you may have to associate the .vfp extension with a text editor like notepad or wordpad first since we're going to edit the file). Scroll down to the fragment shader. You'll find these rows:

Code:

PARAM subOne = { -1, -1, -1, -1 };
PARAM scaleTwo = { 2, 2, 2, 2 };

Add this right below them:

Code:

PARAM specExp = { 16, 0, 0, 0 };

Now scroll down to this:

Code:

# perform a dependent table read for the specular falloff
TEX R1, specular, texture[6], 2D;

Comment out that line by adding a "#" to it, and add another line that will do the same thing with math instead, so it should look like this:

Code:

# perform a dependent table read for the specular falloff
# TEX R1, specular, texture[6], 2D;
POW R1, specular.x, specExp.x;

Save the file and close your text editor. WinRar will ask if you want to update the file in the archive, select yes. Close WinRar and enjoy about 40% higher performance in Doom3. Haven't done extensive testing yet, but my performance went from 34fps in 1280x1024 to 48fps.

Conclusion and discussion:
I don't want to complain about Carmack's work, I still consider him to be the industry leader in graphics engines. Though when I read the shader it striked me how many texture accesses it did compared to the relatively short shader, even for stuff that could just as well be done with math for a small cost in instructions. Using a dependent texture lookup for POW evaluation makes a lot of sense for R200 level hardware due to instruction set limits, but for R300 and up it's much better to just spend the three cycles it takes to evaluate POW with math instead of risking texture cache trashing with a dependent texture read, which may be much more costly, especially since the access pattern in this case will be far from linear. Also, using math improves the quality too, even though it may not be very noticable in this game.

I should point out though that I'm not sure if the constant specular factor 16 that I chose is the one that the game uses, so output may be slightly different, but if this solution will be worked into the game in a future patch, then this is easily configurable by the game so that there won't be a difference, except a lot faster.

An interesting follow-up discussion may be why this dependent texture lookup is much slower on our hardware than on nVidia. Maybe there's an architectural difference that's to blame, or maybe something else? The main point here though is that this should be good enough proof that ATI hardware can run Doom3 just as good if not better than nVidia, and that we can pass on all the "ATI suck in OpenGL", "ATI's drivers suck" etc. into the trashcan where it belongs.

Doom 3 has caused upheaval in the gaming community, especially since most players lack the necessary specs to make the most of their experience. Thanks to our readers we have traced a few ways that most gamers can enhance their experience fighting the hell-breathing monsters that are after their fellow marines.

Light at the end of the barrel

While gamers everywhere are struggling to calm their trigger fingers following the Doom 3 experience, many are already complaining about the need for more light. Thanks to a bit of duct tape and a lot of ingenuity, Glen 'FrenZon' Murphy has created the Duct Tape Mod, a solution to all our Mars vision troubles. A link to the files and a brief description of the mod is available by following the download tab above.

Cheap Cards Not Choppy Games

Another kind soul has taken pity on the poor gamers tackling Doom 3 with the Radeon 8500, 9000 and 9200 series of cards and has released a Graphics Optimization Guide, guaranteed to solve the OpenGL Blues of all low-end ATI card owners. A link to the guide is also available by following the download tab above.

Finally a kind Megagames reader, you know who you are Slijkhuis, has sent in another way to get a very definite performance boost. This guide works by releasing a lot of CPU resources and manages to do so by eliminating the need to decompress data while playing the game. According to our benefactor, there is a catch! By using the fix, you temporarily can't connect to pure multiplayer servers. You have been warned (although there is a way back)

The Guide

After installation, the Doom III Folder consists only of the doom3.exe and some .PK4 files. Those PK4 files includes the entire game (sounds, videos, textures etc.) compressed. They are normally uncompressed in mid game, which is very hard on your CPU. We can unpack them and thus take the strain of your CPU.

1. Make a copy of ALL the files in C:Program FilesDoom 3base. This is some big filage, but if you want to revert to MP without reinstalling you need to do it.
2. Unrar the following .pk4 files (just pretend they are .rar's and open them with winrar) into the C:Program FilesDoom 3base folder (each one should unrar a single folder such as textures or models):
pak000.pk4
pak001.pk4
pak002.pk4
pak003.pk4
pak004.pk4
(This one has many files, put them all in Base and overright any that apply.
3. Now delete the files above (pak000-004) or move them to another folder for storage so you can revert to multiplayer.
When you want to revert to multiplayer, restore everything you had before and get rid of the new stuff. I'm not sure if the folder maps is the same or not, so make sure you back that up.
When in the original Doom3 /base folder (that is, before the unpacking), you would have thse folders and files "maps" "savegames" "config.spec" "doomConfig.cfg" "doomkey" game00.pk4" and "gamex86.dll", nothing else.

ALSO DO THIS! If you open DoomConfig.cfg (C:programfilesdoom3base) in notepad and change (make sure to save a backup copy) seta image_cacheMegs "32" to a higher number, such as 128 or 265 (depends on RAM, use 256 for a gig, 128 for 512mb) you will see a big increase too. You also have to change the seta image_useCache to "1" and seta image_cacheMinK to approx "20480" (or higher)
There you have it, since the CPU wont have to unpack the textures, sounds, etc...there is a MASSIVE performance increase at the expense of no MP and requiring more HD space.

Please feel free to post your experiences using these fixes and Mod in the User Comments section.