Before I make a terrible mistake when making 3D models for my characters, I need to know what details I can/can’t include, as the characters will be customisable.
First of all, is it possible to directly change textures of a character model with code to switch between premade facial expressions?
Also, when making accessories that are to deform along with the body, do I need to copy the enitre skeleton of the original character onto the model for the accessory and make that skeleton move with the player, or is there a better way to do this?
Accessories for 3D characters
- Edited
flame-cube is it possible to directly change textures of a character model with code to switch between premade facial expressions?
yes. you can put them all in a texture and shift UV, or you can swap materials.
what you can't do is change textures during game.
flame-cube when making accessories that are to deform along with the body, do I need to copy the enitre skeleton of the original character onto the model for the accessory and make that skeleton move with the player, or is there a better way to do this?
there are two types, first you have your "clothes" or "parts". these are skinned and will deform with the skeleton. for clothed parts it is common to swap the entire mesh with one with the clothes on.
the other type is called an "attachment", it's a mesh that follow a single bone and doesn't deform. In godot you parent these to a BoneAttachment3D
.
for modeling, create a "base" model, then save two files. one for making animations, and the other for attachments and parts, and create more copies of the base for more attachments and parts as you need.
export them to gltf and import in godot. once you start you can't alter the skeleton or you will have to modify everything or start over.
create a new inherited scene in godot from the new "asset" file, then copy the attachments/parts and paste them in your character scene. then select one, save as scene and delete it.
during game, you can add them as children of the skeleton and they will be deformed with no problem.
just make sure they have a bone profile during import, either humanoid or not. if you run into a problem just disable "rename bones".
Jesusemora I was going to have it be possible to mix up different accessories. What I'm getting from this is that I should have these attachments separate, but with only as many bones are needed to deform, and I add these as children of the main body. Is that right?
flame-cube but with only as many bones are needed to deform
no no no, there are TWO types of things: attachments
and parts/clothes
.
parts/clothes (like a torso with a shirt, or shoes, or gloves, think oblivion) are deformed by the skeleton, but attachments don't have deforms at all, like a ring or shield or a hat or glasses, these must be parented to a boneattachment3D in godot.
for making parts, make sure ALL the files use the exact same skeleton, otherwise there will be problems. don't try to optimize stuff or remove unused bones, you will break it this way. and the origin must be in the same place for all the parts and the body. this is usually at 0 0 0, so a head would be floating with the origin where the feet should be.
attachments on the other hand can be made without the skeleton, just make sure the scale is right, but you can always just scale it. for these it's better to have the origin close to the center of the attachment.
- Edited
flame-cube I need to know what details I can/can’t include, as the characters will be customisable.
- I'll start with a link to my tutorial. This is item zero.
- First question: how customizable are you going to make your characters? What exactly needs to change? Do you have an example of what you want?
- Second: what kind of clothing is expected and what items will the character be equipped with?
Jesusemora like a ring or shield or a hat or glasses
You have to be careful here — of these items, only the shield is definitely not changeable. The ring should correspond to the finger on which it is worn, and the hat and glasses to the head.
For now I can give a link to probably the best in-game character generator, maybe it will inspire something
Tomcat In terms of customisation, it wasn't going to be anything too detailed, mostly being able to change hairstyles, eyes and facial expression, on a relatively simple model. I was thinking that the facial features could even be drawn directly onto a blank face, although I don't know how practical this would be. In game if you equip certain items, it might change appearance, ie some sort of armour, and so it would have to be able to deform with the body of the character
- Edited
Jesusemora there are two types, first you have your "clothes" or "parts". these are skinned and will deform with the skeleton. for clothed parts it is common to swap the entire mesh with one with the clothes on.
How do games handle having hundreds of different clothes?
I know that you need the same skeleton for all of them. So when I want 100 different clothes I make each of them a seperate model and attach arms, feet and head mesh to the bones in game?
I've seen models the have a dozen of meshes. Like 10 shirts, 10 pants, 10 shoes and you would simply make them visible/invisible to change clothes. But with 100 clothes I believe this would be bad especially when there are multiple characters.
flame-cube being able to change hairstyles
each HairStyle can be a simple mesh that is parented to a BoneAttachment of the head bone.
for more complex hairstyles like long hair, it is common to use a skinned mesh instead, so the lower part of the hair deforms and stays close to the neck or even the chest.
but choose one to do, not both.
flame-cube eyes
these depend on the head.
for just eye color you can use a shader to color part of the material. the eyes can be part of the same head mesh and have a different material assigned.
flame-cube facial expression
this also depends on the style.
for anime style it is common to use a spritesheet of faces and move UVs to swap them, or change the entire mesh to get different exaggerated facial expressions.
for more realistic faces it is common to use either bones or shapekeys. shapekeys is better for godot because it allows you to retarget generic humanoid animations.
flame-cube the facial features could even be drawn directly onto a blank face, although I don't know how practical this would be
many games do this. either change the material, or put all the faces in a sort of spritesheet and move the UVs left and right to change to a specific face.
flame-cube In game if you equip certain items, it might change appearance, ie some sort of armour, and so it would have to be able to deform with the body of the character
yes, you use a skinned mesh for this. for something really simple, a mesh of the character in each armor.
splitting the mesh into torso-legs-hands-feet-arms can help you create more modular designs and save you some work.
trizZzle How do games handle having hundreds of different clothes?
depends on the game.
trizZzle I know that you need the same skeleton for all of them. So when I want 100 different clothes I make each of them a seperate model and attach arms, feet and head mesh to the bones in game?
yes. how you work on these is up to you, but the best way is to put most of them into the same file and import it as some kind of "pack".
so you work on one design, finish it, then go to a different layer and work on a different one, always with the same skeleton. it helps copying a basemesh and modifying it to create a new set.
trizZzle I've seen models the have a dozen of meshes. Like 10 shirts, 10 pants, 10 shoes and you would simply make them visible/invisible to change clothes.
nonono. don't make things visible/invisible, replace the mesh. you queue_free() the meshinstance torso_heavy_armor, and instantiate say torso_light_armor in its place.
the objects you can keep in memory, or load
them when you need them, through a StringName
trizZzle But with 100 clothes I believe this would be bad especially when there are multiple characters.
not all clothes need to be unique meshes. many times you can just swap the material.
so for example you have an armor mesh and it's a rusty armor, and you change the material to shining armor or golden or even chainmail and scale.
you can see it done in the first dragon age, where price caylan has a recolored version of a heavy armor, with slightly different pauldrons that are attachments to the arm bone.
- Edited
trizZzle How do games handle having hundreds of different clothes?
Badly, sometimes very badly. Sims 4 was a step backwards compared to Sims 3. Apparently because the developers failed to cope with the optimization and abandoned the open world. And there are a lot of clothes, accessories (and other things).
flame-cube In terms of customisation, it wasn't going to be anything too detailed
Will the body itself change (fat, thin, height)? This is a very important, basic question.
I was thinking that the facial features could even be drawn directly onto a blank face, although I don't know how practical this would be.
and so it would have to be able to deform with the body of the character
Deform — what does it mean? Move or adjust? Either way, it's a garment, not an accessory.
Jesusemora splitting the mesh into torso-legs-hands-feet-arms can help you create more modular designs and save you some work.
Separating clothes into parts is possible, but it raises a non-trivial question of their pairing.
flame-cube Before I make a terrible mistake when making 3D models for my characters
We don't know how you see the game: what kind of graphics you have, how many characters you have, what kind of clothes they have. I haven't seen a game on Godot with a noticeable amount of interchangeable clothing, only prototypes.
Therefore, bugs are bound to happen. They cannot be avoided when mastering and learning new things. To make them fewer and not critical - prototype. Make easy and quick questioning of your ideas. My tutorial is based on a prototype of a character generator that I'm working on now.