Half-Life 2 Shadows
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?
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
disclaimer: i dont know any of this for SURE, but im pretty sure
hope that helps
-Dan
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.
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
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.
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).
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*
They probably just have a light a few units above each model.
*shrugs*
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement