Difference between revisions of "Landscape LOD Tutorial"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>GhanBuriGhan
imported>Bruneauinfo
(→‎Getting Started: Added reference for Creating Large Worldspaces article)
 
(22 intermediate revisions by 7 users not shown)
Line 1: Line 1:
This tutorial will summarize the steps necessary to create LOD terrain - the land you see in the distance in Obivion (if you have the far land option turned on). We will also discuss common problems and possible solutions.
This tutorial will summarize the steps necessary to create LOD terrain - the land you see in the distance in Oblivion (if you have the far land option turned on). We will also discuss common problems and possible solutions.
This article is based on a [http://s11.invisionfree.com/The_Kingdom_OB_Mod/index.php?showtopic=109 tutorial by Seven05].


==Getting started==
==Getting Started==
If you want LOD terrain, you are probably working on a new worldspace. For information about creating a new worldspace, and using the heightmap editor, see these tutorials:
If you want LOD terrain, you are probably working on a new worldspace. For information about creating a new worldspace, and using the heightmap editor, see these tutorials:


[[World_Space_Tutorial|World Space Tutorial]]
*[[World Space Tutorial]]
 
*[[WorldBuilding 101]]
[[WorldBuilding_101|World Building 101]]
*[[Creating Large Worldspaces]]


So go ahead and work on your heightmap. When you are happy with your landscape, save it in the heightmap editor but don't save the esp file yet.  
So go ahead and work on your heightmap. When you are happy with your landscape, save it in the heightmap editor but don't save the esp file yet.  


===Creating the LOD mesh===
===Fixing Mesh Errors===
In the heightmap editor window, go to the '''File''' menu and select '''Generate LOD'''. There are two LOD generation options, which vary only in generation speed and accuracy. They are Quick Prototype and Full and are less accurate but faster, and more accurate but slower, respectively. Depending on the speed of your computer, generating the LOD meshes can take a long time (on my AMD 4400+ dual core it takes ca 20 minutes) . Be patient, your computer has most likely NOT frozen, although it may look like that!
This section is for those who just now created a new landscape and have not yet saved it even for the first time. If you have a well established mod that has been saved and re-opened successfully in the Construction Set at least once, then you can skip this section.
This step creates the actual model for the distant terrain, which is stored as a .nif file just as any other 3D object in the game. It also generates the normal maps for the terrain. These are saved as .DDS format files, with an _FN suffix in the file name and will be saved in \data\textures\landscapelod\generated\.


===Fixing mesh errors===
Here's where the going gets a bit rough. The landscape you just created probably has some errors. These errors show up as "rips" in the landscape mesh which wouldn't be all that dramatic, but when the CS saves your esp, it can not save cells with such errors in them. Which means, when you reload a plugin with such a faulty cell, those cells will be gone, they will be gaping holes dropping down to 0 elevation. Therefore we need to fix these rips before we save our plugin. These rips occur most frequently around cell 0,0 and other corners where four quads meet, if you have more than four.
Here's where the going gets a bit rough. The lanscape you just created probably has some errors. These errors show up as "rips" in the landscape mesh which wouldn't be all that dramatic, but when the CS saves your esp, it can not save cells with such errors in them. Which means, when you reload a plugin with such a faulty cell, those cells will be gone, they will be gaping holes dropping down to 0 elevation. Therefore we need to fix these rips before we save our plugin. These rips occur most frequently around cell 0,0 and other corners where four quads meet, if you have more than four.


; Quads : quadrants, 32x32 cells. If you have created a map by painting one whole viewable area in the heightmap editor, you have four quads (visible as divided by the green lines in the overview if you have created one), they meet in the lower lefthand corner of cell 0,0  
; Quads : quadrants, 32x32 cells. If you have created a map by painting one whole viewable area in the heightmap editor, you have four quads (visible as divided by the green lines in the overview if you have created one), they meet in the lower lefthand corner of cell 0,0  
Line 24: Line 21:
Once you have fixed all of those save the esp. If you still get errors about cells that are missing data, make a note of which cells they are (do not hit "yes to all"), fix them as described, and then save again. Repeat this process until you get no errors.
Once you have fixed all of those save the esp. If you still get errors about cells that are missing data, make a note of which cells they are (do not hit "yes to all"), fix them as described, and then save again. Repeat this process until you get no errors.


===Creating LOD diffuse maps===
==Creating the LOD Meshes==
Before this step you may want to clean out your \data\textures\landscapelod\generated folder. This will avoid conflicts and makes it easier to find your newly generated files. Backup existing files (e.g. from one of the better LOD mods) to some other location while working on your mod.
In the Heightmap Editor window, go to '''File''' --> '''Generate LOD'''. There are two LOD generation options.  Quick Prototype is less accurate but takes less time to generate while Full is more accurate and slower.  Depending on the speed of your computer, generating the LOD meshes can take a long time.  On my AMD 4400+ dual core it took me about 20 minutes to generate the meshes for my worldspace.  Be patient, your computer has most likely NOT frozen although it may look like that!
 
(Note: There seems to be an issue with the TESCS Generate LOD function. If it is run more than once during the same session, the LOD mesh becomes corrupt. If this occurs, close the TESCS, reopen it, and try again)
 
This step created the actual models for the distant terrain, which is stored as a .nif file in \Data\Meshes\Landscape\LOD.  It also generated the normal maps for the terrain. These are saved as .DDS format files with an _FN suffix in the file name and are saved in \Data\Textures\landscapelod\Generated\.
 
==Creating the LOD Diffuse Maps (Color Textures)==
Before this step you may want to clean out \data\textures\landscapelod\generated to avoid conflicts and make it easier to find your newly generated files. I usually create a folder in the landscapelod folder titled "Ding" and just move all the existing files into that folder before proceeding with this step. 
 
This step creates the color images, or textures, of your worldspace, which includes every object you place in the exterior of your world.  Therefore, you should do this step very last, after you have placed everything in your world and completed all of your landscape and texture editing. 
 
Once you are ready, go to the render window in the Construction Set.  Go to 0,0 by double clicking it in the Cell View window.  The Construction set creates the textures based on exactly what you would see in the render window.  Therefore, you probably want to turn off the purple water (Shift + w), which would look terrible in the game. Also turn off cell grids (B) and bright lighting (Button in the taskbar). Now right-click in the render window and select Generate LOD Textures --> This LOD Quad.  Now the texture generation process will load all cells and take snapshots of them (It actually generates a 64x64 pixel texture from every 2x2 cells).  These snapshots are stored in \data\textures\landscapelod\generated\partial\. The time it takes to generate these textures depends completely on how populated your worldspace is. 
 
At the end of this process the partial textures are stitched together into one large 1024x1024 texture which is stored in \data\textures\landscapelod\generated\.  The files in the \partial folder are not used by the game.  They are only used by the Construction Set to stitch into the final, single texture in the \generated folder.  Therefore, you can delete the partial textures as soon as you have tested everything in-game. 
 
You just generated a single LOD texture for the quad you were inside in the Render Window.  Now you need to move into each quad and create an LOD texture for each quad.  Unless your worldspace is nothing more than a hold in the ground (Very small), you are going to need to generate at least four of these.  Go to cells (0,-1), (-1, -1), and (-1,1) and repeat the process for each quad.  If nothing happens, it means that partial textures for this quad already exist. If you need to update the LOD textures, you have to delete the old partial files first.
 
===The Naming Bug===
There is a small bug in the Construction Set that incorrectly names the textures that are created in \data\textures\landscapelod\generated\.  If you'd load your mod now, you will likely see purple landscapes everywhere because of this bug. 
 
To fix this, simply go to the textures in \data\textures\landscapelod\generated\ and rename any textures that have a single 0 in it.  A bunch of the new textures will have a "0" instead of a "00" in the part of the name that indicates cell coordinates. You need to rename the files, replacing all instances of 0 with 00.  For example, the texture titled "11607696.0.-32.32.dds" should be renamed "11607696.00.-32.32.dds"
 
===The Black Texture Bug===
If you find some of your textures have black areas, this is due to a bug in the Construction Set.  The partial textures were not assembled correctly.  This seems to be hardware or system related because some people get it while others do not. There is no known fix to the Construction Set at this time, but there is a workaround.  I have created a [[LOD_texture_fix_script|python script]] that can assemble the textures correctly.
 
==Update LOD Information==
If you have buildings or trees in your world you also should use the Construction Set to update the LOD information for those objects. 
 
In the Construction Set, go to World --> World Testing --> Update Distant LOD Data.  Select your worldspace and select the boxes to the right and then choose "Export (this worldspace only)". Depending on the number of objects, this process can take a long time but with no objects in the world space the process you take a couple of seconds at most, even for a large world.
 
This adds .lod files under the name of your moderation in the folder \data\distantlod. 
 
Also see the [[Visible When Distant Tutorial]].
 
==Testing==
You should now be able to save your mod and test it in the game. 
 
For testing purposes, it is probably best to only load oblivion.esm and your mod.  Loading other mods interferes with the LOD terrain and might make your terrain not visible.  This probably has to do with the hashcode for the textures not matching the hashcode for the mod, which seems to be dependent on mod name and mod load order. Currently no direct fix for this is known; however, there is a work-around which you can read about in the "Additional Notes" section below. 
 
A quick way to get to your landscape once you have loaded the game:
 
Open the console (~)
 
Type: COW MyWorldSpace 0,0
 
Replace 0,0 with whatever cell location you want to visit.
 
Replace MyWorldSpace with the ID of your WorldSpace.
 
==Additional Notes==
If your distant LOD land does not show up, it is recommended that you use TES4Gecko to add your World Space to the Master Index, which will make it appear in the game regardless of other moderations and regardless of load order. 
 
To do this:
Download TES4Gecko (http://www.tesnexus.com/downloads/file.php?id=8665)
Install TES4Gecko according to the instructions included with it.
Once you start TES4Gecko, go to the "Move Worldspaces" function. 
Then select the .esp that contains your worldspace. 
 
This will edit your .esp so that the game sees your landscapes as part of the original game rather than as a moderation.  It also changes the names of the files in \meshes\landscape\lod and \textures\landscapelod\generated to match the changes made to the .esp.
 
==Portability==
If you have gone through all this trouble to create nice Landscape LODs for your worldspace, you are probably going to want to be able to package all the necessary files so you can distribute your mod online for others to enjoy.  To make this easier, below is a list of all the files this tutorial created for you that would need to be included in any redistribution package of your mod.
 
Key:


Now we need a texture for our distant terrain. The CS has a functionality for creating such a texture based on the textured terrain you see in the render view. So for your final release you should update these textures after you have done all your texture editing, so that your LOD texture will fit as close as possible with your detailed textures.
Type of file - Folder location (File name to look for)


So, if you aren't there already, switch to the render window. Go to 0,0 in the render window and press shift-w to turn off the water (also turn off cell grids if they are still on (B). Turn off bright lighting in the taskbar. The texture will be generated from what you see in the render window, so if you e.g. leave the water on, your LOD textures will include the purple water texture which looks pretty bad in the game. Now right-click in the render window and select Generate LOD Textures / For this quad from the popup menu. Now the texture generation process will load all cells and take snapshots of them (it actually generates a 64x64 pixel texture from every 2x2 cells). These are stored in \data\textures\landscapelod\generated\partial\. If you don't have any objects it will go pretty quick, otherwise it may take a considerable time. At the end of this process the partial textures are stitched together into one large 1024x1024 texture that is stored in \data\textures\landscapelod\generated\. Now you need to move into each quad - e.g. move to cells 0,-1 / -1, -1 / -1,1 and repeat the process for each quad. If nothing happens, it means that partial textures for this quad already exist. If you need to update the LOD textures, you have to delete the old partial files first.
Color Textures - \data\textures\landscapelod\generated (11607696.xx.xx.xx.dds)


====fixing the naming bug====
Normal Maps - \data\textures\landscapelod\generated (11607696.xx.xx.xx_FN.dds)
There is a tiny bug in the above routine that mislabels the created texture files. If you'd load your mod now, you would be treated to the famous purple landscapes, the purple indicating a missing texture.  


go to the \data\textures\landscapelod\generated folder and compare the names of the generated textues with the normal maps (_FN suffix) you created earlier. A bunch of the new textures will have a "0" instead of a "00" in the part of the name that indicates cell coordinates. You need to rename the files, replacing all instances of 0 with 00.
Meshes – \data\meshes\landscape\lod (11607696.xx.xx.xx.nif)


====the half black texture bug====
LOD Data – \data\distantlod (Bjornheim_x_x.lod)
You may find that your textures were not assembled correctly. If you find black LOD terrain textures in game, or if you open your generated textues in Photoshop or Gimp and find them to be half black, you suffer from this bug. This seems to be hardware or system related, some people get it, others don't. There is no known fix at this time. However, a manual workaround was found by b3w4r3: [http://www.elderscrolls.com/forums/index.php?showtopic=478551&hl= Link to Forum post]. A solution using an external tool is in development, I will update this as it becomes available.




===Updating LOD information===
In the above file names, the x's stand for cell numbers.  Each file will have different cell numbers, so in each folder you will find several files with the same name except for the cell numbers.  Of course, you will need all files, regardless of their cell numbers.
If you have buildings or trees in your world you also want to update LOD information for those.


Go to the world->world testing->update distant LOD menu, make sure the right boxes are checked and find your new world space in the lefthand side of the window. Select your world space and then click on the "export for this world space only" button. Depending on the number of objects, this process can again take a long time but with no objects in the world space the process you take a couple of seconds at most, even for a large world.
I am not yet sure how the landscape update exactly works - you won't need it if you followed the steps above, but I usually let the update run anyway.
Also see the [[Visible_When_Distant_Tutorial|Visible When Diststant Tutorial]].


==Testing it==
Also, in the .dds and .nif file names above, I have the number 11607696 at the beginning of each file name. This is my mod's hash code. It will be different in your situation, so just look through the .dds or .nif files in one of the folders listed above until you find the files containing the hash code that go with your mod.
At this point you should be able to save everything and test it out in the game.  
An unresolved issue is conflict with other mods. At this time it is recommended to only load oblivion.esm and your mod - loading other mods interferes with the LOD terrain, and it will not be visible. This probably has to do with the hashcode for the textures not matching the hashcode for the mod, that seems to be dependent on mod name and mod load order. Currently no fix for this problem is known.


Anyway, Load up your mod, load or start a game, and move to your world by bringing down the console (~) and type COW MyWorldSpace 0,0 (or some other cell coordinate you want to visit. "MyWolrdSpace" of course should be replaced by the ID of the Worldspace you created).
Jump around the map with coe x,y to visit different cells.


Enjoy your beautiful LOD terrain!
Finally, in the .lod file name I have Bjornheim at the beginning of the name.  This is the ID of my world space.  It will change to whatever worldspace ID you are working with. 


[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Worldbuilding_Tutorials]]
[[Category:Worldbuilding_Tutorials]]

Latest revision as of 16:31, 20 January 2011

This tutorial will summarize the steps necessary to create LOD terrain - the land you see in the distance in Oblivion (if you have the far land option turned on). We will also discuss common problems and possible solutions.

Getting Started[edit | edit source]

If you want LOD terrain, you are probably working on a new worldspace. For information about creating a new worldspace, and using the heightmap editor, see these tutorials:

So go ahead and work on your heightmap. When you are happy with your landscape, save it in the heightmap editor but don't save the esp file yet.

Fixing Mesh Errors[edit | edit source]

This section is for those who just now created a new landscape and have not yet saved it even for the first time. If you have a well established mod that has been saved and re-opened successfully in the Construction Set at least once, then you can skip this section.

Here's where the going gets a bit rough. The landscape you just created probably has some errors. These errors show up as "rips" in the landscape mesh which wouldn't be all that dramatic, but when the CS saves your esp, it can not save cells with such errors in them. Which means, when you reload a plugin with such a faulty cell, those cells will be gone, they will be gaping holes dropping down to 0 elevation. Therefore we need to fix these rips before we save our plugin. These rips occur most frequently around cell 0,0 and other corners where four quads meet, if you have more than four.

Quads
quadrants, 32x32 cells. If you have created a map by painting one whole viewable area in the heightmap editor, you have four quads (visible as divided by the green lines in the overview if you have created one), they meet in the lower lefthand corner of cell 0,0

Switch to the render window and enable the cell grid (press B ) and wireframe (W). Go to cell 0,0 and check the four corners of the cell, one of them (lower left most times) will have a rip. You will need to flatten or smooth that vertex using the landscape editing tool. If your landmass is larger than four quads you need to go to all quad intersections (every 32 cells) and check for the same type of error.

Once you have fixed all of those save the esp. If you still get errors about cells that are missing data, make a note of which cells they are (do not hit "yes to all"), fix them as described, and then save again. Repeat this process until you get no errors.

Creating the LOD Meshes[edit | edit source]

In the Heightmap Editor window, go to File --> Generate LOD. There are two LOD generation options. Quick Prototype is less accurate but takes less time to generate while Full is more accurate and slower. Depending on the speed of your computer, generating the LOD meshes can take a long time. On my AMD 4400+ dual core it took me about 20 minutes to generate the meshes for my worldspace. Be patient, your computer has most likely NOT frozen although it may look like that!

(Note: There seems to be an issue with the TESCS Generate LOD function. If it is run more than once during the same session, the LOD mesh becomes corrupt. If this occurs, close the TESCS, reopen it, and try again)

This step created the actual models for the distant terrain, which is stored as a .nif file in \Data\Meshes\Landscape\LOD. It also generated the normal maps for the terrain. These are saved as .DDS format files with an _FN suffix in the file name and are saved in \Data\Textures\landscapelod\Generated\.

Creating the LOD Diffuse Maps (Color Textures)[edit | edit source]

Before this step you may want to clean out \data\textures\landscapelod\generated to avoid conflicts and make it easier to find your newly generated files. I usually create a folder in the landscapelod folder titled "Ding" and just move all the existing files into that folder before proceeding with this step.

This step creates the color images, or textures, of your worldspace, which includes every object you place in the exterior of your world. Therefore, you should do this step very last, after you have placed everything in your world and completed all of your landscape and texture editing.

Once you are ready, go to the render window in the Construction Set. Go to 0,0 by double clicking it in the Cell View window. The Construction set creates the textures based on exactly what you would see in the render window. Therefore, you probably want to turn off the purple water (Shift + w), which would look terrible in the game. Also turn off cell grids (B) and bright lighting (Button in the taskbar). Now right-click in the render window and select Generate LOD Textures --> This LOD Quad. Now the texture generation process will load all cells and take snapshots of them (It actually generates a 64x64 pixel texture from every 2x2 cells). These snapshots are stored in \data\textures\landscapelod\generated\partial\. The time it takes to generate these textures depends completely on how populated your worldspace is.

At the end of this process the partial textures are stitched together into one large 1024x1024 texture which is stored in \data\textures\landscapelod\generated\. The files in the \partial folder are not used by the game. They are only used by the Construction Set to stitch into the final, single texture in the \generated folder. Therefore, you can delete the partial textures as soon as you have tested everything in-game.

You just generated a single LOD texture for the quad you were inside in the Render Window. Now you need to move into each quad and create an LOD texture for each quad. Unless your worldspace is nothing more than a hold in the ground (Very small), you are going to need to generate at least four of these. Go to cells (0,-1), (-1, -1), and (-1,1) and repeat the process for each quad. If nothing happens, it means that partial textures for this quad already exist. If you need to update the LOD textures, you have to delete the old partial files first.

The Naming Bug[edit | edit source]

There is a small bug in the Construction Set that incorrectly names the textures that are created in \data\textures\landscapelod\generated\. If you'd load your mod now, you will likely see purple landscapes everywhere because of this bug.

To fix this, simply go to the textures in \data\textures\landscapelod\generated\ and rename any textures that have a single 0 in it. A bunch of the new textures will have a "0" instead of a "00" in the part of the name that indicates cell coordinates. You need to rename the files, replacing all instances of 0 with 00. For example, the texture titled "11607696.0.-32.32.dds" should be renamed "11607696.00.-32.32.dds"

The Black Texture Bug[edit | edit source]

If you find some of your textures have black areas, this is due to a bug in the Construction Set. The partial textures were not assembled correctly. This seems to be hardware or system related because some people get it while others do not. There is no known fix to the Construction Set at this time, but there is a workaround. I have created a python script that can assemble the textures correctly.

Update LOD Information[edit | edit source]

If you have buildings or trees in your world you also should use the Construction Set to update the LOD information for those objects.

In the Construction Set, go to World --> World Testing --> Update Distant LOD Data. Select your worldspace and select the boxes to the right and then choose "Export (this worldspace only)". Depending on the number of objects, this process can take a long time but with no objects in the world space the process you take a couple of seconds at most, even for a large world.

This adds .lod files under the name of your moderation in the folder \data\distantlod.

Also see the Visible When Distant Tutorial.

Testing[edit | edit source]

You should now be able to save your mod and test it in the game.

For testing purposes, it is probably best to only load oblivion.esm and your mod. Loading other mods interferes with the LOD terrain and might make your terrain not visible. This probably has to do with the hashcode for the textures not matching the hashcode for the mod, which seems to be dependent on mod name and mod load order. Currently no direct fix for this is known; however, there is a work-around which you can read about in the "Additional Notes" section below.

A quick way to get to your landscape once you have loaded the game:

Open the console (~)

Type: COW MyWorldSpace 0,0

Replace 0,0 with whatever cell location you want to visit.

Replace MyWorldSpace with the ID of your WorldSpace.

Additional Notes[edit | edit source]

If your distant LOD land does not show up, it is recommended that you use TES4Gecko to add your World Space to the Master Index, which will make it appear in the game regardless of other moderations and regardless of load order.

To do this: Download TES4Gecko (http://www.tesnexus.com/downloads/file.php?id=8665) Install TES4Gecko according to the instructions included with it. Once you start TES4Gecko, go to the "Move Worldspaces" function. Then select the .esp that contains your worldspace.

This will edit your .esp so that the game sees your landscapes as part of the original game rather than as a moderation. It also changes the names of the files in \meshes\landscape\lod and \textures\landscapelod\generated to match the changes made to the .esp.

Portability[edit | edit source]

If you have gone through all this trouble to create nice Landscape LODs for your worldspace, you are probably going to want to be able to package all the necessary files so you can distribute your mod online for others to enjoy. To make this easier, below is a list of all the files this tutorial created for you that would need to be included in any redistribution package of your mod.

Key:

Type of file - Folder location (File name to look for)

Color Textures - \data\textures\landscapelod\generated (11607696.xx.xx.xx.dds)

Normal Maps - \data\textures\landscapelod\generated (11607696.xx.xx.xx_FN.dds)

Meshes – \data\meshes\landscape\lod (11607696.xx.xx.xx.nif)

LOD Data – \data\distantlod (Bjornheim_x_x.lod)


In the above file names, the x's stand for cell numbers. Each file will have different cell numbers, so in each folder you will find several files with the same name except for the cell numbers. Of course, you will need all files, regardless of their cell numbers.


Also, in the .dds and .nif file names above, I have the number 11607696 at the beginning of each file name. This is my mod's hash code. It will be different in your situation, so just look through the .dds or .nif files in one of the folders listed above until you find the files containing the hash code that go with your mod.


Finally, in the .lod file name I have Bjornheim at the beginning of the name. This is the ID of my world space. It will change to whatever worldspace ID you are working with.