Animated DNC Light Models

Animated DNC Light Models

DNC (DayNightCycle) is a model made to simulate day/night cycle behavior. It occured to me, one day, that I could make one with much more contrast than the original, Blizzard ones, have. I started editing values in Magos' model editor, just to realize that the editor doesn't save those values, but discards them. Then I thought, no biggie, I will just write everything I have in MDL, and then convert it to MDX, using Guesst's MDLX converter. It did save animated light and intensity values, but now I've had to deal with a different problem: all lights were set to Ambient, and in order for this to work, they must be directional.

I've realized that this is a common problem people don't actually know about, but just think that their generated lights simply "don't work". Truth be told, light nodes are immensely simple in Warcraft III, but those two great tools do not cope too well with them.

So, here's what we need to make our DNC model:

Step 1: Choosing rotation and position

When you want to create a custom DNC model, you must also think about where you want your light to come from. This is pretty hard to do in .MDL alone, especially if you are not familiar with the way coordinates/rotation works in model files.

First go to "Windows > Animation Controller" and set it to play the "Stand" animation.

Now, open the "HelperModel.mdx" that I have provided, go to "Windows > Node Manager", right-click "LightSource" and then "Edit Node". Here you can open "Translation" or "Rotation". First you should set "Rotation" values.

When you open the "rotation" window you will see some zeros and ones.
0:{0,0,0,1} is what you get. Changing the first value changes the roll of your light while changing the second one changes its pitch. If you want a pure left-to-right light, for example, you will only change the first value. If you want to change the rotation further, change the second one. If you want the light to come from the camera eye, you will have to edit both. Basically, you can leave the third and fourth values intact. When satisfied with the angle, copy values (like 0:{0.3, 0.1, 0, 1} for example) to a blank text file, you will need this later.

Now you need to change the light object's position.
Experiment with 0:{0,0,0} values until you're satisfied with the position of light source. Keep ind mind that Z (the last value) should be around 450, as set by Blizzard, but it is important to mention that the first two values do matter a lot. Since you've set rotation in the helper model, now you should also change the X and Y coordinates so that the light's beam (the spike on your HelperModel.mdx) hits the center. Once you've set the values properly, copy them (in my case 0:{-80,-80,450}) to the text file you opened to paste rotation data.

Step 2: Setting up the actual model file

Open the file DNCUnit.mdl in your text processor and follow the instructions provided there. You will have to create two files, one for units (actually, objects), and the other one for the terrain.

Step 3: MDX Conversion

This step can go two ways, either you'll use Yobgul's converter, or Guesst's. With Yobgul's converter, all you need to do is to convert it (and hope it doesn't give you errors without converting the file) OR you will have to use Guesst's tool, which leads to the hex editing stage. What's the catch, why would anybody use Guesst's if it requires more work? Because Yobgul's converter makes perfect Blizzard conversions, by using Blizzard's native .dll files. However, it requires the retail ones, before any patching has occurred, and they can be found in the war3.mpq archive. Not to mention Yobgul's converter won't convert the file at all if you, for example, put the order of some parameters or tags wrong (which all other converters tolerate) and there's few people I know who have been able to properly run it in 2012, on 64bit windows 7. The knowledge about Yobgul's capabilities largely comes from our resident .mdl master, Rao Dao Zao, so a lot of credits to as far as that is concerned. So there you go, if you can get your hands on Yobgul's converter, make it work, make it actually convert the model, you won't need the next, Hex editing stage. In case you are not very lucky with Yobgul's...

Convert your model to MDX using the Guesst's MDLX converter. Just open the tool, click convert, and find your model file, the .mdx version will be saved in the same folder. Aside from being handier and fixing a lot of stuff for you, Guesst's converter also 'fixes' something it shouldn't...

Step 4: Hex editing

Since Guesst's converter doesn't process light node's type properly, you will have to do so yourself. Not a biggie, though, unless you get lost in the model data. Open up the hex editor, and pay attention to any block that may reassemble this:
Important Block.jpg
When you find it, click on the first character after "yyyy" (or "FF FF FF FF" in hex) on the right. Then, when you see what you've selected on the left, double click it on the left window, this lets you change the value via hex. You have two fields that you must edit, and you need to edit the first one to "01" and the second one to "02".
Once done, you've done half the job. Now, if the "@?" (or "40 3F" in hex) block isn't directly below the "FF FF FF FF" one, do not mind, search for it, keep in mind that it can't be more than two rows farther. Once found, use the same technique to edit values just after the said block to "01" and "00", respectively.

Do this for both models you're supposed to have, the DNCUnit.mdx and the DNCTerrain.mdx one.

Step 5: Import into the map and use

Once everything is set, you can start testing your models.
Just import those two models you made into the map, and use the custom script
call SetDayNightModels("DNC\\DNCTerrain.mdx", "DNC\\DNCUnit.mdx")
...assuming you change the strings to your file's locations (and don't forget to replace "\" with "\\"!).

Now you can load the map, play around and see if you need to change something, after reading the tutorial, you will have the knowledge to know what is wrong, so fixing will be easy. Here's the result, as provided by Anvil, since the video has compromised youtube quality, you can instead check the attached map out:


  • DNCTest.w3x
    43.2 KB · Views: 591
Last edited:
I'll try it now, light animated are bugged in magos.. and for this, all my DNC are in ambient light and looks ugly :p

Edit: This works, but if you use another model, all parameters change.
I tried to follow the steps but couldn't find what you have in the pictures, so looking at some values ​​I could change from, ambient to directional, ambient to omnidirectional, etc. +rep
Last edited:
I'll try it now, light animated are bugged in magos.. and for this, all my DNC are in ambient light and looks ugly :p

Edit: This works, but if you use another model, all parameters change.
I tried to follow the steps but couldn't find what you have in the pictures, so looking at some values ​​I could change from, ambient to directional, ambient to omnidirectional, etc. +rep

Yeah, it is mostly that 0 = ambient, 1 = directional, 2 = omnidirectional. The most important thing to change is that one zero to 1, all others, I think just make it work somehow.
I've made a video for those who want a screenshot, this is a custom DNC model made from scratch some time ago. With this tutorial, I optimize my old model converting it from ambient light to directional light. Game speed is 800%, with normal speed the transition is alot better.

Youtube destroyed the quality of the video, maybe at night up the video again with better quality.
Level 10
Dec 21, 2010
It still lack with step by step instructions.. I dd'nt get the last part on importing the two.. models do you have DNCUnit.mdx and DNCterrain.mdx that is ready to import?.. should I change the path "\" to "\\"? can you please put a specific path so I can just copy paste it... I really want to use this in my map....

EDIT: nvm, I used Anvil's map test and it works! I'll put both of you in credits ^_^
Last edited: