Global Animations: Day / Night Cycle

From OpenUru
Jump to: navigation, search

First credit part of this tutorial needs to go to GPNMilano and Dustin. GPNMilano took the time to explain to me in detail how the Day / Night cycle in Eder Gira works several months ago to me, and Dustin figured out the very last piece of the puzzle that was missing! Thanks to both!

Global Animations: What are they?

Basically Uru uses Global Animations for things like the Day and Night cycle we see in Eder Gira. Eder Gira actually has a 10 hour (real time) day. 5 hours of day light and 5 of night. There's a sunrise and sunset in the Age. It's why when we link in one day it's late afternoon, and when we link in on another day, it's the middle of the night.

The movement of the sun and the 2 moons we see there are controlled by Global Animations.

The way the sky goes from the bright blue we see at midday to the starry sky at night is done with what we call Layer SDL Animations.

I'm going to show you how to do this with Max and Cyan's plugin.

Should I Have This In My Age?

In all the Ages we have in Uru and MOUL:a, only 7 have what seems like different times of day:

Eder Gira Teledahn Minkata All of the pods.

Now Teledahn has a day that's like 72 seconds long. But all we have is a sun rotating around on the horizon. It's not the same as the others, and not done the same way. Minkata has a day and a night, but you only see the two different times if you LINK to one of them. If you link into Minkata day time and just stand there, you will not see anything change. Same with the night time Minkata. Again, it's not done the same way as Eder Gira.

Eder Gira and the Pods have Day / Night cycles (all though you can't really tell in Tetsonot's Pod as it's deep under water and always dark there). If you link in and just stand there over time you will see the light change and the skies.

Light in your Age has a BIG impact on how it looks and feels. You may want your Age to have a constant time of day and always look that way (like the Cleft, Eder Tsogahl or Eder Delin). Most of us that make our Ages go through a lot of hair pulling to get our lights to make things look just right. The idea of animating those lights so that it changes how things look might even sound unnerving.

This should not be something you just suddenly decide to do with your Age on the fly. You'll need to plan things out.

Now with that in mind, let's look a little bit at what is going on in Eder Gira.

Eder Gira.....

The way the day / night cycle was made for Eder Gira consists of basically 2 things:

1) Movement and changes in the real time lights, and movement of the sun / moon panels.

2) Layer SDL animation of the materials for things like the sky.

The lights and planes that are used for the sun and the moons are animated so that they revolve around the Age. The lights also have their hue and intensity controlled by animations. As we go from morning to midday, the sun light get's higher in the sky and the light's intensity and color changes getting brighter. As the sun moves back down to set, we have a lowering in the intensity and a change in the hue, until the light is out. At the same time, the light for the moons will rise and get brighter too (but not as bright as the sun of course).

While this is going on objects like Gira's sky dome has it's material animate: The blue sky of the day get's very bright, but as the sun sets it get's darker and more transparent, until the day time sky is completely transparent. At the same time, the night time texture is becoming brighter and more solid until you can completely see it.

There is also a change in sounds. Certain sound emitters are being changed so that you go from Day to Night time sounds.

Now you could animate all this by hand. you'd have to keep track of what is where, and what is going on frame by frame. And that would be a HUGE pain in the rear end!

Using Global Animations makes it to where the animation is controlled by the Age's time of day, and you won't have to worry about the frames! A LOT easier!

Okay, let's get ready.......

Getting Started......

The first thing you are going to have to do is set your length of day in your .age file for your Age. Now if you plan on having a 24 hour day cycle, then you're good to go with the default .age file we make up. BUT...... That means when you go to test your Day / Night cycle will take a full 24 hours to test.........real time! Not exactly a good work flow there!

Even if you want to have a shorter day, say like Gira's at 10 hours, you'd still have to wait 10 hours to see everything cycle all the way through.

So, we're going to give our Age a very short day, but just until we are done testing everything. When you've gotten to the point that you are ready to make your Day / Night cycle, then it's time to edit the .age file.

The best way to do this is to simply delete the .age file you have for your Age in your PlasmaTest folder. Then using Notepad like you did to first start working on this Age, make a new .age file, but this time you are going to change where it says "DayLength=24" to something else. Here is mine from my Outside Test Age:


Notice how my DayLength says it equals 0.25. That's 1/4 of an hour, or 15 minutes. That means I'll see a full day / night cycle in 15 minutes. A LOT faster than 24 or 10 hours. Still, if you want it faster than that, just make that number even smaller. Setting it to 0.016 will give you a day / night cycle that's just under 1 minute long. Now save the .age file. Later, when you have everything set to how you want it and tested, you can go back in and change the DayLength to the value you want for your Age.

Next we need to have some python. Specifically we need to have what most of us call a "Dummy" Python file for our Age. If you don't know how to do this, go take a look at my tutorial on "Builtin Prp File". It will show you how to set up a "Dummy" python file. This is needed for your Age. Once you have one, you need to assign it to an object (any will do) in your scene, and make sure you put a check mark where it says "Make Global"

And last we need to have a SDL file made for the Age. Here is what mine looks like. It only has the variable for the day / night cycle:


Once you have the SDL file for your Age made, you need to make a copy of it, then go to your PlasmaTest folder. Make a new folder called "sdl" and past your sdl file in there. You'll need to restart Max so it can read it. This is VERY important and you can't skip this!

Now that's it for setting it up. Now you need to make your animations.

Layer Animations and Global Animations.

I'm not going to sit here and tell you how to make your lights rotate around, or how to animate your texture. Those things are covered under other tutorials I've done, and if you don't know how to do them, you need to stop right here and go read those tutorials and learn how to animate objects, lights and your Materials.

The only thing you need to know how to do at this point is how to make the animations for your lights, objects and materials that are going to be controlled by your Age's time of day:

For any OBJECT that is animated by movement (IE your lights, the planes that have the Sun or Moon textures that you have rotating around your Age), you need to assign an Animation Component just like you normally would.


This time in the roll out box in your Utils Tab, you need to put a check mark where it says "Animate On Global" like I've done in my picture below:


Now, in the drop down box, where it says (none), you need to click on it, and you should see your SDL variable name. Click on it.

What's that? You are not seeing your SDL variable name? Only the (none) name? Then that means you didn't do like I said and make a sdl file for your Age, and then copy it to a folder called "sdl" in your export folder (PlasmaTest)! You MUST do that so that Max and Cyan's Plugin can read your SDL file!

For Material Animations like making your sky texture go from a nice blue to a dark starry night:

Once you have the animation made (Opacity, Ambience, etc), move down on your Material until you see the "Animations Parameters" box. Again, you'll see from the picture below, you need to put a check mark where it says "Animate On Global"


Then click on the drop down box where it says (none) and you should see your SDL variable name. Click on it to select it:


And that's it people! You can export your Age, Convert it, Link in and watch your Global Animations happen!

Return To: 3DS Max Plugin Tutorials

Copyright (C) 2011 Andy Legate.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU Free Documentation License".