Sunday, December 9, 2012

Day/Night Time Lapse

Been working my ass off the last few days implementing some of the core features into the game. One of them being the day/night cycle. After a lot of experimentation I decided to use Unity's animation curves to accomplish this. Something that most coders might not have done, but I'm an artist and we think differently. It gave me the flexibility to smoothly transition between different aspects of the cycle and add or manipulate what I need. Here's a quick time lapse of some of the work.


  1. Dude! Sweet! Curves on a custom shader? I'd love to hear more ;)

  2. Ya its pretty simple I edited the shader I sent you to cater to my needs for the sky sphere. Then I created a 20 min animation loop that I applied to the directional light for sun control, and the sky sphere for blending the different textures together. This is all usually controlled by code so I was super pumped when I found out I could just use animation curves. Then I created a simple script to control the speed and time of the animation. This way if I want the days to go faster I just increase the speed of the animation, and since its a 20 min cycle I can just do some simple division to figure out how many minutes I want it. It also gives me the control to set the time of day at any given point since I just set the time in the animation and voila. Took a little bit to implement the whole thing but its super flexible, and I can control pretty much every parameter of the sun/sky with animation.