Skip to main content
GameDev.net gamedev.net
🔒 Locked

How does the doom3 engine render soo many lights

Started by redeemer90 Aug 4, 2005 at 7:35 AM 20 replies 4.9k views
Original Post
redeemer90
redeemer90
Hi, I was just wondering how the Doom3 engine renders so many lights in a single frame with bump mapping and specular highlightting. Ok, lets take my card -> ATI Radeon 8500. It has 8 texture stages. So 3 texture stages will be used for diffuse mapping, normal map and 1 for the specular map. Then each light will use texture stage for the light normal and 1 texture stage for the half angle vector for specular mapping. I created a doom3 map with 5 lights touching a single face and all the lights were rendered perfectly ok. The only way I can think that this is hapenning is if Doom3 does multiple passes per frame. So my question is -> Does it? and if so, how does it manage to keep up such a decent frame rate? I am very curious as to how Doom3 manages this. Thanks, - Sid
Chris81
Chris81
Why would you need a texture stage for light normal and specular half vector? Right now I just use a uniform constant for the light normal, and calculate the half in the shader. Since specular is view-dependent, when doing per-pixel lighting you have to calculate the half vector in the pixel shader anyway.

Anyhow, I have read some lighting tricks in shader books that show how do to 4 lights per pass. I imagine it's something like this.
Rocket05
Rocket05
doom3 does take multiple passes per frame, in fact if i remember right it takes an extra pass or two -- per light.
"I never let schooling interfere with my education" - Mark Twain
dave
dave
Shame it still looks horrible though.
Sr_Guapo
Sr_Guapo
Quote:
Original post by ace_lovegrove
Shame it still looks horrible though.


nah, it looks fine, it is just so damn dark you can't see any of the greatness. That and the gameplay sucked...
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Toji
Toji
The key thing to remember about Doom 3 is that very few of the lights overlap each other much. The engine is designed so that during each light pass only the polygons that are affected by that light are drawn, so in essence if a poly is only being hit by one lights it only takes one pass to draw. (Well, yeah, there's multiple passes for specular and such, but you get the idea)

Therefore, while it sounds like you're redrawing the entire scene 3-4 times per light, you're mostly drawing the scene 3-4 times total, with certain polys drawing a bit more due to light overlap. Using that logic, it almost becomes cheaper to fill a room with 50+ non-overlapping lights rather than use 3-4 big overlapping ones.

//Slightly unrelated rant

Oh, and stop complaining about how bad Doom looks. It looks great, especially considering the hardware it runs on, and you know it. I hate people who bash game X because it's the "fashionable" thing to do. It's a good, solid engine that if nothing else is slightly behind it's time. In any case, I have much more appreciation for the D3 engine than something like HL2.

(Now the gameplay... that's a different ball of wax all together. ^_^)
// The user formerly known as Tojiro67445, formerly known as Toji [smile]
zedzeek
zedzeek
graphically doom3 is still the most advanced game that exists as of today on the pc
if anyone has a differeing opinion ild like to see links to a demo
reltham
reltham
Far Cry is more advanced.
Moe
Moe
Quote:
Original post by skittleo
But all three of those games are top notch.

Agreed, and I say we leave it at that.

zedzeek
zedzeek
Quote:
How can you compare Doom 3 and HL2 and Far Cry? They take place in wildly different environments! Now on a realism scale, I would vote for HL2 because it takes place in settings so familiar to us. But all three of those games are top notch

whilst this is true (though ild say farcry would be the most realistic, ie when was the last time u saw aliens towering over your town)
doom3 is the only one of the 3 games mentioned that features realtime shadows
The Rug
The Rug
How do you mean realtime shadows?

From playing FarCry just now, it seems that it does indeed have dynamic stencil shadows. I couldn't really tell, but it seemed they were only cast by certain objects under certain lights. The FarCry website also has this:
Quote:

Lighting and Shadows: Combines pre-calculated, real-time shadows, stencil-shadows, and lightmaps to produce a dynamic environment. Includes high-resolution, correct-perspective, and volumetric smooth-shadow implementations for dramatic and realistic indoor shadowing. Also supports advanced particle technology and all kinds of volumetric lighting effects on particles.

From here.

The HL2 engine is a different story... what boggles my mind is why they spent so much time making awesome looking water, when shadows are a single projection coming from the sun, regardless of whether you are inside or out. Not to mention the fact that they go through walls, steps, etc. I've killed (and no doubt been killed by) CS:Source players simply because the shadow of a person was visible in places it shouldn't have been, thus alerting me to their position. (Awesome game, though, and that's what really counts.)
the rug - funpowered.com
Toji
Toji
Quote:
Original post by zedzeek
doom3 is the only one of the 3 games mentioned that features realtime shadows


Exactly! I'm not sure why, but Far-Cry, Half Life 2, and Doom 3 all seem to get lumped in the same category when people discuss engine architecture. (Maybe it's because they all use normal mapping... who knows.)

The way I see it is that Source is pretty much the last of the old "Quake" style engines, in that it relies heavily on pre-computed lightmapping and a lot of similar, "older" techniques to acheive it's graphical effects. It can look very nice if done right, but it has a lot of drawbacks such as most of the lighting being static, and requiring a HUGE amount of pre-processing time.

Doom 3, in contrast, is the first of a new generation of engines which are designed from the ground up to be completely dynamic. In the Doom 3 editor, you can pick up a light, move it around a hallway, and see the results in realtime as you move. That would never, EVER have happened with the old lightmapping techniques. (Far Cry seems to fall somewhere between these two, but I think it lies more on the Lightmapping side of the line)

Of course, you can never get everything right on the first go, and since Doom 3 is the first of these new style of engines, there were bound to be some bumps. Probably the most obvious is the classic "It's too dark!" complaint. The engine has been adjusted since to accomodate this (See Quake Wars screenshots), and future engines (such as Unreal Engine 3) definately look like an improvement. The fact of the matter is, though, that Doom 3 is probably the most advanced engine on the market at this moment.

(Get's off his little soapbox and goes back to cursing at Lightwave)

// The user formerly known as Tojiro67445, formerly known as Toji [smile]
Evil Bachus
Evil Bachus
Doom 3 does a bit of extra work to cut down on the amount of time per pass. Basically it draws just to the depth buffer, then it draws shadows, then it makes a pass or two per-light for the textures. And obviously you can throw in things like scissor testing, etc to cut down on how much drawing per-light you have to do.

http://www.beyond3d.com/interviews/carmackdoom3/
redeemer90
redeemer90
Nice article there Evil Bachus. Answers a lot of questions that I had about the engine and more.
Tessellator
Tessellator
I belive Doom3 also cheap "filler" lights in places too, that cast no shadows (and possibly use a simpler pipeline too).
perfectly_dark
perfectly_dark
Quote:
Original post by The Rug
Hehe, yah, it makes hiding behind objects very difficult :P


Arild Fines
Arild Fines
Doom 3 has lights? Then how come I can't see anything?
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
DudeMiester
DudeMiester
Oh dear God! The HL2 vs Doom 3 debate! Is there no end? No escape from this madness?!
[s] [/s]
I can see the fnords.
MumbleFuzz
MumbleFuzz
Quote:
The DOOM engine performs some pre modulation and post scaling to support arbitrarily bright light values without clamping at the expense of dynamically tossing low order precision bits
I've wondered before about this. How would the scaling be done?
MumbleFuzz
Daivuk
Daivuk
there is a tutorial about how to make shadow with multiple light using opengl :
http://www.geocities.com/duktroa/RealTimeShadowTutorial.htm

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.