Porting Levels into Source
General Overview of Converting Scenes that Were Not Designed with Source in Mind
A very common task in some modding communities is porting levels from another game into a Source mod. Below are some tips to help you in this task. Please note that you should only port levels for which you have permission to port. Most commercial game content is copyrighted. You should always contact the owner of the content before using it in your project.
This documentation explains the tools and methods that are the most efficient at this time. The documentation utilizes Wall Worm Pro instead of Wall Worm. For standard WW, you may or may not need to modify some of the steps. Some steps also discuss some of the extra plugins developed by Wall Worm, including ShellVex and Brushify.
First off, understand that the process is very likely to not be a simple import-export process. You are almost certainly going to have to do some manual labor. This is because there are specific technical requirements for Source Engine Levels, including the makeup of brushes and displacements. Many games don't utilize brushes. So converting geometry to brushes is problematic.
If you do not understand these specific topics for Source, you will very likely have a very hard time finishing your project: Brush Geometry, Displacements, 3D Skybox, Models. It's very important that you understand the principal differences between models and brushes.
Before you get going, make sure that you have 3ds Max units setup correctly for Source. To do this, set your System Units to Generic Units where 1 Unit = 1 Inch. You can do this with the Customize > Units Setup... menu.
Cleaning Up Your Scene
Importing the scene into Max is not part of this documentation. It's assumed that you've already taken the necessary steps to bring a level into 3ds Max. There are countless converters associated to each game, so it's up to you to find the one that is relevant to your game. As long as you can convert it into a format that Max can open/import, you can get started. The prefered file format is .MAX files, but other common ones are .FBX and .OBJ.
1) Scale Scene
Once your level is inside Max, you should first make sure that the scene scale is correct. The easiest way to do this is set up a Box Primitive in the scene with a dimension of 24x24x72. Make sure this box appears to be the correct scale of a player character's bounding box in the scene. If not, you should scale the scene so that this box would be the correct size for a player matching the bounding box. If you scale the scene, make sure to click Reset XForm on it in the Utilities Tab and convert it to Editable Poly when done.
2) Check Scene Limits
Next, check to see if the level fits the dimensions allowed by Source. You can quickly visualize this by opening Wall Worm > Wall Worm Level Design > Anvil and clicking on the Show World Limits Tab in the World Button. If the level exceeds this limit, you are not going to be able to use this level as one map in Source without pruning the level down to a size that fits or placing objects outside the bound into the 3D Skybox.
3) Organize the Scene
Now you need to take a few minutes to organize the scene into logical parts. You should carefully decide what elements you will convert to Models and what elements you wish to convert to brushes and displacements. Create four layers inside 3ds Max layer manager: Brushes, Displacements, Models, Point Entities. Place all elements that you want to convert to brushes into the Brushed layer, all the landscape elements into the Displacements Layer, etc.
If the scene is a single Editable Poly, use the Detach function in the Modify Tab to break it up into sections that you then place into the layers.
Converting Elements to Brushes
Converting the imported geometry to brushes is likely to be a challenging step. This is because brush geometry has very specific rules on setup to be valid. You have two choices for converting the brushes, and which one you choose should hinge on how much time you have and how complex the scene is.
Manually Creating Brushes
To manually create brushes, you need to identify each element that should be a single brush. You must keep in mind the rules for a brush!
Rules for a Valid Brush
- It must be Convex;
- It must be sealed (no open borders)
- It must contain Planar Polygons;
- It cannot contain co-planar polygons.
- Furthermore, it's preferred that all vertices of it are on the 1x1 world grid.
Breaking Object into Brushes
- Select each set of polygons that should be a single Brush and Detach them to their own object.
- Once done detaching, select all add a Brushify Modifier to the selection*
- Open the brushify settings in the Modify Tab and use these settings:
- Snap To Grid = ON
- Snap Precision = 1.0
- Weld Close Verts = ON
- Weld Thresshold = 0.1
- Cap = ON
- Turn Concave Polys = ON
- Auto Edge = ON
- Auto Edge Threshhold = 2.0
- Tag as World Geometry = ON
* If there are hundreds of objects, you may want to apply the Brushify modifier to smaller sub-sets of objects rather than all at once.
Automatically Creating Brushes
Another method of generating brushes is to use ShellVex. The benefit of using ShellVex is that it takes much less time to get the brushes ready. The downside is that each polygon of the source geometry gets converted to a brush--which can add up to a more brushes and brush sides than manually converting. If the scene is not exceptionally complex, this may be a non-issue.
- Select All of the object that should be brushes*
- Click Wall Worm > Wall Worm Level Design > ShellVex: Create Terrain
- Open the ShellVex settings in the Modify Tab and use these settings:
- Cap Opposite End = On
- Force Convex Polygons = On
- Sew Outer Verts = On
- Snap Precision = On/1.0
- Auto Edge = On/2.0
* If the face-count on the objects to convert to brushes with ShellVex are high, you may want to break the collections up into smaller sections as ShellVex can be slow with many objects and/or many faces.
Converting Elements to Models
The conversion to models is fairly straightforward. Manual instructions are below. However, you should instead look into the Convert Scene to Model tools which offer efficient ways of converting scene objects into models.
- If the models use explicit normals, go to the global settings set the Normals to Explicit Normals in the Models tab. (If you do not have WW Pro installed, this will significantly slow down the export but is necessary unless the models use smoothing groups).
- Separate/Combine each mesh that should be it's own model*.
- Select all the individual models.
- Open Anvil (Wall Worm > Wall Worm Level Design > Anvil)
- Open the Models Tab
- Minimize the Proxies rollout so the Models rollout fits in view
- Turn On these settings: Local $origin; Origin in SMD; Rotate Origin; $staticprop.
- Enter a Model Path
- Enter a Material Path
- Click the Quick WWMT button (which makes 1 WWMT Helper per selected object)
- Click the Compile All WWMT Textures button
- Click the Export and Compile Selected WWMT button
* If the objects have multiple materials, remember that there is a material limit per model in Source. Generally that limit is 32 materials. So your options for dealing with this are to limit the number of materials used in each prop or to bake the materials into single textures. Texture baking is not covered in this article. For baking entire scenes, refer to Flatiron.
The steps above do not address re-usable props. If the scene includes props that should be instances of a single prop, then you will need to take some extra steps. In that case, you should only make a WWMT for one instance of the prop. Then create a WWMT Proxy for each extra prop and align it to the location of the extra meshes. You can create a Proxy of a WWMT Helper by selecting a WWMT Helper, opening its settings in the Modify Tab and clicking the Create Proxy button in the Proxy Functions Rollout.
Converting Elements to Displacements
Converting your terrain to displacements will take some custom work. It will work best if all the terrain pieces are built of from quads.
- Combine all terrain objects into a single Editable Poly (Use Carver's Combine Function if present)
- Apply a Vertex Weld modifier to the object
- Collapse to Editable Poly
- Open the Modify Tab
- Open the Graphite Toolbar
- In the Modeling Tab, click the Geometry (All) arrow to open more options
- Click Quadrify All
- Choose the Polygon sub-object mode
- Open the Selection Tab of the Graphite Toolbar
- In the By Numeric section set the Sides to 4, the method to = and click the pick button.
- Click CTRL+I to invert the selection
- Now start editing these selected polygons with Cut and other Max tools to convert them to Quads.
- Once done, deselect all faces in the object and exit sub-object mode
- With the terrain selected, click Wall Worm > Wall Worm Level Design > Create Displacements From Selection
Considerations About the Terrain
Remember that each Quad from the original terrain will be converted into a single displacement (meaning one brush per quad where one side in the brush becomes a displacement). This means that if the density is very high, you will end up with extremely high brush counts and displacement counts. So you may need to take time to edit the terrain geometry for optimization before converting to displacements.
Tips for Displacements
- Set the Displacement Power to the appropriate level. Setting the Power to 2 is probably best. You can set the global setting either in Anvil's Displacement tab or in the Level Design tab of the global settings.
- When cleaning the base terrain into quads, remember to remove any irrelevant vertices. Using the Remove Edge function can leave vertices that need to be removed manually to create quads.
- A handy tool for quickly reducing mesh resolution is Turbo Reverse.
This document covers the bare minimum of getting your level ported into Source via 3ds Max. There are more advanced topics that this article does not cover. You will likely find that some steps need to be modified for the specific scene you are working in.