Basic GMax tweaks (ASM tweak)
This article has been written by Christian Stock on the AvSim forum. It has been written for the Fs2002 gamepack of GMax, so not everything might still be valid.
This manual won't go into any gmax design techniques, but rather explains a few technical things concerning making scenery for FS2002. This manual should help to create truly professional sceneries and explaines a few advanced concepts that aren't covered in any SDK released by Microsoft.
First of all, makemdl is quite incomplete in some aspects. If you would just use makemdl alone, there are a lot of things you can't do. For most of the things explained in this manual you'll need to edit the ASM sources directly.
By default, makemdl produces bgl files, and you don't have any influence on the code generation process. To be able to tweak the bgl code, you'll need the source ASM files. Makemdl works like this: First it exports the model into the ASM format (which is a readable text format), then it compiles the ASM files using BGLC into the binary BGL format, and finally deletes the ASM files. What we want though is modify the ASM files and then compile them by ourselves. The new makemdl that came with the SDK has an option to keep the ASM file (the makemdl from FS2002 Pro doesn't). Make sure that that option is always selected (by default it is off). To compile the ASM file you can simply drag and drop it onto the BGL compiler BGLC (which also comes in an SDK).
Actually, you will find that you'll have two ASM files for each object. One is a 'wrapper' file (filename.asm) that does a few initialisations, and the other is the actual object file (filename_0.asm) that contains the vertices and polygons. You only need to compile the wrapper file, because it calls the object file from within, so that both files get compiled into one bgl file. You will use that sort of 'nesting' of asm files yourself in this tutorial, it can be quite handy to have several files that in the end will be compiled into one file. Be aware that you may have to make changes to both files.
As the name suggests, makemdl primary purpose is to design airplane mdl files. The bgl scenery functionality seems to be a bit slapped on in some regards. There are two things that need fixing in the ASM code.
Firstly, every scenery object gets a crash box or crash octree. I won't go into any details how an octtree works, you really only need to know that an octree is one way to do very fast complex crash detection. In the crash detection code the crash type is also set. By default this is CRASH_OBJECT. However, you may want to specify a more appropriate type. In most cases that would be CRASH_BUILDING_PLANE, i.e. a crash between your plane and a building.
The other thing makemdl does is to set the texture type as 'TEXTURE_AIRCRAFT'. This will cause the texture to vanish after a certain distance, and won't use any available mipmaps. You should always change this to 'TEXTURE_BUILDING'. The texture will behave correctly then. I should mention here that by changing the texture type to 'TEXTURE_BUILDING' glossmaps (TEXTURE2_REFLECTIVE) and lightmaps (TEXTURE2_LIGHTMAP) won't work anymore. However, this is no serious limitation. Instead of lightmaps you should use 'TEXTURE_NIGHTMAP' anyway, and specular textures using glossmaps (reflective textures) won't work correctly on buildings anyway, as explained further below.