Day/Night Cycle


Controls:
Mouse: Select field or click button
Keyboard: Input numbers into the field
Enter: Submit input


Summary:
This is a simple practical demonstration of a Day/Night Cycle system I made. You can see how the lighting of the scene changes over the course of an in-game day. You can look at specific times of day, change how quickly time passes in a day, and even make time go backwards!

Background:
This is a simple Day/Night system that I made for a skills test in early 2022. I can't remember exactly how long this took to make, I want to say it was about a day. Here is the link to the documentation if you want to see all of the details, but the most exciting element of this system is the LightingTemplate scriptable object type I made.

Overall imitating the rise and fall of the sun is pretty simple. You just need to rotate whatever light source it is you have. But if you want things to look *good*, that's going to take a bit more work. That's where the LightingTemplate comes in! The LightingTemplate is a scriptable object associated with a set time period. This object determines the intensity and color of the light source and can even modify the colors of whatever materials you'd like. What's really cool is that each LightingTemplate works together and all of the lighting and coloring effects seamlessly mesh into each other. In the sample you see above, the scene has four LightingTemplates: Dusk, which starts at 6:30 AM; Noon, which starts at 12:00 PM; Twilight, which starts at 5:30 PM; and Night, which starts at 8:30 PM. These are just times and coloring that I chose for an example. Users of this systme can have as many, or as few LightingTemplates as thier project may need. Designers may want to have several different lists of LightingTemplates to represent different times of year, or even different planets entirely!

Again, I go into a bit more detail in the documentation. If you find any of this interesting, be sure to give it a look!