View Full Version : Doom3 with Relief Mapping

05-25-2005, 11:14 AM
Just modified Doom3 shader (interaction.vfp file) to use Relief Mapping. You can check out the results in the following video:

Doom3 with Relief Mapping Video (http://fabio.policarpo.nom.br/videos/Doom3_ReliefMapping_Video.zip)

As the game does not include depth maps I also created a tool to process all game normal maps and generate the apropriate depth maps. I store the depth maps in specular map alpha channel (as normal map blue and alpha channels are useless with the DXT5 compression where X and W components are wapped and Z recalculated).

It works great at many places but will break at some gemetry where the polygon edges do not have depth zero. If depth maps wore manualy created this could be fixed but my tool is automatic and game normal maps wore not created for this type effect. Anyway it is a nice mod and intresting art to test my Relief Mapping shader idea.

And yes it does run real-time and you can play the game with all geometry using Relief Mapping. Get around 50 fps here in my P4 HT 2.5 with AGP 4X and geForce6800GT.

It could be more optimized as relief mapping changes only per view. For now it is calculated for every light (relief is recalculated many times per view, once per light). Could be done once per frame and have all lights share the same relief calculations stored in a texture for example (deffered shading). But this is not possible with current Doom3 render pipeline.


05-25-2005, 11:38 AM
Awesome work, again!

05-25-2005, 12:46 PM
Nice test ! :)

05-25-2005, 01:05 PM
Wow...do you have a patch or something :p id love to see it in action.

Unbelievable...when i first saw it i expected tonnes of artifacts, like with the parrallax mod.


05-25-2005, 01:43 PM
That is so awsomely amazing I just had to register and tell you this:

That is so awsomely amazing.

05-25-2005, 03:37 PM
Argg... stop stop! you are making the rest of us look bad!

Really REALLY cool demo...

05-25-2005, 06:05 PM
any chance of a few screenshots? (for those of us with dialup)

05-26-2005, 12:00 AM
Extremely awesome!

I'm also surprised that it runs 50 fps on a GeForce 6800 GT. Looks really practical and robust. I can hardly wait to see how it actually matches up with Doom 3 environment and thus the coming G70/R520-gen PC games.

Anyway, when is the public release of the MOD? :)

05-26-2005, 12:28 AM
:eek: wow That's great man! I once modified the interaction.vfp to add parallax mapping, but this is just another league!
Can't wait to try it!!!
Is there a way this will work on a R9800?

05-26-2005, 06:08 AM
Hi again... thanks for the complements and yes I have some images and the mod here:

Doom3 with Relief Mapping mod and screenshots (http://fabio.policarpo.nom.br/files/Doom3_ReliefMapping.zip)

Use htm files to view the screenshots and move mouse in/out image to switch from original and relief versions. And make sure to READ the README file... important instrictions there... 50fps at 640x480 resolution :rolleyes: .

In video I just got the places where I found to look better anyway. Expect to see bad areas where depth at polygon edges is not zero (white). It can be fixed by editing the depth maps manually but will be too tedious (too many maps).

Need to find a way to store depth in normal map (disable the x-w swap or normal map compression). Would be much better and more efficient to have the depth in blue or alpha normal map channel. Anyone knows how to do it?

Tried following cfg file options but seams nothing changes with them. Anyone knows specifics on the following parameters:

seta image_usePrecompressedTextures "0"
seta image_useNormalCompression "0"
seta image_useAllFormats "1"
seta image_useCompression "0"

05-26-2005, 10:45 AM
this technique (and its kin) is the biggest graphic advancement of the year. up there with shadowmapping/bumpmapping
how well does it handle the stencilshadows (shadowmaps) in the first screenshot, various things look brighter for some reason

05-26-2005, 11:14 AM
There is a blinking light there in the background and between the two screenshots I got it on/off by mistake... forget about that.

One nice things I want to try is outputing depth correct values (write to OUT.depth in shader). This makes shadow boundaries follow the relief nicely allowing correct shadows over the displaced geometry.

05-26-2005, 11:49 AM

Awesome work! On GF 6800 Ultra it is playable even on 1280x1024. This is excellent...


05-26-2005, 12:17 PM
Hi Dude!

When I drag and drop pak004.pk4 onto normal2depth.exe nothing happens. The app runs but creates no output ?

What am I doing wrong :)

05-27-2005, 03:24 AM
I believe this drag&drop technique only works on 2000/xp, so you must be using 98/95/ME! Ugh!

05-27-2005, 04:16 AM
Originally posted by knackered:
I believe this drag&drop technique only works on 2000/xp, so you must be using 98/95/ME! Ugh!I'm using XP SP2...

05-27-2005, 04:40 AM
Hi pocketmoon... you can use the command line option. Open a command promt and go to the tool folder. Then type:

normal2depth.exe c:\doom3\base\pak004.pk4

After processing all normal maps you should see all specular maps including depth in alpha channel at c:\doom3\base\textures\

But game must be in ultra-quality mode so you can see the relief mapping at work. It can be done for the high-quality mode but then we should process the dds files and not the tga ones... maybe for the future... should run faster at high-quality I gess.

06-01-2005, 04:39 AM
It does not work for me. When i load a map i can see
black screen, i can see only the flashlight.
My configuration is:

Doom3 1.3 + ROE
Win XP sp2

Asus GeForce 6800GT (Forceware 71.84), P4 2.8Ghz, 1Gb DDR400; No overclock!

i did all the steps in the readme file carefully


Java Cool Dude
06-01-2005, 05:38 AM
[Totally Offtopic]
Anyone can see what Master FPO :D looks like if they flip on the contributors page in GPU GEMS, I know I did :p
[/Totally Offtopic]

06-01-2005, 06:43 AM
I Have the same problem as Mr Pink

Do we think it's a 1.3 patch issue

I have two 6800gt SLi Configuration though i can't see how that would make a difference.

Mod looks soo GOOD i just wanna try it out on me system and see how playable it is lets try and find a solution PLEASE!! :confused:

Cheers ;)

06-01-2005, 06:57 AM
Ok fixed it. Someone told me the line:

OPTION NV_fragment_program2;

was not needed and without it nv5xxx cards would also run it. So I removed it without testing.... too bad as it does not work without it.

So I included the NV_fragment_program2 dependency again (only works on nv6xxx hardware!!).

Please redownload the mod and it all should be fine.

Also please someone there with a SLI machine can you post how fast does it go with dual GPU configurations? Should be faster and maybe you can use 800x600 instead of low 640x480 resolution.

06-01-2005, 11:30 AM
it works fine now!
thanks man! :)

06-01-2005, 01:21 PM
I just downloaded the modification, followed the instructions exactly, and am having the same black screen problem. All the textures seem to be totally black and I can barely see where I'm going.

My system specs:
Athlon 3200+ / 1GB DDR400 / nForce4 Ultra chipset
ATI Radeon X800 XT Platinum Edition (256MB)
Doom 3 1.3 patched

06-01-2005, 01:31 PM
the shaders require a geforce6 card

06-01-2005, 05:50 PM
So it won't work with ATI at all... :p Crap.

06-02-2005, 05:10 AM
Also please someone there with a SLI machine can you post how fast does it go with dual GPU configurations? Should be faster and maybe you can use 800x600 instead of low 640x480 resolution. No way to get an improvement on any OGL application with SLI nowadays ... waiting for newer drivers ...


06-02-2005, 10:18 AM
No criticism to fpo, but I don't think the doom3 environment and textures do anything to show off this technique. I've spent a good half an hour walking around various old save points I've got lying around and it doesn't add much at all to the visual experience, which is mad because it should be dramatic. The environment is perhaps too dark and cluttered, don't know what it is really but I'm not as awe struck as I was by fpo's little demo progs.

06-02-2005, 02:43 PM
I felt the same as knackard. I did notice a lot of surfaces had a wavy look to them...quite strange. But I'm sure it's just b/c the art for doom 3 was not created with RM in mind, just plain dot3. Where as the demos fpo created were setup just for this technique so it's no wonder the demos look more impressive. Although I did notice a few spots in doom 3 where RM made it look better.


06-02-2005, 03:52 PM
Yes many of the depth maps are not good... but this is my converter's fault. If you browse the generated depth maps (in specular map alpha channel) you will notice most of them have problems. But some parts in game look good with the mod (like the ones from my video and some others)... if we had perfect depth maps from original geometry it would be a different story. Maybe creating a new demo map using original textures with depth maps would make it look good.

Have to work more on the normal to depth converter. Try to remove those terrible artfacts.

06-02-2005, 08:23 PM
A simple unsigned binary triplet normal representation cannot represent a flat surface where the vector equals the normal.

If you derive a height map from the gradient in such a map then it will inevitably produce a slope for any 'flat' normal map.

You're right that this is entirely because you're producing the height map without the original content. The right place to add this is the art path.

Java Cool Dude
06-02-2005, 10:21 PM
A neat thing would be to get in touch with THE man (read John Carmack) and see if you guys can work something out.
I've probably been reading a lot of fairy tales as this could never happen in real life :rolleyes:

06-03-2005, 03:59 AM
Do not think it will ever happen... they are very conservative with their game art material (it is very expensive to generate all that good art and letting other people use it would be like giving money away).

Sent them an email asking permission to use a single image from the game comparing a view with and without relief mapping in a chapter I'm writing about the idea for shaderx 4 book (also using deffered shading with relief mapping and other things)... but got no answer so far.

Without permission I can not use the screeshots from the game in a publication (ok to show on iternet I gess).

06-03-2005, 11:35 AM
FPO, use the screenshot - if anyone asks, say knackered gave you permission.

Java Cool Dude
06-03-2005, 12:47 PM
Originally posted by knackered:
FPO, use the screenshot - if anyone asks, say knackered gave you permission.I'm stand right with you on that one knackered, go for it FPO :D

06-03-2005, 12:49 PM
Thanks knackered but the publishers will never let me use material without permission even though the contract tries to move all legal responsibilities to the authors.

Not that I believe something could happen to me as I'm not in US (and here in Brazil things are different). But I do not want to do anything other people might consider an abuse to them or to their rights. I will try talking to the publishers maybe they can resolve it by phone for example... but I'm running our of time for final text.

But if nothing else works I might just use it there and forget about it :rolleyes: .

06-03-2005, 01:10 PM
You should send an e-mail to Todd Hollenshead, he is in charge of that kind of stuff. His e-mail is <e-mail removed>. Make sure you put a meaningful subject to the e-mail so that he can see it right away.

06-03-2005, 01:19 PM
Yes re-sent it to him... hope he reply me by next week. Used a good subject, hope his spam filter lets me trough.

06-03-2005, 03:08 PM
I've actually had best luck contacting id through Todd. Also that one programmer at id who runs the iddevnet.com site was good about getting back to me a few times. I forget his name ATM.


06-04-2005, 03:11 AM
Already got a reply from Todd, he said it is ok to use the screenshot. Excelent! Will just add a copyright notice on the text. Thanks for his email.

06-05-2005, 05:57 AM
Originally posted by fpo:
Already got a reply from Todd, he said it is ok to use the screenshot. Excelent! Will just add a copyright notice on the text. Thanks for his email.No problem, I'm glad they let you use their stuff :)

PS: What happened to Paralelo Computação?