Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Zoost

Question about shadows

Recommended Posts

(FYI: this isn't directed at anyone specifically, just the generally clueless fans that think they know what they are talking about)

It won't be faster. So shutup.

You guys don't understand how it works. When there is 1 light in the scene, the renderer doesn't switch over to some single-light-in-scene optimized renderer for drawing pitch-black shadows. It uses the same rendering pipeline for a scene with one light as it does for a scene with 2 lights.

The engine doesn't draw the shadows, it only draws the light. If a light is blocked by something, it doesn't draw the shadow, the light just never gets to that part of the scene. Each frame, the engine runs through the lights in the scene, one light at a time. It calculates the shape of the shadows casted onto the scene and then contributes its light to the scene outside of these shadows. At the beginning of each frame before it runs through the lights in the scene, the engine starts with the scene containing no light. Just black. Each light adds its light to the scene until they are all done. If there are parts of the scene that none of the lights contributed light to, it stays black.

To get rid of pitch-black shadows, they simply increase the ambient light in the map, and shadows and crannies will only be able to get so dark. This is simply done by not starting with a black scene, but a dark-gray scene, or perhaps a precalced radiosity lightmap that is very dark, but not black. All the lights add their light and there will be no black even if none of the lights light up parts of the scene, eliminating black shadows. But ambient light also looks kinda awkward because even in a room with no lights, you will still be able to see the room.

Pitch-black shadows aren't faster, they just don't have any light on them so when the perpixel maths are done with all the textures and stuff it just ends up with a black pixel. It doesn't think to itself "Hey, this is a shadow, just draw black".

There are three options:

-Pitch black shadows for areas with no direct illumination
-Ambient light, just a crappy approximation of radiosity
-Radiosity lightmaps. This would only work for static lights

Radiosity lightmaps are out of the question with Doom3, just because John Carmack isn't going in that direction (it would probably be the slowest choice).

Ambient light is ugly. It looks ok in some scenes, but horrid in others. And you can't have like a scary room with a flickering light revealing the environment for only fractions of a second. It will flicker still, but it won't go to a pitch black scene when it flickers off. Thus ruining the effect.

Pitch black shadows are just an ambient light of zero, and would probably look better in any case. I am sure Doom3 will support ambient light, but it won't look as good as you think so most Doom3 maps will just have no ambient light.

Share this post


Link to post

I understand the "one light source= black shadow", but I wonder if Doom 3 will have multiple shadows on one character?

I mean, with multiple light sources situated from each other, and I have seen this in RL, in some cases, there is a "main shadow", then a lighter shadow that's projected off at an angle to the object, yet both are visible at the same time.

Of course, the location of the lights affects this, but it'd be interesting to see if Carmarck could pull it off.

Share this post


Link to post
Livo said:

I understand the "one light source= black shadow", but I wonder if Doom 3 will have multiple shadows on one character?

Uh, does the game calculate all shadows? Do characters cast shadows? There is your answer.

Share this post


Link to post

This occurs naturally with the standard stencil shadowing algorithm. Like was said above, for each light, one at a time, you determine where the shadows are and draw them into the stencil buffer. Then you draw the scene (using an additive blend) using a stencil test to reject pixels that would be in the shadow. See, in Quake II light was taken away from the scene via the lightmaps. In DOOM III, light is added to the scene and adds up much like light in the real world does. After all lighting is complete, the beauty pass is drawn and modulated with the lit scene.

Also note, each light requires one pass to create the lit scene, and then the beauty pass may take one or more render passes depending on the scene elements and graphics hardware. This is the reason it was mentioned that you will not be able to simply put hundreds of point lights in maps like was often done in Quake II. Each light in the scene (or rather that casts into the scene), requires a complete pass of the scene. Which obviously can quickly make things come to crawl if there are many lights casting into the scene.

Share this post


Link to post

Doom3 calculates the shadows formed by ALL geometry PER light.

Meaning if you have ten lights around a guy (very slow) then 10 shadows will be cast off of him. But the other lights may illuminate the shadows formed by other lights.

Doom3 does NOT DRAW SHADOWS onto the scene. It only draws light. If light is blocked, light simply isn't drawn. The engine doesn't do some special case shadow-drawing crap like other games.

Share this post


Link to post

Ok i know that was aimed at me, but your saying what i was saying - the engine IS faster because its ONLY DRAWING LIGHT. If it had to draw the entire scene and then draw the shadows it would take longer

i didnt mean to make you mad gixels |)

Share this post


Link to post
GiXeLz said:

Ambient light is ugly. It looks ok in some scenes, but horrid in others. And you can't have like a scary room with a flickering light revealing the environment for only fractions of a second. It will flicker still, but it won't go to a pitch black scene when it flickers off. Thus ruining the effect.

Pitch black shadows are just an ambient light of zero, and would probably look better in any case. I am sure Doom3 will support ambient light, but it won't look as good as you think so most Doom3 maps will just have no ambient light.

I dont see how you could possibly create a realistic looking room without *some* ambient light. youd have to have at least 4 lights in a scene, and some of them would have to be on the FLOOR. not every single area in the game can be this intense dark moody atmosphere or the gimmick will get old QUICK.

the best solution would be to combine radiosity pre-calculated lightmaps with only one or two moving lights a scene. MOST lights in the real world are STUCK to the wall or ceiling, not swinging or moving at all. and carmack said that the wolrd will be static anyway, so no one will be able to tell the difference. youll still see shadow and whatnot, just not as many

Share this post


Link to post

Xian: Ambient light will look ok in SOME places.

I don't think Carmack would say the world will be static and show us some footage (in legacy video) of a swinging light.

The two best choices are radiosity lightmaps and no ambience. With ambience it just looks wrong in some cases. It won't be pitch black where it should be (which it will at times).

Radiosity lightmaps just add another pass to the already-bloated rendering pipeline. So they are out of the question.

Starting with zero light is the cheapest.

Well, I am sure ambient light will be used in few of the maps, so don't worry about it. In all the footage/screenies I have seen so far, ambient light wouldn't fit very well. Unless it was VERY VERY VERY super low ambient. But whatever..

And yay for the technology forum! :D

Share this post


Link to post

hed meant the objects will be static, as in we cant break static lights and blackout

Share this post


Link to post

I don't see why not. You just set an ignore flag on the light so when it comes time to render everything, it just skips that light. Then it's simply a matter of associating a light with the object representing the light so that when you shoot and break the object, the light itself will react accordingly.

Share this post


Link to post

its weird, he DID say they would have static environments except for scripted sections, but in the leaked video you can break boxes, sparks fly, etc. apparently the desginers dont agree with him! but he DOES say it, listen to the interview with carmakc about 20 minutes in he says that we "missed the window" for good interactive environments and that non-static stuff will only happen when "we want it to".

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
×