Making a complex model



Handy Myth model rules:

Myth can place a maximum of 128 model markers per map. By model markers, i mean 128 instances of model per map. this could be 1 model placed 128 times, or 128 models each placed once.

Myth can handle a maximum of 8 unique animated models per map. this means you can place up to 8 different animated models as many as 128 times total, and it uses up your model limit too.

Animated models have a limited number of frames. The exact number appears to be variable, and may be due to a combination of unique geometry data, texture memory, and other internal memory caps set within the engine. I've seen instances however where as many as 20-30 unique frames will work.

Animated models cannot be rotated. If you want to rotate the facing of an animated model, you'll need to make a new version of it.

Models are limited to 512 triangles, and the actual number (due to a bug i assume?) might actually be more like 509 or 510.

Models must have triangulated polygons. From FormZ, the triangulation needs to be set manually on export. From Meshworks, the triangulation appears to be set right by default.

Models have a virtual bounding region which is determined by their outmost X, Y and Z shape. This bounding region cannot be intersected by another model.

Textures need to be a power of 2 and no larger than 256x256. this part is pretty standard with today's 3d engines. So you can have a texture be 128x128, 64x256, 128x16, 128x32, etc. Myth can display mirrored or flipped textures but not repeated ones. Textures have access to the full 8bit palette with 1bit alpha, or in some cases a 4 bit alpha mask.

One thing to note here is that myth has an arbitrary cap on unique collections, it's guessed to be right around 32 for the entire level. Every unique scenery item, every unit, every model will typically have it's own collection. Even the terrain, overhead map and interface graphics are supposedly factored into this limit. This is why collection sharing between models can be really important.

Starting to feel a bit limited? fortunately these limits are probably the worst of it.



A complex shape

I have very few models that deal with every possible dillema and problem that can come up when making complex myth2 models.

So for our problem child today, i will choose "destroyed building" from level 5 of jinn. As someone from europe or something might say, "what a bugger". (image) (image)

The main problem with destroyed building is it's amorphous shape. simply put, myth2 was never designed to handle a polygonal mess such as this. Because the nearby fallen pillars intersect the bounding region of the main building shape, i opted to make the whole thing one model.

Here is the original concept rendering. (image)

I remember when i told fisj that i was gonna put this model into myth, he laughed at me. if the laughter was meant to goad me on into actually building it, then it worked. This was after i constructed the nionel level and was pretty sure i knew every rule about myth models well enough to know how to break them and still make it work. =D

I knew before i even started that i'd need to tone down the polys from what my concept rendering appears to indicate. That's how i tend to work- although i'm aware of what the engine limits are, i choose to ignore them when designing. When implementing the design, i'll make reasonable changes based on gameplay and performance. i believe this is the best way to work, it allows for a form of creativity at every step of the process.

Another thing to note about the geometry is that myth's renderer tends to distort and skew polygons in software mode. in order to make this shape look solid even in software, i subdivided down large surfaces into smaller triangles. as a rule, i try to never make triangles larger than 4 mesh cells. i've learned that this is about the maximum threshold before myth begins to radically distort your textures.

Performance wise, it's usually not triangles that kills myth2, it's the amount of unique collection data it needs to load and display per level. More on reasonable usage of collections soon, this model clocked in at 253 triangles- and already consumes a large portion of screen real estate. (image)

The largest problem with this model was the depth sorting. Getting it to display correctly from most angles proved difficult, but was accomplished by a combination of Closest Z and Dependency settings. (image)

There were still some instances like here where the model would break from one side but not the other. I couldn't tag the exterior wall as closest Z because it would draw over units who might walk near it. (image)

The solution was to texture the interior wall black to match the mesh. Then, the interior mesh, which is never played upon, was dragged upwards to be out of the rendering angle when viewed from the exterior. This way it would not clip so much (as mesh backfaces are never drawn) yet it would display correctly when viewed from the other side, as all the player would see was a blackened inside corner. (image)



Optimized Textures

It's important to keep your collections data low for each level if you want it to also play well. by keeping it low i mean both in the number of unique collections used and total amount used for the entire level. as a rule of thumb, unique collections should be under 5-10 (depending on the level and what else you have going on) and total meggage should be under 3mb if you want things moving along at a nice framerate. if performance isn't important, ignore these suggestions.

This may sound impossible, but it really isn't. Assuming you had 5 unique collections for model textures on your map, and at 256 colors per collection, you have 1280 total colors in your palette to pick from acrossed your models. managed right, it's an ocean of color.

There's a good technique you can use for models that keeps collections data down. It's called collection sharing, and it's pretty straightforward to manage.

the idea is that you'd have multiple models using the same collection tag for texturing. the collection that you make should be packed as tightly as possible with as much similarly colored texturing, this way it's on the same palette. each model can only use one palette at a time, so really, it's all in the management.



The Chimera Castle

Now this is where i get to pretend that my brain is as big as Derek Smart's and talk about how much cooler my toys are than the next kid. In the addon Chimera they made a castle at the end of level 7, and it tended to slow people's machines to a crawl. This wasn't because the myth engine was incapable of handling such extensive use of scenery models, but rather they designed it way too bloated for it's own good. (image)

If you open up and study the collection files attached to that castle, you'll find about 5mb worth. most of it is redundant data, less than 500k is actually unique. that means 4.5mb of it was bloat, and could be cut out with some collection sharing. this work takes less than an hour to do and can be done with a hex editor.

If you think about it, the incredible load lag associated with looking at this castle for the first time in the myth engine is the performance equivalent of asking myth to reload the entire level texture map again. except it's while the game is running and you are playing. myth does not precache these textures, this is one reason why they typically need to be pretty small.

by sharing the collections you can reduce the collection files to 1/10th their size. and it will look exactly the same as the 5mb version, only it will play alot faster. you could even add detail, go back in and add another 500k of unique textures (bringing the total to a tolerable 1mb) and make the castle look way more pretty and detailed than the original, while keeping the framerate high.



Links Index

Pages 2-4 cover the use of Apathy. Pages 5-6 cover
the model making process in detail. Page 7 takes you
to where you need to get more goodies.

Page 1 - Documentation Overview

Page 2 - The GUI

Page 3 - Touched by a triangle

Page 4 - Affecting mesh cells and vertices

Page 5 - Making a simple model

Page 6 - Making a complex model

Page 7 - Other Tools