Hi All,
I have been trying to plan out a system which will have static pre baked lightmaps for static objects and to then combine it with real time shadows from dynamic objects.
I'm not worried about the mathematical blending between the static and dynamic, as I think I have it figured out - my actual problem is how to handle dynamic objects.
I want the dynamic objects to receive and cast shadows.
The only way I can think of doing this is to render the entire scene and do realtime shadow mapping - but this totally defeats the purpose of doing lightmapping for the shadows surely? I still have to incur the cost of all of that rendering!!
The reasons I think I have to do it that way are:
- How can a dynamic object receive static lightmap shadow? (I don't think you can?), so I have to do a full shadow mapping pass
- How can I cast accurate shadows from dynamic objects? I would have to use the shadow mapping technique again too!
Assuming I have to use full shadow mapping I thought of a very basic solution:
- render the entire scene into the shadow depth buffer
- create a temp copy
- render dynamic objects into buffer and then use that
- restore the copy for next frame (so we do not have to re render the scene, only dynamic objects)
Which is all fine and dandy, unless the scene is too large and I have to use something like cascaded shadow maps which would then mean I would have to render per frame? Which could be too much for mobile?
My scene is going to be city builder style/angle, so the shadows are going to breakdown quite quickly if I want the entire view to have shadows (and if I just have the entire shadow volume be the size of the map, it is going to look terrible).
Argh! I don't know what to do! How do other engines solve this?
Unity 5 doesn't blend the lightmaps with dynamic shadows so you get this dual shadow artifact which looks awful and is what I am trying to avoid. I also do not know how they do their shadows for dynamic objects, without incurring the cost of re- rendering the scene.
I have no idea how Unreal Engine does this either
I hope you understand what my problem is, it's a little difficult to explain clearly! I guess I really have two problems here...
Thanks