Animating Day/Night window transitions:
Come here for tutorials and 3d training. The aim is to point out good 3d training sites or methods.

Moderators: Winterhawk99, Mermut, Bannor Bloodfist

Post Reply
User avatar
Bannor Bloodfist
Posts: 1309
Joined: Fri Oct 09, 2009 11:45 pm
ctp: Yes
dla: Yes
TBotR: Yes
nwnihof: Yes

Animating Day/Night window transitions:

Post by Bannor Bloodfist »

Forgot to Give Tom_Banjo credit for teaching me most of this!

Quick Note: that we will not actually be ANIMATING anything, but we will be using the animation engine to fade an object in and out of view to give the illusion that the window is changing from day to night and back. Later in this tutorial, we will be adding a light to change the color of the night window to make it appear lit from inside, and of course turning that light back off to simulate turning off the lights for daytime. So if you are looking for instructions on creating moving objects in a tile mdl, please look for a different post.

Ok, first off, a couple of basic assumptions:

  1. You have a version of max or gmax.
  2. You have nwmax installed as tools needed to work with NWN mdl files.
  3. You know what a mdl base is.
  4. You know how to import that mdl into whatever version of max you are using.
  5. You will not need to search for, nor will you find, an automatic way to do this. It doesn't exist.
  6. You don't 'directly' link objects to anything. Max handles ALL of that for you. Provided you follow the steps below. (IE: there is no drag and drop an object onto an animation selection, nor will clicking on that animation list show you anything by default. The only thing you see when selecting the animation node is the start and end frames.)
  7. You already have 2 window panes (of glass) in your mdl. One for daylight, one for night. They should be textured with different colored textures to allow for the illusion of lights coming on at night.
  8. The two window panes should be seperated by at least 1 cm front to back, with the night one set behind the day one if looking straight onto them. IE, the day one should hide the night one.
  9. You have a reason for wanting to do this, and you don't mind pain. :D This is not for the faint of heart, but it really is not all that difficult once you get past some of the misconceptions that I had originally!

Open your mdl file. In these expamples, I will be working with a default bioware rural tile, named TTR01_S07_01.mdl (see shot)

This is a simple building, with windows that change from day to night and back again during normal use. (Nothing moves, for moving objects, please see another post that I hope to have uploaded shortly)

So, select the mdl base. (see shot)

Now look over on the right hand side to the rollout section and notice the animation(s) listed there (see shot)

If your tile does NOT have these anims defined yet, you can quickly add them using the defaults (see shot)

Be sure to either note down these settings (start, end and transition numbers) as you will use them later if you are modifying someone else's work. If you are placing the defaults, then the start and end frames for all of them will be zero. We will actually CHANGE them after we are done defining what we want to happen.

Next, select the anim node dummy and anything you have linked as a child as well as the mdl base. (if you have NOT already linked the objects, (window panes) to the animation node, please do so before proceeding. (see shot)

Now that you have those objects selected, hide everything else so it doesn't get in the way for now.

Next, select the first pane that you want to be set as your default look during the day. Notice the default settings for Alpha and Self illum color (see shot)

Next, select the start position on the animation slide bar (this can be anywhere on the timeline you want/need, but for our purposes, we will start at zero) (see shot)

WARNING: Although the images shows me setting the AUTOKEY button, this is VERY dangerous.You would be MUCH safer using the 'Set Key' button. Autokey tracks every click on every object and can set animations on things you don't want touched etc. By using 'SetKey' option, you just have to click on the large Skeleton key when you have whatever it is, adjusted to however you want it. IE, you start at your zero position, get everything ELSE setup. Ensure that you have selected the object you wish to work with, then click the Skeleton Key. Next go do whatever changes you want, move the anim bar to where ever you want that change to occur, and use the skeleton key again to force a new point onto the animation bar.

This has gotten you a default position or 'normal' state for your main, daylight, window pane.

Next, select the 10 spot on the animation slide bar to give us a new key position. (click set key button) Make no other changes. We are just resetting a key point in the anim cycle. We want the alpha to still be a full 1.0. Do the same thing at location 20 (see shot)

Now go back to anim slide bar and select the 28 spot and set a new key. Once that is selected, on the right hand rollout, adjust the Alpha color up from zero to first setting. 0.03 something. (It is actually down from 1, but requires several clicks to get it to one spot above the zero point.) (see shot)

Go back and select the 29 spot on the anim bar add a key (set key button), and change the alpha to be zero.

What we have done so far, is select the day pane and give it a start look, and several points during the cycle with that default look. We have also defined two endpoints, one where the alpha is slightly above zero, and one that is exactly zero.

Now click on the timeline at the 38 second point. Set a new key here. Again changing nothing else. We just want a 2nd key, down the timeline that is also set with Alpha at zero.

Now click the 39 spot on the timeline. Again, set a key. Adjust the alpha to 0.03 or upwards one click from zero.

Click 47 spot on timeline and adust alpha up to 0.9 and set a key here as well.

Click 50 spot and set alpha back to 1.0 and set a new key.

We now have a starting point with the alpha at one, and several points along the timeline where the alpha changes down from one to zero, and back up from zero to one again. Our intention is that the window starts solid, fades to nothing, stays at nothing all night, and fades back in to solid during the day.

Next, we need to adjust the main animation settings, for the animation parameters.

First, select the mdl base, and then select the Night2Day animation. (see shot)

Below that you find the name listed again, and below that you find Start and End frame boxes as well as transition.

The start frame box for Night2Day will be the number we used above, in this case, 38. So Start Frame needs to read 38.

Next change End frame to the setting for the solid look on the window, in this case that will be 50.

The transition gives you the opportunity to set the gradient that is used to fade objects in and out between the start and end frames. A 0.25 setting is good here, it gives a nice, slow change.

The start and end frames for 'DAY' are Zero to start, and 20 to End. Since nothing changes, transition doesn't matter.

Do the same thing for Night, Day2Night, IE: adjust their start and end frames to match the settings we used for them above.

What we have so far done is to set the 'Day' window pane to hide itself during the dusk and night, and to return to view during the dawn and stay there during the day. (Thus making the Night window show up from Dusk till Dawn...wasn't that a movie?). next we need to make the NIGHT version of the Window appear to 'glow' during the night. This 'glow' effect is NOT a light, but a direct effect applied to the night window itself. It makes the pane of glass appear to be self illuminated, without that pane casting light or shadows. It is accomplished with just ONE change to the object, and one that is applied without animation. IE, it is the default, and full time setting for this object. (see shot)

During the Day2Night Transition and stay that way until the end of the Night2Day transition. Now Export mdl+animations and load it up in game, the window will change from the way it looks in the first pic of this tile to be what is shows in this picture. (see pic)

Window, IN GAME, during daylight. Note that sun is behind the building, so this wall is actually in shadow. (see shot)


Window about halfway through a Day to night transition, effectively 'Dusk' in the evening as the sun is going down. Again, the sun is behind the building to the left, so this section of the building is in shadow. You just barely see that the day window pane is still slightly visible, but the night window pane is showing up more. (See shot)


Now, full night, Only the Night window pane is visible, that pane of glass glows, and the auroraDlight is casting light onto the ground. (see shot)


This shot shows that same window at night, but minus the auroraDlight. The window pane still glows, but there is no light cast onto the ground. (see shot)


Here is the same scene, but this time there is a light, with no glow added to the window pane itself. (see shot)


Now the combined again, with Window Glow enabled, AND the AuroraDLight casting light at night. (See shot)

Post Reply