How to add new Paintings

Mar 16, 2014
44
7
8
#1
Adding new paintings is an easy process, but what some might consider to be overly tedious. This guide will assume you have a basic knowledge on the usage of SIE, and how mods work in general with SWG. This process can also be applied to literally any object in the game to re-texture them. For this guide however, we will presume you are wanting to add a painting to the game.

Step 1: Select which painting to copy
To begin, we'll find the painting we want to replace the content of. For this example, we're going to use the first Golden Flower painting. It's base object file is
Code:
object/tangible/painting/shared_painting_bestine_golden_flower_01.iff
Step 2: Identifying all the files connected to the painting
Every non-animated object, from its root, is made up of 6 critical objects, inheriting in this order of file types:
DDS > SHT > MSH > LOD > APT > IFF

The DDS file is the texture file associated to a specific SHT (Shader) file. Every new texture introduced into the game will need an accompanying SHT file. The MSH (Mesh) file can hold several SHT file references, typically one per mesh part in the file. For a painting, there is 2 mesh parts per painting MSH (3 if you're using MTG/NGE files, due to the addition of a backface). For this guide, we'll only be editing one part of the MSH, which is the painting itself.

This guide will walk through every file that needs to be changed from here on out, but to begin, we'll identify all the files we need to change to make this Golden Flower painting unique (without changing the frame)

Code:
texture/frn_all_painting_golden_flower_s01.dds
shader/frn_all_painting_golden_flower_s01_as8.sht
appearance/mesh/frn_all_painting_golden_flower_s01.msh
[LOD Omitted]
appearance/frn_all_painting_golden_flower_s01.apt
object/tangible/painting/shared_painting_bestine_golden_flower_01.iff
Author's Note: It would appear that the LOD file is not neccesary for all objects, and this particular painting does not utilize a LOD file. I did not know this until now, but for most other objects, a LOD file has to be created.

Step 3: Creating the new DDS file
This guide won't go into detail on how to create a new texture in SWG, just that it has to be a DDS file for the game to recognize it. It is advisable to export the original texture file and use that as a template for creating your new image. You can upscale or downscale this image as much as you'd like, so long as it maintains the same aspect ratio. After you've created your image, put it in the "texture" folder.

Step 4: Creating the new SHT File
This is as simple as copy and pasting. Open the existing SHT file in the "Shader" folder, and locate the node in which the DDS texture is defined.
1528405523966.png
In the "Texture" field of the template values in the NAME node, replace the existing line with
Code:
texture/YOUR_NEW_TEXTURE.dds
Save the new SHT file with a unique name, and make sure that it is saved in the Shader folder, like the original was.

Step 5: Creating the new MSH File
This can be done entirely within SIE, and does not require a third party mesh editing tool. All we are doing is replacing the reference of one SHT, to the new one.
Open the MSH file of our original painting in SIE, and begin to scroll through the different nodes. Here, we are looking for a Node called "NAME", that has our old SHT file listed. In the case of the golden painting, it is in Category 0002.
1528405747858.png
Simply replace that line, like you did before in the shader file, with the path to the new SHT file that you've made, like so:
Code:
shader/YOUR_NEW_SHADER.sht
Save the mesh with a new custom name in the appearance/mesh/ folder, and you're done with the MSH file!

Step 6: Creating the new APT File
Behold the simplest file in this entire process. All you have to do is find the original APT file of the painting you're copying, and replace the MSH file reference in the only NAME node with the path of your new MSH file, like so:
Code:
appearance/mesh/YOUR_NEW_MESH.msh
Once you've done that, save the APT file as something new into the appearance folder.

Step 7: Creating the new IFF File
In your second to last client-side edit for this new painting, you're going to need to locate the original IFF file for your object. For the Golden Flower painting I am using in this example, you'll see the path to it above. Open the IFF file and scroll through the fields until you can find the reference to the Object's "appearanceFilename" - For the time being, I do not know how valuable the null character (empty space at the start of the path) is in the entry for this, so it is recommended to retain that space when entering the new path. Simply delete the path without deleting the 'space' and enter the path to your new APT file.

Note: You cannot replace the empty character with a simple space, as it is not an actual space! It is an empty character!

Make sure to prefix your Object IFF file's name with "shared_" !!

Simply save the file into the path you desire, then keep note of that path! You will need it!

Step 8: Adding the entry to the CRC Table
For the final task of client editing before it is ready to be put into a new TRE, you will need to add the object's path to the CRC table, located at
Code:
misc/object_template_crc_string_table.iff
Here, you will need to add the pathway of your object to the list by pasting it into the large text field, and hitting the + button on the right side. For an example, my new file would look like this:
Code:
object/tangible/painting/shared_painting_example_01.iff
Once the entry is added, save your table, and include it into your top TRE file, so that it overwrites vanilla TRE tables.

Step 9: Getting it into the Server
There are three critical files needed to include a new object into the server. First, you will need to create a base Lua object for the file. This can easily be done by finding your original painting's Lua file (which contains its technical name as the file's name) and copying it, then replacing the text inside to reflect your new file's name and path.

Then, you will need to add this file to be loaded in the most relevant "serverobjects.lua" file, which will be located within the folder with the rest of the painting files. Lastly, you'll need to add this object's template into the "objects.lua" file at the very end. Here is the example with the golden flower. Keep in mind the usage of shared_ and the lack of it in certain fields, as it is critical to mimic the file name layout of the original files.
Code:
object_tangible_painting_shared_painting_bestine_golden_flower_01 = SharedTangibleObjectTemplate:new {
    clientTemplateFileName = "object/tangible/painting/shared_painting_bestine_golden_flower_01.iff"
}

ObjectTemplates:addClientTemplate(object_tangible_painting_shared_painting_bestine_golden_flower_01, "object/tangible/painting/shared_painting_bestine_golden_flower_01.iff")
Step 10: Enjoy your new painting!
Toss the files into a TRE, connect it to your client and your server, and restart the server. Once its finished, you should be able to spawn your new object with the /object createitem command and enjoy whatever art you've now injected into this grand old game!
 
Mar 16, 2014
44
7
8
#2
Bonus: On LOD Files

I assumed that APT files always required a LOD file to be added, but apparently it can call on MSH files directly. For most objects (and for modders inclined on importing high poly work) the LOD (or Level-of-detail) file is important.

Creating a LOD file is as simple as the other files listed here. You simply must find the original LOD file you want to work with, and find the CHLD object nodes.
1528407173475.png

Replace the Mesh entry for each CHLD with the mesh you want for that level of detail. Keep in mind the Mesh ID, to ensure you're spawning the correct mesh at the correct distance. 0 is for the closest (highest detail), and 3 or 4 will be the least. The levels of detail can vary in number, but I've commonly seen most use 3 levels, but never more than 4. Additionally, it is perfectly fine to use the same mesh for every single child.

When Applying the LOD file to the APT file, you would simply put the LOD's path in instead of the mesh.

All LOD files are saved in the appearance/lod/ folder.
 

xTears

New Member
Jul 2, 2018
1
0
1
#3
great guide. the only issue im having is locating the config file server side to add the custom tre. im using zonamadev fast track server to test. so all the tre files are on the desktop of the VM but no config file to be found. i know its probaly extremely easy to find but its really been bugging me that i cant find it. Im just an idiot and was tired. thank you for the great guide!
 
Last edited: