First steps to making daytime cycle material shader (animated)

I’m getting started on the day cycle in my game. I figured the easiest way without resorting to performance-killing dynamic lights would be to make an unlit material that had a bunch of parameters for controlling the light. This is what I came up with.

Anyone interested in making your own, this is what I started off with:

Basically I take the diffuse and normal textures from a regular material and bring them over. I make an unlit material and simulate lighting with the parameters shown. From there, I replaced those few parameters with several others: light, shadow, and highlight colors, each times four in order to have different color schemes for sunrise, daylight, sunset, and night. Then I add another parameter for time of day, and use that to lerp between colors. Next I need to add something to turn the light.

It seems to be working pretty well so far. Because it’s unlit, it runs at a svelt 47 instructions. And that’s including all of the layer switching and 3D texture projection.

Getting all of the landscape’s normals figured out was kind of a pain, but I think I finally have it right.

Looks good, but the lack of shadows… why don’t use dynamic light? With a proper cascade configuration the performance are not too bad with the modern computers.

The last time I used dynamic lights was years ago and I was running a tiny weak Radeon. Maybe I should give dynamic lighting another try. I was hoping to approximate shadows with AO, but we’ll see. I’ll give dynamic lighting a try and see what happens.