Hello, everyone. I am working on developing a free and open source plugin I am calling AWOC or Avatar Wardrobe Organizer and Colorer. Probably need a better name but that's pretty much what AWOC hopes to accomplish. AWOC solves a common problem in game development. Let's say you have 3D model with 10 unique outfits that are split into several different parts like helmet, gloves, torso, etc. And each one of those parts has areas that you would like to be able to color dynamically. You can load up the avatar, turn off the meshes you don't need, and apply materials to the meshes you want to show. But now you have a separate draw call for each mesh and materials laying around everywhere.
And what if you want to have a dozen or 100 of these avatars running around in your game world? You would have to instantiate your avatar over and over, turn off the meshes you don't need, add materials, animations and on and on. It's a big task and if you are just hiding the meshes so you can turn them back on later, you now have a hundred copies of every mesh floating around.
AWOC is still in early development but the idea is that you will have slots, meshes, materials, animations, recipes, and wardrobes. Slots are a way of telling AWOC where you want an item equipped. For example, lets say we have the following slots: helmet, hair, and beard. If you want to equip a helmet, you just tell AWOC which helmet you want to equip and AWOC takes care of removing the previous helmet before equipping the new one. Also, slots can have hide slots. So in the case of the helmet, we could add the slots for hair and beard to the helmet slot as hide slots and when AWOC equips the helmet, it automatically un-equips the hair and beard slots. When you remove the helmet, AWOC automatically re-equips the hair and beard.
When AWOC builds your avatar, it automatically combines all the meshes you have equipped into a single mesh. This saves draw calls but comes at a cost. All of your UVs will also be compressed into one. Eventually, I'd like AWOC to automatically combine all the materials into one huge material and offset the UVs for each mesh but that will probably be one of the last things I work on. For the foreseeable future, you will need to offset your UVs yourself before you create an AWOC.
Materials will consist of an albedo texture and any number of overlay textures. Overlay textures are just images with either a black or transparent background and a white or red mask. When you create a new AWOC, all of the pixel information for all of your overlays will be read into a single array that will be used to apply color, metallic, emission, etc. This way, AWOC only has to read pixel information in the editor. When your game runs, it will only have to set pixels on the new texture.
Recipes are where you bring everything together into something you can use. A recipe will consist of a slot, any number of meshes, and a material. You can preset colors here or change them dynamically at runtime. If you add more than one mesh, the first mesh becomes the primary mesh and will always be equipped when you equip this recipe. The other meshes become options you can specify when you create the AWOC in your game. Say, for example, you have a chest plate with a belt and you'd like the belt to be optional. You add the chest plate as the primary mesh and then add the belt to the recipe. Now, if you load this recipe, by default, it will include the belt but you will have the option to turn the belt off if you want. This keeps you from having to create and manage a chest_plate slot and a chest_plate_belt slot.
FInally, Wardrobes are just collections of recipes. So instead of loading the helmet recipe, gloves recipe, torso recipe, etc. separately, you can load an entire wardrobe with a single line of code. You will also have the option to export the material into a file with all the colors, metallics, etc. baked in to make loading an entire wardrobe more efficient.
As I have said, AWOC is still in early development. I worked on it for a while in Unity but then Unity went and stabbed a rusty spear through my trust and roasted it over a raging fire until not even ashes were left so I began porting to Godot. So far, things are going much more smoothly in Godot. As of now, slots and meshes are working in the editor. I still have a little code cleaning to do before moving on to materials.
Once things get a little more settled, I'll do a video on how to use AWOC. For now, feel free to download it and play around with it. Just know that AWOC is free and open source so I can't be held liable if AWOC ruins your project or your life.
You can check out the project at https://github.com/standstilldigitalmedia/AWOC