• Register
Post news Report RSS Shadows!

This post is for the people who like videogames but don't know too much about their development. We will show you how the shadows work.

Posted by on


This post is for the people who like videogames but don't know too much about their development. We will show you how the shadows work.

First we have to differentiate two concepts, the “own shadow” and the “cast shadow”. The “own shadow” is the area in the surface of an object which doesn't recieve light. The “cast shadow” is the area of an object which doesn't recieve light because another object blocks it. The blocking object is the “shadow caster”, sounds epic, isn't it?


Now, we will focus on the “cast shadow” and the “shadow casters”. We have now another two new concepts. Dynamic and static objects. It's easy to understand but we will explain it anyway. Dynamic objects move and static ones don't... it's simple. So, we only let the main dynamic objects cast shadows, because this shadows are “dynamic shadows” and they are too expensive. These objects are usually the cars and some big animated models like dinosaurs.They cast this shadow due to the main directional light (and sometimes other lights). These lights must have the “cast shadow” property for the objects we marked as “shadow casters”.

And, what happens with this dynamic shadow? It's only casted in objects able to “receive shadows”. That's because these objects are always searching if something is casting a shadow over them, and as we say “it's bad because it's expensive”. So we only mark as “receiving shadows” the objects where the players will drive over.

Then, we have the statics objects (like rocks), most of them cast shadows. But we dont want them to always cast dynamic shadows because they don't move. Thus, we make “lightmaps”.


Lightmaps are the resulting texture of the engine calculations of lights and shadows of the selected objects. When we make a lightmap for an object, the engine puts an overlaying texture and simulates the light, the “own shadow” and all the “casted shadows” of the static objects that the lightmapped object receives. But don't worry, a lighmapped object can receive “dynamic shadows” as well.

That's how we have, for example, a terrain with the “casted shadows” of the rocks painted in the lightmap and the dynamic shadows of the cars, calculated dynamically.


Post comment Comments
MohamedFS
MohamedFS - - 17 comments

useful info thanks guys !

Reply Good karma Bad karma+3 votes
gghani Author
gghani - - 81 comments

You're welcome!!

Reply Good karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: