Jump to content
  • Advertisement
Sign in to follow this  
evanofsky

Half-Life 2 Shadows

This topic is 4904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I'd be interested to hear how they look on older ATI cards (ones that have neither depth textures nor floating-point textures).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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*

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!