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

Both unreal engine 3 and doom 3 use shadow volume, not shadow map. why?

Started by jimipeisun Oct 2, 2005 at 12:17 PM 25 replies 7.5k views
Original Post
jimipeisun
jimipeisun
Both unreal engine 3 and doom 3 use shadow volume, not shadow map. why?
Cypher19
Cypher19
Doom3 used shadow volumes because for lower poly objects SVs run WAY faster, not to mention the fact that even older hardware supports them, whereas modern ATi cards don't even support shadow maps w/o pixel shaders, iirc.

UE3 has both shadow maps and shadow volumes, and the artist can use either one, depending on whether the resulting performance or image quality is preferable.


Quote:
Original post by Anonymous Poster
Most likely because shadow volumes look better graphicaly and also because they can calculate shadow volumes on the graphics card which gets rid of the main CPU burden that past shadow volumes had to deal with.


Um...you sure you didn't mix up maps and volumes?
Ademan555
Ademan555
I didnt realize that ue3 could use shadow volumes, in all of the demos i've seen they're quite clearly shadow maps.

cheers
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
The Rug
The Rug
How can you tell?

I seem to remember someone (Tim Sweeney?) saying they were "fuzzy penumbra volumes" or something in one of the E3 videos. Not sure exactly what that means.
the rug - funpowered.com
hplus0603
hplus0603
Doom 3 doesn't calculate the shadow volumes on the GPU, though; it's been documented to calculate silhouettes on the CPU to create the fewest shadow volume polys. I think it also uses them together with beam trees to get better occlusion per-light.

Saying that shadow volumes run faster than shadow maps is rather misleading. Shadow volumes use very unpredictable amounts of fill rate; at larger resolutions they may go very fill limited. This is a Bad Thing for broad compatibility. Meanwhile, shadow maps use very predictable fill rate, that also early-Z-culls very well. Instead, it uses more vertex processing power -- but on the mid-end, which is where most graphics cards are sold, vertex power scales up faster than fill power. An extreme example is the 5200 and 6200 cards -- plenty of transform power, pretty abysmal fill (compared to their larger siblings).
enum Bool { True, False, FileNotFound };
matches81
matches81
I wouldn´t say that shadow volumes look better than shadow maps... "standard" shadow volumes without tweaking look pretty ugly IMHO... just because they result 100% hard shadows, which NEVER occurrs in reality. I remember Riddick did soft shadows and I suppose they used shadow volumes, at least the artifacts looked like it... but with soft shadowing enabled the game ran incredibly slow.
Though I never implemented one of the techniques (but will be doing so soon I hope), I´ve read lots of articles, papers and tutorials about both, and I tend to use shadow maps, because there are a number of tricks to get more or less rid of the jagged edges you experience in bad cases. And soft shadows are easier to do I suppose, which is a huge plus for me when it comes to the look of a scene.
DrewGreen
DrewGreen
I have seen a small number of areas on Doom 3 where the shadows look completely wrong, specifically on the first couple of levels when you shine the flashlight at a railing. Sometimes the shadow is projected onto the wrong surfaces, or appears to be projected into thin air a few pixels behind the railing for instance.
Unfortunately I don't have any screenshots as it wasn't something I was concerned about when I noticed it.

This said, the method looks tons better over maps and is more dynamic.

However, my favourite example of shadows is with the overhead power/phone lines in GTA:SA (pc version, dunno about ps2/xbox). I think they're done with volumes, though could be wrong.
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
OrangyTang
OrangyTang
Quote:
Original post by DrewGreen
I have seen a small number of areas on Doom 3 where the shadows look completely wrong, specifically on the first couple of levels when you shine the flashlight at a railing. Sometimes the shadow is projected onto the wrong surfaces, or appears to be projected into thin air a few pixels behind the railing for instance.

Thats actually perfectly accurate behaviour - it's due to the fact that the lightsource (the torch) is almost but not quite the same as the viewpoint. This means that the shadows (although projected correctly) end up looking odd when re-projected onto the screen. Were you able to freeze the torch and move around it'd look fine.

The problem with volumes is that they're *too* accurate. Everything is reduced to a binary shadowed/lit, producing unrealistic hard edges. Doing interpolation on a shadow map (while physically incorrect) does produce a nice soft transition.

IIRC, when Doom3 was released shadow maps weren't nearly as practical as they are now. But as graphics cards get higher depth textures (reducing precision artifacts) and more texture memory (meaning higher res maps, reducing aliasing artifacts) shadow maps are going to scale much better now and in the future.
Johnny Watson
Johnny Watson
Doom 3 used shadow volumes because Carmack started the project back in 2000, and the original GeForce 256 was the base hardware he had to work with. On those cards, you could hack together 8-bit depth buffer shadow maps, but they were so low precision and so low resolution they didn't look good at all. Ontop of that, there were no shaders back then, so no way to achieve soft shadowing and get rid of the really obvious aliasing caused by low resolution shadow maps. The lack of precision would have resulted in significant shadow acne, and the performance with switching the render targets and drawing all that geometry onto the shadow maps every frame would have been abysmal. Carmack actually tried Doom 3 with old school, GF256 level shadow maps in there and faced all the afforementioned problems and didn't like it. Basically, with Doom 3, the hardware wasn't ready for a fully shadow mapped game yet, both in terms of caps and performance.

As for Unreal Engine 3, I think it's just a performance tradeoff. In some cases they use precomputed shadow masks, in some cases they use shadow volumes, in some cases they use shadow maps. They each have different performance characteristics and varying image quality, so I guess shadow volumes were thrown in there just to give the developers some options/tradeoffs. As for the "fuzzy penumbra volumes," in that particular demo I saw a sharp and blurred shadow mask being interpolated between (the "soft shadows" casted by the lamp), along with hard shadow volumes.
Saruman
Saruman
Quote:
Original post by Johnny Watson
Doom 3 used shadow volumes because Carmack started the project back in 2000, and the original GeForce 256 was the base hardware he had to work with.

The Geforce 2 series was actually available in 2000.
hplus0603
hplus0603
GeForce 2 is the same thing as GeForce 256, except with a better memory interface and higher clock speed. They have the same capability. Not until GeForce 3 did we get shadow map support (and not until Radeon 9500 did ATI get on the bandwagon -- and they still don't do hardware PCF).
enum Bool { True, False, FileNotFound };
Saruman
Saruman
Oh cool I didn't know the 256 was a G2, I actually haven't used one. Good to know :)
Toji
Toji
This wasn't all THAT hard to look up... it's on their tech page!

Quote:
# Advanced Dynamic Shadowing. Unreal Engine 3 provides full support for four shadowing techniques:

* Dynamic stencil buffered shadow volumes supporting fully dynamic, moving light sources casting accurate shadows on all objects in the scene.
* Dynamic characters casting dynamic soft, fuzzy shadows on the scene using 16X-oversampled shadow buffers.
* Ultra high quality and high performance pre-computed shadow masks allow offline processing of static light interactions, while retaining fully dynamic specular lighting and reflections.
* Directional Light Mapping enables the static shadowing and diffuse normal-mapped lighting of an unlimited number of lights to be precomputed and stored into a single set of texture maps, enabling very large light counts in high-performance scenes.


Sooo..... the answer is that they use both, selectively choosing the method that will work best in a given situation. I'd imagine they might use shadow volumes in cases like directional/outdoor lighting where shadow buffers become impractical.

Doom 3 used them, as stated before, simply because of the hardware requirements. The target hardware range at the time development started couldn't give good results with shadow buffers, so it's only sensible that they went with shadow volumes. Carmack has stated, however, that shadow buffers are likely to be the main technique used in their next engine.

Oh, and as for shadow volumes being accelerated on the GPU... I've looked at the methods they use to do this and I consider it essentially a hack. It requires a lot more geometry to be processed than even standard shadow volumes (something like 3X if I remember correctly), it would be awkward to get working with skinned meshes, and it relies on a lot of very careful mesh setup. Overall, it's not a really effecient or easy way of doing things, and I think that paper was meant as more of a "proof-of-concept" than a proposal for any actual, usable method.

[Edited by - Toji on October 3, 2005 1:56:18 PM]
// The user formerly known as Tojiro67445, formerly known as Toji [smile]
PixelPhil
PixelPhil
Quote:

The shadow map support is good to get in, but I am still unconvinced
that a fully general engine can be produced with acceptable quality using
shadow maps for point lights. I spent a while working with shadow
buffers last year, and I couldn't get satisfactory results. I will revisit
that work now that I have GeForce 3 cards, and directly compare it with my
current approach.

-John Carmack

in JC's Feb 2001 .plan

Shadow maps are good for spotlights or directionnal lights. But for a point light you need a shadow cubemap which is 6 time the expense.
matches81
matches81
does anyone have an idea how expensive it gets to get soft shadows using shadow volumes? I don´t have a clue, which is why I ask, because I don´t know how you would achieve soft shadows with shadow volumes.
The reason I ask is the following:
If I´d used shadow maps for spotlights and the like, I´d get soft shadows there. But if now I used shadow volumes for point lights, I would find it hard to compose a convincing image out of those 2 different techniques, because I got soft shadows on the one hand, and harshly sharp shadows on the other. How´d I combine those two without getting an odd-looking image?

If I stick with shadow maps for point lights, too, I understand I´d have to do essentially 6 shadow-map-passes to fill the cubemap. Is this really that bad performance-wise?
The Doom³ engine sticks with volumes completely and gets really slow if there are more than 4 lights (or something like that, got that from a guy building maps for D³), so volumes got their downsides, too, obviously, which is the volume extraction, I assume.
Cypher19
Cypher19
Quote:
Original post by matches81
If I stick with shadow maps for point lights, too, I understand I´d have to do essentially 6 shadow-map-passes to fill the cubemap. Is this really that bad performance-wise?


Not as bad as it was a year or two ago.
Quote:

The Doom³ engine sticks with volumes completely and gets really slow if there are more than 4 lights (or something like that, got that from a guy building maps for D³), so volumes got their downsides, too, obviously, which is the volume extraction, I assume.


4 BIG lights maybe, but I thought the average Doom3 scene would have maybe 10 (small to medium) lights in it, and it runs pretty smoothly on my machine.

Johnny Watson
Johnny Watson
Quote:
Original post by PixelPhil
Shadow maps are good for spotlights or directionnal lights. But for a point light you need a shadow cubemap which is 6 time the expense.


You could do six passes on the same shadow buffer to alleviate the significant memory requirement for shadow cube maps. There's also dual-paraboloid mapping which cuts down on memory and number of rendering passes.

Quote:
Original post by matches81
does anyone have an idea how expensive it gets to get soft shadows using shadow volumes?

It takes a lot of samples to get jittered shadow volumes to look nice. Too few samples and the shadows look banded and ugly, too many and your performance takes a big hit.

Quote:

If I´d used shadow maps for spotlights and the like, I´d get soft shadows there. But if now I used shadow volumes for point lights, I would find it hard to compose a convincing image out of those 2 different techniques, because I got soft shadows on the one hand, and harshly sharp shadows on the other. How´d I combine those two without getting an odd-looking image?

A lot of games obviously use multiple lighting/shadowing techniques for performance/quality reasons. Of course I say it's obvious because I'm a graphics programmer, but if i weren't I probably wouldn't really notice. Unreal Engine 3's got hard volume shadows mixed up with soft depth buffer shadows. Check out some of those screenshots if you want to see what it's like having shadow maps, shadow volumes, and precomputed shadow masks juxtaposed with eachother (it doesn't look that bad).

Quote:

If I stick with shadow maps for point lights, too, I understand I´d have to do essentially 6 shadow-map-passes to fill the cubemap. Is this really that bad performance-wise?


First off, using cube maps is kind of a waste of memory. Just do six passes on the one shadow buffer. You'll save a lot of memory. If you're worried about performance, you can have different MIP levels for your shadow buffer so far off lights (which are smaller in screen space) render to a lower resolution shadow buffer to save time. You can also cache some shadow buffer information as a part of the map. If you just brute force render 6 shadow map passes at 1024x1024 on every light for every frame, yes that will be a drain on performance, but with some clever optimizations you can get good practical performance out of an all-shadow map solution.
Cypher19
Cypher19
Quote:
You could do six passes on the same shadow buffer to alleviate the significant memory requirement for shadow cube maps. There's also dual-paraboloid mapping which cuts down on memory and number of rendering passes.


...while at the same time exponentially increasing your geometry count and reducing the quality of the resulting shadow! FUN!
RAZORUNREAL
RAZORUNREAL
There's some good stuff on shadows here. It is actually possible to do soft shadows with shadow volumes without resorting to multiple passes, even on ps2 hardware, it's just extremely expensive.

As for the soft shadows in unreal engine 3, the famous scene with the lantern is obviously just a projected cube map and stencil shadows. If you think about it, you just pregenerate the cube map for the lanterns shadow and project it on your scene, and the size of the penumbra changes with the distance of the geometry without you doing a thing. The rest of the shadows were just stencil, nothing soft about them. It's the character that's impressive, which is where they used the 16 sample shadow maps.

As for shadow mapping everything, it may be possible to make it look good, but lots of small point lights certainly wouldn't be the solution. I'd try things like independantly shadowing important objects like characters to give them enough detail. That way you don't have to ubdate the main shadow maps as often either, but it'd cost you in memory. And Skewbe maps or whatever they were called could help quite a bit.

Just a little disclaimer, I havn't actually tried any of this.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
Toji
Toji
Quote:
Original post by Cypher19
4 BIG lights maybe, but I thought the average Doom3 scene would have maybe 10 (small to medium) lights in it, and it runs pretty smoothly on my machine.


For the record, it has nothing to do with the size of the lights. You can just as easily have 50 lights in a room as you can 4, and take a minimal (if any) preformance hit for it. What makes multiple lights expensive is when they overlap. If you have a polygon that's being lit by 5 different lights, it ends up being rendered 5 times (or more, on lower end cards it's a multipass situation per-light. So 5 lights could mean up to 15 renders of the same poly!)

Additionally, when lights overlap you have the chance of extracting a meshes shadow volume multiple times too. All in all, it makes it much more difficult for the engine to render. So, going back to our original example, a room with 50 non-overlapping lights could easily preform BETTER than a room with 4 lights that overlap heavily. Go figure!

// The user formerly known as Tojiro67445, formerly known as Toji [smile]

Topic Locked

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

Sign in to reply to this topic.