Jump to content

[WIPz] TES5LODGen for Trees LOD


zilav

Recommended Posts

Generation of LOD for trees in Skyrim.
Built-in in TES5Edit 3.0.33 and later versions
http://www.afkmods.com/index.php?/topic/3750-wipz-tes5edit/

To build a lod for trees, right click on a mod in TES5Edit, Other -> Generate LOD, then select worldspace(s). Only worldspaces that have terain lod are shown (have existing lodsettings file), this is required to align newly generated lod with terrain/objects lod and make them compatible. Alternatively you can rename TES5Edit to TES5LODGen and it will autobuild lod for all worldspaces in all plugins similar to TES4LODGen.

LOD generation requires 2D images of trees (billboards) to be present at particular path and have specific names. The naming format is
Textures\Terrain\LODGen\<PluginName>\<NifModelName>_<TreeFormID>.dds
where
<PluginName> - the name of plugin from which TREE record originates (master record). For example if a tree record from Skyrim.esm is overridden by some plugin, the used plugin name will remain Skyrim.esm since it is the master for that record.
<NifModelName> - name of tree nif model without path and extension, for example Landscape\Trees\TreeAspen03.nif the used name is TreeAspen03
<TreeFormID> - FormID of tree record with mod index part (leading byte) always equal to 00.

Examples:
TreePineForest05 [TREE:00051126] in Skyrim.esm, billboard Textures\Terrain\LODGen\Skyrim.esm\TreePineForest05_00051126.dds
DLC2TreePineForestAshL02 [TREE:02017F6D] in Dragonborn.esm, billboard Textures\Terrain\LODGen\Dragonborn.esm\TreePineForestAshL02_00017F6D.dds

Additional parameters for LODGen are specified in optional text files that have the same names and locations as billboards
Textures\Terrain\LODGen\Skyrim.esm\TreePineForest05_00051126.txt
They have the following format like ini file

[LOD]
Width=566.409180
Height=1521.464722
ShiftX=0.0
ShiftY=0.0
ShiftZ=0.0
Scale=1.0

Width and Height define the size of LOD image in game units. If absent, they are calculated using Object bounds OBND field of tree record Width=X2-X1 and Height=Z2-Z1. They can be used to stretch lod trees in game without changing billboard textures.
Shift(X|Y|Z) - shift references of that tree by amount, default is 0.0
Scale - additional scale of refs lod image, default is 1.0

All other values are ignored, for example atlas splitter also saves Model value, but it is not used by LODGen.

When building trees LOD, only references of trees that have existing billboards will be included. Deleted, initially disabled, enabled via parent (XESP field) or having large rotation angles (30 < RotX, RotY < 330) references are exluded from lod.

LODGen creates the following files:
meshes\terrain\<Worldspace>\Trees\<Worldspace>.LST - index of trees in LOD
meshes\terrain\<Worldspace>\Trees\<Worldspace>.4.*.*.BTT - lod data
textures\terrain\<Worldspace>\<Worldspace>TreeLOD.DDS - combined atlas of billboard textures in LOD
Remove those files and folders if you wish to uninstall generated LOD.

Existing atlases splitter, accessible in Other -> Split Trees LOD Atlas menu allows to split atlas textures into billboards. It scans lod data and tries to associate trees lod indexes with TREE records, results are saved into folder
textures\terrain\LODGen\SplitAtlas_<AtlasName>
Unknown lod trees will be saved with indexes number in the billboard name.

Please note that TES5LODGen reads BSAs the same way as the game, and Data folder is always the winning override.

Link to comment
Share on other sites

awesome!

 

Here is a quick n dirty ReachTree01/02, ReachCliffTree01/02 and TundraDriftWood01 for testing

 

Everything seems to work. Do not try to split from your own LODGen generated tree LOD though - which really only happens when you test stuff, It can get cranky then when in tests you didn't do all trees :)

 

FlatTreesForTES5LODGen.zip

Link to comment
Share on other sites

out of curiosity, how do you determine that treeaspen05 and treeaspen06 are the same billboard? It only shows up once in the created atlas, rightfully so, like in the original. Coincidence or attention to detail? :)

Link to comment
Share on other sites

This is a godsend.  I'm the author of "Simply Bigger Trees" and the only missing component is the LOD, which has thus far been a surprisingly confusing issue to tackle (not a lot of clear information readily available.)

 

Pardon if this is a ridiculous question, but do the LOD NIFs that sit next to the regular tree NIFs factor into the scaling of the LOD when it is generated?  Or does the text file strictly control that?  Reason being is that I resized all of the LOD meshes appropriately to the size of my regular trees and am hoping that is enough to do the trick.

 

Going to play with this a bit, any tips would be amazing.

Link to comment
Share on other sites

lod_flat.nif files are only required by CK when generating lod, they hold information about UV location of a tree image on a premade atlas, and the size of flat mesh defines width/height of tree lod in the game.

TES5LODGen generates atlas dynamically and creates own UVs each time, and reads size values from corresponding txt files or calculates them directly using object bounds field of trees (there is a right click menu option in CK named Calc bounds to update it if full meshes changed iirc), so it doesn't need flat nif files at all.

It would be actually very nice if all mod authors that change trees lod will include billboard textures (and txt files if needed) in TES5LODGen format with their mods. They doesn't affect the game or CK in any way, and require just a bit of extra space.

Certainly users can split atlases from existing mods themselves, but I'm not sure they will do it. The other way is me splitting atlases of all popular trees mods and shipping billboards with TES5LODGen in optional packages, but I doubt that nexus will allow it.

So the situation is unfrotunate - TES5LODGen gives flexibility and solves all trees lod compatibility problems between mods changing it, but requires support from mod authors providing billboards included with their mods. And the chances for that are low considering Skyrim is 3 years old and many mod authors already moved away.

Link to comment
Share on other sites

  • 4 weeks later...

Wrote a small utility for myself to split existing atlases from lod_flat.nif files.

Usage: put it in a separate folder, then copy lod_flat files there too and atlas image itself. Execute command like

deatlas.exe SomeTreeLodAtlas.dds

 

It will scan all trees lod nifs in the current folder and subfolders, grab their UV data and export tree images as separate dds files ready to use with TES5LODGen.

deatlas.7z

Link to comment
Share on other sites

  • 2 weeks later...

It would be a very nice addition if an output path could be selected for creating tree lod, to avoid overwriting existing files.  Can be a PITA when using Mod Organizer

Link to comment
Share on other sites

There is a mod that makes the pale actually pale by removing lots and lot of trees. http://www.nexusmods.com/skyrim/mods/59766

 

 

It removes so many trees that LODGen for trees doesn't have to generate some of the *.btt files. I wonder if it is possible for it to create empty *.btt files so they "overwrite" the files from Skyrim.bsa?

 

 

 

Of course the current workaround is to create those empty files by hand, which works just as well.

Link to comment
Share on other sites

To cover a 128x128 worldspace like Tamriel it will require 32x32=1024 btt files. Right now lodgen creates around 320 for Tamriel, this means creating extra 700 empty files which is a bit too much just for a mod like that imho. Better to fix that mod and instead of deleting trees move them under the ground at -30000. Easy enough with a simple TES5Edit script :imp:

Link to comment
Share on other sites

That is actually a good idea, but then tree LOD generation should ignore trees below ground level :)

No don't! Because, all it needs is one tree per quad to generate a file, no matter where it is, so this really is a good and easy workaround.

Link to comment
Share on other sites

  • 1 month later...

Going to play with this a bit, any tips would be amazing.

Going to reply here so others see this too.

TES5LODGen requires 2D dds images of trees to generate LOD, there are several ways of getting them:

1. Split existing atlases using existing LOD files, instructions are in the first post. Sheson also uploaded youtube videos for DynDoLOD that have that part covered.

2. Split existing atlases using lod_flat.nif files, I uploaded my utility deatlas for that in the post above. Not all mod authors distribute those nifs since they are not requires for gameplay.

3. Generate billboard image from preview window in CK, I also made a separate tool for that

4. Create billboard image in Photoshop or by some other means. I don't work with graphical editors so can't comment on that.

 

To generate LOD for Skysight Simply Bigger Trees mod, I split existing atlas (used the one from Detailed Terrain and Tree LOD), put Scale=1.5 in appropriate txt files for trees that were scaled up in SSBT, and generated new LOD in TES5LODGen.

Link to comment
Share on other sites

  • 1 month later...

http://www.nexusmods.com/skyrim/mods/61711

 

This mods replaces a lot of trees with the same meshes all over again. For example

0005C072 = TreePineForestSnow01.nif

0001306D = Landscape\Trees\TreePineForest01.nif -> Landscape\Trees\TreePineForestSnow01.nif

0005D2DB = Landscape\Trees\TreePineForestSnowL01.nif -> Landscape\Trees\TreePineForestSnow01.nif

 

When splitting the atlas only one dds/txt combo is generated per mesh filename, while it should generate basically the same combos again just with different form ids.

Link to comment
Share on other sites

When splitting the atlas only one dds/txt combo is generated per mesh filename, while it should generate basically the same combos again just with different form ids.

Damn 290MB download just to test :wallbash:

Loaded SCO Winter Edition.esp in TES5Edit, split atlas for Tamriel, works fine. Attached results.

Though "leafless" trees are square (same width and height in txt) and have empty images, but maybe it is by design.

 

AtlasSplit_TamrielTreeLod.zip

Link to comment
Share on other sites

The leafless are black trees on black background, turn alpha on then you see them. I was scratching my head too at first :)

 

Yes it splits only into 8 trees. I am expecting it to split into many more trees, even if they look the same.

 

There are 6 different group of pines trees. The mod changes them to always be the same 5 trees. TreePineForestSnow01 to TreePineForestSnow05

 

Splitting atlas should create files for all of them.

 

TreePineForest01Dead_000B927A
TreePineForest02Dead_000B927B
TreePineForest03Dead_000B927C
TreePineForest04Dead_000B927D
TreePineForest05Dead_000B927E
TreePineForestSnow02Dead_000EF5A4
TreePineForestSnow03Dead_000EF5A3
TreePineForestSnow04Dead_000EF5A2
TreePineForestSnow05Dead_000EF5A1
TreePineForestSnow01_0005C072
TreePineForestSnow02_0005C071
TreePineForestSnow03_0005C070
TreePineForestSnow04_0005C06F
TreePineForestSnow05_0005C06E
TreePineForestSnowL01_0005D2DB
TreePineForestSnowL02_0005D2DA
TreePineForestSnowL03_0005D2D9
TreePineForestSnowL04_0005D2D8
TreePineForestSnowL05_0005D2D7
TreePineForestSnowL01Dead_000EF5A0
TreePineForestSnowL02Dead_000EF59F
TreePineForestSnowL03Dead_000EF59E
TreePineForestSnowL04Dead_000EF59D
TreePineForestSnowL05Dead_000EF59C
TreePineForest01_0001306D
TreePineForest02_00018A02
TreePineForest03_0004B016
TreePineForest04_0004FBB0
TreePineForest05_00051126

Link to comment
Share on other sites

There is only 8 entries in LST file, nothing more to split there. Splitter goes over those entries and seaches for the first match (found FormID of reference), then goes to the next one in LST. I assume you want it to to go through all possible references in case of several trees using the same texture?

Link to comment
Share on other sites

The alternative would be to manually copy the files to all the needed formid versions to generate correct tree LOD for such a mod. So if you can do that would really help IMHO.  :)

Link to comment
Share on other sites

The alternative would be to manually copy the files to all the needed formid versions to generate correct tree LOD for such a mod. So if you can do that would really help IMHO.  :)

Already uploaded version that saves billboards for all trees :evil:

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...