Half-Life 2 Shadows

Started by
23 comments, last by MikeyO 19 years, 2 months ago
I'm curious- how does half-life 2 handle dynamic shadows? I can tell it uses shadow mapping, and that only shadows from the sun are computed. But my question is, does hl2 render a shadow map for each object from the direction of the sun, or is it one huge shadow map? Or is it some other method I haven't heard of yet?
Advertisement
Moved to "Graphics programming and theory".

Whats there not to understand? it renders a shadow map for each object and then projects it onto the respective polys. so there is a shadow map for each object, (or maybe not every instance but just every type, ie Terrorist, and it reuses that multiple times, i dont know)

disclaimer: i dont know any of this for SURE, but im pretty sure

hope that helps
-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 his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
well, you can turn on a cvar to show shadow ids, (they appear as numbers over the shadows), so i assume theyre being rendered seperately.
die or be died...i think
Its not shadow maps per se. Each seems to be rendered separately for characters without any self shadowing and only part of the world seems to be receiving the projection of the shadow. In one location a combine was on the stairs but the shadow was projected through the steps and onto the world below (stairs weren't shadowed).

I think they render a separate one for each character because some of their levels can have multiple lights in close proximity, which is handled by lightmaps for the world and then the shadow is rendered for the closest light or averaged between two (guessing here, didn't watch for the effect).

It looks like shadow mapping but I dont think thats what they would use because the world doesn't cast shadows (all precomputed lightmaps). I think they are rendering the character to a texture (untextured and gray) from a light source or some average of and then projecting that texture on the world. This would help explain how self shadowing isn't possible in the engine.

HTH


Quote:Original post by nts
Its not shadow maps per se. Each seems to be rendered separately for characters without any self shadowing and only part of the world seems to be receiving the projection of the shadow. In one location a combine was on the stairs but the shadow was projected through the steps and onto the world below (stairs weren't shadowed).


Yes, if you play CS:S there is alot of shadows appearing on the wrong side of solid objects, its one of my pet hates with the engine. It looks great and all but the shadows can ruin it at times [rolleyes]
I think it uses something called texture shadows that is used in alot of games for character shadows. Basically all objects have a texture that has a shadow rendered onto it and that then is projected onto the world. This technique is used in Ogre for example. It has some limitations like no self-shadowing and (at least in Ogre) shadowscasting objects can't recieve shadows.

Not 100% sure about this though so please correct me if I am wrong.
I'd be interested to hear how they look on older ATI cards (ones that have neither depth textures nor floating-point textures).

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

They don't use shadow mapping if you by "shadow mapping" mean what is commonly understood i.e a projected texture that contains depth values. They just render each dynamic object in all black as seen from the view of the sun into a texture and project that. Just bog standard cookie-cutter projected shadow textures. As seen in countless PS2 games for example.
I doubt they use the sun as the light, since the shadows are always the same size.

They probably just have a light a few units above each model.

*shrugs*

This topic is closed to new replies.

Advertisement