Creating Precombine/Previs for a Mod

I have mentioned elsewhere that I think it is a better idea to create a seperate Previsbine Patch for your Mod, as it allows you to create multiple versions for different environments (i.e. those using PRP and those not), and is generally includes less Cells (so less conflicts), but you may want to include Previs in your actual Mod.

As you cannot rename precombine files after creating them (Clean), you will need to use your actual Mod in the CreationKit process.
To do that successfully you need to 'prepare' your Mod and follow this process:-

Preparing your Mod for Precombines:
The CreationKit has a number of flaws requiring you to prepare your Mod before generating Precombines from it. If you do not do this the resulting mod will have issues.

1) All Cells in your Mod, that have at least one REFR or LAND record (excluding the exterior Persistent Cell), need to have their XCRI and XPRI fields cleared.  Deleting the VISI and PCMB field is optional as these will be replaced anyway, however, DO NOT delete fields on Cells that won't get new precombines and/or Previs.
Why?
Spoiler:  
Show

These Cells will get new Precombines. If the CK does not create any Precombines then it will not update these fields (so they will contain the old/incorrect Precombine details).

2) All Precombine Meshes and Physics files for those cells need to be removed from your Mod's Archive. Don't leave loose files in Data\Meshes\Precombined either.
Why?
Spoiler:  
Show

It will be hard to tell what is new and what is obsolete otherwise, so your Archive size will be bigger than necessary.

3) All Exterior Clusters, that have at least one Cell getting new Precombines, need to have the XPRI field cleared on all their member Cells. If such a Cluster member is NOT in your mod (and doesn't have a blank XPRI) then you need to create an ITM for it so you can clear the XPRI.
Why?
Spoiler:  
Show

These Clusters will get new Previs, but the CK will not clear this field if it does not generate any XPRI data (leaving the old Data). Any reference in the XPRI that is not in the Cluster Previs will become invisible in-game.

4) All Exterior Clusters (or Interior Cells) with new precombines need to have their previs file (CellID.uvd) removed from your Mod's Archive. Don't leave loose files in Data\vis either.
Why?
Spoiler:  
Show

These will be getting new Previs files, and sometimes the CK failes to generate such a Previs file. It is better to be missing that Previs file
(which will just disable Previs) rather than having a wrong (old) one - which will cause occlusion issues.

5) Any Exterior Cells that will be getting new Previs should be present in your Mod (even as an ITM). If they are still ITM when you have completed building you previs then you can always remove them via FO4Edit QuickAutoClean.
Why?
Spoiler:  
Show

The CK will create ITM's of these Cells anyway, but it often gets the Masters wrong if the Cell it is copying has a different master list to your Mod (i.e. not all the DLC's are in your Master List). This results in broken ID's in the copied Cell - particularly in the XPRI field.

6) Any references (of base type STAT), in a Cell getting new Precombines, that has a Material Swap on it's Base object (Model/MODS), but NOT on the Reference (XMSP),  needs to have an ITM created of that reference with that Material Swap.
Why?
Spoiler:  
Show

The CK ignores the Material swap on the Base Object when building Precombines, so those references will revert to the texture built into the Mesh itself (rather than what was specified in the Material Swap). This commonly manifests as buildings being the wrong colour.

7) Also, any references with Alpha Blending XALP (example - weathered Pictures on Walls) need to be excluded from Precombines by creating an ITM of them and adding a Location Ref Type of NoPrecombineRefType.
Why?
Spoiler:  
Show

The CK ignores Alpha Blend so will precombine these objects at full Alpha. They will look either pristine or blank (depending on how they were set up).

8) Make sure your Mod has all the Masters it requires in it's Masters List. For instance, If you building "PRP compatible" Previsbines then make sure PRP.esp is a Master.
Why?
Spoiler:  
Show

When the CK runs to create Precombines/Previs it will only load those plugines in your Mod's Masters List. If some of your Precombines will use Static meshes from another Mod (say one that overrides a Mesh) then your Precombines will use the wrong mesh because the CK did not see that override.


There is currently no script which will do all this for you (I am considering it), except for step 3 which you can find a script called "Apply Material Swap.pas". Be careful, as the one called "50_FixMaterialSwap.pas" does nothing.

Building Your Precombines/Previs:
Once you have prepared you Mod you can feed it into any "Previsbine builder" Command script to generate Precombines/Previs.
Just be careful that the script will handle merging the generated Precombines/previs into your existing Archive (if your mod has one).
Currently my script (GeneratePrevisbines.bat) does NOT support this (and will exit saying "Mod has existing Archive").

To build your Previsbines manually you need to do the following:
1) Clean your Mod as instructed above.
2) Generate Precombines via the command "<creationkit> -GeneratePrecombined:<your mod name>.esp Clean All".
Replace <Creationkit> with your creationkit exe path (or the CKPE/CKfixes loader as the CK does not like ENB or any mods that replace d3d11.dll).
3) Merge "CombinedObjects.esp" into your Mod via FO4Edit script (see Note 1)
4) Move the Precombine meshes under Data\Meshes\Precombined\* into your Mod's archive ("<your mod name> - Main.ba2"), and delete those files.
5) Compress the PSG file via the CK command "<creationkit> -CompressPSG:<your mod name>.esp"
6) Build the CDX file via the CK command "<creationkit> -BuildCDX:<your mod name>.esp"
7) Generate Previs via the CK command "<creationkit> -GeneratePreVisData:<your mod name>.esp Clean All"
8) Merge "Previs.esp" into your Mod via a FO4Edit Script (see note 2, 3)
9) Move all the Previs files under Data\vis\* into your Mod's Archive ("<your mod name> - Main.ba2"), and delete those files.
10) Delete the following files from your Data directory - Previs.esp, CombinedObjects.esp, "<your Mod name>  - Geometry.psg".
11) (Re)Package up your Mod files (<mod name>.esp, <mod name>.cdx, "<mod name> - Geometry.csg", "<mod name> - Main.ba2", and "<mod name> - Textures.ba2") and install in your Mod manager as normal.

Note 1: The old version of this script was "03_MergeCombinedObjects.pas". This has problems with some edge cases so I would recommend my version
"FO4MergeCombinedObjectsAndCheck.pas". Either way you need to bring Up FO4Edit, clear the mod list except for "CombinedObjects.pas" (which will load your Mod and it's Masters too), right click ON YOUR MOD and choose "Run Script..." to run your script of choice.

Note 2: The old version of this script was "05_MergePreVis.pas". This also has issues so I recommend my version "FO4MergePreVisandCleanRefr.pas". Bring up FO4Edit, clear the Mod list except for "Previs.esp" (again your Mod and it's masters will also be loaded), right click ON YOUR MOD and choose "Run Script..." to run your script of choice.

Note 3: Once you have finished building Precombines/Previs for you mod you should probably remove any ITM records you added to make it work properly.
i.e. ITM of References to exclude them from Precombines, or for Material Swap purposes. My script will remove such reference overrides if they have an EditorID starting "PleaseRemove". Consider this when adding them.

Updated: PJM Mar 2024

Article information

Added on

Edited on

Written by

PJMail
  翻译: