Quake4 Relief Mapping

Hi… made a few optimizations to the Relief Mapping assembler shader I used for Doom3 and added depth bias to reduce aliasing on steep angles. Looks better now and runs much faster.

Also made it available for Quake4 now! Looks much better in Quake4 as the textures there are much higher resolution and normals maps covert better to depth maps than in Doom3.

So here are the two updated versions:
Quake4 Relief Mapping
Doom3 Relief Mapping

Instructions on how to apply the mod to Quake4 are in readme file included in zip and screenshots from same view with/without relief mapping are also there. For Quake4 you need to process three pk4 files for building the depth maps (in Doom3 just one).

On my new system Athlon64 4000 with GeForce 7800gt and 2 Gb RAM it plays very fast at 800x600. Needs to be in Ultra Quality mode for the TGA files to be loaded… I also want to modify the DDS files in order to run at lower quality modes… anyone would like to help on that?

Screenshots!

Perhaps you could have a look at the code that the guys that got Doom3 loading on a Voodoo card did. I believe they loaded the .dds files and saved out a smaller version that the card could load.

Screenshots are in the zip files in the screenshots subdirectory. Did you read his whole post ? :wink:

arrgh, That will teach be for being too excited…

OK made a quick video. Stills do not capture all the effect… the correct parallax is much more evident when you move around.

Quake4 Relief Mapping Video
EDITED: New link as my site bandwidth did not handle that many downloads and reached its monthly limit yesterday.

As I only applied the depth map computation to packs 10, 11 and 12 (texture folder) only static scene objects gets relief mapping. That is why all other dynamic geometry stays the same as the original game (elevators, doors, etc).

The problem with the dynamic objects is that most of them have discontinuous normal maps (many different parts put together in a same texture). This gives wrong results when processing the normal maps into depth maps. Many of them would work fine like doors but some would not look that good.

Any link for the DDS texture thing you said? Need a good DDS library for the depth map utility. Have to keep same compression and mipmaps as original files (just add an alpha channel to them).

And just one more note… relief mapping could be much more efficient if used with deferred shading. Quake4/Doom3 recalculates relief mapping for each light source. But relief mapping is constant per view and using deferred shading it could be done only once per frame for any number of lights sources (much more efficient).

That looks really great. Too bad Q4 didn’t ship like that. :smiley:

-SirKnight

Originally posted by fpo:
And just one more note… relief mapping could be much more efficient if used with deferred shading. Quake4/Doom3 recalculates relief mapping for each light source. But relief mapping is constant per view and using deferred shading it could be done only once per frame for any number of lights sources (much more efficient).
Yea, I figured they do a pass per light.They don’t handle 2 lights at a time or anything more?

PS : When I tried your shader the last time, mostly things looked the same. I don’t know if it was me or what. Secondly, the textures don’t have much detail on medium setting so it doesn’t look all that great. You took the screentshots on ultra high, right?

This mod only works in Ultra Quality mode. For now my normal2depth tool only process the TGA files (not the DDS ones). Ultra Quality loads the TGA files while all other quality modes uses the DDS ones.

So if you do not set Ultra Quality mode you will be loading the DDS files without any depth information included (all depth values will be 1.0 so you get no displace at all).

And Doom3/Quake4 renders a single light per pass repeating relief mapping calculations for a polygon as many times as there are lights illuminating it.

Nice work, Fabio. This stuff is looking scary.

OK made a quick video. Stills do not capture all the effect… the correct parallax is much more evident when you move around.
Nice… mostly.

It’s slowly becoming evident to me that these kinds of height-texture effects are never going to work 100%. And, because of the subtlety of the detail, when the approximation breaks down, it creates a sense of… strangeness about the object. If they can’t get everything 100% right, then the user will occassionally get the feeling that the world is somewhat strange. The average user may not be able to tell what is strange about the world, but they will definately know that something isn’t real.

And when you’re getting pretty close to high-detailed reality, having something being off absolutely destroys the illusion.

It’s a nice effect, but I’m would almost say that the effect falls into the space between clearly unreal and clearly real. And in the middle of that space is the uncanny valley , which is a place where I believe this effect falls. It’s very nearly real, but certain views of the environment cause it to break down (edge-on views, how shadows from other objects play on it, etc). Whereas a flat texture is considered really “broken” from reality (and therefore the imagination can infer what the texture is trying to convey), this relief mapping effect is mostly right, but sometimes provokes a sense of wrongness that is difficult to put one’s finger on.

Another way of saying it is that it looks too good when it’s working right such that when it’s reaching the edge of the approximation, it looks very wrong by comparison. The totality of the world now feels very inconsistent, because what looked nearly real before now seems quite wrong.

don’t forget that the d3/q4 game textures weren’t designed for use with that technique.
btw what’s the advantage over parallax mapping?

I know some people who fit in the uncanny valley.

Originally posted by Vexator:
don’t forget that the d3/q4 game textures weren’t designed for use with that technique.
btw what’s the advantage over parallax mapping?

It’s much preciser. Parallax Mapping works only on very few textures convincingly, such as brick walls. On almost every other kind of texture it looks quite bad. Also Parallax Mapping can’t handle such fine detail and on “steps” inside the texture the step-edge becomes very apparent because of the distortion.

About the “too real and too unreal” issue:
I think it looks great. Yes, there are certainly cases, where you still can see, that it doesn’t work absolutely real. But at least in computer games i don’t think this is a problem. Computer games have never been consistent in any way. It has always been like that, that new technologies or methods were developed, that made some part of the game look more realistic. But some parts have always been less realistic.
And even if everything seems to LOOK right, you usually pretty fast get the impression that it still FEELS wrong, because of humble animations, unsuitable speech/audio, bad AI or whatever.

It is ONE piece that can be improved. But games will always feel wrong in some kind. I don’t bother if it still feels wrong but at least looks better :smiley:

Jan.

I liked the definition of Uncanny Valley… interesting notion and I believe it is somewhat true.

But I think that art carefully made thinking about the limitations of this and other related pixel based displacement mapping techniques can achieve a good result. Look at the new Toy Shop demo from ATI they use something similar and fits well into the demo (although they use a much too simple depth map with rounded edge rocks for avoiding artifacts).

Also sampling step could be dynamic so that at steep angles more samples are taken. This could replace depth bias making the resulting image more ‘real’ as Korval says. This can be done with shader branching support available in pixel shader 3.0 for example.

Originally posted by dorbie:
I know some people who fit in the uncanny valley.
That’s the most insightful thing I’ve heard anyone say in a long time.
Seriously.
It’s sort of like the effect of falling in love with someone, going on picnics, boat trips, then…as the sun sets over a yellow meddow, she says [edit]something racist[/edit]

Yeah, there’s no escaping the on-edge flatness, but it’s well worth that small price. I’ve been playing with this technique for some time now and it can indeed work extremely well with the right textures. I’m blown away just looking at these screens… haven’t even tried the game yet (don’t really need to).

We’re all fairly accustomed to some artifacts in games. I don’t really see that as a show-stopper… necessary evil, perhaps, but not a show-stopper.

Uncanny valley is human-human thing, is it not? I don’t get that sensation when looking at a wall, for example. But human-like animations can be a bit disturbing if close, but not quite close enough.

@fpo
would you write a glsl version of your relief mapping shader? i’d like to understand how it worls and want to test it with my own models/textures… just don’t come along with those low-level shaders :stuck_out_tongue:

But I think that art carefully made thinking about the limitations of this and other related pixel based displacement mapping techniques can achieve a good result.
Certainly decisions on what to make displaced and what to make geometry could be made better to achieve a less jarring effect. But one of my main subconscious visual concerns is with shadows from external objects. The relief mapping approach simply doesn’t handle it at all under stencil shadows. It might be able to operate under depth shadows, though it would add a level of complexity to the algorithm.

And the artifact in this case is very subtle and noticable with even a slight raised floor/wall outcropping. It’s the kind of thing that a graphics programmer/artist would notice as the breakdown of an effect, but would be registerred as a non-descript oddity by the average person. It’s the kind of thing that falls into the uncanny valley for most people, where the world is slightly “off” in a way that they aren’t able to detect. And because it isn’t obvious, it gives a very uneasy feeling about the world.

We’re all fairly accustomed to some artifacts in games. I don’t really see that as a show-stopper… necessary evil, perhaps, but not a show-stopper.
Well, if you make a game that visually falls into the uncanny valley, it’s graphics will be considered worse than more abstract graphics, even if you’re modelling 80% of reality when the abstract one is only getting 40% or so. Visually, artistically, you always want to operate on one side of the valley or the other; you never want to fall into it.

Now, it may not be this particular visual effect that pushes us over into the uncanny valley (though clearly, this one needs to be massaged properly in terms of art lest its subtle artifacts cause problems). But I definately think we’re visually approaching a point where we’re going to start falling into the gap if we’re not cognizant of it.

Uncanny valley is human-human thing, is it not?
Not necessarily. That’s what the article was talking about (as it was born out of robots and androids and such), but once you start applying it to Cg, it can be applied to terrain. Granted, because people know people better than rocks, the problems are going to show up more with modelling and rendering people, but the theory is relatively sound applying it to non-humans.

I suppose this is a valid point, but only valid if realtime graphics were anywhere near photorealistic. They’re not, they’re all full of artefacts, whether it’s hard edged shadows, aliasing, pixelation from shadow maps, environment mapping approximations…the list is endless, and will be for the forseable future. So, if there are so many artefacts already, why do you think this point is relevant to relief mapping particularly?

Just one note on shadows… supporting correct displaced shadow volumes is easy, all you need to do is update the depth buffer adding the displace before you do stencil shadows (check it out on my papers including that).

The problem is that Doom3/Quake4 can not do it as it would require relief mapping to happen when it is doing the depth only pass (to get the displaced depth buffer).

So in a custom made engine (specially using deferred shading) it would work fine with stencil or shadow maps… so you can have correct displaced shadows with hard edges if you want (and it does not add a lot to the shader just a few more instructions in order to output depth value).