Wednesday, February 22, 2012

.lod File Generator

For those of you who want to make your own .lod files but would rather not mess around with a hex editor I now present:

LodFileGenerator_v0.01
made by Geggakloss



------------
Description:
This is a simple command based program that can make a .lod file for Skyrim worldspaces without the use of a hex editor.
This file is needed in addition to the meshes and textures that make up the LODs to show in the game.
------------
Installation:
No installation needed, just run exe file.
------------
Use:
Run LodFileGenerator_v0.01.exe

The program will ask for:
1) Name of your worldspace
2) x coordinates of the lower left cell
3) y coordinates of the lower left cell
4) width of your world measured in number of cells

The program will create a "YourWorldspace".lod file in the same directory as the exe file.

Put the .lod file under Skyrim/Data/lodsettings (create this folder if it does not exist)

Exsample:
A world that starts at (-64,-64) in the lower left corner and ends at (64,64) has a width of 128 cells.
The name of the worldspace is test.
For this worldspace answer:
1) test
2) -64
3) -64
4) 128

-----------
EDIT:
If your world size in smaller than tamriel, you can use the tamriel.lod and rename it for your worldspace. 

Know issues: 
The .lod file generated will not work for worlds spaces smaller then 32 cells in width!

-----------
EDIT (2012-03-04)
New version out (v0.02), hopefully all issues are now fixed .

Enjoy!

/E and J

Tuesday, February 21, 2012

From Heightmap to Worldspace in Skyrim

Update (23 April 2013)
I’m sorry to be the bearer of bad news to all of you who wish to do really large worlds. There is a bug in the game engine that limits the functional size of a worldspace to 4096×4096 pixels (128×128 cells centered around cell 0,0). You can read more about what this bug effect here.
___________________________________________________________________

GK asked if I could outline the world and height map creation in more detail. I will try to make an in depth description of my workflow. There will be repetitions of some of the things I have described earlier, but perhaps in a more collected manner :)

(Updated 07 Dec 2013)
First a brief summary of the steps I go through from image to worldspace:
  • make Height map in Photoshop, save as TIFF
  • run it in Geocontrol 2 to make natural looking erosion
  • back to Photoshop to lower the gray scale color range, save as RAW
  • run TESAnnwyn to make an .esp
  • change LOD water, default water and land levels in CK
  • (convert esp to esm with CK)
  • Previous post: Make LOD meshes and Textures 

Making the height map: 
(Updated 07 Dec 2013)
The size in pixels of the image will determine the size of the world in Oblivion/Skyrim. The game is built up by quadrants, with 32 x 32 cells in each. One quadrant is 1024 x 1024 pixels. As a reference, Skyrim is 3808 x 3008 pixels (not all of which is playable). A world can be up to 16 x 16 quadrants (16384 x 16384 pix) in size, but due to the bug I mentioned in the header, worlds larger than 4 x 4 quadrants (4096x4096) will have huge problems.

There are several ways to make the height map, paint it yourself or use a landscaping software (like GeoControl, EarthEdit, etc).

EDIT
Don't have Photoshop? Well I think I found a way to still make a 16bit height map using Gimp, ImageJ and GeoControl. See new post.

This is my workflow for a 4096 x 4096 pixel sized world:

Photoshop
1.  I have made my original height map in Photoshop. Make a new image with the size you want, File -> New, size 4096 x 4096 pix, 16-bit and gray scale.
(Alternatively change the settings of an image you already have: Image -> Mode -> gray scale and 16-Bit.)
2.  Paint your terrain, I did this in layers, first black for the lowest to almost white as the top of a huge mountain. In the color tab you can chose the % gray scale. 100% is Black and 0% is White, so 50% gray has 50% black in it and so on. Whenever I talk about % gray, this is what I mean. 

(Oblivion and Skyrim can not handle a full range black to white height map like this, but I will fix this in a later step)
What can be good to know when you paint your world is where the sea level will be. When I paint my height map in 100-2% gray scale, the sea level will be between 89% and 90% gray scale. (This will change later to 99-98% when I lower the gray scale range to fit what Skyrim can handle.)


3.  Make sure to flatten the image if you worked in layers, Save file as TIFF

GeoControl
4.  Import Image to GeoControl2. Generation -> Terrain Import -> Image Import
GeoControl2 can only handle images up to 4096 x 4096 pixels. There are a lot of settings in GeoControl2, DON'T PANIC :) 
5.  Under the General tab -> Filter tab -> Add -> erosion system or erosion system inverse -> choose the erosion typed you want. I have used: Thin flow deep - inverse (all levels, strength 100), Thin flows sediment (only levels 1024 and 2048, strengths 40), Thin flow deep (all levels, strength 100) and Mountain ridged (all levels, strength 100).
I have uploaded some of my more used GeoControl settings if anyone want them.
EDIT:
Under the tabs Generation, General, General, General Settings, set "Random Noise up to level" to 0 and "Protect Terrain up to Level" to at least 64.
A high number for "Random Noise up to level" will introduce features that are not in your original map and a low number at "Protect Terrain up to Level" will lead to a flat terrain.
Some ideas on what the different settings can do

6.  Press Generate, depending on you computer this can take a lot of time.

7.  When it's done and you like the results go to Generation -> Terrain Export ->chose TIFF 16 bit greyscale.

Using GeoControl this way gives me less control over the final outcome of my world, but for me that's okay, in fact I have been happily surprised by my landscape when I'm in the game, as it turned out completely different to what I expected sometimes. 

Photoshop

8.  Open file in Photoshop, to flip the image vertical (TESAnnwyn will flip it back) go to Image -> Image Rotation -> Flip Canvas Vertical 
9.  The last thing we need to do is change the grayscale range. This is because Oblivion/Skyrim can only handle images that is from 0-76% gray (see previous post where I try to explain why and how I think it works, 1, 2, 3)
Go to Image -> Adjustments ->  Brightness/Contrast change to -150 brightness, and repeat again with -150 brightness. 
10.  Check with the Eyedropper tool that the lightest parts of the height map is not above 76% gray (With "above" I mean anything in the range 0-75%)
11.  Save as RAW, with the settings : Header 0, IBM PC
Now your height map is ready :)

Note: Important rules for the Heightmap
(Updated 07 Dec 2013)
1. If the change in height is too great there will be tears between cells!
This image posted by someone that had problems with this issue. Here you can see a classic example of this problem. Try making the height map image darker by lowering the brightness even more.

I have made some tests to see when I have too much height differences and get breaks between cells, I apologize if this is getting a bit technical. In the image below I have different gray scale color ranges from 100-95%, 100-90%, 100-85% and 100-80%. The color range is spread out over approximately 3 or 5 cells, and distinct color borders is where a break between cells will happen (*). Note that a change in height from 100-90% over 3 cells is almost a vertical wall :)  


2. Sea levels will be between 99% and 98% gray color in the finished height map (When using the setting -h -22192 in TESAnnwyn, and setting the default land levels to -27000, default water levels to -14000, see description below) 

TESAnnwyn: making the esp

I use the TESAnnwyn (Skyrim compatible version) to make esp from raw files, much easier than using the Creation kit. TESAnnwyn is a command line program that is really easy to use.
TESAnnwyn.exe -i Skyrim -p 1 -b 16 -d 4096x4096 -x -64 -y -64 -h -22192 -w NameOfWorldspace YourImage.raw
 -i sets the game, -p RAW format, -b 16 bit image, -d size in pixels, -x and -y cell offset in x and y directions, -h -22192 lowers the land, specific to work with water LODs in Skyrim.

h -22192 will give about 8000 units of the land under sea level, that is a lot. I like to have more above the sea level, so I use -16048 (2048 units under sea level) or -18096 (4096 units under sea level).

Now move the .esp to you Skyrim/Data folder.

(Updated 07 Dec 2013)
To make LODs work we have to change the default water and land settings for the worldspace. This can be done with the Creation kit (alt 1).
There are also other ways to do this, but you will only need them if you are doing a world that is larger that 4096 x 4096, and as mentioned above larger world spaces will have huge bugs.
The alternative methods are: Creation Kit with version control (alt 2), or an editor for Fallout New Vegas, FNVEdit (alt 3, you need a registered copy of Fallout New Vegas for it to work).

Alt 1) using the Creation kit (for .esp files)
For a world up to 4096x4096 pixels you can open and edit the esp in the Creation kit.
1.  In the Creation kit, open your esp (set as active).
2.  Under World -> Worldspace
3.  Select the worldspace, edit: LOD water height to -14000.0000, Default Land Height to -27000.0000 and Default Water Height to -14000.0000
Set Default Land Height to different thing dependent on value given in TESAnnwyn: -18096.0000 for h -18096 or -16048.0000 for h -1604.
4.  Save the esp

Update 2012-07-28
Alt 2) using Version Control (with the Creation Kit)
For a large worldspace like my 106384x16384 pixels there is no way I can open it as an active esp in the Creation kit, but you can be opened as an esm. What you need is to set up Version Control, follow Meagfaer's guide on how to do this: http://www.creationkit.com/Version_control

1.  Make the esp in to a esm, I use TES4Gecko. You also have to set up this esm according to the version control guide.
2.  In the CK, open only your esm (not the Skyrim.esm).
3.  Under World -> Worldspace
4.  Select the worldspace, edit: LOD water height to -14000.0000, Default Land Height to -27000.0000 and Default Water Height to -14000.0000
Set Default Land Height to different thing dependent on value given in TESAnnwyn: -18096.0000 for h -18096 or -16048.0000 for h -16048.
5.  Save the esp
6.  Load your esm and the new esp as active.
7.  Click on the version control botton (left of the load botton)
8.  Select the worldspace entry, click Check out. Select the worldspace entry again, click Check out.
9.  You can close the new window that pops up, and then select the your esm that the changes will be saved in to.
10. I was also asked if I would set the ID for WaterType and LOD WaterType, choose Yes.
11. Choose NO when asked about Check In Data files.
Now the esm has changed water height and so on.

Alt 3) using FNVEdit (for esp and .esm files)

1.  Put the esp file in the FalloutNewVegas/Data folder, open FNVedit and select the file
2.  Change the LOD water height to -14000.0000, Default Land Height to -27000.0000 (alt -16048.0000 or -18048.0000 ) and Default Water Height to -14000.0000.
3.  Close the FNVEdit and wait for it to save. It will create a backup and a save file. Rename the save file to .esm again.

(Updated 07 Dec 2013)
Optional: Converting the esp to an esm
You can trick the Creation Kit into making a functional esm.
1. Make a copy of your esp file and rename the extension to .esm
2. Open the new file as active in the CK, the file will still be listed among the esp as a plugin.
3. Save. The CK will now make the adjustments needed to make the file a proper esm. Next time you open the CK, the file will be listed as an esm.

Now you are ready to make LODs (described in a previous post).

Hopefully this procedure will work for you too :)

EDIT 2012-03-03

After Skyrim updates some esm file will no longer work, the game will crash.
* esm that is dependent on the Skyrim.esm will work (example, the esp was loaded together with Skyrim.esm and then saved, then converted to an esm)
* esp will work
* As default the CK can only open one esm at the time, but you would like to open both your esm and Skyrim esm. You need to make a change in the SkyrimEditor.ini file in your /Skyrim folder. Add bAllowMultipleMasterLoads=1 under [General].


/E

Saturday, February 11, 2012

Generating LODs for your worldspace

Edit: I have rewrite this guide a bit.

LODs are made by four file types: meshes (.btr files), textures (.dds files), normal (.dds files) and a .lod file for the world space. There are several ways to create all of these file, you can use the CK or other programs depending on what works on your computer.

The steps in this guide are:

Duplicating textures (optional, see point 2 under Making Meshes), converting to tga
Making Meshes, Textures and Normals
Making .lod file (optional)

Duplicating textures in the CK (optional)

If you have painted the terrain with any texture apart from default texture, you need to do some extra things to make Oscape work properly. This only has to be done in the file used for LOD making.

1. Open your esp and the Skyrim.esm in the CK.
2. In the Object window, under Miscellaneous, TextureSet. Duplicate every texture you would like to have as LOD.
3. In Miscellaneous, LandTexture. Open every LandTexture you duplicated, change the file to your copied TextureSet.
4. Save

Making the Meshes, Textures and Normals

I had problems with the crashes in the CK when I tried generating textures. Oscape will make meshes, normals and diffuse/color, I would recommend using it, much faster than struggling with the CK. For me the CK worked, even with a 16x16 quad world (took several hours!).
You can find Oscape here
For working with Oscape I followed this easy to follow tutorial made by Maegfaer.
(Warning, Oscape will not work on Vista. If you are running on a Vista machine, try using the CK to make the LOD files, or contact someone that can make the LOD files for you, like me. I can't promise I will always have time to make them right away.)

For landscape textures to show in LODs they need to be put in the Source folder as tga files.
1. Nico cioN over at AFKmods has been very nice and made all the files you need for Skyrim vanilla files.
http://afkmods.iguanadons.net/index.php?/topic/4079-skyrim-vanilla-lod-source-files/
2. Under Steam\steamapps\common\source\ make a new folder TGATextures. Copy the Landscape folder from the downloaded file.

If you are using custom landscape textures you will need to convert these to TGA files too.
a) Copy you dds texture files to the Source\TGATextures\Landscape folder
b) You can use a command line batch program called Nconvert to make the tga files. Download here http://www.xnview.com/en/nconvert/ (download section is at the end of the page). Put the Nconvert.exe in the folder containing the textures.
c) Make the batch file by create a txt document. Write exactly:
nconvert -out tga *.dds
Change the file extension to .bat (file should change icon to gears).
(you can also download the file here). Put the bat file among the textures to be converted together with the Nconvert.exe file. To run the bat file simply double click on it. Now you should have tga files of all your dds files and you can delete the dds files.

Continue to generate the landscape LODs with Oscape.

1. For Oscape to work, you need to convert your esp into an esm. 
You can use Oblivions Gecko to make an esm from an esp. (TES4Gecko can't do anything else that will work for Skyrim files.) Put the esm in the Data Folder.

2. Start Oscape, under Game, select Skyrim. This will give you a list of all the masters and plugins. Click in the box of your esm.
If you are using any texture apart from default texture, you need to have that TextureSet and TextureSet in your esm (see Duplicating textures in the CK) or select an esm with these resources in Oscape together with the esm you want to make LOD from. 
(Thanks to Hyperactivehild for figuring this out!)

3. Press the Fill button, and in the drop down list next to the button select your world space.

4. Check the feature-map and surface-map boxes.

5. Under Outputs, press Browse and select the output folder, can be any folder. You must rename the raw file to the same name as the worldspace. Press Extract and wait.

6. Oscape will now show you the Preview tab. The blue is the water level. No need to change anything if you can see your land (and sea) as you want, press Accept.
If you only see land or blue water you may need to change the sea level in the “Sealevel” field.

7. Oscape will now show you the Generator tab. The Target of Max resolution value is dependent on how detailed your world is, a completely flat world can have a very high number. Ethatron (the maker of Oscape) has recommended never to use a value over 1000 pts per cell in your worldspace. I have used 8 000 000 for my 16x16 quad world for test proposes, but when I want my finished world I will use more. There are of course limits to how high number you can use depending on amount of memory on your computer. You have to test what works for your world. If a value works, try something higher.
8. Check the Meshes box and then check (1/1), 1/2, 1/4, 1/8, optimize of overdraw, and NIF boxes.
9. Check the Normals box and then check 1/1, 1/2, 1/4, 1/8, and DirectX boxes. Choose low, standard or high resolution textures.

10. Check in the Colors box and then check 1/1, 1/2, 1/4, 1/8, and DirectX boxes. Choose low or standard resolution textures. (If the Color box is grey, you forgot to check the surface-map box in step 4. )
11.  Press Generate and wait for Oscape to generate the files.

12. Oscape will now show you the Installer tab. Make sure your Worldspace is selected. check the boxes of LOD Settings Generate, Level0, Level1, Level2 and Level3. This will transfer the right files to the right folders.

The Oscape settings
If you run into errors, transfer the textures and meshes manually.
The texture files (.dds) should be put in:
Skyrim/Data/Textures/Terrain/"worldspace"
and the mesh (.btr) in to
Skyrim/Data/Meshes/Terrain/"worldspace"

You might have to create the folders if you do not have them already.
Copy all the .btr and .dds files.
Meshes are made at different levels: 4, 8, 16 and 32. All are needed by the game. Level 32 makes up the map.





Alternatively: Meshes with the Creation Kit:
In the Creation kit go to World, World LOD. A new window will open where you can choose between different settings, then press Generate. One of the settings under meshes is Background or High Priority, this determines the speed of generation (use High Priority, it will save you a lot of time). My Creation kit crashed when I minimized it,  but restarting the generation picked up where it left off. There is a tool that will Clear Scratch Files, and I guess that it would clean out any unfinished LODs.The LODs are put under Skyrim/Data/Meshes/Terrain/"worldspace" as .BTR files.

Making the lod file (optional)

Without the .lod file none of the textures or meshes will show up in game. Oscape should make this file, but sometimes you might want to make a .lod file that covers larger areas that your actual worldspace. You can make the .lod file with a simple command line program that will write a lod file for you. Download it here: lodFileGenerator (download from nexus)

Well that's it, you should have LODs now :)

It's easy to see the potential beauty, even with default texture and no flora. I just love the sky :) 


Now the LODs mostly works in game, but I still have some problems with purple textures.

This is due to lacking textures. Some of the texture .dds files had black squares in them, resulting in missing textures purple.










As I said before, the world map is made from the level 32 mesh and textures. First image is with missing normal and color textures, the second with these textures.















A big thanks to all the nice modders figuring these things out at the Bethesda forums :)

Running into troubles?
I made a test on how different problems you can run into would look in the game. First off, if you see no LODs at all, you probably don't have a working YourWorldSpace.lod file in the lodsettings folder. 
1. This is how it looks when everything is working fine :)
2. Missing textures (.dds), you get a purple color over all the LODs.
3. Missing normals (_n.dds), the terrain looks diffuse with no details.
4. Missing meshes (.btr), the LODs that show are black (probably will not fit your terrain).

LODs for objects and trees
If you are making LODs with trees and objects, take a look at this video made by Alexander J. Velicky. It explains everything nicely :)

When it comes to LOD trees, beware that the CK can not do LOD trees for any trees that stand in cells beyond  -/+ 32. This will result in a wall of trees at the edge of that cells. Tes5Edit will solve this problem, have a look here.


/E

Height maps and making a new world

Some height map data:
Skyrims min height is -8192 and max 122878 Game Units. As a default, land is generated at -2048 GU, and water levels at 0 GU. Interestingly the Tamriel world space of Skyrim has a default land level of -27000 GU and water levels at -14000 GU. I have no idea why this is.
As before the max gray scale height of a height map was 75% gray, if the image was lovered to -8192 with TesAnnwyn (-h -8192 function). 


I will use the same height map that I used for Oblivion when making my world in Skyrim.  The image is a 16384 x 16384 px, 16 bit raw file. With the help of Lightwaves new  beta TesAnnwyn (v0.23) I can easily make a esp file that works in Skyrim.
The settings I used in TesAnnwyn: -i Skyrim - p 1 -b 16 -d 16384x16384 -x -255 -y -255 -h -2048 "x.raw"

EDIT:
use -h below -14000 to lower the land so water LODs work in Skyrim, I use -16048 to have 2048 units below sea level.

After making a esp I still need to convert it to an esm file, the Creation kit crashed when I tried to open a 16 quad world :) I used TESGecko's convert to master function and this worked fine.

To try my world in game, I named one cell, and put out a COCMarkerHeading in that cell, and saved this as a new plugin esp that I loaded together with my esm. In Skyrim press ~ (or §) to open the console, and type coc NameOfCell and this cell will be loaded.

Next step will be to make LODs...

/E





Friday, February 10, 2012

Skyrim - Image Library of Textures with 3D grass

Finally the Creation kit for Skyrim has arrived :)

One thing I do miss from Oblivion is all the diversity in the resources.  I really like the Skyrim theme, the tundras and snow, but I would also like to make lush forests and seas of green high grasses and flowers. As a comparison to a earlier post with the 3D grasses  of Oblivion, these are the vanilla Skyrim ground textures that has 3G grasses:
LCoastBeachGrass01 LFallForestGrass01 LFallForestGrass01NoFerns
LFallForestGrass01NoFerns LFieldGrass01 LFieldGrass02
LForzenMarshGrass01 LForzenMarshLichen01 LGrassSnow01
LPineForest02 LPineForest03 LReachGrass01
LTundra01 LVolcanicTundraDirt01
I hope someone makes more grasses, trees, flowers and ground textures. I'm not at good at making textures and models, but I guess I will have to learn :)

Edit
The amount of grass, that is the density can be set in the CK for each grass.


Comparison of a density setting of 10 to 70:


/E

Sunday, February 5, 2012

Autogenerated regions


While waiting for the release of the Skyrim Creation kit, I have tried to texture and populate an island with the Construction set (TES4) in my world using the Gold Coast regions. I'm pleased by the result :)
 









/E