PDA

View Full Version : Doom 3 pre-rendered "dynamic shadows" ?


Pages : [1] 2 3

Sazar
08-03-04, 02:39 PM
just a little investigation into doom 3's shadow rendering technique...

I was initially under the impression each shadow cast was completely independent and rendered according to the light source and rather cool...

it would appear that instead every single shadow in the game is a pre-stenciled entity that just becomes darker (or lighter or does not appear) depending on the light-source angle and the intensity of the light-source...

the dynamic part is it moves and becomes lighter and darker... it is not dynamic in so much as it varies per curvatures or gradient or distance or any other such thing... so often you will see a shadow being rendered in plain air...

granted that Mars has a dusty environment but its a bit strange still :cool:

anyone care to shed any light on doom 3's shadow technique...

shots taken @ 12x10/high quality/cropped for this post

-edit- updates as later in this thread...

it would appear these situations are not so widespread and limited instead to particular situations... other than these instances the shadows indeed appear to be dynamic for the most part...

CaptNKILL
08-03-04, 02:55 PM
I think i know what youre talking about but I dont think its wrong, even though it looks that way. If you hold a flashlight and shine it, the lightsource comes from your hand, so the shape of the shadows you will see will be almost identical to the object casting them. Is that what you are talking about? The way the shadows seem to just be stripes, rather than going up the walls at angles?

Edit: Yeah, as lame as it sounds I just tried it :p
I just got a flashlight, and a pencil, held the pencil on end on my desk, and pointed the light from my shoulder at the pencil, toward a wall... the shadow is a straight line. Only if i move my head to the side does is it clear that it bends over everything.

EDIT2: And the reason things appear to not change for distance is because again, the light is coming from you. What is far from the light, is far from you, so it appears smaller. One thread here shows an imp throwing a fire ball, the light coming from the flame in his hand creates a gigantic shadow of his hand across the entire room.

I think you just happened to notice this because youre walking around with a flashlight... plus, the screens you took are in a bit of an odd scene... but they are right, dont worry :)

Sazar
08-03-04, 03:05 PM
-edited so as not to constitute a conspiracy theory-

|JuiceZ|
08-03-04, 03:08 PM
shadows cast off the railings as you can see from my small caps show absolutely no variation depending on the objects behind them... they are just THERE...

blah, didn't notice that until now, o well.

Thx for the doc link btw. ;)

Sazar
08-03-04, 03:09 PM
-edited so as not to constitute a conspiracy theory-

Clay
08-03-04, 03:14 PM
Interesting Saz, thanks for the info. :) I'd sort of noticed this but didn't pay much attention to it (too busy recording videos lately) :D

CaptNKILL
08-03-04, 03:35 PM
Bah, thats sort of disapointing. I dont understand most of what Carmack says in that text file... not surprising really :p

I guess we havent quite made it to real lighting and shadowing, its still just a simulation... still looks good, but, theres obviously problems with it.

BTW, how the hell does this work in multiplayer? Is there no flashlight? And if thats the case, then this wierd "projected floating shadow" crap is probably just done when the flashlight is used.

Still not sure why he didnt go with real dynamic shadows though. Anyone that can read "carmack-ese" know what he says is the problem? I read something about going behind a projected shadow would cause the screen to be black or something... if thats it, then youd think there would have been an easier way than creating floating shadows :|

Ninjaman09
08-03-04, 03:41 PM
Interesting, but completely wrong. I'm not sure what you meant by "pre-rendered shadows", but I'm assuming you mean light maps, though there was nothing in the text file you linked to suggest that. In fact, I'd like for you to point out the lines you think support your argument. The lights are all dynamic, and every shadow in the game is cast dynamically as well. This has been stated repeatedly by Carmack, and is extremely evident in the game, especially when a different character than yourself has a flashlight (like a sentry bot or the service platform you control later on).

God damn it, would you people stop trying to find faults with the game and just let yourselves enjoy it?!

Clay
08-03-04, 03:43 PM
Interesting, but completely wrong. I'm not sure what you meant by "pre-rendered shadows", but I'm assuming you mean light maps, though there was nothing in the text file you linked to suggest that. In fact, I'd like for you to point out the lines you think support your argument. The lights are all dynamic, and every shadow in the game is cast dynamically as well. This has been stated repeatedly by Carmack, and is extremely evident in the game, especially when a different character than yourself has a flashlight (like a sentry bot or the service platform you control later on).

God damn it, would you people stop trying to find faults with the game and just let yourselves enjoy it?!Mmm, even more interesting. Based on Saz's rebuttal I may have to investigate this for myself tonight. ;)

Intel17
08-03-04, 04:03 PM
Who cares? Teh game r0x0rz!!

ClosetFanBoy
08-03-04, 04:04 PM
hmmm. my flashlight doesnt cast a shadow nor can i see my shadow (your supposed to see the marines shadow yes?) i'm playing on high quality. am i missing something here?

Nutty
08-03-04, 04:05 PM
I dunno what those screenshots are meant to prove ?

If you're talking about the boxes shadow going the other way, thats because theres a light on the other side of the room casting that. If you look around the edge of the box, you can see the shadow the flashlight is casting, but its mostly obscured by the box.

The 2nd image looks fine as well. The shadow is a projection, so it will look straight regardless of the surface it's casting across.

I cant see anything wrong with the images, what's the problem ?

UDawg
08-03-04, 04:11 PM
LIES! ALL LIES! Saz is just trying to take our joy away.

Zeno
08-03-04, 04:13 PM
just a little investigation into doom 3's shadow rendering technique...

I was initially under the impression each shadow cast was completely independent and rendered according to the light source and rather cool...

it would appear that instead every single shadow in the game is a pre-stenciled entity that just becomes darker (or lighter or does not appear) depending on the light-source angle and the intensity of the light-source...


I had to jump in here as a programmer to say that you are incorrect. Doom 3's stencil shadows are fully dynamic, fully 3D, and conform to the environment as they should.

What you are seeing (and complaining about) is the result of the light source (flashlight) being very close to the your eye (the camera). If it were exactly at the point of the camera, you would see no shadows at all. As the light source and the camera move away from eachother in 3D space, the projection of the shadow onto the 2D screen (your monitor) will become more distinct from the projection of the shadow caster. Because the light source and eye are at nearly the same spot, so the projections are nearly the same and you get the flat appearance of the shadow. The same thing would happen in real life! Try putting a flashlight by your eye in an otherwise pitch black room and see how the shadows look.

Another way to see that the shadows are correct was mentioned above: look at the shadows cast by another player's flashlight, or set your in-game camera to be behind and above your character....I seem to remember a post here explaining how to do that. Then you will be able to see the shadows wrapping around the environment like you want.

I've implemented stencil shadows before, and it would be far more difficult to have them floating out in space like you are suggesting than to do them correctly.

Zeno
08-03-04, 04:18 PM
hmmm. my flashlight doesnt cast a shadow nor can i see my shadow (your supposed to see the marines shadow yes?) i'm playing on high quality. am i missing something here?

Your flashlight does cast a shadow if you have shadowing turned on, it may just be hard to see sometimes because it is almost blocked by the object casting the shadow (see my post above).

For whatever reason, your own shadow is only turned on in multiplayer. Not sure yet why they decided to turn it off in single player. I bet there's a console command to enable it, though....

Clay
08-03-04, 04:21 PM
After further review... :D

It's obvious that these shadows are not "floating"...if that were the case then you would not clearly see this depth of field difference at play on the edge of the box shot (zoomed in to point it out). You can see that the shadow "after" the box is further away...just as it should be...

http://www.nvnews.net/temp/doom3/boxshadow.jpg

ClosetFanBoy
08-03-04, 04:27 PM
Your flashlight does cast a shadow if you have shadowing turned on, it may just be hard to see sometimes because it is almost blocked by the object casting the shadow (see my post above).

For whatever reason, your own shadow is only turned on in multiplayer. Not sure yet why they decided to turn it off in single player. I bet there's a console command to enable it, though....


thank you sir.

CaptNKILL
08-03-04, 04:29 PM
For whatever reason, your own shadow is only turned on in multiplayer. Not sure yet why they decided to turn it off in single player. I bet there's a console command to enable it, though....
Its probably because the AI doesnt react to the players shadow, so it would look strange having your shadow cast into the view of an enemy and have him not respond.

In multiplayer however, shadows can give away the position of an opponent, so it makes sense to have them there.

And im still a bit skeptical of the whole floating shadow thing.

Theres a command for a 3rd person view right? If you turn that on, the truth will probably be revealed (unless the shadow "floating" distance changes for that view).

If it is true however, it almost HAS TO BE limited to the players flashlight, in single player only. Then of course, this doesnt make any sense... bah...

wheres carmack when you need him :retard:

EDIT: Sazar, is there any way you can take a screen shot of that exact scene with the flashlight off? Im talking about the one with the railing and the crate (the one clay just quoted).

Clay
08-03-04, 04:31 PM
just a little investigation into doom 3's shadow rendering technique...Hey since you obviously have Doom 3 now... how's about some more examples of this for everyone's consideration?

Zeno
08-03-04, 04:36 PM
Hey since you obviously have Doom 3 now... how's about some more examples of this for everyone's consideration?

Guys, you're chasing ghosts here. You cannot "cheat" on stencil shadows. It uses the depth buffer that's already been laid down by the objects in the scene, combined with the silhouette of the object extruded away from the light source in 3D to define the shadowed regions in screen space. It is a physically correct model for point lights.

P.S - Nice observation in the pic above, Clay. Another thing to notice is that the shadow strip is "thicker" on the floor even though it's further away because it is at more of a glancing angle to the light than the box is.

Zeno
08-03-04, 04:47 PM
Its probably because the AI doesnt react to the players shadow, so it would look strange having your shadow cast into the view of an enemy and have him not respond.

In multiplayer however, shadows can give away the position of an opponent, so it makes sense to have them there.


Ahh, good call. I'm sure you're right. It would be tricky to tell if a monster could "see" the shadow....you'd almost have to render the scene from the monster's point of view to get that info. Multiplayer takes care of that problem, as the shadows ARE rendered from everyone's point of view.

Clay
08-03-04, 04:49 PM
FYI...Check Kamel's thread over here (http://www.nvnews.net/vbulletin/showthread.php?t=33784)...seems like he is about to post some more good info on the console commands.

Sazar
08-03-04, 04:51 PM
sry I was playing the game :)

wrt to the shadows stay posted for a few more examples of what I am talking about.. it does not appear to be the same case with all the models... it just depends on their location...

I'll try and post to give an idea of what I am talking about in more detail :)

-edit-

since making the initial post I have played through a fair deal of the game and this is basically what I am seeing (keeping in mind other comments posted)

the shadows are being rendered correctly for the most part (I have been going back and checking them after clearing out the various areas) and generally the shadows are being rendered accurately... they vary according to distance/intensity/background and the like...

in some situations such as what I have pointed out (and that I do see coz there are a fair deal of railings in the game) it appears to just be a floating shadow...

I am not as advanced a programmer as some others out there... but it would appear that in certain situations, certain objects are not rendering accurate projections of shadows...

the floating effect I mentioned can be seen in the shots I have posted... I think :)

Nv40
08-03-04, 05:07 PM
interesting topic. :)

as other have said all Doom3 shadows are dynamic and in real time.. (cough).. hehe. well maybe 90% of all of them are. Doom3 can also use lightmaps if you want ,and projected shadows a quick hack to simulate Softshadows. but also if you want all your shadows can be 100% generated in realtime.(i have seen levels that way) but it will look ugly and unrealistic in some situations .the control is all there in the editor .its up to the level designers what they want to do.Stencil shadow volumes (most of doom3 shadows) is not the be all for all shadows situations ,there are situations where stencil shadows will not be apropiated for some situations. read Unreal3 engine specs , it use MAny diferent shadows techniques for many diferent situations. becasue no technique with shadows yet exist that will be good enough for every single situation in a game. the main player shadows i think are disable by default for performance reasons ,but you can enable them witht the console.

CaptNKILL
08-03-04, 05:10 PM
sry I was playing the game :)

wrt to the shadows stay posted for a few more examples of what I am talking about.. it does not appear to be the same case with all the models... it just depends on their location...

I'll try and post to give an idea of what I am talking about in more detail :)
Those shots dont really prove anything, ill go get a coffee can and shine a light at it with a pencil in front, but i expect the same result. I dont know what else you think the shadow is supposed to look like :p

Unless you are at a very different angle than the light source, the shadow will appear to be the same shape as the object casting it, its just how it is.