TUTORIALS - UE3 MODELING 1 - BASICS

Info

About : This tutorial will explain how to import a model into Unreal Engine 3, and a number of important properties involved in the process. Note how this tutorial will only focus on the creation of static meshes, and not on animated meshes, which is a wholly different process.

Target Audience : Beginner

Platform : Unreal Engine 3

Last Update : November 2007










What it can and can't do

Importing a model into the engine and configuring its flags is very easy and takes less than 10 seconds once you know what to do. We'll start this tutorial with a shortlist of the things the engine supports and offers, and the things it does not.


Can do

  • Ascii Scene Export (ASE) support. Default export format of 3DSMax.
  • Virtually no polycount limit on what it can import, although importing can take an age if the polycount runs into many ten thousands.
  • Supports smoothing groups, vertex colors (only since certain 2007 builds), virtually unlimited number of UV sets/channels, open edges, meshes of any size.
  • Can lightmap a mesh, or vertex light it.
  • Models do not need to be triangulated before exporting, nor collapsed.
  • Unlimited UV space, including using negative UV space.
  • Automatically tessellates meshes in case vertex lighting is used.
  • Supports importing externally made collision models.
  • Supports per poly collision if one does not decide to import a separate collision along with the model.
  • Supports "auto" generating low poly collision models after import, if one does not decide to go with either externally made collision models, or per poly collision.


  • Can't do

  • Does not support importing Cameras, Lights, Materials, Splines, Nurbs meshes and similar.
  • You can't export pivot points. It always uses worldspace 0, 0, 0 as its pivot point.
  • Does not like strange characters in file names, or spaces.


  • This tutorial will focus on how to export a mesh from 3DSMax. XSI and Maya users will need to download the Unreal plugin before they can commence modeling for Unreal. Max users do not need to as Max supports ASE exporting by default.

    The plugins for Maya and XSI can be found here.




    Setting up a model, exporting, and importing


    Your 3D package should preferably use a type of Generic Units as grid size. The actual unit size doesn't really matter in the end though, as whatever unit you had in the 3D package will simply translate as 1 unit in Unreal. 400 Units width in the 3D package means 400 units in Unreal. Usually the player size is between 80 and 250 units. This depends from game to game, as the size of a character is freely customizable.

    The implications this has on you, is that there is no true way to translate an Unreal unit into the metric system. One can't say X Unreal Units equals X meter (or feet) as this varies from game to game.


    A model must have UV coordinates and it must have correctly configured smoothing groups (preferably).



    If you want to use more as one texture on the model, you need to create a Multi/Sub Object material in the material editor, and assign a number of sub materials to it by using the Set Number button.
    These materials can be set to the mesh by using the Set ID feature in the Edit Poly and Edit Mesh modifiers.




    Materials need a bitmap in the Diffuse Color slot to export correctly. You may add additional maps to all the other material slots, but those won't import and are thus only useful for previewing things in 3DSMax.

    Once your mesh is ready, make sure it is positioned on coordinates 0, 0, 0 as the world's center will become the pivot of the object once exported. Export the mesh by going to the top menu of 3DSMax File - Export Selected - Select ASE as type.

    Following menu will pop up:



    The settings marked must be enabled. Anything else is optionally and won't make a difference to the engine.

    Note that models cannot be exported together. Every model needs a separate ASE file or it will merge itself with other models into one big object.


    Once the model has been exported, open up the editor, and go to the Generic Browser. If it isn't open already, you can open it by the button on the top toolbar (marked on the upper left of the screenshot).

    In the Generic Browser go to the File menu - Import - and select your file. Once you ok'ed the import dialog, a new window will pop up.




    This new window allows you to set a name for the object, and a name for the package. Optionally you can also set a Group name if you desire so. Be sure to not use spaces in names.

    Once imported, you should browse to the package, and double click your mesh in it. The Staticmesh Properties window will open.



    Expand the LODInfo to add your materials to the mesh again. If done correctly, the mesh will have exactly as many material slots as you added to the Multi Sub Object in 3DSMax.
    Optionally you can also configure the Lightmap information. For more information refer to my Lightmap tutorial.

    You're done! Add the staticmesh to the world by using the rightclick menu, or by holding S on the keyboard and clicking somewhere in the world.





    Collision


    Three different types of collision exist:

  • Collision made in an external package.
  • Collision generated by the editor.
  • Per-poly collision.

  • Usually only larger and more complex meshes have their collision made in external packages. Anything that will do with cubes, cylinders and similar shapes is done in the editor. Large natural objects such as caverns often use per poly collision.



    # Collision made in an external package

    All you need to do is to give the mesh you wish to use as collision the prefix UCX. Example: if the regular mesh is named Tree, the collision for Tree should be named UCX_Tree. Select both, and export both together into the same ASE file. Upon import the engine will recognize the UCX mesh, and assign it as collision model. It will not show up in the Generic Browser.



    # Collision generated by the editor

    Three subtypes exist: DOP models, auto generated convex models, and BSP made collision. You are free to use whatever type you want, although usually DOP models are easiest to apply.


  • DOP models

  • DOP collision models are simple shapes like boxes and cylinders. 6DOP for example is simply a box which transforms the bounding box into a collision model. Experiment with the DOP's to see what each one does.

    Note that you can preview collision by enabling the marked button.




  • Convex models

    Convex collision creation allows you to generate a collision model that fits your model better than standard DOP models. It can be accessed in the same menu as displayed in the DOP collision image (Collision - Auto Convex Collision)





  • BSP collision

    It is possible to use the shape of the red builder brush as collision model. This allows you to create quite complex collision models without the need of creating those in an external application.
    To assign the shape of the brush to the model, place the brush where you want the collision to be, and select both the brush as the model and rightclick them. Select Save Brush As Collision to assign it.





  • # Per-poly collision

    In the properties of a staticmesh, simply turn off the two settings marked to force per-poly collision. UseSimpleBoxCollision and UseSimpleLineCollision. Optionally you can also turn off UseSimpleRigidBodyCollision so physics too use per-poly collision.



    By default your model will have these settings enabled, while having no type of simplified collision configured. This will cause the player to walk through your model. You must do something after importing your model, either creating a simplified collision, or enabling per-poly collision, or it won't work.





    Batch exporting


    By using KeensBatchExport script for 3DSMax, you can mass export dozens of meshes within a second, dramatically speeding up the process.

    Download the script

    Bind it to a button on a menubar or on the keyboard, and then open it.



    Be sure to enter an output directory, and "ase" as extension. The three other necessary options speak for themselves.

    This script will automatically place all meshes on location 0, 0, 0 before exporting, and it will place all meshes back on their original location after the export. This way you can easily have dozens of meshes in the same Max file, and easily transform their own pivots into the ingame pivot.

    It automatically names the ase files with the names the meshes had in the Max files.





    Common problems



  • Multi Sub Object material not translating correctly to the engine


  • Some materials in 3DSMax may be sharing names, thus confusing the engine. Fix it by renaming offending materials.
    In this example both materials share the same name (Material #25), even while they do have different textures assigned.







  • Meshes are disappearing after having restarted the editor


  • You might have forgotten to save the package! Packages need to be saved manually, or changes will not be saved.
    If that is not the solution to the problem, you might be using shared package names. Package names must be unique and may not contain spaces and similar non standard characters. Unreal does not see file extensions so a package called Dog and a code file Dog are identical to the engine, and it will get confused. Likewise for a level and an asset file with the same name.