Message Received And Understood
All my plans, I placed in a bag and tossed out the window for Tuesday. The feedback both internal and external was clear, which was to get those pesky shadows back in!
A sage thought, and the right one. I have plenty plans for more eye candy in our terrain but shadows are super critical to make the scene 'pop'. To that end, apart from dealing with delegation via emails, my focus today was all things shadowy.
More Than Normal
As you may know I have already maxed out my texture stage usage on the terrain shader, and I ain't using more than eight slots in this engine to ensure some level of backward compatibility with last years graphics cards. Mark, and now Rick are both insisting on normal maps for the terrain floor, and as they are technically shadow casters I decided to add them in. I achieve this by making the terrain a two pass process, or rather, a two render process. I can hear the intake of breath there, but there simply is no way to squeeze a veg map, five color textures, four cascade shadow map textures, multiple normal maps, one per texture style and who knows what else. The good news is that in theory the shader work simply gets split between the two passes, with only the geometry getting processed twice. This is where deferred steps in to improve performance, and this can still be an optimization for us, but I need to get it written first before I can start performance tests.
I used some placeholder normal maps, and the terrain has had it's nice textures and subtle colors replaced by a basic lighting system (used by Valve) which employs said normal maps. Once this was done, time for...
I must have visited this shadow stuff about three times now, each time getting better and improving it. My finished shadow shader is now the best, with the ability to stretch all the way to the end of the terrain map and generate a convincing directional light.
The current prototype as I write this is in debug mode with each cascade tinted a specific color so I can see the quality step line and iron out any last minute artifacts like shadow edge bleeding and peter-panning. All looks good to be which means time to add it to the new terrain shader.
It's 2:40AM now so I could slink off to bed and restore a more normal working day for the remainder of the week, but who would integrate the shadows into the new terrain shader :)
I am going to fix myself a small J.D & Coke as a little reward for getting the super sized shadow issue sorted (finally), and then put another 25 minutes into the shadow integration, then see if I can rotate myself back onto the day shift. It's hard to say whether day or night shift produces more, and I've experienced plenty of both. I dare say it's 50/50 and entirely dependent on the devilishness of the code on that day.