It's been quiet these last few weeks. Why? I've been getting baked. Shadows that is. More specifically, I failed to get baked shadows. Why? I'm not quite sure. A sprinkle of Unity magic here and a solid fail there.
Initially, all the shadows in the game are realtime. I set the range of shadows out to 6000 meters, the same as the camera's draw distance. The map is 8000x8000 so this meant you saw shadows right out to the draw distance and the cost for doing that is pretty high, but in this low poly world, managable with a modern gaming computer.
Shadows either look good up close, or far away. But not both at the same time. For multitude of reasons. Plus you get weird shimmering as Unity struggles to show detail with this overly large realtime shadow area.
Solution 1: The Big Bake Off
Bake shadows at a high resolution! Why not, I've got the time to let the computer chug for a day or two and make lovely shadow maps. And it did... kind of. Unity created a light data asset and once it went over 2GB, Unity would crash when I tried to reload the project. Crud. For reference mine was a 3.1GB LightingData.asset when I used low settings... Oh my. Seems like at least a few other souls had this problem too:
Solution 2: The Ugly Bake Off
Ok, so let's just make a smaller set of data and do lower resolution shadow maps. Tried that and... Unity coundn't even do the bake. I got errors on one of the many steps of baking shadows. I can't even remember the error now. Upsampling something? Reticulating Splines? At this point I belive my computer is haunted. Send help.
Solution 3: Fail Forward
So, both the big and little bakes failed. Quite frankly, I gave up. I set the realtime shadows to a reasonable range, 1000 meters, and washed my hands of it all. Hopefully people will still think it's pretty and not notice the shadow draw distance.
Bonus Solution 3.5: Split it up
I know this is probably what I should have done: take the gigantic world and split it up into pieces that load on demand. This is actually the "correct" solution from what I've read, but let's be honest, that would require a total rewrite of a lot of my game's systems and I'm not ready to go there. Yet. I'm still learning Unity, this is my first (overly large) 3D gameand I've already bitten off way more than I can chew.
I'll probably come back to this issue again. Armed with a little more knowlege, or maybe an updated version of Unity that fixes some of my problems. Or I might take that plunge and see about streaming in level chunks.
Or, maybe one of you have deal with this before and have a solution I'm unaware of.
Regardless, the moral of this story is to fail forward. As long as you keep making progress, you're doing great. You learned something, even if what you learned is how things don't work. I learned TONS about Unity's shadows, and how they work, and what's going on under the hood. Failure is always an option!