Generating LOD Data for Custom Worldspaces in Fallout 3 (WIP)
LOD stands for Level of Detail, which is a technique which game engines use to optimize gameplay. The basic concept is simple: when the player is close to an object in-game, the game engine uses a high polygon count model and high resolution texture for maximum visual quality; when the player moves away from the object, the engine replaces this model and texture with a lower polygon count model and lower resolution texture. By reducing the visual quality of the object, it can reduce the processing overhead on the system and improve framerate and/or render more objects on-screen at the same time.
LOD techniques differ from game to game, but most 3D games use some form of LOD optimization. In Fallout 3 and Oblivion, LOD is used in 4 principle areas:
- landscape meshes
- landscape textures
- visible while distant objects, like the Washington Monument
- trees
In order to generate proper LOD for your mod, you must generate each of these four types of data. LOD generation is not complicated, but it is time consuming and suffers from certain limitations which will be discussed below.
The World LOD Dialog

All of the LOD functions for Fallout 3 can be found by selecting World -> World LOD... from the menu bar. This will pull up the World LOD dialog.
The World LOD dialog is very easy to use. First, select the world space that you would like to generate LOD for from the column on the left. Details about the world space, including the number of cells contained within it, and the number of 'chunks' that will be generated appear in the small information box to the right. (Unfortunately, for some reason, the display box is not large enough to display all of the information.)
The first button, Generate Terrain Meshes, is used to generate the landscape LOD meshes. This is the time and cpu-intensive process that seems to thwart a lot of people.
The next three buttons are used for generating the textures. Generate Terrain Textures is the button used for default terrain texture generation, and is the only option I will be covering in this tutorial (since I haven't tested the others).
The Chop Handpainted Terrain Texture button, according to the wiki, allows you to 'build LOD terrain texture maps from a handpainted texture up to 8192x8192 in size'. It's not clear whether these maps represent individual chunks, or if the map itself is subdivided to cover the entire terrain, although it seems to imply the latter.
The Combine Generated and Handpainted Terrain Textures button seems to imply that you can mix handpainted texture chunks with generated texture chunks, but the wiki has no information about this so that's pure speculation. Just one more thing I'll next to experiment with. :)
The next button, Generate Objects, is used to generate the visible while distant objects populating your landscape. Visible While Distant (or VWD) objects are low-poly versions of things like the Washington Monument, overpasses, radio towers, etc. They sit on top of the landscape LOD meshes, and, like the LOD landscape meshes, are replaced with the original, high-poly versions when you get close to them.
The last button is Generate Trees, which, predictably, generates tree LOD objects. Trees include 'real' trees (speedtree files) and 'fake' or static trees with the Has Tree LOD box checked in the Object dialog. (Needs to be verified.)
Generating LOD Landscape Meshes
The first stage of the LOD process is by far the most time-consuming and resource intensive. LOD landscape meshes are reduced polygon count copies of groups (or 'chunks') of the original landscape mesh (the terrain that you create in the heightmap editor and/or landscape editor). The process used to create the LOD meshes is known as 'decimation'. Decimation takes a high-poly mesh (in this case, the landscape) and approximates its shape using fewer polygons. Fallout 3 uses a multi-tiered system of landscape LOD that chunks groups of cells into 4x4, 8x8, 16x16 and 32x32 cell squares. The LOD meshes in each tier cover progressively larger surface areas, but at a reduced resolution. Using this process, an 8x8 LOD chunk will have less accuracy than a 4x4 chunk but render just as quickly. (If you look in the Data/Meshes/Landscape/LOD/Wasteland/ folder you will see that each chunk is approximately the same size even though they cover different surface areas.) The details that are lost in the decimation process are generally not noticeable at the distance from which the player views the mesh. (This technique is known as Discrete LOD. You can find a good article about LOD at Wikipedia.)
This improved LOD process comes at a cost, however: each LOD landscape mesh generation pass is expensive in terms of system resources and generation time, so the larger your landscape, the longer it's going to take to generate LOD for it. In fact, each pass is an order of magnitude more expensive: a small worldspace that only requires a few 'chunks' can be generated in minutes; a large worldspace requiring hundreds of chunks can take days or weeks and may not even be possible to generate on your system. (Many people with older systems have tried--and failed--to regenerate the Wasteland LOD data.) If your world space is very small (such that from every point in the world space every other cell is less than eight cells away) the Geck will only require a single decimation pass and the LOD folder will only contain 4x4 chunks. Once you exceed this size, an additional generation pass is required to generate 8x8 chunks. If your world space is greater than 15 cells across, a third pass will be required to generate 16x16 chunks, etc. Although this system might seem complicated and expensive in terms of generation time, it allows the game to maintain high visual fidelity without a significant loss of framerate. Anyone who's played Oblivion will immediately notice the difference in quality between Oblivion's LOD and the LOD in Fallout 3.
To create landscape LOD meshes, simply go to World -> World LOD..., select your world space, and click on the Generate Terrain Meshes button. This will give you a pop up warning you that the process could take "up to 10 hours". (On my own system, generating the Wasteland LOD meshes took about six hours and ten minutes.) Click Ok and the process will begin. The Geck may appear to stop responding, but this is normal and in all likelihood the LOD generation process is proceding smoothly in the background.

Eventually (after a few minutes, in my own case) the Geck will issue a warning that the "First segment of segmented tri shape has a start index other than zero". I have no idea what this error really means, though it may have something to do with the way that the Geck generates LOD land meshes: because it generates chunks beginning with 4x4 cell sections, it may be caused by having world spaces that are not evenly divisible by 4 in both directions. (If you look at your LOD underwater in-game at the edges of your world space you will likely see various sorts of LOD land mesh errors. These are not harmful and seem to be caused by the Geck's attempt to generate an LOD mesh using cell data from a cell which "doesn't exist" because it contains no data.) In any case, it does not appear to affect the LOD in-game and can be safely ignored. Just click 'Yes to All' and let the process continue.
During the time that the Geck is generating the meshes, it will in all likelihood refuse to respond to any other requests from Windows (for example, clicking on a menu). It will also likely indicate that the Geck is 'Not Responding' in the title bar. As noted previously, this is nothing to worry about. You just have to give it time to complete the process. That is why it is generally best to start the LOD mesh generation process only if you don't need to use the Geck for an extended period of time. (Many people start the process before going to sleep at night or before leaving for work.) Just remember to wait for the first warning and click 'Yes to All' before abandoning it to its own devices. You may also want to temporarily disable sleep mode on your system to keep it from pausing the process when your computer becomes inactive. Unless you have a very old rig, you should be able to continue using other applications while the Geck is generating the terrain.
When the Geck is done generating the meshes, you should see a new folder located here: Data/Meshes/Landscape/LOD/editor id of your world space. This folder will be filled with files called 'name of your world space'.Level4.x coordinate.y coordinate.nif. Depending on the size of your world space, there will also be Level8, Level16, and Level32 nifs as well. You can use the coordinates in the file name to determine which part of the world space each file represents. Chunks are created starting from the bottom left corner of a 4x4, 8x8, 16x16, or 32x32 cell group. For example, if your file is 'name of your world space'.Level4.X0.Y0.nif it represents the cells from X0,Y0 (bottom left) to X3,Y3 (top right). (This detail can be useful to know when you need to update a specific chunk of LOD but you don't want users to have to redownload all of the files.)
Once you're done generating your LOD land meshes, you can move on to generating the LOD textures.
Generating LOD Textures
To generate the LOD textures and get them working in-game, you must do a couple of things. The first thing you have to do is unpack all of the necessary landscape textures to your Data/Textures/Landscape/ folder. If you haven't unpacked your textures, your LOD will look purple in-game. The second thing is simply to click the Generate Terrain Textures button in the World LOD dialog. Generating textures is much, much faster than generating LOD meshes so this shouldn't take too long. (A small worldspace will likely only take a few seconds.) The trick to generating LOD terrain textures is knowing what the Geck does with them when it's done!
When you generate LOD textures, all of the textures will be placed in a new folder within your Bethesda Softworks directory (in other words, NOT in your Fallout 3 directory, but one up from it) called Source. The file path is actually: Bethesda Softworks/Source/Textures TGA/Landscape/LOD/editor id of your world space. This folder contains three sub-folders called Diffuse, DiffuseGenerated, and Normals (and eventually Blocks and Trees once you've generated LOD objects and LOD trees). The color textures are located in the DiffuseGenerated folder and have to be copied to the Diffuse folder to be visible in-game (the Diffuse folder is empty by default). The Normals folder contains the normal maps for your landscape mesh. If you don't know what a normal map is, I recommend you look it up on Wikipedia, but essentially it's an image file that tells the engine how to bounce light off your mesh to create realistic shadows.
Once you have copied your DiffuseGenerated files to your Diffuse folder (or deleted your Diffuse folder and renamed your DiffuseGenerated to Diffuse) copy the whole folder (the folder named after your world space and all the sub-folders I just described) over to your Fallout 3/Data/Textures/Landscape/LOD/ directory. If you forget this step, you will end up with purple textures in-game, so don't forget!
Generating LOD Objects
Now that you have your LOD land mesh and landscape textures generated, you need to generate the VWD object data. The Geck does not generate miniature versions of these objects for you: you'll need to unpack the vanilla LOD meshes and textures in order to generate this data. If you are using custom meshes, you will need to create simplified LOD versions of these objects in your modeling program and place them in the appropriate folders. When you run the Generate Objects function, it essentially takes these models and creates a new mesh object out of them using the location and rotation data of the original objects to position the LOD versions: when your character moves out of range, the original, high-poly objects are unloaded from memory and the VWD LOD objects are displayed instead.

If you try to run Generate Objects and one of your objects is missing a LOD model or texture, the Geck will inform you of the error and the procedure will fail. The easiest way to ensure that all of your VWD objects generate correctly is to unpack all of the meshes and textures to your data folder. If you prefer to keep a tidy computer, you can check each mesh for the required .nif and .dds files and unpack just the ones you need. You'll also need to convert the .dds textures files to .tga files which you can do in an image-editing program like the Gimp. (Just open the .dds file in the Gimp and save it as a .tga file. Default settings are fine. You will need the Gimp .dds plugin to do this.) You have to move these converted files to the Bethesda Softworks/Source/Textures TGA/ folder for the Geck to find them. The files have to be placed in folders corresponding to the location of the original files, so if the LOD texture you converted is from the Data/Textures/Architecture/Wasteland folder, you have to place it in the Bethesda Softworks/Source/Textures TGA/Architecture/Wasteland/ folder. (If the filepath doesn't exist, you'll have to create it manually.) If you're feeling really ambitious, you can go through all of your LOD .dds files and convert them to .tga files before starting the LOD Object generation process. Just search the texture folder for files with the "*lod" wildcard. Most of the rocks share a couple of common LOD files and there may be other overlaps as well, so you won't need to unpack textures for every single object. Most of these textures can be found in the Data/Textures/Landscape or Data/Textures/Architecture folders.
Once the LOD object data has been created, you need to copy the generated textures from Bethesda Softworks/Source/Textures TGA/Landscape/LOD/editor id of your world space to the corresponding Fallout 3/Data/Textures/Landscape/LOD/ directory. If you forget this step, your LOD objects will have purple textures in-game.
Generating LOD Trees
You can generate LOD tree data by clicking the Generate Trees button on the World LOD dialog. This will create a tree block containing LOD information about all of the speedtree (.spt) trees and all static object trees (the dead ones) with the 'Has Tree LOD' tickbox checked in the static object dialog. Like VWD objects, you will need to unpack the tree lod meshes and textures so that the Geck can find them. You'll also need to copy the treedeadlod.dds file from the Fallout 3/Data/Textures/Landscape/Trees/ folder and convert it to a .tga file in the Gimp (or other image editing program) and place it in the Bethesda Softworks/Source/Textures TGA/Landscape/Trees/ folder to execute the build process. Unlike the LOD Object build process, the LOD Tree build process will not inform you if it failed to build. You will simply have to check your Data/Meshes/Landscape/LOD/editor id of your world space/Trees/ folder for tree blocks. If you don't see any, you'll know the blocks failed to build.
Regenerating LOD
It goes without saying that you will need to generate all of your LOD after you have completed shaping and texturing your terrain mesh and adding your trees and VWD objects. It will be one of the very last things that you do before releasing your mod. But that doesn't mean that you can't generate all of this data sooner for testing purposes. You may generate this data as often as you like, as long as you remember to delete all of the previously generated data before starting a new round of generations. Of course, the size of your world space may dictate how often you can afford to generate this data: if your world space is very large and generating the LOD meshes takes several days to execute you're not going to want to do it very often.
My recommendation is to get your heightmap/landscape shaping finalized and then generate the LOD meshes for it. Generating the other LOD data is relatively quick and painless, so you can retexture and add and remove objects and trees as much as you want as long as you don't change the shape of the landscape mesh too much (ie. not enough to be noticeable from a distance). The only thing you need to remember is that the Geck will not regenerate data that already exists so before regenerating your LOD you need to delete or remove the files that you've already generated.
The following files are generated by the LOD build process (not all of these files will exist if you haven't gone through all four stages of the build and/or one or more of the files failed to build for some reason):
- the Data/Meshes/Landscape/LOD/your world space folder
- the Data/Textures/Landscape/LOD/your world space folder
- Data/LODSettings/your world space.DLODSettings file
- the Bethesda Softworks/Source/Textures TGA/Landscape/LOD/editor id of your world space file
Packaging LOD with Your Mod
When you distribute your mod for others, you will need to remember to include the following files:
- the Data/Meshes/Landscape/LOD/your world space folder
- the Data/Textures/Landscape/LOD/your world space folder (you only need to include the Diffuse folder, not the DiffuseGenerated, but make sure the textures are inside!)
- Data/LODSettings/your world space.DLODSettings file
You do not need to include the files in the Source directory that were generated by the Geck. You should have transferred the necessary files over to your Textures folder earlier in the build process.
Regenerating Wasteland LOD for Your Mod
If you have made changes to the Wasteland landscape (or another vanilla world space) you may regenerate LOD for that world space so that your changes are reflected in the distant LOD. Regenerating the entire Wasteland world space LOD can take a very long time. The landscape LOD mesh generation process took a little over six hours on my system. Others have reported similar durations, typically around the 8 hour range. Some have reported being unable to generate the Wasteland LOD at all, however, so if you have an older rig you may experience problems in this area. In that case, you may have to find someone else to generate your LOD data for you.
A better solution than regenerating the entire landscape is to find out which chunks your mod alters and then to regenerate only these chunks. The details for this procedure can be found here: LOD Grid to Cell Grid Conversion Chart.
Troubleshooting
Phantom Landscape
When the LOD landscape mesh projects through the actual landscape and obscures it you have phantom landscape. Phantom landscape can be identified by the low-resolution texture and by its lack of collision (ie. you can walk through it). To fix phantom landscape, you have to regenerate the LOD landscape mesh.
Floating Trees
When you move trees in the Wasteland (or any other worldspace with LOD) you end up with floating trees or ghost trees: low-resolution tree billboards with no collision at the location originally occupied by the tree. Unfortunately, there isn't an easy, elegant solution to this problem. If you regenerate the tree LOD, the LOD trees will correctly update their x and y coordinates, but the z coordinate is usually 'off' and any rotations applied to the mesh are ignored. The best solution is to move unwanted trees below the landscape mesh so that they are no longer visible (pull them down at least a couple hundred units) and then regenerate the tree LOD. (If anyone knows a better solution, please contact me.)
See also: Creating Custom Worldspaces
See also: G.E.C.K. Editor Warnings and Solutions
See also: LOD at Wikipedia
Comments
Feel free to comment, but please be civil and constructive. Inappropriate, inflammatory, and spam-related comments will be deleted.
Last updated October 3, 2011
© 2009-2011 Dave Finch

