40% speed increase in doom3

Off topic, but don't go too far overboard - after all, we are watching...heh.
User avatar
Posts: 1440
Joined: Mon Jan 20, 2003 2:40 pm
Location: SK Canada

40% speed increase in doom3

Postby shockwave203 » Sun Aug 08, 2004 10:44 am

this tweak is suppose to increase fps a lot. it was discovered by Humus, who works for ATI. it's from this site, though it appears to be down right now so I'll post it

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 doom3\base 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.


you can read about it here. I'm not sure if this tweak works on Nvidia hardware, but it makes a huge difference on Radeon's.

hitznrunz

Postby hitznrunz » Sun Aug 08, 2004 2:26 pm

whats the command for frames per second??

Agent-Commando

Postby Agent-Commando » Sun Aug 08, 2004 3:08 pm

Originally posted by hitznrunz
whats the command for frames per second??


Do these codes in the console. (Codes are the last word in the following entries.)


What code does Code
Save demo in .AVI format avidemo
Game benchmark benchmark
Skip to last level doomhell
Freeze everything on screen freeze
Display graphics card details gfxinfo
God mode god
No clipping noclip
Ignored by most enemies notarget
Show framerate com_drawfps 1
Full weapons and ammunition give all
Classic 1995 version give doom95
All keys give keys
Machine gun give weapon_machinegun
Shotgun give weapon_shotgun
Plasmagun give weapon_plasmagun
BFG give weapon_bfg
Chainsaw give weapon_chainsaw
Rocket launcher give weapon_rocketlauncher
Display game status status
Spawn indicated model spawn <model name>
Play indicated map map <map name>
Benchmark test timedemo demo1.demo
Set gamma level r_gamma <0-3>
Set brightness level r_brightness <number>
Toggle sound level display s_showlevelmeter 1
Set sound volume; default is 0 s_volume_db <number>
Toggle hit % to HUD g_showprojectilepct 1
Exit game quit


--------------


Model name
Cyberdemon monster_boss_cyberdemon
Guardian monster_boss_guardian
Guardian's Seeker monster_boss_guardian_seeker
Sabaoth monster_boss_sabaoth
Vagary monster_boss_vagary
Archvile monster_demon_archvile
Cherub monster_demon_cherub
Hellknight monster_demon_hellknight
Imp monster_demon_imp
Maggot monster_demon_maggot
Mancubus monster_demon_mancubus
Pinky monster_demon_pinky
Revenant monster_demon_revenant
Tick monster_demon_tick
Trite monster_demon_trite
Wraith monster_demon_wraith
Zombie wth flashlight monster_zombie_ maint_flashlight
Flaming Zombie monster_zombie_bernie
Commando Zombie monster_zombie_commando
Commando Zombie with chaingun monster_zombie_commando_cgun
Fat Zombie with wrench monster_zombie_fat_wrench
Fat Zombie monster_zombie_fat2
Zombie in jumpsuit monster_zombie_jumpsuit
Zombie eating monster_zombie_jumpsuit_eating
Zombie in labcoat monster_zombie_labcoat
Zombie missing limb monster_zombie_limb
Zombie monster_zombie_maint
Bald zombie monster_zombie_maint_bald
Zombie with no jaw monster_zombie_maint_nojaw
Skinny zombie monster_zombie_maint_skinny
Zombie with Wrench monster_zombie_maint_wrench
Zombie monster_zombie_maint2
Zombie with a pipe monster_zombie_pipe
Chainsaw zombie monster_zombie_sawyer
Skinny zombie monster_zombie_skinny
Bloody mouthed zombie monster_zombie_suit_bloodymouth
Headless zombie monster_zombie_suit_neckstump
Skinny zombie in suit monster_zombie_suit_skinny
Bald Zombie in T-shirt monster_zombie_tshirt_bald
Zombie in T-shirt monster_zombie_tshirt_blown
Z-sec Zombie with machine gun monster_zombie_zsec_machinegun
Z-sec Zombie with pistol monster_zombie_zsec_pistol
Z-sec Zombie with shield monster_zombie_zsec_shield
Z-sec Zombie with shotgun monster_zombie_zsec_shotgun

hitznrunz

Postby hitznrunz » Sun Aug 08, 2004 3:29 pm

thanks bud

User avatar
Posts: 2045
Joined: Tue Feb 25, 2003 6:19 pm
Location: Fort Bliss, TX

Postby Evan » Sun Aug 08, 2004 3:30 pm

Someone use this and tell us how it goes.
Image.

hitznrunz

Postby hitznrunz » Sun Aug 08, 2004 3:33 pm

lol..is the console the pda?

Xenius

Postby Xenius » Sun Aug 08, 2004 3:34 pm

Somebody send me their copy when you're done with it. ;)

Dakana

Postby Dakana » Sun Aug 08, 2004 3:46 pm

This WORKS! At least in my case.

I did this tweak, Enigmatic Cat's tweak, and the cache change from 20, 32, or whatever to 256.

I went from jittering (high teens, low 20's) on 640x480 on Low settings to 40+ FPS on Medium settings, 800x600. These tweaks really do work!

Oh, and one reason I'm so happy is this:

AMD 2500+
Radeon 8500DV AIW (64mb)
680mb DDR-266 or 333 (I forget :roll: )

Anyway, happy Dooming.

User avatar
Posts: 3614
Joined: Mon Feb 03, 2003 4:17 pm
Location: Ottawa, Canada

Postby Tommy Boy » Sun Aug 08, 2004 6:03 pm

Originally posted by Dakana
This WORKS! At least in my case.

I did this tweak, Enigmatic Cat's tweak, and the cache change from 20, 32, or whatever to 256.


Where do you get these tweaks from?

User avatar
Posts: 1441
Joined: Sat Mar 13, 2004 4:00 pm
Location: Philadelphia, PA

Postby CodeRed68 » Sun Aug 08, 2004 6:11 pm

Originally posted by hitznrunz
lol..is the console the pda?


You access the console by typing "ctrl, alt, ~"
Image
thanks to Spirit of Me for the sig!

Agent-Commando

Postby Agent-Commando » Sun Aug 08, 2004 6:28 pm

Wow, it works... went from 30-37fps on 1024x768, 16AF, no AA, Med. quality to 45-60fps!!!!!!!!!!!


You do tweak now!

At 1152x854, went from 25-30fps to 35-42fps. :)

User avatar
Posts: 3614
Joined: Mon Feb 03, 2003 4:17 pm
Location: Ottawa, Canada

Postby Tommy Boy » Sun Aug 08, 2004 6:59 pm

how do I associate the .vpf file with wordpad? It won't let me open it!

Never mind, I figured it out!

YEAH TOMMY :)

hitznrunz

Postby hitznrunz » Sun Aug 08, 2004 7:03 pm

ive pushed all those buttons

hitznrunz

Postby hitznrunz » Sun Aug 08, 2004 7:11 pm

the frames per second command doesnt work for me
u sure thats it

Agent-Commando

Postby Agent-Commando » Sun Aug 08, 2004 8:17 pm

Originally posted by hitznrunz
the frames per second command doesnt work for me
u sure thats it



Whoops, it's actually com_showfps 1

Next

Return to The Smokin' Room

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 39 guests