First off, a quick introduction on meshes:
- UT has 2 main kinds of 3D models, BSP and meshes, BSP is used to build the structure of the level and generally is limited to that alone, while meshes can be used to both mapping and modding purposes.
The main differences between BSP and meshes are the following:
BSP Pros:
- Occlusion of non-visible polys
- Unlimited and customized UV mapping
- Support for decals, detail and macro textures, and depending on the render even more than that (DX10 bump/normal mapping comes to mind)
- Very easy to build using good ol'UEd tools
- Can be additive and subtractive
- Per-poly collision
- Support for high-resolution textures (S3TC)
- Poly flags (reflective, unlit, bright, low/high detail shadows, etc)
- Good ray tracing lighting
BSP Cons:
- Fairly unstable due to potential geometry errors (bent polys, floating point errors thus being advised to stay on the grid which is mainly integer and thus precise numbers, HOMs, overlapping of different types of BSP, poly flags that are simply error inducing garbage, etc).
- Relatively slow to render (thus has to be kept as low poly as possible)
- Generates a lot more polys during rebuild rather than the ones you added (BSP cuts and nodes)
- Hard-limit on the number of nodes/polys in the entire map (65.536 if I am not mistaken)
- Cannot be animated nor moved (static, except movers which can move)
- Cannot be dynamically cast into the level (they need to exist in the map itself beforehand)
- Cannot change texturing (except when using ScriptedTextures or a native mod to change them directly)
- No LOD
So having that said, before you do anything, if your aim is to make a map with your own custom 3D models, you have to first choose which ones are going to be BSP and which ones are better off as meshes.Mesh pros:
- Extremely quick to render (when in direct comparison with BSP)
- No geometry errors and WYSIWYG polys
- Polys limit based mostly on hardware and not the engine (but not much the GPU like in newer games, thus you can't have too many polys even nowadays)
- Are not effected by nor do affect BSP
- Has some of the same per-poly flags as BSP does (unlit) and others which BSP does not support (environment mapped)
- Gouraud smooth lighting (although you can make it flat as I have shown in debris effects by manipulating the smoothing groups)
- Can be animated, scaled and have their texture changed at any given time
- Can be dynamically cast into the level
- Can be environment mapped (metallic shiny effect comes to mind when done properly and with the right texturing)
- LOD
Mesh cons:
- No occlusion on hidden polys (the mesh is always rendered as a whole even if a single pixel is visible from the mesh, so beware of high poly models, specially without any LOD applied)
- No support of high resolution textures, decals, nor secondary detail and macro textures
- Have to be built in a 3rd party 3D modelling application, and along that an exporter which works properly
- Cylindrical collision (same as any actor)
- UV mapping limited to 1.0
- Limited to up to 8~9 textures (8 multiskins + 1 texture for environment mapped polys)
- Crouching on top of one of these does not work properly
Generally the golden rule is: BSP for structure and meshes for decorations, although given their visual differences may defeat the "illusion" you're trying to give when mixing both, so extra care is needed to blend both together properly.
Now as for the tutorial itself:
1 - First make the mesh in a 3D application, like MilkShape, Blender or 3D Studio Max (your choice)
2 - Then export it to either _d.3d/_a.3d or .psk/.psa formats (the difference is that in the first the animation is done by vertex, while in the second is done by a set of joints linked as a skeleton). The second one always required at least a joint and all the vertexes linked to it to be able to be exported, while the first doesn't require any of that whatsoever, so for non-animated meshes the first is always the one to go with, for animated pick what fits best for you.
3 - Create a package and the classes to import these meshes (for info on how to create a class and a package, go here: http://www.ut99.org/viewtopic.php?f=57&t=4482)
4 - The models you just exported go generally to the Models folder (although it can be any folder of your choice, you just have to point the path to them on import)
5 - The textures for the model need to go to the Skins or any other kind of folder you see fit (same rule as above). Don't forget to convert the textures to 256-color format.
6 - Each class structure should be as the following (I am going with the _d.3d/_a.3d format import since it's what most use):
Code: Select all
class MyCustomModelActor expands Actor;
#exec MESH IMPORT MESH=MyCustomMesh ANIVFILE=MODELS\MyCustomMesh_a.3d DATAFILE=MODELS\MyCustomMesh_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=MyCustomMesh STRENGTH=0.5
#exec MESH ORIGIN MESH=MyCustomMesh X=0 Y=0 Z=0 PITCH=0 YAW=0 ROLL=0
#exec MESH SEQUENCE MESH=MyCustomMesh SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=MyCustomMesh SEQ=Still STARTFRAME=0 NUMFRAMES=1 RATE=1.0
#exec MESHMAP NEW MESHMAP=MyCustomMesh MESH=MyCustomMesh
#exec MESHMAP SCALE MESHMAP=MyCustomMesh X=0.03 Y=0.03 Z=0.06
#exec TEXTURE IMPORT NAME=MyCustomMesh_Skin FILE=SKINS\MyCustomMesh_Skin.bmp GROUP=Skins LODSET=2 MIPS=OFF
#exec MESHMAP SETTEXTURE MESHMAP=MyCustomMesh NUM=1 TEXTURE=MyCustomMesh_Skin
defaultproperties
{
DrawType=DT_Mesh
Mesh=MyCustomMesh
}
The first 3 import lines are the basic import parameters:
- the first defines the path where the mesh is and how it's going to be called in your package
- the second defines the LOD of the mesh (when it starts to morph in a lower detail, and the values can go from 0.0 to 1.0, being 0.0 "never morph" and 1.0 "morph immediately"... if you tried to import your mesh and completely disappears from view too soon, this is the setting you should look at)
- the third defines the origin point of the mesh (X, Y and Z) and its initial base rotation (Pitch, Yaw and Roll)
The next 2 lines are the definition of the animation groups, where you define the name of each animation, rate and the amount of frames of each one.
It's worth to mention though that even if you only define the groups for 10 frames when you have 200, all 200 frames are still imported, they will simply be unreachable unless you define an animation group for them.
You must be fully precise of the amount of frames for each animation, since if any animation has more frames defined than the ones the mesh actually has, it will import and compile but the mesh will distort and the game will crash immediately once the mesh is rendered.
The 2 lines after those (3rd "paragraph" of imports) define the initial scale of the of the mesh. Notice how the Z scale is always the double of the X and Y counterparts: this is due the fact that the _d.3d format has only half of the numeric range in the Z axis relative the X and Y ones, and thus once exported the mesh is always scaled in half in the Z axis and so to import with the correct scale, the Z axis needs to be doubled once again on import.
The last 2 import lines are the import and assignment of the skin texture to the mesh:
- the first just imports the texture, and here you define the final name of the texture, the path it gets to be imported from, the LODSet (which game detail settings affect this texture: 0 is none of them, 1 the world settings and 2 the skin settings), and Mips defines if mipmaps should be generated for this texture or not (if the texture is 256x256 MIPS=OFF is desirable as it looks more detailed on distance, and even when rendered closeup, if above 256x256, MIPS=OFF should not be used at all otherwise some renders (including the one that comes with the game) will crash).
At last we have the default properties, where it's defined that the actor should be rendered as a mesh, and which mesh it's supposed to render.
In this case I expanded from Actor, but you can expand it for any class you find proper, like Decoration or that makes more sense in the context of what you're trying to add to your map or even your mod.
Like I said, a rather quick one without images, but I hope this still proves to be useful as it is. Any doubts you have just ask.