47 ratings
Portraits and Portholes for new custom characters.
By Marthenil
This guide will walk you through adding portraits and portholes to new custom characters.
One of the major issues when making new custom characters has been the lack of working custom portraits. The portrait is the icon you see at the diplomacy screen, when recruiting a character, the skill window and more.

Well, no more. In this relatively simple guide, we'll go through the steps required to add a working portrait to your new custom character.
Things you will need
Setting up and understanding the XML
Extract selfie.exe and the XML template in a directory of your choice.
Open up the XML template with Notepad ++ or the text editor of your choice. The template is already configured for a custom vanilla male dreadlord.
The settings themselves are pretty straightforward. Let's ignore Distance, Theta, Phi and FOV for now.

Each art_set_id from the campaign_character_arts table requires its own entry.

The variant key from the variants table goes into the Variant ID= slot.

The link to your 2d portrait porthole is added in the <FileDiffuse></File> slot.

Filemasks, Season, Level, Age, Politician, and Faction Leader values should be left untouched.
Repeat for each campaign variant.

All of your characters in a single mod pack should use a single xml file. Just keep adding entries.

Distance, Theta, Phi, FOV
Those values essentially adjust the viewing angle of the porthole portrait. Unfortunately, there's no easy way to figure out what works best in each specific case. You can try the default values in the XML template, but they won't always work.
In that case, you will have to find a unit that uses a similar model/portrait and copy the values from that.
Extract either portrait_settings__.bin in ui/portraits in the data.pack or portrait_settings__2.bin in ui/portraits in data_2.pack. TW:W1 portraits are found in portrait_settings__.bin and TW:W2 in portrait_settings__2.bin.
Open the newly exported bin file with HXD. Make sure data inspector is on (right hand panel with value translations) by making sure it's ticked in View>Toolbars>Data Inspector.
Hit CTRL+F to search for the unit with the portrait settings you want to use.
Notice there's some text, and some giberish

The text is the art_set_id of the unit.
The first 16 gibberish characters, in groups of 4, are the actual values for Distance, Theta, Phi and FOV in Float.

Highlight the four first characters (bytes) and look at the data inspector (right panel) under float. This is your Distance value.

The next four are your Theta Value.

And, you guessed it, the next four are your Phi Value and the last four are your FOV value.

Finishing up and getting it into our game
After you've succesfully added your Distance Theta Phi and FOV values to your XML, save it as portrait_settings__[yourmodname].xml in the directory that you extracted selfie.exe in the previous steps.
Simply drag the file onto selfie.exe and a portrait_settings__[yourmodname].bin should appear in the same folder.
To get your .bin in the game, simply add it to the UI/Portraits/Porholes folder in your mod's pack.

Voila! Your portraits and portholes are ready!
A word of warning:
Do not mess with the .bin files or filenames in HXD, other than reading the values for Distance,Theta, Phi and FOV.
Do not mess with the filename of the custom .bin too much, either.
Do not mess with the Filemasks, Season, Level, Age, Politician, and Faction Leader values in the XML either.
Failure to comply with the above can lead to severe game crashes, system-wide crashes and even the dreaded Blue Screen of Death.
You have been warned.
Some notes about selfie.exe
Decimals in your xml must use decimal points ( . ) and not commas ( , ) otherwise selfie will not recognise the float values.

Selfie also supports error reporting, if your returned file is not working properly, try running selfie through the command prompt.

Open up a command prompt in the folder you've got selfie and your xml, useage is

selfie.exe <filename>
Closing and Thanks
Feel free to comment if you have any issues/questions!

Major thanks to Crux3d for creating selfie.exe for Attila, without his tool it would be close to impossible to figure the values out.

Thanks to Crynsos and Cataph for their help with figuring some of the stuff out and testing the whole thing!

< >
frozentreasher Feb 27 @ 6:21am 
Many thanks for your guide!
I spend few days realising that Distance, Theta, Phi and FOV must use "." divider and not ",". I suggest you to add this info to the mod description.
D_Jon_Mustard Feb 17 @ 10:48pm 
Ah, nevermind. I just went ahead and renamed all my tables since nothing was working.
D_Jon_Mustard Feb 17 @ 9:19pm 
I can't seem to get it working no matter what I do. All I get is a frustrating question mark when I try to load it up. I didn't change the camera settings at all. The Art_set_id is exact, the variant id exact and the file path is exact. What could possibly be issue?
Marthenil  [author] Feb 12 @ 2:02pm 
Yeah and it does nothing, because these are then encoded into the bin (hence why this guide was required)
Ailoer Feb 10 @ 10:37am 
Not sure if it was recently added, but the unit_porthole_camera_settings table contains all of these values (and more) in ASCII
MaskedMustachio Feb 5 @ 10:27am 
That was the issue thank you Gaeatirumati. It was my first mod long long ago and I didn't realize there was porthole settings to choose from.
gaeatirumati Sep 15, 2020 @ 12:17am 
@MaskedMustachio I think your problem might be the 'porthole camera' selection in the main units table. Try tweaking that. It's kinda in between the checkboxes for is_high_threat and use_hitpoints_in_campaign
MaskedMustachio Jul 6, 2020 @ 8:43am 
Thank you for the file to create the bins. I was able to use it in my mod to edit Cylostra's portholes after changing her in game model to the vampire heros. I had two issues though...first the hex editor would not open the hex files into anything readable even with the data inspector selected so I had to just do trial and error to get my settings to work in the camera.
The main issue I had is that none of my changes in the template file changed the in-battle 3d porthole for her. Only her campaign ones...which is fine for 95% of gameplay but if you know what to do to fix that I would really appreciate it.
Sweet Jul 1, 2020 @ 9:07pm 
I mean regular units instead of lords nd heroes
Sweet Jul 1, 2020 @ 8:43pm 
Hi where can I find art_set_id of units?