This add-on is a fork of KotorBlender, upgraded to support newer versions of Blender. KotorBlender is in turn based on NeverBlender, forked from version 1.23a.
- Import & export MDL models, including walkmeshes
- Import & export LYT files
- Import & export PTH files
- Clone this repository or download the latest release of KotorBlender from Deadly Stream
- If you have cloned the repository, create a ZIP archive containing the io_scene_kotor directory
- From Edit → Preferences → Add-ons in Blender, install the add-on from the ZIP archive and enable it by ticking a box next to "Import-Export: KotorBlender"
- Alternatively, if you want to contribute to KotorBlender, you may want to create a symbolic link to the local repository in the Blender add-ons directory, typically located at
C:/Users/{user}/AppData/Roaming/Blender Foundation/Blender/{version}/scripts/addons
: mklink /D io_scene_kotor {repo}/io_scene_kotor
Extract models, textures, walkmeshes, LYT and PTH files into a working directory, using a tool of your choice, e.g. reone toolkit. Recommended directory structure:
- data — extract all BIF archives here without subdirectories
- texturepacks
- swpc_tex_tpa — extract swpc_tex_tpa ERF archive here
If you plan to edit textures, batch-convert TPC to TGA / TXI files using reone toolkit, although TPC textures are also supported by KotorBlender.
- Import via File → Import → KotOR Model (.mdl)
- Select top-level MDL root object to be exported
- Export via File → Export → KotOR Model (.mdl)
To edit list of model animations and corresponding events, select MDL root object and navigate to Object → KotOR Animations. KotorBlender supports both object and armature-based edits. To create an armature from objects, navigate to KotOR Animations → Armature and press Rebuild Armature and Apply Object Keyframes. Before exporting a model, make sure to copy armature keyframes back to objects by pressing Unapply Object Keyframes.
- Select objects for which you want lightmaps to be recreated, or unselect all objects to recreate all lightmaps
- Press KotOR → Lightmaps → Bake (auto)
UV mapping:
- Select objects having the same lightmap texture and enter Edit mode
- For every object, ensure that
UVMap_lm
UV layer is active - Select all faces and unwrap UVs via UV → Lightmap Pack, increase Margin to avoid face overlapping
Fine-tuning:
- Increase lightmap image size via UV Editing → Image → Resize
- Tweak ambient color via Scene → World → Surface → Color
- Manually toggle rendering of objects in Outliner and press KotOR → Lightmaps → Bake (manual)
- In Scene → Render, set Device to GPU Compute to improve performance, set Render Engine to Cycles if not already
- In Scene → Render → Sampling → Render increase Max Samples to improve quality
- Press KotOR → Minimap → Render (auto)
- Open "Render Result" image in Image Editor and save it as "lbl_map{modulename}.tga"
- Open "MinimapCoords" text in Text Editor and copy-paste generated properties into module .ARE file using any GFF editor
Fine-tuning:
- Tweak background color via Scene → World → Surface → Color
- Manually toggle rendering of objects in Outliner and press KotOR → Minimap → Render (manual)
- Select a room walkmesh
- Enter Edit mode and select two vertices adjacent to another room
- Determine 0-based index of the other room into the LYT file
- Enter Vertex Paint mode and set brush color to (0.0, G, 0.0), where G = (200 + room index) / 255
- Ensure that brush blending mode is set to Mix, and brush strength is set to 1.0
- Paint over the selected vertices
- Extract PTH file from the module's RIM file, e.g. "modules/danm13_s.rim" (Kotor Tool, reone toolkit, etc.)
- Import PTH into Blender via File → Import → KotOR Path (.pth)
- Create/move path points, or modify path connections via Object Properties
- Export PTH via File → Export → KotOR Path (.pth)
Known to work with Blender versions ranging from 3.3 to 4.0.