Custom Mesh and ArmorRender infodump - Catman-232/Homebrewery GitHub Wiki
This stuff is brand new even to me and since I implemented the couple things I put in with contributed models, the mod broke down and I spent two weeks fixing it. I don't really know how to structure the explanations for this at the moment so this will have to do so there's at least SOMETHING saying how to do it. This will get replaced by proper guide pages eventually, I'm just very scatterbrained and really want to get back to work on the programming again because there's still massive improvements to be made haha.
So firstly, thanks to the efforts of Marioalexsan and ScottyFox, we now have a plugin that enables mods to import models into the game from file.
https://thunderstore.io/c/atlyss/p/Marioalexsan/AtlyssGLTF/
This was sort of possible already with Unity Assetbundles but it's a pain in the ass to do all that work to make one and still need a mod to load them contextually, and I don't want to deal with Unity Editor and I don't expect the average artist to do all that either. So we have a code library that was built by some really smart duders to work with the glTF model format, I think a lot of Godot engine games use it, not sure. Regardless, it's pretty convenient since all you need to provide is a .glb file, which is possible to export from Blender!
I should say here right away that character parts like ears, tails etc are currently a mystery to me still, I haven't had the time or brain power to investigate them, I still don't even have an example item for every possible part area on gear as it is. It'll get done when possible, and help with example models for those places would be appreciated because I am not an artist!
The game deals in Mesh and ScriptableArmorRender types for parts on gear, this distinction is crucial as this is the game data way of referring to them. A ScriptableArmorRender is a custom class object which essentially contains an array of five ArmorRender objects (also a custom class), and those are basically a Mesh, a race nametag and some curious Vector3 tweaks to the scale and positioning of the Mesh (Which I think are unused for anything that isn't a Helm).
The fields listed below are all of the ones that are relatively straight forward for HB to supply a model for, field refers to the property value in the object data. HB checks the text string you put into the properties in the param.txt to acquire the Mesh by its name when creating the actual item itself. This is why any Mesh can be used in any Mesh field, and any ScriptableArmorRender can be used in any ScriptableArmorRender field.
Fields that are ScriptableArmorRender:
_chestRenderDisplay
_robeSkirtRender
_armCuffRender
_helmRender
_legPieceRender_01
,_02
, ,_03
and ,_04
Fields that are just Mesh:
_capeMesh
_neckCollarMesh
_shoulderpadMesh
_helmOverrideMesh
_shieldMesh
weaponMesh
(Custom weapons currently not implemented in HB yet, working towards it!)- Hair is also a Mesh type but I am handling the models from files more like ScriptableArmorRender for convenience, you'll hopefully understand why.
It is difficult to figure out the correct way to set these out because many of the fields have strange game-level scaling applied to them, which results in them being massive in-game unless they are made extremely tiny in the viewport, the cape is a good example of this, and I think it also had to be mirrored on one axis too. Very strange. Here's all of them together for comparison sake.
The wings really are so small that they clip into the near-clipping plane in the viewport, making them a pain to work with.
Your custom model glb files need to be placed in their respective folder, which are among the item and part folders. ArmorRender, Hair and Mesh.
Inside there you make a new folder just like you would for items and parts.
And that's where you put the glb file.
It does not currently matter what the glb file is called, the name is taken from the folder name, which is also similar to how I handle naming parts.
Mesh type only needs one model in your file, it can be named whatever, doesn't matter. To refer to it in a custom gear, you fill in the text string with the name of the source folder (the mod folder name) plus "-Mesh-"
plus the name of the folder that the glb file is in.
So for example:
Catman232-Homebrewery-Mesh-CoolMesh
(The cone that the Cone of Shame Halo Helm uses)
Good luck figuring out the right scale and placement though, they are probably all world origin based at least, but the collar and the wings cape couldn't be any further apart in scale. I will hopefully get some more example items implemented over time to serve as good reference for the placement and scales neccesary for each field.
ScriptableArmorRender type MUST contain five models, named after each race, and by that I mean this name, not the collection name above it.
So far I have only made a helmRender one, so the Bunhost Ears exist as a reference for how they are positioned relative to the world origin, but each one needs to be offset individually to for the race's different scales. You can clone the same model for this purpose of course, but any adjustments you make to any of them need to actually be applied!
Any tweaks you make, you need to remember to apply the transforms to it.
To refer to it in a custom gear, you fill in the text string with the name of the source folder (the mod folder name) plus "-ArmorRender-"
plus the name of the folder that the glb file is in.
So for example:
Catman232-Homebrewery-ArmorRender-BunhostEars
katzenjugen-Durendal_Eyes_And_Equipment-ArmorRender-Antennae
Hair is Mesh type but I handle them more like ScriptableArmorRender, your file does not strictly require a model for all five races. The models present will be imported and added as a custom Hair for whatever races the models are named for (same way as shown for ScriptableArmorRender above). So you can make a Hair for just one or two races if you want. Just note that whatever is imported from the same file is named as the same Hair, you can make adjustments to the models to suit each race if you want to. Unfortunately Hair meshes need to be offset from the world origin point to about the height of each race, you can see this in the picture above which was a very simple mohawk. I'd reccomend importing that into Blender to use as reference for the positions and scale!
How do you actually do it though?
I don't know if there's any version specifics to this but I've been using Blender 4.1, which was the latest when I got it a while back for figuring out RE Engine modding. You can import a glb via File > Import > glTF 2.0 (.glb/.gltf)
I can't teach you how to use Blender, but there are a billion tutorials about it to be found. But I will say that to check out your model's UV unwrap for previewing a texture, you go to the UV Editing tab.
You'll want to be in edit mode for one of your models in the Scene Collection, you can change to Object Mode to select one, and then change to Edit Mode so that it'll show the polys in the UV Editing viewport.
The UV Editing viewport will now show the unwrap of the verts of the model.
These will be made for you when you use prefabs, and meshes you import from elsewhere may have them already too, if you're lucky. You are responsible for making the edits to this layout in order to fit the textures. For custom gear, you are providing the texture anyway, which is a boon to you since you don't have to deal with some of Kiseff's really tiny or bizarre UV layouts on some of the vanilla meshes. Hair however is textured by the SkinTextureGroup, more often than not by the head texture being shared to it, so you will need to work out a decent UV unwrap if you want hair to look any good. Though Imps and Kubolds just have a simple gradient texture for their hairs.
Bit difficult without any texture in there though huh? Well, you can put an image into the UV Editing viewport for a start.
Pro strat, find the "Backfill" folder inside Homebrewery's "Internal" folder. HB uses these to fill in gaps in SkinTextureGroups, which is quite often the case when custom skins are just body and legs. The PNGs here are vanilla textures, though duplicated to cover every field, since the vanilla game reuses many of them across multiple fields. Such as Poon skins generally having the Head texture also used for the Hair, Ear and Tail.
Since I have the Hair models loaded in Blender, I guess I will put in the Poon Hair texture from the backfill folder.
Wonderful, as you can see, this texture includes their face with the nose, the ears and a tail bit too. I have no idea what the vanilla hairs' UV layout looks like, and I didn't even try to edit it for this simple Mohawk, maybe in the future I will get a proper one for each race.
To actually show that texture on the model you have to add a Material for it
Now to put the image in the Material, click on the dot next to Base Color and click Image Texture
Since you added the image to the UV Editing viewport, the image wll be in the dropdown list already
It won't show it until you set the model viewport to render materials though, to do that you'll need to use your scrollwheel while hovering on the context bar to scroll to the right to find these icons:
Now the model will be displaying that texture, and edits you make the UV unwrap will be noticable right away.
To export what you have as a glb file, you go to File > Export > glTF 2.0 (.glb/.gltf)
On the right side of the File View window, there will be settings you should tweak!
First ensure Format is glTF Binary (.glb)
, then check Remember Export Settings
This will save these following settings with your .blend
project file, so you won't need to tweak them every single time you export the file!
Uncheck Animation, then open the Data section and uncheck Shape Keys and Skinning, since you won't be using these aspects anyway and maybe there's no data of such in the scene regardless but it doesn't hurt to min-max this just in-case to keep the file size smaller. Then go into Material and set Materials to No Export.
Homebrewery doesn't need these Materials in the file since the game is setting them onto the models anyway, so embedded textures would be unused and be a potentially large waste of file space. Your custom textures go with the custom items that use these custom meshes.
Hopefully that covers everything, if I missed something, feel free to complain to me about it on Discord. Sorry it's not very structured, this is just so much to cover, it's a bit overwhelming, and I'm hardly even done with investigating how to use this stuff myself anyway.