I’m looking into making a top-down vehicle game and I’d like to have the vehicles cast realtime shadows. I’d also like to take advantage of lightmapping for performance and quality reasons on the terrain.
Since it’s top down, dual lightmaps don’t seem like a good solution, because everything is basically on the same plane and you don’t see any distant object.
What I’d like to accomplish is this:
- Vehicles and props cast realtime shadows on the environment.
- The environment casts realtime shadows on the vehicles and props.
- The environment casts lightmapped shadows shadows on the environment.
Here’s an illustration:
The issue seems to be that I can’t figure out how to get realtime shadows on lightmapped surfaces. Am I correct that this is just simply not supported?
I’m aware that there are differences in how this works between forward and deferred lighting modes, but none of the combinations of rendering paths and lightmap settings seemed to work for me.
I’ve also tried a two-light solution, but I couldn’t seem to get the intensities to match and I couldn’t get a realtime-only light to cast shadows without illuminating objects. (Although maybe there is a way to use two lights that I didn’t figure out).
I’ve also tried having an invisible object that only receives realtime shadows using a shader found on the Unify wiki. That failed to work when I baked a lightmap, then the realtime shadows disappeared from the invisible object even though it wasn’t marked as static and the light was on auto. This also makes it very difficult to have interesting background geometry that can receive realtime shadows.
Here’s some of the resources I looked at but couldn’t find a solution: