|
 |
 |
 |
 |
This will hopefully give some insight into
how to use MIP levels to your advantage to achieve the best possible
appearance for objects in Microsoft Train Simulator 1.0. While this is far
from a complete explanation, it will hopefully guide you in the right
direction for learning how to determine what settings to use and how to
manipulate shape files and textures.
Scott Miller (Click here for Scott's
original guide) |
|
 |
| Some background info... |
MIP is short for the Latin Multum In Parvo, which means 'many
things in a small place'. It refers to a sampled-down version of an
image. Kuju .ace files have built-in MIP maps (which I may refer to as mips, because it's easier). What this means is that one 'image file'
actually contains more than 'image'. A 256x256 pixel .ace file not only
has the 256x256, but also every power of two down to 1x1 - 256, 128,
64, 32, 16, 8, 4, 2, and 1. That's nine total. (see below).
It gets a
little more complicated involving DXT1 and .ace files, but I won't go
into that here. So why do we care? The Kuju-supplied makeace.exe and
makeacewin.exe do not generate mips properly. Mips are normally
generated by taking a cluster of four pixels (in a 2x2 arrangement) and
averaging them into one pixel (called a box average). This reduces the
image by a power of 2. The faulty algorithm used by makeace/win merely
chooses a predefined pixel (bottom left, but not certain) out of the
cluster and uses that for the pixel in the next mip. While not obvious
in the first mip, you can imagine how the error compounds.
|
|
images ( 2
image ( acefile1.ace )
image ( acefile2.ace )
)
textures ( 2
texture ( 0 0 0 ff000000 )
texture ( 1 0 -1 ff000000 )
) Let's go over a couple of settings first. In the .s (shape) file,
there is a group called 'images' that lists all the image files used on
the shape. The images are indexed starting at 0 and counting down.
Immediately following it is a group called 'textures' which defines
texture settings for the images listed. Looking at the example,
acefile1.ace and acefile2.ace are images 0 and 1 respectively. You can
see that the textures reference this by the first value in those
entries.
The other value of importance in the textures section is the
third one, which represents the mipmap LOD bias. This basically tells
the sim where mips should be activated. A value of 0 means 'no change'.
This is what is shown for image 0. Values less than 0 (usually
integers, but not required) tell the sim to push the current mip back
that much farther. For example, a value of -1 (image 1) tells the sim
to use mip 0 (the main image) out to where it normally would, and
continue using it out to where mip 1 would normally end, and then
switch to mip 1 where it would normally switch to mip 2, switch to mip
2 where it'd switch to mip 3, and so on. Values greater than 0 do the
opposite - they switch in smaller mips for larger ones. In general,
this is not a concern, because it is easier to reduce the texture size
by 50% and save on resources than to have it present, and not use the
largest mip. If you're still awake, let's get on with the show.
|
|
|
|
Note: all the images below are thumbnails. The effects I describe
don't show up in the thumbnails very well. Click on them to get the
full effect.
|
|
 |
| Object: default textures, 0 mip bias |
 |
 |
So you've produced an object and it's ready for use in MSTS, but it just doesn't look right. What can you do about it?
Shown here, the object has default textures (as-produced by makeace). The mip bias for all images is set at 0. Note the strange effects occurring on the edges of the building. This is the result of makeace's faulty algorithm. Since the texture applied is a repetitive one (brick), strange scaling effects can appear when the pattern repeats in pixel lengths that aren't divisible by two.
To put it simply, what happens is every so often, the mortar joint falls on one of the rows of pixels slated for removal, and is disappears. This effectively joins two bricks together. It may not happen on the first mip, but it usually does happen eventually.
|
|
|
 |
| Object: default textures, -3 mip bias |
 |
 |
I know how to fix it!
Before correcting mip levels was an option, the common solution was (and unfortunately still is, which is part of the reason for this tutorial) to set the mip bias to -3 to basically force the sim to not use the mips until the object would be so far away that you couldn't tell they were messed up.
You can see the difference where the strange looking areas are gone. Unfortunately, we're left with another nasty effect. Moiré. These concentric patterns occur because the sim is trying to draw a texture onto a surface that is too small. It has to throw out some pixels, and which ones it throws out depends on the size of the surface. Moiré looks bad enough in the picture - it is much worse while you are moving relative to the object, as the Moiré pattern changes as your relative position changes. |
|
|
 |
| Object: remipped textures, -3 mip bias |
 |
 |
So what was this talk about correcting mip levels good for? My object still looks funky!
Just remipping the textures is not enough. As you can see, using remipped textures with the mip bias still set to -3 results in a remarkably similar appearance to the default textures. This means that suppressing the mip levels worked.
This is not what we want. Instead of suppressing them, we want to use them to our advantage. Since the mips are smaller than the full image, they will fit onto the surface better, reducing Moiré. |
|
|
 |
| Object: remipped textures, -1 mip bias |
 |
 |
That looks better...
Here, the mip bias for the important textures is dropped down to -1. You can see how the Moiré is reduced, but some still appears on the close side of the wall more perpendicular.
So why the division on a flat surface? The mips kick in based on many factors. One of them being distance from the view source, and another being the surface's angle relative to the view source. It just happens that this criteria was met along that surface, and a division occurred. There are ways to reduce this effect by choosing different texture filters, which I'll discuss shortly. |
|
|
 |
| Object: remipped textures, 0 mip bias |
 |
 |
Almost there...
Now we've dropped the mip bias back all the way to 0. It's important to try different options, because factors like size of the texture relative to the object, size of the object, the distance that the object will be from the typical viewing position and other factors all play a part in what will look best.
It is important to change the settings, and then move around the object in a manner consistent with its intended purpose to get a feel for how it looks. And from what I've noticed, looking at it in the RE doesn't count. I chose to drop down to 0 because the object is fairly large, and is intended to be viewed from a bit of a distance. This cut down on Moiré at the expense of introducing a little fuzziness, which happens when too small of an image is applied to a surface, which is typically the result of too small of a mip being selected. |
|
|
 |
| Object: remipped textures, 0 mip bias, named_filter_mode changed to LinearMipNearest |
|
|
|
 |
So that's part of the story. Now, if you've got a good enough video card, go figure out how to turn on anisotropic filtering and anti-aliasing to improve the visual quality even more.
email: smmille1( AT )yahoo.com |
|
|