The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Day and Night Cycle

  • Filter
  • Time
  • Show
Clear All
new posts

  • Day and Night Cycle

    What i will be covering in this tutorial is:
    - Creating the Procedural Sky that will change over time.
    - Setting up lighting for the level.
    All of this will be fully controlled via Matinee for a sped up 24 hour day cycle.

    Lets get started.

    We want to create a base level for our player to walk on. Go to the top tool bar and click 'Tools', then select 'New Terrain'. You can either leave all the setting the same by just pressing OK or change the size of the map by changing the Patches X and Y values.

    Now that we have our map we can now place our lighting. Go to 'View', 'Browser Windows', 'Actor Classes'. Scroll down to the Light tab and open it. We need 2 lights: 'DominantDirectionalLightMoveable' and 'SkyLight'. The 'DominantDirectionalLightMoveable' will provide us with the sun movement across the sky and the 'SkyLight' will provide us with ambient light, we use the 'SkyLight' because if we used and normal DirectionalLight it will display two sun's in the sky. You could use a normal DirectionalLight for the moon but it cant be controlled in Matinee due to the fact its not a dynamic actor. So since the 'SkyLight' isn't going into matinee we should set it's values to give us nice looking shadow's and that at night it wont be completely dark.

    Changing the Environment Color or Intensity in the World Propertieswont change the shadow color in this circumstance. Also in Actor Classes, we will find a tab called 'Info' which will then select height fog and place that into our level. Its is used just like the name says. The higher you place the fog in the Z position the thicker it will become a ground level. No point on changing the DominantDirectionalLightMoveable or the HeightFog's values at the moment it will be controlled in Matinee.

    Now regarding the material for our sky i wont go in depth on what each node will do, but i will display images showing each section of the material and show you what the whole thing should look like. One thing i should point out there is only one Texture Sample in there and that is the Stars which can be found in the content browser.

    The Scalar Parameter that is being plugged into most of the nodes is just called 'Stars' and has a value of 0.
    Down at the bottom we change the lighting model to custom lighting.
    and further down at the 'Usage' tap, tick 'Used with static lighting'.

    Now that our material is finished, press the green check button at the top to save the changes. Now in the Content Browser, with the material selected, right click the material and create a 'MaterialInstanceTimeVarying'.
    Now double click the MITV and tick the box 'Auto Activate All'. Then scroll down and open all the Scalar Parameters and Vector Parameters and tick the box 'Override' for all of them. Also in the 'ZenithColorNIGHT' Vector Parameter, set its RGB values to 0 so that it will work in Matinee.

    We now have to create a Matinee sequence which will hold our light movement, height fog and our material.

    With Matinee open and the selected actors highlighted we can then add them into Matinee.
    With the DominantDirectionalLightMoveable selected open up Matinee and right click in the gray area in the bottom left and add a new 'Empty Group', and you can name it Sun Movement. Right Click the Sun Movement track and select 'Movement'. You can set Keys to at any point but i like to keep it at even values, so with this tutorial well keep it at 180 seconds. It doesn't matter where you place Key's inbetween 180 and 0 but i just had them at 45, 90 and 130. Also make sure the light's physic's is set to Interpolate otherwise it wont save any the changes you put into Matinee. Now at every key point just rotate it 90 degrees in either Y or X direction, until you have it reach the same degree you started with at Key 1. All you have to do now is add 'Float Parameters' and 'Color Parameter' which will have all the lights values you will need. You can add key's at the same points as your Movement Track to follow the real sun's movement, color, brightness and so forth. The same will go for the 'HeightFog', just add new float property and color tracks so that all parameters are met. With the material, just have the MITV highlighted in the Content Browser, and then add it into Matinee. Concerning controlling its material parameters in Matinee; having the material track selected right click and add 'Float Material Parameter', and now with the float selected down at the bottom go to Materials and press the green plus sign. Go back to the Content Browser and have the MITV selected and back in Matinee, where you just added a new material slot press the green arrow and that should place the MITV into it. Name it to whatever Scalar Parameter you want to control. Lets say 'Stars', you will then add keys to when you want the stars to fade in and out. 0 value will be off and 1 will be fully on.

    NOTE: I made my whole sequence last for 180 seconds and in Kismet with the Matinee sequence selected, i controlled its playback time(which can be accessed at the bottom where it says properties. You can either increase it for time sake or lower it to see what it would really look like. I personally have it set to 2 because i don't want to sit there for ages, but the intention was to make a 24 hour day last 3 hours in real life.

    That covers most of what you will need to achieve a nice Day & Night cycle.
    If you have any problems you can contact me at my email:

    I hope this helps every one who has been asking for a tutorial.

  • #2
    May I make a video tutorial of this, giving credit to you?


    • #3
      Originally posted by Allar View Post
      May I make a video tutorial of this, giving credit to you?
      Yeah go right ahead, i didn't make one due to the fact i didn't have any software for it.


      • #4
        Did you understand the tut easily?
        I dont know if it was good enough. It being the first ive done.


        • #5
          I followed it easy enough. Good tut. The only thing I notice is that the top picture (Of the Sun and Moon Disc section) has a parameter named 'none', which is bad to do. It needs a name.

          Other than that, it's great.

          Thanks for the tutorial!


          • #6
            Sorry that parameter is the bloom color. Thanks for pointing that out.


            • #7
              Doesn't work for me like it did for you. This part of my material gives different results, even though I set it up the same way as you did:

              Is there maybe a certain value that I need to enter in the Sphere Mask?


              • #8
                What does your whole material look like?


                • #9
                  Originally posted by Crusha K. Rool View Post
                  Doesn't work for me like it did for you. This part of my material gives different results, even though I set it up the same way as you did:

                  Is there maybe a certain value that I need to enter in the Sphere Mask?
                  Attenuation distance: 0.010000


                  • #10
                    Also the top Tex Coordinate for the Stars section is X-12, Y-12 and the bottom one is X-8, Y-8.


                    • #11
                      Ah, thanks.


                      • #12
                        Did that fix your problem?


                        • #13
                          The AttenuationRadius did it. And I estimated the TexCoords to be 10, so that was pretty close already.

                          You should add that to the first post.


                          • #14
                            Already noted and none. Thank You.


                            • #15
                              Hmmm, my video tutorial ended up being an hour and a half long... but I do go over how and why things work they do instead of simply just building it...

                              Will post a link once its rendered and up