seedhartha

TOOL:KotorBlender (for Blender 2.8)

Recommended Posts

KotorBlender (for Blender 2.8)


This add-on is a fork of KotorBlender, upgraded to support Blender 2.8+. KotorBlender is in turn based on NeverBlender, forked from version 1.23a.

Find the latest version on GitHub.

## Features

- Import & export ASCII MDL models: geometry, materials, animations, walkmeshes and TXI files
- Import & export LYT files
- Import & export ASCII PTH files

## Installation

1. Clone this repository or donwload a ZIP release
2. Copy or unpack the **kotorblender** folder into Blender addons directory, e.g. "C:/Users/USERNAME/AppData/Roaming/Blender Foundation/Blender/BLENDER_VERSION/scripts/addons"
3. Enable the add-on in Blender Preferences via Edit → Preferences → Add-ons

## Usage

### Modelling

1. Extract MDL, MDX, WOK, and, optionally, TPC and LYT files to a single directory (Kotor Tool, reone-tools, etc.)
2. Convert TPC files to TGA/TXI (reone-tools)
3. Convert binary MDL to ASCII MDL using MDLops or MDLedit
4. Import ASCII MDL into Blender via File → Import → KotOR Model (.mdl)
5. Create/modify models
6. Select an MDL root object to be exported 
7. Export ASCII MDL via File → Export → KotOR Model (.mdl)
8. Convert ASCII MDL to binary MDL using MDLops or MDLedit

### Baking Lightmaps

1. Select lightmapped objects and enter Edit mode
2. UV Unwrap Faces via UV → Lightmap Pack (increase Margin to avoid overlapping faces) 
3. For each lightmapped object:
    1. Select lightmap UV Map in Object Data Properties
    2. Select lightmap texture node in material node tree
    3. Remove a link between Multiply node and Base Color slot of Principled BSDF node
4. In Render Properties
    1. Set Render Engine to Cycles
    2. Set Device to GPU Compute, if available
    3. Set Margin to a lower number, e.g. 1
    4. Press the Bake button

Fine-tuning:

1. Disable rendering of walkmeshes in Outliner
2. Set Render samples to a higher number, e.g. 1024, to reduce noise
3. Enable Ambient Occlusion in World Properties and tweak Factor to improve contrast
4. Tweak light radius and color (try copying color from vanilla lightmaps)

### Editing Paths

1. Extract PTH file from the module's RIM file, e.g. "modules/danm13_s.rim" (Kotor Tool, reone-tools, etc.)
2. Convert binary PTH to ASCII PTH using reone-tools: `reone-tools --to-ascii m13aa.pth`
3. Import ASCII PTH into Blender via File → Import → KotOR Path (.pth)
4. Create/move path points, or modify path connections via Object Properties
5. Export ASCII PTH via File → Export → KotOR Path (.pth)
6. Convert ASCII PTH to binary PTH using reone-tools: `reone-tools --to-pth m13aa-ascii.pth`

### Connecting Room Walkmeshes

1. Select a room walkmesh
2. Enter Edit mode and select two vertices adjacent to another room
3. Determine 0-based index of the other room into the LYT file
4. Enter Vertex Paint mode and set brush color to (0.0, G, 0.0), where G = (200 + room index) / 255
5. Ensure that brush blending mode is set to Mix, and brush strength is set to 1.0
6. Paint over the selected vertices

## Trivia

- Check "Image search" when importing to recursively search for textures in subdirectories

## Compatibility

- Blender 2.8+
- MDLops 1.0.2
- MDLedit 1.0.3

### Known Issues

- You cannot have neverblender and kotorblender *enabled* at the same time
- MDLedit has problems reading `color` and `selfillumcolor` controllers from ASCII MDL


 

Share this post


Link to post
Share on other sites

When trying to export a mesh with a dangly mesh I get the following error:

On line 1107 in nvb_node.py:  RuntimeError: Error: Mesh "(insert danglymesh name here)" is outside of main database and cannot be removed from it.

Share this post


Link to post
Share on other sites
2 hours ago, Hunters Run said:

When trying to export a mesh with a dangly mesh I get the following error:

On line 1107 in nvb_node.py:  RuntimeError: Error: Mesh "(insert danglymesh name here)" is outside of main database and cannot be removed from it.

Fix is in the repository (mesh removal made redundant after upgrade).

  • Like 1

Share this post


Link to post
Share on other sites

Status update: I've done a couple of beta releases (now at beta 4), where I've improved compatibility with MDLedit and added support for editing PTH files. For those interested in baking lightmaps or editing PTH files in KotorBlender, I've listed the necessary steps in the description.

  • Thanks 1

Share this post


Link to post
Share on other sites

Status update: I'm releasing version 2.0.0, which is the first non-beta version of the updated add-on. I've tested it on quite a few models, doing modelling, texturing, rigging, animation, etc. I think KotorBlender is now on par with KotorMax in terms of functionality: it works equally well for editing (and creating) character and area models, and I'm quite happy with the result.

Here's the excerpt from the release changelog:

  • Rewritten handling of materials and lights (Eevee)
  • Made materials configurable from Object Properties
  • Implemented import & export of LYT files
  • Implemented import & export of ASCII PTH files (reone-tools)
  • Implemented armature creation (no animations yet)
  • Fixed MDLedit compatibility issues
  • Removed NWN-specific functionality
  • Disabled minimap rendering (until later)
  • Code cleanup and refactoring in accordance with Blender and Python code styles
  • Like 2

Share this post


Link to post
Share on other sites

Hey I just wanted to say this is amazing. I've been using blender for awhile and much prefer it to the other main 3D packages, especially Max. Until recently, my workflow has been to import a file into blender 2.79, manually change the textures, so on so on. You can image that this gets pretty annoying real quick. Really excited to see what you can do with it. 

Share this post


Link to post
Share on other sites

When you import a supermodel, some animations on the right arm rotate in a circle. To see what I mean import s_male02 (k1 or k2) and look at animation pausestl. Decompiled with both mdledit and mdlops. This also applies to s_female03.

Share this post


Link to post
Share on other sites

my novice nature is showing but can this tool be useful for making new characters for a recruitment mod. i have a rough draft in my head that involve Ord Mantell by Redhawke.

Share this post


Link to post
Share on other sites
49 minutes ago, Hunters Run said:

When you import a supermodel, some animations on the right arm rotate in a circle. To see what I mean import s_male02 (k1 or k2) and look at animation pausestl. Decompiled with both mdledit and mdlops. This also applies to s_female03.

That is a known issue - same goes for pre-2.8 version of the add-on. Apparently, it has something to do with keyframe interpolation. Exported animations and imported armatures work OK though, so it's not exactly high on my todo list.

4 minutes ago, DeathScepter said:

my novice nature is showing but can this tool be useful for making new characters for a recruitment mod. i have a rough draft in my head that involve Ord Mantell by Redhawke.

I'm not aware of any hard limitations of KotorBlender, with regards to creating new characters. It may not have as many utilities as NWmax, it lacks tutorials, but you can certainly model, texture and rig new characters using KB.

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, seedhartha said:

That is a known issue - same goes for pre-2.8 version of the add-on. Apparently, it has something to do with keyframe interpolation. Exported animations and imported armatures work OK though, so it's not exactly high on my todo list.

I'm not aware of any hard limitations of KotorBlender, with regards to creating new characters. It may not have as many utilities as NWmax, it lacks tutorials, but you can certainly model, texture and rig new characters using KB.

I am interested in re using one of the female Revan heads(Angelina Jolie one with the red braid) as a base and maybe using other's assets to make a Recruitable character. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.